00001
00009 #ifndef BS_FI_OPERATOR_CALC_SOLUTION_MULT_CELL_H_
00010 #define BS_FI_OPERATOR_CALC_SOLUTION_MULT_CELL_H_
00011
00012 namespace blue_sky {
00013
00019 template <typename strategy_t, bool is_w, bool is_g, bool is_o>
00020 BS_FORCE_INLINE typename strategy_t::item_t
00021 fi_operator_impl <strategy_t, is_w, is_g, is_o>::calc_solution_mult_cell (const norms_storage_t &old_norm)
00022 {
00023 item_t d = 0.0;
00024 item_t mult = 0.0;
00025 const static item_t eps = item_t (1.0e-8);
00026 norms_storage_t norm;
00027
00028 for (index_t id = norms::C_ACPV_GAS; id <= norms::C_ACPV_OIL; ++id)
00029 {
00030 norm.clear ();
00031 update_norm_by_cell (old_norm.idx[id], norm);
00032 norm.val[id] /= calc_model_->ave_volume;
00033
00034 item_t abs_old = fabs (old_norm.val[id]);
00035 item_t abs_new = fabs (norm.val[id]);
00036 if ((old_norm.val[id] * norm.val[id]) < -eps || (abs_old > abs_new))
00037 {
00038 mult += abs_new * abs_old / fabs (old_norm.val[id] - norm.val[id]);
00039 d += abs_new;
00040 }
00041 }
00042
00043 return (d > eps) ? mult / d : 1.0;
00044 }
00045 }
00046
00047
00048 #endif // #ifndef BS_FI_OPERATOR_CALC_SOLUTION_MULT_CELL_H_
00049