00001
00010 #ifndef BS_FI_OPERATOR_CALC_POROSITY_AND_DERIV_H_
00011 #define BS_FI_OPERATOR_CALC_POROSITY_AND_DERIV_H_
00012
00013 namespace blue_sky {
00014
00026 template <class strategy_t, bool is_w, bool is_g, bool is_o>
00027 BS_FORCE_INLINE void
00028 fi_operator_impl <strategy_t, is_w, is_g, is_o>::calc_porosity_and_deriv (index_t i,
00029 index_t pvt_reg,
00030 item_t *poro,
00031 item_t *dp_poro,
00032 item_t *t_mult,
00033 item_t *dp_t_mult)
00034 {
00035
00036 if (calc_model_->rocktab.size ())
00037 {
00038 item_t phi_m = 0, d_phi_m = 0;
00039
00040
00041 index_t reg = calc_model_->rock_regions[i];
00042
00043 calc_model_->rocktab[reg].interpolate (pressure_[i], &phi_m, &d_phi_m, t_mult, dp_t_mult);
00044
00045 *poro = poro_array_[i] * phi_m;
00046 if (*poro > 1)
00047 {
00048 *poro = 1;
00049 }
00050
00051 *dp_poro = poro_array_[i] * d_phi_m;
00052 }
00053 else
00054 {
00055
00056 item_t d = rock_grid_comp_const_[pvt_reg] * (pressure_[i] - rock_grid_comp_ref_pressure_[pvt_reg]);
00057
00058
00059
00060 *poro = poro_array_[i] * (1.0 + d);
00061 *dp_poro = poro_array_[i] * rock_grid_comp_const_[pvt_reg];
00062 *t_mult = 1.0;
00063 *dp_t_mult = 0.0;
00064 }
00065 }
00066
00067 }
00068
00069 #endif // #ifndef BS_FI_OPERATOR_CALC_POROSITY_AND_DERIV_H_
00070