Flow123d  JS_before_hm-2154-g185f171e0
reaction_term.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file reaction_term.hh
15  * @brief Class ReactionTerm is an abstract class representing reaction term in transport.
16  *
17  * Descending classes implements different physical models - dual porosity, sorption, decays,
18  * chemical reactions.
19  */
20 
21 #ifndef REACTION_TERM_H
22 #define REACTION_TERM_H
23 
24 #include <memory> // for shared_ptr
25 #include <string> // for string
26 #include "coupling/equation.hh" // for EquationBase
27 #include "system/index_types.hh" // for LongInt
28 #include "input/input_exception.hh" // for DECLARE_INPUT_EXCEPTION, Exception
29 #include "system/exceptions.hh" // for ExcStream, operator<<, EI, TYPED...
30 #include "transport/substance.hh" // for SubstanceList
31 #include "fem/dofhandler.hh" // for DOFHandlerMultiDim
32 #include "fields/field_fe.hh" // for FieldFE
33 #include "fields/field_set.hh" // for FieldSet
34 
35 class Distribution;
36 class Mesh;
37 class OutputTime;
38 namespace Input {
39  class Record;
40  namespace Type {
41  class Abstract;
42  }
43 }
44 
45 
47 {
48 public:
49  TYPEDEF_ERR_INFO( EI_Substance, std::string);
50  TYPEDEF_ERR_INFO( EI_Model, std::string);
51  DECLARE_INPUT_EXCEPTION( ExcUnknownSubstance, << "Unknown substance name: " << EI_Substance::qval);
52  DECLARE_INPUT_EXCEPTION( ExcWrongDescendantModel, << "Impossible descendant model: " << EI_Model::qval);
53 
55 
56  /**
57  * Static variable for definition of common input record in reaction term.
58  */
63 
64  /// Reaction data
65  class EqFields : public FieldSet
66  {
67  public:
68  /// Constructor
70  {}
71 
72  /// FieldFEs representing P0 interpolation of mobile concentration (passed from transport).
74  };
75 
76  /// Reaction data
77  class EqData
78  {
79  public:
80  /// Constructor
81  EqData();
82 
83  /**
84  * Names belonging to substances.
85  *
86  * Must be same as in the transport.
87  */
89 
90  /// Pointer to DOF handler used through the reaction tree
91  std::shared_ptr<DOFHandlerMultiDim> dof_handler_;
92  };
93 
94  /**
95  * Constructor.
96  *
97  * @param init_mesh is the reference to the computational mesh
98  * @param in_rec is the input record
99  */
100  ReactionTerm(Mesh &init_mesh, Input::Record in_rec);
101 
102  /// Destructor.
103  ~ReactionTerm(void);
104 
105 
106  ///@name Setters
107  //@{
108  ///Sets the names of substances considered in transport.
110  {eq_data_base_->substances_.initialize(substances); return *this;}
111 
112  ///Sets the output stream which is given from transport class.
113  ReactionTerm &output_stream(std::shared_ptr<OutputTime> ostream)
114  {output_stream_=ostream; return *this;}
115 
116  /**
117  * Sets the pointer to concentration matrix for the mobile zone,
118  * all substances and on all elements (given by transport).
119  */
121  {
123  eq_fields_base_->conc_mobile_fe = conc_mobile;
124  eq_data_base_->dof_handler_ = eq_fields_base_->conc_mobile_fe[0]->get_dofhandler();
125  return *this;
126  }
127  //@}
128 
129  /** @brief Output method.
130  *
131  * Some reaction models have their own data to output (sorption, dual porosity)
132  * - this is where it must be reimplemented.
133  * On the other hand, some do not have (linear reaction, pade approximant)
134  * - that is why it is not pure virtual.
135  */
136  virtual void output_data(void) override {};
137 
138  /// Disable changes in TimeGovernor by empty method.
139  void choose_next_time(void) override;
140 
141 protected:
142  /// Compute reaction on a single element.
143  virtual void compute_reaction(const DHCellAccessor& dh_cell) = 0;
144 
145  /// Pointer to a transport output stream.
146  std::shared_ptr<OutputTime> output_stream_;
147 
148  /// Equation data - all fields needs in assembly class.
149  std::shared_ptr<EqFields> eq_fields_base_;
150 
151  /// Equation data - all data needs in assembly class.
152  std::shared_ptr<EqData> eq_data_base_;
153 };
154 
155 #endif // REACTION_TERM_H
ReactionTerm::output_stream_
std::shared_ptr< OutputTime > output_stream_
Pointer to a transport output stream.
Definition: reaction_term.hh:146
ReactionTerm::output_data
virtual void output_data(void) override
Output method.
Definition: reaction_term.hh:136
ReactionTerm::concentration_fields
ReactionTerm & concentration_fields(FieldFEScalarVec &conc_mobile)
Definition: reaction_term.hh:120
ReactionTerm::it_abstract_immobile_term
static Input::Type::Abstract & it_abstract_immobile_term()
Definition: reaction_term.cc:37
ReactionTerm::ReactionTerm
ReactionTerm(Mesh &init_mesh, Input::Record in_rec)
Definition: reaction_term.cc:51
ReactionTerm::EqFields::EqFields
EqFields()
Constructor.
Definition: reaction_term.hh:69
Input
Abstract linear system class.
Definition: balance.hh:40
SubstanceList
Definition: substance.hh:70
ReactionTerm::EqData::EqData
EqData()
Constructor.
Definition: reaction_term.cc:61
ReactionTerm::TYPEDEF_ERR_INFO
TYPEDEF_ERR_INFO(EI_Substance, std::string)
field_set.hh
substance.hh
Classes for storing substance data.
std::vector
Definition: doxy_dummy_defs.hh:7
ReactionTerm::EqFields
Reaction data.
Definition: reaction_term.hh:65
field_fe.hh
dofhandler.hh
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
index_types.hh
exceptions.hh
ReactionTerm::choose_next_time
void choose_next_time(void) override
Disable changes in TimeGovernor by empty method.
Definition: reaction_term.cc:66
Distribution
Definition: distribution.hh:50
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
ReactionTerm::it_abstract_reaction
static Input::Type::Abstract & it_abstract_reaction()
Definition: reaction_term.cc:43
Input::Type::Abstract
Class for declaration of polymorphic Record.
Definition: type_abstract.hh:62
OutputTime
The class for outputting data during time.
Definition: output_time.hh:51
ReactionTerm::output_stream
ReactionTerm & output_stream(std::shared_ptr< OutputTime > ostream)
Sets the output stream which is given from transport class.
Definition: reaction_term.hh:113
input_exception.hh
FieldSet
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:159
ReactionTerm::substances
ReactionTerm & substances(SubstanceList &substances)
Sets the names of substances considered in transport.
Definition: reaction_term.hh:109
equation.hh
Abstract base class for equation clasess.
EquationBase
Definition: equation.hh:57
ReactionTerm::~ReactionTerm
~ReactionTerm(void)
Destructor.
Definition: reaction_term.cc:55
ReactionTerm::EqData
Reaction data.
Definition: reaction_term.hh:77
Mesh
Definition: mesh.h:355
DHCellAccessor
Cell accessor allow iterate over DOF handler cells.
Definition: dh_cell_accessor.hh:43
ReactionTerm::it_abstract_term
static Input::Type::Abstract & it_abstract_term()
Definition: reaction_term.cc:25
ReactionTerm::DECLARE_INPUT_EXCEPTION
DECLARE_INPUT_EXCEPTION(ExcUnknownSubstance,<< "Unknown substance name: "<< EI_Substance::qval)
ReactionTerm::eq_fields_base_
std::shared_ptr< EqFields > eq_fields_base_
Equation data - all fields needs in assembly class.
Definition: reaction_term.hh:149
ReactionTerm::EqData::substances_
SubstanceList substances_
Definition: reaction_term.hh:88
ReactionTerm::eq_data_base_
std::shared_ptr< EqData > eq_data_base_
Equation data - all data needs in assembly class.
Definition: reaction_term.hh:152
ReactionTerm::compute_reaction
virtual void compute_reaction(const DHCellAccessor &dh_cell)=0
Compute reaction on a single element.
ReactionTerm::EqFields::conc_mobile_fe
FieldFEScalarVec conc_mobile_fe
FieldFEs representing P0 interpolation of mobile concentration (passed from transport).
Definition: reaction_term.hh:73
ReactionTerm::FieldFEScalarVec
std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > > FieldFEScalarVec
Definition: reaction_term.hh:54
ReactionTerm::it_abstract_mobile_term
static Input::Type::Abstract & it_abstract_mobile_term()
Definition: reaction_term.cc:31
ReactionTerm
Definition: reaction_term.hh:46
ASSERT_PTR
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
Definition: asserts.hh:336
ReactionTerm::EqData::dof_handler_
std::shared_ptr< DOFHandlerMultiDim > dof_handler_
Pointer to DOF handler used through the reaction tree.
Definition: reaction_term.hh:91