Flow123d  release_2.2.0-34-g18a8075
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  Field<3, FieldValue<3>::Scalar > rock_density; ///< Rock matrix density.
63  MultiField<3, FieldValue<3>::Scalar > sorption_coefficient; ///< Coefficient of linear sorption.
64 
65 
67 
68 
69 
70  ModelEqData();
71 
72  static constexpr const char * name() { return "Solute_AdvectionDiffusion"; }
73 
74  static string default_output_field() { return "\"conc\""; }
75 
77 
79 
80  };
81 
82 
84 
85 
87 
88  void init_from_input(const Input::Record &in_rec) override;
89 
91  const ElementAccessor<3> &ele_acc,
92  std::vector<double> &mm_coef) override;
93 
95  const ElementAccessor<3> &ele_acc,
96  std::vector<std::vector<double> > &ret_coef) override;
97 
98 
99 
101  const std::vector<arma::vec3> &velocity,
102  const ElementAccessor<3> &ele_acc,
104  std::vector<std::vector<arma::mat33> > &dif_coef) override;
105 
106  void compute_init_cond(const std::vector<arma::vec3> &point_list,
107  const ElementAccessor<3> &ele_acc,
108  std::vector<std::vector<double> > &init_values) override;
109 
110  void get_bc_type(const ElementAccessor<3> &ele_acc,
111  arma::uvec &bc_types) override;
112 
113  void get_flux_bc_data(unsigned int index,
114  const std::vector<arma::vec3> &point_list,
115  const ElementAccessor<3> &ele_acc,
117  std::vector< double > &bc_sigma,
118  std::vector< double > &bc_ref_value) override;
119 
120  void get_flux_bc_sigma(unsigned int index,
121  const std::vector<arma::vec3> &point_list,
122  const ElementAccessor<3> &ele_acc,
123  std::vector< double > &bc_sigma) override;
124 
126  const ElementAccessor<3> &ele_acc,
130 
131  void compute_sources_sigma(const std::vector<arma::vec3> &point_list,
132  const ElementAccessor<3> &ele_acc,
134 
135  ~ConcentrationTransportModel() override;
136 
137 
138  /**
139  * @brief Updates the velocity field which determines some coefficients of the transport equation.
140  *
141  * @param dh mixed hybrid dof handler
142  *
143  * (So far it does not work since the flow module returns a vector of zeros.)
144  * @param velocity_vector Input array of velocity values.
145  */
146  inline void set_velocity_field(const MH_DofHandler &dh) override
147  {
148  mh_dh = &dh;
149  flux_changed = true;
150  }
151 
152  /// Returns number of transported substances.
153  inline unsigned int n_substances() override
154  { return substances_.size(); }
155 
156  /// Returns reference to the vector of substance names.
157  inline SubstanceList &substances() override
158  { return substances_; }
159 
160 
161  // Methods inherited from ConcentrationTransportBase:
162 
163  void set_target_time(double target_time) override {};
164 
165  void set_balance_object(std::shared_ptr<Balance> balance) override;
166 
168  { return subst_idx; }
169 
170  void set_output_stream(std::shared_ptr<OutputTime> stream)
171  { output_stream_ = stream; }
172 
173  std::shared_ptr<OutputTime> output_stream() override
174  { return output_stream_; }
175 
176 
177 
178 protected:
179 
180  /// Derived class should implement getter for ModelEqData instance.
181  virtual ModelEqData &data() = 0;
182 
183  /**
184  * Create input type that can be passed to the derived class.
185  * @param implementation String characterizing the numerical method, e.g. DG, FEM, FVM.
186  * @param description Comment used to describe the record key.
187  * @return
188  */
189  static IT::Record get_input_type(const string &implementation, const string &description);
190 
191  /**
192  * Formula to calculate the dispersivity tensor.
193  * @param velocity Fluid velocity.
194  * @param Dm Molecular diffusivity.
195  * @param alphaL Longitudal dispersivity.
196  * @param alphaT Transversal dispersivity.
197  * @param porosity Porosity.
198  * @param cross_cut Cross-section.
199  * @param K Dispersivity tensor (output).
200  */
201  void calculate_dispersivity_tensor(const arma::vec3 &velocity,
202  const arma::mat33 &Dm,
203  double alphaL,
204  double alphaT,
205  double water_content,
206  double porosity,
207  double cross_cut,
208  arma::mat33 &K);
209 
210  /// Indicator of change in advection vector field.
212 
213  /// Transported substances.
215 
216  /// List of indices used to call balance methods for a set of quantities.
218 
219  /// Density of liquid (a global constant).
221 
222  /**
223  * Temporary solution how to pass velocity field form the flow model.
224  * TODO: introduce FieldDiscrete -containing true DOFHandler and data vector and pass such object together with other
225  * data. Possibly make more general set_data method, allowing setting data given by name. needs support from EqDataBase.
226  */
228 
229  std::shared_ptr<OutputTime> output_stream_;
230 
231 
232 
233 };
234 
235 
236 
237 
238 
239 
240 
241 
242 #endif /* CONC_TRANS_MODEL_HH_ */
void get_bc_type(const ElementAccessor< 3 > &ele_acc, arma::uvec &bc_types) override
void compute_retardation_coefficient(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< double > > &ret_coef) override
SubstanceList substances_
Transported substances.
static const Input::Type::Selection & get_bc_type_selection()
void set_balance_object(std::shared_ptr< Balance > balance) override
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 init_from_input(const Input::Record &in_rec) override
Read necessary data from input record.
void set_output_stream(std::shared_ptr< OutputTime > stream)
Setter for output stream.
MultiField< 3, FieldValue< 3 >::Scalar > sorption_coefficient
Coefficient of linear sorption.
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:62
void calculate_dispersivity_tensor(const arma::vec3 &velocity, const arma::mat33 &Dm, double alphaL, double alphaT, double water_content, double porosity, double cross_cut, arma::mat33 &K)
SubstanceList & substances() override
Returns reference to the vector of substance names.
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.
void compute_init_cond(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< double > > &init_values) override
Definition: mesh.h:97
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.
double solvent_density_
Density of liquid (a global constant).
Field< 3, FieldValue< 3 >::Scalar > rock_density
Rock matrix density.
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.
Mesh & mesh()
Definition: equation.hh:176
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:292
Field< 3, FieldValue< 3 >::Scalar > porosity
Mobile porosity - usually saturated water content in the case of unsaturated flow model...
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.
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content - result of unsaturated water flow model or porosity.
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.
std::shared_ptr< OutputTime > output_stream_
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_flux
Flux value in total/diffusive flux b.c.
MultiField< 3, FieldValue< 3 >::TensorFixed > diff_m
Molecular diffusivity (for each substance).
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:182
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.
void compute_sources_sigma(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< double > > &sources_sigma) override
Template for classes storing finite set of named values.
void compute_source_coefficients(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< double > > &sources_conc, std::vector< std::vector< double > > &sources_density, std::vector< std::vector< double > > &sources_sigma) override