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)));
104 Linear(
double mult_coef) : mult_coef_(mult_coef) {}
107 return (mult_coef_*x);
122 Langmuir(
double mult_coef,
double alpha) : mult_coef_(mult_coef), alpha_(alpha) {}
125 return (mult_coef_*(alpha_ * x)/(alpha_ *x + 1));
142 Freundlich(
double mult_coef,
double exponent) : mult_coef_(mult_coef), exponent_(exponent){}
145 return (mult_coef_*pow(x, exponent_));
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");
183 ConcPair(
double x,
double y) : fluid(x), solid(y) {}
204 void reinit(
enum SorptionType sorption_type,
bool limited_solubility_on,
205 double aqua_density,
double scale_aqua,
double scale_sorbed,
206 double c_aqua_limit,
double mult_coef,
double second_coef);
215 void make_table(
unsigned int n_points,
double table_limit);
227 void compute(
double &c_aqua,
double &c_sorbed);
234 void interpolate(
double &c_aqua,
double &c_sorbed);
240 return interpolation_table.size() != 0;
245 {
return table_limit_;}
253 void make_table(
const Func &isotherm,
int n_points);
274 double get_total_mass(
ConcPair conc );
326 template <
class Func>
330 CrossFunction(
const Func &func_,
double total_mass,
double scale_aqua,
double scale_sorbed,
double rho_aqua)
331 : func(func_), total_mass_(total_mass),
332 scale_sorbed_(scale_sorbed), scale_aqua_(scale_aqua), rho_aqua_(rho_aqua)
338 return scale_sorbed_*func( conc_aqua/rho_aqua_) + (scale_aqua_) * conc_aqua - total_mass_;
double table_limit(void) const
Getter for table limit (limit aqueous concentration).
double mult_coef_
Multiplication parameter of the isotherm.
CrossFunction(const Func &func_, double total_mass, double scale_aqua, double scale_sorbed, double rho_aqua)
double second_coef_
Optional secod parameter of the isotherm.
ConcPair(double x, double y)
double operator()(double x)
Isotherm definition.
Langmuir(double mult_coef, double alpha)
Constructor to set parameters.
#define DECLARE_EXCEPTION(ExcName, Format)
Macro for simple definition of exceptions.
double operator()(double x)
Isotherm definition.
double mult_coef_
Parameters of the isotherm.
Freundlich(double mult_coef, double exponent)
Constructor to set parameters.
double mult_coef_
Parameters of the isotherm.
std::vector< double > interpolation_table
double scale_sorbed_
coefficient that convert adsorbed molar concentration to mass; molar_weight * rho_rock * (1 - porosit...
Linear(double mult_coef)
Constructor to set parameters.
#define TYPEDEF_ERR_INFO(EI_Type, Type)
Macro to simplify declaration of error_info types.
bool limited_solubility_on_
Solubility limit flag.
Pair of soluted and adsorbed concentration.
double operator()(double conc_aqua)
double mult_coef_
Parameters of the isotherm.
SorptionType
Type of adsorption isotherm.
bool operator()(const T &a, const T &b)
None()
Constructor to set parameters.
double scale_aqua_
coefficient that convert soluted concentration to mass; porosity = k_W, originally rho_aqua*porosity ...
double table_limit_
Concentration in liquid phase for limit of the interpolation table.
double solubility_limit_
Concentration limit in liquid phase (solubility limit).
bool is_precomputed(void)
double operator()(double x)
Isotherm definition.
double operator()(double)
Isotherm definition.
double rho_aqua_
density of the solvent