Flow123d  JS_before_hm-1828-g90ad75301
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FirstOrderReactionBase Class Referenceabstract

Base class for linear reactions and decay chain. More...

#include <first_order_reaction_base.hh>

Inheritance diagram for FirstOrderReactionBase:
Inheritance graph
[legend]
Collaboration diagram for FirstOrderReactionBase:
Collaboration graph
[legend]

Public Member Functions

 FirstOrderReactionBase (Mesh &init_mesh, Input::Record in_rec)
 Constructor. More...
 
 ~FirstOrderReactionBase (void)
 Destructor. More...
 
void initialize () override
 Prepares the object to usage. More...
 
void zero_time_step () override
 Moves the model to zero time. More...
 
void update_solution (void) override
 Updates the solution. More...
 
- Public Member Functions inherited from ReactionTerm
 TYPEDEF_ERR_INFO (EI_Substance, std::string)
 
 TYPEDEF_ERR_INFO (EI_Model, std::string)
 
 DECLARE_INPUT_EXCEPTION (ExcUnknownSubstance,<< "Unknown substance name: "<< EI_Substance::qval)
 
 DECLARE_INPUT_EXCEPTION (ExcWrongDescendantModel,<< "Impossible descendant model: "<< EI_Model::qval)
 
 ReactionTerm (Mesh &init_mesh, Input::Record in_rec)
 Constructor. More...
 
 ~ReactionTerm (void)
 Destructor. More...
 
ReactionTermsubstances (SubstanceList &substances)
 Sets the names of substances considered in transport. More...
 
ReactionTermoutput_stream (std::shared_ptr< OutputTime > ostream)
 Sets the output stream which is given from transport class. More...
 
ReactionTermconcentration_fields (FieldFEScalarVec &conc_mobile)
 
virtual void output_data (void) override
 Output method. More...
 
void choose_next_time (void) override
 Disable changes in TimeGovernor by empty method. More...
 
- Public Member Functions inherited from EquationBase
 EquationBase ()
 
 EquationBase (Mesh &mesh, const Input::Record in_rec)
 
virtual ~EquationBase ()
 
virtual void set_time_upper_constraint (double dt, std::string message)
 
virtual void set_time_lower_constraint (double dt, std::string message)
 
TimeGovernortime ()
 
virtual void set_time_governor (TimeGovernor &time)
 
double planned_time ()
 
double solved_time ()
 
Meshmesh ()
 
std::shared_ptr< Balancebalance () const
 
TimeMark::Type mark_type ()
 
FieldSeteq_fieldset ()
 

Protected Member Functions

virtual void assemble_ode_matrix (void)=0
 Assembles the matrix of the ODEs. More...
 
virtual void compute_reaction (const DHCellAccessor &dh_cell) override
 Computes the reaction on a specified element. More...
 
virtual void initialize_from_input ()=0
 Initializes private members of sorption from the input record. More...
 
unsigned int find_subst_name (const std::string &name)
 
- Protected Member Functions inherited from ReactionTerm

Protected Attributes

std::vector< std::vector< unsigned int > > substance_ids_
 
std::vector< std::vector< double > > bifurcation_
 
unsigned int n_substances_
 Number of all transported substances. It is the dimension of the reaction matrix. More...
 
arma::mat reaction_matrix_
 Reaction matrix. More...
 
arma::vec prev_conc_
 Column vector storing previous concetrations on an element. More...
 
arma::mat molar_matrix_
 Diagonal matrix with molar masses of substances. More...
 
arma::mat molar_mat_inverse_
 Inverse of molar_matrix_. More...
 
std::shared_ptr< LinearODESolverlinear_ode_solver_
 
- Protected Attributes inherited from ReactionTerm
FieldFEScalarVec conc_mobile_fe
 FieldFEs representing P0 interpolation of mobile concentration (passed from transport). More...
 
SubstanceList substances_
 Names belonging to substances. More...
 
std::shared_ptr< OutputTimeoutput_stream_
 Pointer to a transport output stream. More...
 
std::shared_ptr< DOFHandlerMultiDimdof_handler_
 Pointer to DOF handler used through the reaction tree. More...
 
- Protected Attributes inherited from EquationBase
bool equation_empty_
 flag is true if only default constructor was called More...
 
Meshmesh_
 
TimeGovernortime_
 
Input::Record input_record_
 
FieldSeteq_fieldset_
 
std::shared_ptr< Balancebalance_
 object for calculation and writing the mass balance to file. More...
 

Additional Inherited Members

- Public Types inherited from ReactionTerm
typedef std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > > FieldFEScalarVec
 
- Static Public Member Functions inherited from ReactionTerm
static Input::Type::Abstractit_abstract_term ()
 
static Input::Type::Abstractit_abstract_mobile_term ()
 
static Input::Type::Abstractit_abstract_immobile_term ()
 
static Input::Type::Abstractit_abstract_reaction ()
 
- Static Public Member Functions inherited from EquationBase
static Input::Type::Recordrecord_template ()
 Template Record with common keys for derived equations. More...
 

Detailed Description

Base class for linear reactions and decay chain.

The class implements common interface for linear reactions and decay chains. One step of the linear reaction or the decay is represented as a product of a reaction matrix and a vector of concentrations of transported substances on a single element.

It uses armadillo to compute the reaction matrix which then multiplies to concetration vector. This class also resolves the choice of the numerical method which is used to compute the reaction matrix.

Definition at line 41 of file first_order_reaction_base.hh.

Constructor & Destructor Documentation

◆ FirstOrderReactionBase()

FirstOrderReactionBase::FirstOrderReactionBase ( Mesh init_mesh,
Input::Record  in_rec 
)

Constructor.

Definition at line 36 of file first_order_reaction_base.cc.

◆ ~FirstOrderReactionBase()

FirstOrderReactionBase::~FirstOrderReactionBase ( void  )

Destructor.

Definition at line 42 of file first_order_reaction_base.cc.

Member Function Documentation

◆ assemble_ode_matrix()

virtual void FirstOrderReactionBase::assemble_ode_matrix ( void  )
protectedpure virtual

Assembles the matrix of the ODEs.

We solve the system of $N$ equations

\[ \frac{\textrm{d} c_i}{\textrm{d}t}=-\sum\limits_{j=1}^N \frac{M_i}{M_j} \lambda_{i} b_j c_j, \qquad \textrm i=1,\ldots,N \]

where $M_i, M_j$ are the molar masses of the parent substances and products, $\lambda_i$ are the reaction rate constants (in case of decays converted from half_lives) and $b_j$ are the branching ratios. The constant coefficients $\mathbf{A}_{ij}=\frac{M_i}{M_j} \lambda_{i} b_j$ are the elements of the system matrix.

It is pure virtual and must be implemented in descendants.

Implemented in RadioactiveDecay, and FirstOrderReaction.

Here is the caller graph for this function:

◆ compute_reaction()

void FirstOrderReactionBase::compute_reaction ( const DHCellAccessor dh_cell)
overrideprotectedvirtual

Computes the reaction on a specified element.

Implements ReactionTerm.

Definition at line 84 of file first_order_reaction_base.cc.

Here is the caller graph for this function:

◆ find_subst_name()

unsigned int FirstOrderReactionBase::find_subst_name ( const std::string &  name)
protected

Help function to create mapping of substance indices. Finds a position of a string in specified array.

Definition at line 121 of file first_order_reaction_base.cc.

Here is the caller graph for this function:

◆ initialize()

void FirstOrderReactionBase::initialize ( )
overridevirtual

Prepares the object to usage.

Allocating memory, reading input, initialization of fields.

Reimplemented from EquationBase.

Definition at line 46 of file first_order_reaction_base.cc.

◆ initialize_from_input()

virtual void FirstOrderReactionBase::initialize_from_input ( )
protectedpure virtual

Initializes private members of sorption from the input record.

Implemented in FirstOrderReaction, and RadioactiveDecay.

Here is the caller graph for this function:

◆ update_solution()

void FirstOrderReactionBase::update_solution ( void  )
overridevirtual

Updates the solution.

Goes through local distribution of elements and calls compute_reaction.

Reimplemented from EquationBase.

Definition at line 103 of file first_order_reaction_base.cc.

◆ zero_time_step()

void FirstOrderReactionBase::zero_time_step ( )
overridevirtual

Moves the model to zero time.

The assembly of the system matrix is called here.

Reimplemented from EquationBase.

Definition at line 71 of file first_order_reaction_base.cc.

Member Data Documentation

◆ bifurcation_

std::vector<std::vector<double> > FirstOrderReactionBase::bifurcation_
protected

Two dimensional array contains mass percentage of every single decay bifurcation on every single row.

Definition at line 102 of file first_order_reaction_base.hh.

◆ linear_ode_solver_

std::shared_ptr<LinearODESolver> FirstOrderReactionBase::linear_ode_solver_
protected

Definition at line 113 of file first_order_reaction_base.hh.

◆ molar_mat_inverse_

arma::mat FirstOrderReactionBase::molar_mat_inverse_
protected

Inverse of molar_matrix_.

Definition at line 111 of file first_order_reaction_base.hh.

◆ molar_matrix_

arma::mat FirstOrderReactionBase::molar_matrix_
protected

Diagonal matrix with molar masses of substances.

Definition at line 110 of file first_order_reaction_base.hh.

◆ n_substances_

unsigned int FirstOrderReactionBase::n_substances_
protected

Number of all transported substances. It is the dimension of the reaction matrix.

Definition at line 105 of file first_order_reaction_base.hh.

◆ prev_conc_

arma::vec FirstOrderReactionBase::prev_conc_
protected

Column vector storing previous concetrations on an element.

Definition at line 108 of file first_order_reaction_base.hh.

◆ reaction_matrix_

arma::mat FirstOrderReactionBase::reaction_matrix_
protected

Reaction matrix.

Definition at line 107 of file first_order_reaction_base.hh.

◆ substance_ids_

std::vector< std::vector <unsigned int> > FirstOrderReactionBase::substance_ids_
protected

Sequence of integers describing an order of isotopes. substance_ids_[reactant][local_product_idx] = global_substance_idx

Definition at line 97 of file first_order_reaction_base.hh.


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