Flow123d  3.9.0-960b954f9
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Isotherm Class Reference

#include <isotherm.hh>

Collaboration diagram for Isotherm:
Collaboration graph
[legend]

Classes

struct  ConcPair
 Pair of soluted and adsorbed concentration. More...
 

Public Types

enum  SorptionType { none = 0, linear = 1, freundlich = 2, langmuir = 3 }
 Type of adsorption isotherm. More...
 

Public Member Functions

 TYPEDEF_ERR_INFO (EI_BoostMessage, std::string)
 
 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_TotalMass, double)
 
 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")
 
 Isotherm ()
 Default constructor. More...
 
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)
 
void make_table (unsigned int n_points, double table_limit)
 
void clear_table ()
 
void compute (double &c_aqua, double &c_sorbed)
 
void interpolate (double &c_aqua, double &c_sorbed)
 
bool is_precomputed (void)
 
double table_limit (void) const
 Getter for table limit (limit aqueous concentration). More...
 
template<>
Isotherm::ConcPair solve_conc (Isotherm::ConcPair c_pair, const None &)
 
template<>
void make_table (const None &, int)
 

Protected Member Functions

template<class Func >
void make_table (const Func &isotherm, int n_points)
 
template<class Func >
ConcPair solve_conc (ConcPair c_pair, const Func &isotherm)
 
ConcPair solve_conc (ConcPair conc)
 
ConcPair compute_projection (ConcPair conc)
 
ConcPair precipitate (ConcPair conc)
 
double get_total_mass (ConcPair conc)
 

Protected Attributes

enum SorptionType adsorption_type_
 Type of isotherm. More...
 
double mult_coef_
 Multiplication parameter of the isotherm. More...
 
double second_coef_
 Optional secod parameter of the isotherm. More...
 
double table_limit_
 Concentration in liquid phase for limit of the interpolation table. More...
 
bool limited_solubility_on_
 Solubility limit flag. More...
 
double solubility_limit_
 Concentration limit in liquid phase (solubility limit). More...
 
double rho_aqua_
 density of the solvent More...
 
double scale_aqua_
 coefficient that convert soluted concentration to mass; porosity = k_W, originally rho_aqua*porosity = k_W More...
 
double scale_sorbed_
 coefficient that convert adsorbed molar concentration to mass; molar_weight * rho_rock * (1 - porosity) = k_H More...
 
double inv_scale_aqua_
 reciprocal values More...
 
double inv_scale_sorbed_
 
std::vector< double > interpolation_table
 
double total_mass_step_
 

Detailed Description

Class describing one isotherm with possibly precalculated interpolation table.

Definition at line 158 of file isotherm.hh.

Member Enumeration Documentation

◆ SorptionType

Type of adsorption isotherm.

Enumerator
none 
linear 
freundlich 
langmuir 

Definition at line 174 of file isotherm.hh.

Constructor & Destructor Documentation

◆ Isotherm()

Isotherm::Isotherm ( )

Default constructor.

Definition at line 32 of file isotherm.cc.

Member Function Documentation

◆ clear_table()

void Isotherm::clear_table ( )

Clears the interpolation table and resets the table limit. (That means, no interpolation takes place in the computation.)

Definition at line 37 of file isotherm.cc.

Here is the caller graph for this function:

◆ compute()

void Isotherm::compute ( double &  c_aqua,
double &  c_sorbed 
)

Direct calculation of the equilibrium adsorption using a non-linear solver. reinit has to be called just before this method.

Definition at line 68 of file isotherm.cc.

Here is the caller graph for this function:

◆ compute_projection()

Isotherm::ConcPair Isotherm::compute_projection ( Isotherm::ConcPair  c_pair)
protected

Update concentrations using interopolation.

Definition at line 100 of file isotherm.cc.

Here is the caller graph for this function:

◆ DECLARE_EXCEPTION() [1/2]

Isotherm::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   
)

◆ DECLARE_EXCEPTION() [2/2]

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"   
)

◆ get_total_mass()

double Isotherm::get_total_mass ( ConcPair  conc)
protected

Definition at line 62 of file isotherm.cc.

Here is the caller graph for this function:

◆ interpolate()

void Isotherm::interpolate ( double &  c_aqua,
double &  c_sorbed 
)

Use interpolation to determine equilibrium state. Assumes previous call to make_table. If total mass is larger then table limit we either call precipitate (limit_solubility_on) or use direct computation.

Definition at line 84 of file isotherm.cc.

◆ is_precomputed()

bool Isotherm::is_precomputed ( void  )
inline

Returns true if interpolation table is created.

Definition at line 239 of file isotherm.hh.

◆ make_table() [1/3]

template<class Func >
void Isotherm::make_table ( const Func &  isotherm,
int  n_points 
)
protected

Implementation of interpolation construction for particular isotherm functor. Specialized for sorption 'none' - creates empty table.

Definition at line 217 of file isotherm.cc.

◆ make_table() [2/3]

template<>
void Isotherm::make_table ( const None ,
int   
)

Definition at line 247 of file isotherm.cc.

◆ make_table() [3/3]

void Isotherm::make_table ( unsigned int  n_points,
double  table_limit 
)

Create interpolation table for isotherm in rotated coordinate system with X axes given by total mass in both phases. Currently we support only linear interpolation. reinit has to be called just before this method.

Parameters
n_pointsis the size of the table
table_limitis the limit value of aqueous concentration

Definition at line 259 of file isotherm.cc.

◆ precipitate()

Isotherm::ConcPair Isotherm::precipitate ( Isotherm::ConcPair  c_pair)
protected

Modify concentrations after adsorption for limited solubility.

Definition at line 127 of file isotherm.cc.

Here is the caller graph for this function:

◆ reinit()

void Isotherm::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 
)

Setting adsorption parameters for general isotherm. These parameters are then used either for creation of the interpolation table via make_table method or just one adsorption is computed through compute method. Provided parameters are:

Parameters
sorption_type- type of isotherm
limited_solubility_on- true if c_aqua_limit is solubility limit
aqua_density- density of the liquid phase
scale_aqua- generalized porosity, fraction of the space with liquid phase
scale_sorbed- fraction of the space with the solid to which we adsorp
c_aqua_limit- solubility limit (limit aqueous concentration)
mult_coef- multiplicative coefficient of the isotherm (all isotherms have one)
second_coef- possibly second parameter of the isotherm

Definition at line 44 of file isotherm.cc.

Here is the caller graph for this function:

◆ solve_conc() [1/3]

template<class Func >
Isotherm::ConcPair Isotherm::solve_conc ( Isotherm::ConcPair  c_pair,
const Func &  isotherm 
)
protected

Find new values for concentrations in c_pair that has same total mass and lies on the isotherm (functor object). Specialized for sorption 'none' - returns unchanged c_pair.

Definition at line 137 of file isotherm.cc.

Here is the caller graph for this function:

◆ solve_conc() [2/3]

Isotherm::ConcPair Isotherm::solve_conc ( Isotherm::ConcPair  conc)
protected

Dispatch isotherm type and use appropriate template.

Definition at line 183 of file isotherm.cc.

◆ solve_conc() [3/3]

template<>
Isotherm::ConcPair Isotherm::solve_conc ( Isotherm::ConcPair  c_pair,
const None  
)

Definition at line 177 of file isotherm.cc.

◆ table_limit()

double Isotherm::table_limit ( void  ) const
inline

Getter for table limit (limit aqueous concentration).

Definition at line 244 of file isotherm.hh.

Here is the caller graph for this function:

◆ TYPEDEF_ERR_INFO() [1/2]

Isotherm::TYPEDEF_ERR_INFO ( EI_BoostMessage  ,
std::string   
)

◆ TYPEDEF_ERR_INFO() [2/2]

Isotherm::TYPEDEF_ERR_INFO ( EI_TotalMass  ,
double   
)

Member Data Documentation

◆ adsorption_type_

enum SorptionType Isotherm::adsorption_type_
protected

Type of isotherm.

Definition at line 281 of file isotherm.hh.

◆ interpolation_table

std::vector<double> Isotherm::interpolation_table
protected

Interpolation table of isotherm in the rotated coordinates. The X axes of rotated system is total mass, the Y axes is perpendicular.

Definition at line 309 of file isotherm.hh.

◆ inv_scale_aqua_

double Isotherm::inv_scale_aqua_
protected

reciprocal values

Definition at line 304 of file isotherm.hh.

◆ inv_scale_sorbed_

double Isotherm::inv_scale_sorbed_
protected

Definition at line 304 of file isotherm.hh.

◆ limited_solubility_on_

bool Isotherm::limited_solubility_on_
protected

Solubility limit flag.

Definition at line 293 of file isotherm.hh.

◆ mult_coef_

double Isotherm::mult_coef_
protected

Multiplication parameter of the isotherm.

Definition at line 284 of file isotherm.hh.

◆ rho_aqua_

double Isotherm::rho_aqua_
protected

density of the solvent

Definition at line 298 of file isotherm.hh.

◆ scale_aqua_

double Isotherm::scale_aqua_
protected

coefficient that convert soluted concentration to mass; porosity = k_W, originally rho_aqua*porosity = k_W

Definition at line 300 of file isotherm.hh.

◆ scale_sorbed_

double Isotherm::scale_sorbed_
protected

coefficient that convert adsorbed molar concentration to mass; molar_weight * rho_rock * (1 - porosity) = k_H

Definition at line 302 of file isotherm.hh.

◆ second_coef_

double Isotherm::second_coef_
protected

Optional secod parameter of the isotherm.

Definition at line 287 of file isotherm.hh.

◆ solubility_limit_

double Isotherm::solubility_limit_
protected

Concentration limit in liquid phase (solubility limit).

Definition at line 295 of file isotherm.hh.

◆ table_limit_

double Isotherm::table_limit_
protected

Concentration in liquid phase for limit of the interpolation table.

Definition at line 290 of file isotherm.hh.

◆ total_mass_step_

double Isotherm::total_mass_step_
protected

Step on the rotated X axes (total mass).

Definition at line 313 of file isotherm.hh.


The documentation for this class was generated from the following files: