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