Flow123d  jenkins-Flow123d-windows32-release-multijob-51
linear_reaction.hh
Go to the documentation of this file.
1 /** @brief class Linear_reaction is used to enable simulation of simple chemical reactions
2  *
3  * Class in this file makes it possible to realize simulation of reaction of the first order by simple matrix multiplication.
4  * One step of the linear reaction is represented as a product of a matrix containing concentrations of observed speciesin elements in rows multiplied by so called
5  * reaction_matrix. Through this way radioactive decay can bee also realized and that was exactly what we did at the begining of journey. :-)
6  * Matrix containing concentrations has a dimension Nxn, where N is a number of elements in mesh and n denotes a number of transported chemical species.
7  * The reaction_matrix is a square matrix and it has a dimension nxn.
8  *
9  */
10 #ifndef LINEAR_REACTION_H
11 #define LINEAR_REACTION_H
12 
13 #include <vector>
14 #include <input/input_type.hh>
15 
16 class Mesh;
17 class Distribution;
18 class ReactionTerm;
19 
21 {
22 public:
23  /**
24  * Static variable for new input data types input
25  */
27  /**
28  * Static variable gets information about particular decay step
29  */
31 
32  /// Constructor.
33  LinearReaction(Mesh &init_mesh, Input::Record in_rec);
34 
35  /// Destructor.
36  ~LinearReaction(void);
37 
38  /// Prepares the object to usage.
39  /**
40  * Allocating memory, reading input, initialization of fields.
41  */
42  void initialize() override;
43 
44  void zero_time_step() override;
45 
46  /// Updates the solution.
47  /**
48  * Goes through local distribution of elements and calls @p compute_reaction.
49  */
50  void update_solution(void) override;
51 
52 protected:
53 
54  /**
55  * This method modificates reaction matrix as described in ini-file a single section [Decay_i] or [FoReact_i]. It is used when bifurcation is switched off.
56  */
57  virtual void modify_reaction_matrix(void);
58 
59  /**
60  * For simulation of chemical reaction in just one element either inside of MOBILE or IMMOBILE pores.
61  */
62  virtual double **compute_reaction(double **concentrations, int loc_el) override;
63 
64 
65  /// Resets reaction matrix as eye matrix.
66  void reset_reaction_matrix();
67 
68  /// Initializes private members of sorption from the input record.
69  void initialize_from_input();
70  /**
71  * For control printing of a matrix describing simple chemical raections.
72  */
73  void print_reaction_matrix(void);
74  /**
75  * For printing nr_of_isotopes identifies of isotopes in a current decay chain.
76  */
77  void print_indices(int dec_nr, int n_subst);
78 
79  /**
80  * For printing (nr_of_isotopes - 1) doubles containing half-lives belonging to particular isotopes on screen.
81  */
82  void print_half_lives();
83 
84  /**
85  * Finds a position of a string in specified array.
86  */
87  unsigned int find_subst_name(const std::string &name);
88 
89  /**
90  * Small (nr_of_species x nr_of_species) square matrix for realization of radioactive decay and first order reactions simulation.
91  */
93  /**
94  * Pointer to reference previous concentration array used in compute_reaction().
95  */
97  /**
98  * Sequence of (nr_of_isotopes - 1) doubles containing half-lives belonging to particular isotopes.
99  */
101  /**
102  * Sequence of integers describing an order of isotopes in decay chain or first order reaction.
103  */
105  /**
106  * Two dimensional array contains mass percentage of every single decay bifurcation on every single row.
107  */
109 
110  unsigned int n_substances_;
111 };
112 
113 #endif // LINEAR_REACTION_H
void reset_reaction_matrix()
Resets reaction matrix as eye matrix.
void update_solution(void) override
Updates the solution.
void initialize() override
Prepares the object to usage.
void print_indices(int dec_nr, int n_subst)
Definition: mesh.h:108
~LinearReaction(void)
Destructor.
std::vector< std::vector< double > > reaction_matrix_
unsigned int find_subst_name(const std::string &name)
virtual void modify_reaction_matrix(void)
void initialize_from_input()
Initializes private members of sorption from the input record.
std::vector< double > half_lives_
static Input::Type::Record input_type
unsigned int n_substances_
void print_reaction_matrix(void)
Accessor to the data with type Type::Record.
Definition: accessors.hh:308
virtual double ** compute_reaction(double **concentrations, int loc_el) override
LinearReaction(Mesh &init_mesh, Input::Record in_rec)
Constructor.
std::vector< std::vector< unsigned int > > substance_ids_
std::vector< std::vector< double > > bifurcation_
static Input::Type::Record input_type_one_decay_substep
void zero_time_step() override
Record type proxy class.
Definition: type_record.hh:161
std::vector< double > prev_conc_