Flow123d  jenkins-Flow123d-windows32-release-multijob-51
reaction.hh
Go to the documentation of this file.
1 /** @brief Class ReactionTerm is an abstract class representing reaction term in transport.
2  *
3  * Descending classes implements different physical models - dual porosity, sorption, decays,
4  * chemical reactions.
5  */
6 #ifndef REACTION_TERM_H
7 #define REACTION_TERM_H
8 
9 #include "coupling/equation.hh"
10 
11 class Mesh;
12 class Element;
13 class Distribution;
14 class OutputTime;
15 
16 
18 {
19 public:
20 
21  /**
22  * Static variable for definition of common input record in reaction term.
23  */
25 
26  /// Specification of the output record.
27  /**
28  * Need not to be used by all reaction models, but they should
29  * allow output of similar fields.
30  */
32 
33  /// Constructor.
34  /** @param init_mesh is the reference to the computational mesh
35  * @param in_rec is the input record
36  */
37  ReactionTerm(Mesh &init_mesh, Input::Record in_rec);
38 
39  /// Destructor.
40  ~ReactionTerm(void);
41 
42 
43  ///@name Setters
44  //@{
45  ///Sets the names of substances considered in transport.
47  {names_=names; return *this;}
48 
49  ///Sets the output stream which is given from transport class.
51  {output_stream_=&ostream; return *this;}
52 
53  /**
54  * Sets the pointer to concentration matrix for the mobile zone,
55  * all substances and on all elements (given by transport).
56  */
57  ReactionTerm &concentration_matrix(double **concentration, Distribution *conc_distr,
58  int *el_4_loc, int *row_4_el)
59  {
60  concentration_matrix_ = concentration;
61  distribution_ = conc_distr;
62  el_4_loc_ = el_4_loc;
63  row_4_el_ = row_4_el;
64  return *this;
65  }
66  //@}
67 
68  /** @brief Output method.
69  *
70  * Some reaction models have their own data to output (sorption, dual porosity)
71  * - this is where it must be reimplemented.
72  * On the other hand, some do not have (linear reaction, pade approximant)
73  * - that is why it is not pure virtual.
74  */
75  virtual void output_data(void){};
76 
77  /// Disable changes in TimeGovernor by empty method.
78  void choose_next_time(void) override;
79 
80 protected:
81  /**
82  * Communicate parallel concentration vectors into sequential output vector.
83  */
84  virtual void output_vector_gather(void){};
85 
86  /**
87  * Computation of reaction term on a single element.
88  * Inputs should be loc_el and local copies of concentrations of the element, which is then returned.
89  */
90  virtual double **compute_reaction(double **concentrations, int loc_el) =0;
91 
92  /**
93  * Pointer to two-dimensional array[species][elements] containing concentrations.
94  */
96 
97  /// Indices of elements belonging to local dofs.
98  int *el_4_loc_;
99  /// Indices of rows belonging to elements.
100  int *row_4_el_;
101 
102  /// Pointer to reference to distribution of elements between processors.
104 
105  /// Names belonging to substances.
106  /**
107  * Must be same as in the transport.
108  */
110 
111  /// Pointer to a transport output stream.
113 
114 };
115 
116 #endif // REACTION_TERM_H
ReactionTerm & output_stream(OutputTime &ostream)
Sets the output stream which is given from transport class.
Definition: reaction.hh:50
Abstract base class for equation clasess.
OutputTime * output_stream_
Pointer to a transport output stream.
Definition: reaction.hh:112
virtual void output_data(void)
Output method.
Definition: reaction.hh:75
double ** concentration_matrix_
Definition: reaction.hh:95
virtual void output_vector_gather(void)
Definition: reaction.hh:84
vector< string > names_
Names belonging to substances.
Definition: reaction.hh:109
Definition: mesh.h:108
int * row_4_el_
Indices of rows belonging to elements.
Definition: reaction.hh:100
virtual double ** compute_reaction(double **concentrations, int loc_el)=0
Definition: reaction.cc:34
ReactionTerm(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Definition: reaction.cc:18
static Input::Type::AbstractRecord input_type
Definition: reaction.hh:24
Distribution * distribution_
Pointer to reference to distribution of elements between processors.
Definition: reaction.hh:103
Accessor to the data with type Type::Record.
Definition: accessors.hh:308
Class for declaration of polymorphic Record.
Definition: type_record.hh:463
The class for outputing data during time.
Definition: output_time.hh:37
void choose_next_time(void) override
Disable changes in TimeGovernor by empty method.
Definition: reaction.cc:41
int * el_4_loc_
Indices of elements belonging to local dofs.
Definition: reaction.hh:98
~ReactionTerm(void)
Destructor.
Definition: reaction.cc:29
ReactionTerm & names(const std::vector< string > &names)
Sets the names of substances considered in transport.
Definition: reaction.hh:46
static Input::Type::Record input_type_output_record
Specification of the output record.
Definition: reaction.hh:31
Record type proxy class.
Definition: type_record.hh:161
ReactionTerm & concentration_matrix(double **concentration, Distribution *conc_distr, int *el_4_loc, int *row_4_el)
Definition: reaction.hh:57