Flow123d  release_1.8.2-1603-g0109a2b
concentration_model.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 concentration_model.hh
15  * @brief Discontinuous Galerkin method for equation of transport with dispersion.
16  * @author Jan Stebel
17  */
18 
19 #ifndef CONC_TRANS_MODEL_HH_
20 #define CONC_TRANS_MODEL_HH_
21 
23 
24 #include "fields/bc_field.hh"
25 #include "fields/bc_multi_field.hh"
26 #include "fields/field.hh"
27 #include "fields/multi_field.hh"
28 
29 
30 
31 
33 public:
34 
35  class ModelEqData : public TransportEqData {
36  public:
37 
43  };
44 
45  /// Type of boundary condition (see also BC_Type)
47  /// Prescribed concentration for Dirichlet/reference concentration for flux b.c.
49  /// Flux value in total/diffusive flux b.c.
51  /// Transition coefficient in total/diffusive flux b.c.
53  /// Initial concentrations.
55  /// Longitudal dispersivity (for each substance).
57  /// Transversal dispersivity (for each substance).
59  /// Molecular diffusivity (for each substance).
61 
62 
64 
65 
66 
67  ModelEqData();
68 
69  static constexpr const char * name() { return "ConvectionDiffusion"; }
70 
71  static string default_output_field() { return "\"conc\""; }
72 
74 
76 
77  };
78 
79 
81 
82 
84 
85  void set_components(SubstanceList &substances, const Input::Record &in_rec) override;
86 
88  const ElementAccessor<3> &ele_acc,
89  std::vector<double> &mm_coef) override;
90 
91 
92 
94  const std::vector<arma::vec3> &velocity,
95  const ElementAccessor<3> &ele_acc,
97  std::vector<std::vector<arma::mat33> > &dif_coef) override;
98 
99  void compute_init_cond(const std::vector<arma::vec3> &point_list,
100  const ElementAccessor<3> &ele_acc,
101  std::vector< arma::vec > &init_values) override;
102 
103  void get_bc_type(const ElementAccessor<3> &ele_acc,
104  arma::uvec &bc_types) override;
105 
106  void get_flux_bc_data(unsigned int index,
107  const std::vector<arma::vec3> &point_list,
108  const ElementAccessor<3> &ele_acc,
110  std::vector< double > &bc_sigma,
111  std::vector< double > &bc_ref_value) override;
112 
113  void get_flux_bc_sigma(unsigned int index,
114  const std::vector<arma::vec3> &point_list,
115  const ElementAccessor<3> &ele_acc,
116  std::vector< double > &bc_sigma) override;
117 
119  const ElementAccessor<3> &ele_acc,
123 
124  void compute_sources_sigma(const std::vector<arma::vec3> &point_list,
125  const ElementAccessor<3> &ele_acc,
127 
128  ~ConcentrationTransportModel() override;
129 
130 
131  /**
132  * @brief Updates the velocity field which determines some coefficients of the transport equation.
133  *
134  * @param dh mixed hybrid dof handler
135  *
136  * (So far it does not work since the flow module returns a vector of zeros.)
137  * @param velocity_vector Input array of velocity values.
138  */
139  inline void set_velocity_field(const MH_DofHandler &dh) override
140  {
141  mh_dh = &dh;
142  flux_changed = true;
143  }
144 
145  /// Returns number of transported substances.
146  inline unsigned int n_substances() override
147  { return substances_.size(); }
148 
149  /// Returns reference to the vector of substance names.
150  inline SubstanceList &substances() override
151  { return substances_; }
152 
153 
154  // Methods inherited from ConcentrationTransportBase:
155 
156  void set_target_time(double target_time) override {};
157 
158  void set_balance_object(boost::shared_ptr<Balance> balance) override;
159 
161  { return subst_idx; }
162 
163  void set_output_stream(std::shared_ptr<OutputTime> stream)
164  { output_stream_ = stream; }
165 
166  std::shared_ptr<OutputTime> output_stream() override
167  { return output_stream_; }
168 
169 
170 
171 protected:
172 
173  /// Derived class should implement getter for ModelEqData instance.
174  virtual ModelEqData &data() = 0;
175 
176  /**
177  * Create input type that can be passed to the derived class.
178  * @param implementation String characterizing the numerical method, e.g. DG, FEM, FVM.
179  * @param description Comment used to describe the record key.
180  * @return
181  */
182  static IT::Record get_input_type(const string &implementation, const string &description);
183 
184  /**
185  * Formula to calculate the dispersivity tensor.
186  * @param velocity Fluid velocity.
187  * @param Dm Molecular diffusivity.
188  * @param alphaL Longitudal dispersivity.
189  * @param alphaT Transversal dispersivity.
190  * @param porosity Porosity.
191  * @param cross_cut Cross-section.
192  * @param K Dispersivity tensor (output).
193  */
194  void calculate_dispersivity_tensor(const arma::vec3 &velocity,
195  double Dm,
196  double alphaL,
197  double alphaT,
198  double porosity,
199  double cross_cut,
200  arma::mat33 &K);
201 
202  /// Indicator of change in advection vector field.
204 
205  /// Transported substances.
207 
208  /// List of indices used to call balance methods for a set of quantities.
210 
211  /**
212  * Temporary solution how to pass velocity field form the flow model.
213  * TODO: introduce FieldDiscrete -containing true DOFHandler and data vector and pass such object together with other
214  * data. Possibly make more general set_data method, allowing setting data given by name. needs support from EqDataBase.
215  */
217 
218  std::shared_ptr<OutputTime> output_stream_;
219 
220 
221 
222 };
223 
224 
225 
226 
227 
228 
229 
230 
231 #endif /* CONC_TRANS_MODEL_HH_ */
void get_bc_type(const ElementAccessor< 3 > &ele_acc, arma::uvec &bc_types) override
SubstanceList substances_
Transported substances.
static const Input::Type::Selection & get_bc_type_selection()
ConcentrationTransportModel(Mesh &mesh, const Input::Record &in_rec)
MultiField< 3, FieldValue< 3 >::Scalar > output_field
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
void set_output_stream(std::shared_ptr< OutputTime > stream)
Setter for output stream.
SubstanceList & substances() override
Returns reference to the vector of substance names.
MultiField< 3, FieldValue< 3 >::Scalar > diff_m
Molecular diffusivity (for each substance).
void get_flux_bc_data(unsigned int index, const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< double > &bc_flux, std::vector< double > &bc_sigma, std::vector< double > &bc_ref_value) override
Return data for diffusive or total flux b.c.
MultiField< 3, FieldValue< 3 >::Scalar > sources_density
Concentration sources - density of substance source, only positive part is used.
Definition: mesh.h:99
MultiField< 3, FieldValue< 3 >::Scalar > sources_conc
ConcentrationTransportBase FactoryBaseType
bool flux_changed
Indicator of change in advection vector field.
static constexpr const char * name()
void compute_mass_matrix_coefficient(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< double > &mm_coef) override
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
unsigned int size() const
Definition: substance.hh:87
void set_velocity_field(const MH_DofHandler &dh) override
Updates the velocity field which determines some coefficients of the transport equation.
MultiField< 3, FieldValue< 3 >::Scalar > disp_t
Transversal dispersivity (for each substance).
BCMultiField< 3, FieldValue< 3 >::Enum > bc_type
Type of boundary condition (see also BC_Type)
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_dirichlet_value
Prescribed concentration for Dirichlet/reference concentration for flux b.c.
void compute_init_cond(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< arma::vec > &init_values) override
void compute_sources_sigma(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< arma::vec > &sources_sigma) override
Mesh & mesh()
Definition: equation.hh:174
void set_target_time(double target_time) override
MultiField< 3, FieldValue< 3 >::Scalar > sources_sigma
Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc) ...
Accessor to the data with type Type::Record.
Definition: accessors.hh:277
void calculate_dispersivity_tensor(const arma::vec3 &velocity, double Dm, double alphaL, double alphaT, double porosity, double cross_cut, arma::mat33 &K)
Field< 3, FieldValue< 3 >::Scalar > porosity
Mobile porosity.
unsigned int n_substances() override
Returns number of transported substances.
const vector< unsigned int > & get_subst_idx() override
Return substance indices used in balance.
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Transition coefficient in total/diffusive flux b.c.
void compute_source_coefficients(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< arma::vec > &sources_conc, std::vector< arma::vec > &sources_density, std::vector< arma::vec > &sources_sigma) override
void set_balance_object(boost::shared_ptr< Balance > balance) override
std::shared_ptr< OutputTime > output_stream() override
Getter for output stream.
MultiField< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal dispersivity (for each substance).
void get_flux_bc_sigma(unsigned int index, const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< double > &bc_sigma) override
Return transition coefficient for flux b.c.
Discontinuous Galerkin method for equation of transport with dispersion.
void set_components(const std::vector< string > &names)
Definition: field_set.hh:167
std::shared_ptr< OutputTime > output_stream_
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_flux
Flux value in total/diffusive flux b.c.
vector< unsigned int > subst_idx
List of indices used to call balance methods for a set of quantities.
Record type proxy class.
Definition: type_record.hh:171
Class for representation of a vector of fields of the same physical quantity.
Definition: multi_field.hh:55
void compute_advection_diffusion_coefficients(const std::vector< arma::vec3 > &point_list, const std::vector< arma::vec3 > &velocity, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< arma::vec3 > > &ad_coef, std::vector< std::vector< arma::mat33 > > &dif_coef) override
virtual ModelEqData & data()=0
Derived class should implement getter for ModelEqData instance.
Template for classes storing finite set of named values.