47 #ifndef ISOTHERM_IMPL_HH_
48 #define ISOTHERM_IMPL_HH_
59 #include <boost/math/special_functions/detail/round_fwd.hpp>
73 eps = T(ldexp(1.0F, 1-bits));
78 return fabs(a - b) <= (
eps * (std::max)(fabs(a), fabs(b)));
162 "The Boost solver of nonlinear equation did not converge in sorption model.\n"
163 <<
"Check input at the following address for possible user error: \t" << Input::EI_Address::val <<
"\n"
164 "Solver message: \n" << EI_BoostMessage::val);
168 "The total mass in sorption model became negative during the computation (value: "
169 << EI_TotalMass::val <<
").\n"
170 <<
"Check input at the following address for possible user error: \t" << Input::EI_Address::val <<
"\n");
205 double aqua_density,
double scale_aqua,
double scale_sorbed,
206 double c_aqua_limit,
double mult_coef,
double second_coef);
227 void compute(
double &c_aqua,
double &c_sorbed);
234 void interpolate(
double &c_aqua,
double &c_sorbed);
253 void make_table(
const Func &isotherm,
int n_points);
260 ConcPair
solve_conc(ConcPair c_pair,
const Func &isotherm);
326 template <
class Func>
330 CrossFunction(
const Func &func_,
double total_mass,
double scale_aqua,
double scale_sorbed,
double rho_aqua)
CrossFunction(const Func &func_, double total_mass, double scale_aqua, double scale_sorbed, double rho_aqua)
double operator()(double conc_aqua)
double mult_coef_
Parameters of the isotherm.
Freundlich(double mult_coef, double exponent)
Constructor to set parameters.
double operator()(double x)
Isotherm definition.
DECLARE_EXCEPTION(ExcBoostSolver,<< "The Boost solver of nonlinear equation did not converge in sorption model.\n"<< "Check input at the following address for possible user error: \t"<< Input::EI_Address::val<< "\n" "Solver message: \n"<< EI_BoostMessage::val)
TYPEDEF_ERR_INFO(EI_BoostMessage, std::string)
double solubility_limit_
Concentration limit in liquid phase (solubility limit).
ConcPair precipitate(ConcPair conc)
bool is_precomputed(void)
void make_table(unsigned int n_points, double table_limit)
double get_total_mass(ConcPair conc)
ConcPair compute_projection(ConcPair conc)
TYPEDEF_ERR_INFO(EI_TotalMass, double)
ConcPair solve_conc(ConcPair c_pair, const Func &isotherm)
DECLARE_EXCEPTION(ExcNegativeTotalMass,<< "The total mass in sorption model became negative during the computation (value: "<< EI_TotalMass::val<< ").\n"<< "Check input at the following address for possible user error: \t"<< Input::EI_Address::val<< "\n")
void compute(double &c_aqua, double &c_sorbed)
bool limited_solubility_on_
Solubility limit flag.
double mult_coef_
Multiplication parameter of the isotherm.
double table_limit(void) const
Getter for table limit (limit aqueous concentration).
Isotherm()
Default constructor.
SorptionType
Type of adsorption isotherm.
double table_limit_
Concentration in liquid phase for limit of the interpolation table.
double second_coef_
Optional secod parameter of the isotherm.
void interpolate(double &c_aqua, double &c_sorbed)
void reinit(enum SorptionType sorption_type, bool limited_solubility_on, double aqua_density, double scale_aqua, double scale_sorbed, double c_aqua_limit, double mult_coef, double second_coef)
double rho_aqua_
density of the solvent
std::vector< double > interpolation_table
double scale_aqua_
coefficient that convert soluted concentration to mass; porosity = k_W, originally rho_aqua*porosity ...
enum SorptionType adsorption_type_
Type of isotherm.
double inv_scale_aqua_
reciprocal values
double scale_sorbed_
coefficient that convert adsorbed molar concentration to mass; molar_weight * rho_rock * (1 - porosit...
double mult_coef_
Parameters of the isotherm.
double operator()(double x)
Isotherm definition.
Langmuir(double mult_coef, double alpha)
Constructor to set parameters.
double mult_coef_
Parameters of the isotherm.
Linear(double mult_coef)
Constructor to set parameters.
double operator()(double x)
Isotherm definition.
None()
Constructor to set parameters.
double operator()(double)
Isotherm definition.
bool operator()(const T &a, const T &b)
Pair of soluted and adsorbed concentration.
ConcPair(double x, double y)