Flow123d  JS_before_hm-2088-g1c00063e5
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 
34 class Distribution;
35 class Mesh;
36 class OutputTime;
37 namespace Input {
38  class Record;
39  namespace Type {
40  class Abstract;
41  }
42 }
43 
44 
46 {
47 public:
48  TYPEDEF_ERR_INFO( EI_Substance, std::string);
49  TYPEDEF_ERR_INFO( EI_Model, std::string);
50  DECLARE_INPUT_EXCEPTION( ExcUnknownSubstance, << "Unknown substance name: " << EI_Substance::qval);
51  DECLARE_INPUT_EXCEPTION( ExcWrongDescendantModel, << "Impossible descendant model: " << EI_Model::qval);
52 
54 
55  /**
56  * Static variable for definition of common input record in reaction term.
57  */
62 
63  /// Constructor.
64  /** @param init_mesh is the reference to the computational mesh
65  * @param in_rec is the input record
66  */
67  ReactionTerm(Mesh &init_mesh, Input::Record in_rec);
68 
69  /// Destructor.
70  ~ReactionTerm(void);
71 
72 
73  ///@name Setters
74  //@{
75  ///Sets the names of substances considered in transport.
77  {substances_.initialize(substances); return *this;}
78 
79  ///Sets the output stream which is given from transport class.
80  ReactionTerm &output_stream(std::shared_ptr<OutputTime> ostream)
81  {output_stream_=ostream; return *this;}
82 
83  /**
84  * Sets the pointer to concentration matrix for the mobile zone,
85  * all substances and on all elements (given by transport).
86  */
88  {
89  conc_mobile_fe = conc_mobile;
90  dof_handler_ = conc_mobile_fe[0]->get_dofhandler();
91  return *this;
92  }
93  //@}
94 
95  /** @brief Output method.
96  *
97  * Some reaction models have their own data to output (sorption, dual porosity)
98  * - this is where it must be reimplemented.
99  * On the other hand, some do not have (linear reaction, pade approximant)
100  * - that is why it is not pure virtual.
101  */
102  virtual void output_data(void) override {};
103 
104  /// Disable changes in TimeGovernor by empty method.
105  void choose_next_time(void) override;
106 
107 protected:
108  /// Compute reaction on a single element.
109  virtual void compute_reaction(const DHCellAccessor& dh_cell) = 0;
110 
111  /// FieldFEs representing P0 interpolation of mobile concentration (passed from transport).
113 
114  /// Names belonging to substances.
115  /**
116  * Must be same as in the transport.
117  */
119 
120  /// Pointer to a transport output stream.
121  std::shared_ptr<OutputTime> output_stream_;
122 
123  /// Pointer to DOF handler used through the reaction tree
124  std::shared_ptr<DOFHandlerMultiDim> dof_handler_;
125 
126 };
127 
128 #endif // REACTION_TERM_H
ReactionTerm::output_stream_
std::shared_ptr< OutputTime > output_stream_
Pointer to a transport output stream.
Definition: reaction_term.hh:121
ReactionTerm::output_data
virtual void output_data(void) override
Output method.
Definition: reaction_term.hh:102
ReactionTerm::concentration_fields
ReactionTerm & concentration_fields(FieldFEScalarVec &conc_mobile)
Definition: reaction_term.hh:87
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)
Constructor.
Definition: reaction_term.cc:51
Input
Abstract linear system class.
Definition: balance.hh:40
SubstanceList
Definition: substance.hh:70
ReactionTerm::TYPEDEF_ERR_INFO
TYPEDEF_ERR_INFO(EI_Substance, std::string)
substance.hh
Classes for storing substance data.
std::vector
Definition: doxy_dummy_defs.hh:7
field_fe.hh
dofhandler.hh
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
ReactionTerm::dof_handler_
std::shared_ptr< DOFHandlerMultiDim > dof_handler_
Pointer to DOF handler used through the reaction tree.
Definition: reaction_term.hh:124
index_types.hh
SubstanceList::initialize
void initialize(const Input::Array &in_array)
Read from input array.
Definition: substance.cc:58
exceptions.hh
ReactionTerm::conc_mobile_fe
FieldFEScalarVec conc_mobile_fe
FieldFEs representing P0 interpolation of mobile concentration (passed from transport).
Definition: reaction_term.hh:112
ReactionTerm::choose_next_time
void choose_next_time(void) override
Disable changes in TimeGovernor by empty method.
Definition: reaction_term.cc:63
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:80
input_exception.hh
ReactionTerm::substances
ReactionTerm & substances(SubstanceList &substances)
Sets the names of substances considered in transport.
Definition: reaction_term.hh:76
ReactionTerm::substances_
SubstanceList substances_
Names belonging to substances.
Definition: reaction_term.hh:118
equation.hh
Abstract base class for equation clasess.
EquationBase
Definition: equation.hh:57
ReactionTerm::~ReactionTerm
~ReactionTerm(void)
Destructor.
Definition: reaction_term.cc:56
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::compute_reaction
virtual void compute_reaction(const DHCellAccessor &dh_cell)=0
Compute reaction on a single element.
ReactionTerm::FieldFEScalarVec
std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > > FieldFEScalarVec
Definition: reaction_term.hh:53
ReactionTerm::it_abstract_mobile_term
static Input::Type::Abstract & it_abstract_mobile_term()
Definition: reaction_term.cc:31
ReactionTerm
Definition: reaction_term.hh:45