Flow123d  JS_before_hm-1016-g09ec2cb
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 
22 
23 #include <memory> // for shared_ptr
24 #include <string> // for string
25 #include <vector> // for vector
26 #include <armadillo>
28 #include "fields/field_values.hh" // for FieldValue<>::S...
29 #include "fields/bc_multi_field.hh"
30 #include "fields/field.hh"
31 #include "fields/multi_field.hh"
32 #include "input/type_base.hh" // for Array
33 #include "input/type_generic.hh" // for Instance
34 #include "input/type_record.hh" // for Record
35 #include "input/type_selection.hh" // for Selection
36 #include "transport/substance.hh" // for SubstanceList
37 #include "transport/transport_operator_splitting.hh" // for ConcentrationTr...
38 
39 class Balance;
40 class Mesh;
41 class OutputTime;
42 namespace Input { class Record; }
43 template <int spacedim> class ElementAccessor;
44 
45 
46 
47 
49 public:
50 
51  class ModelEqData : public TransportEqData {
52  public:
53 
58  bc_diffusive_flux
59  };
60 
61  /// Type of boundary condition (see also BC_Type)
63  /// Prescribed concentration for Dirichlet/reference concentration for flux b.c.
65  /// Flux value in total/diffusive flux b.c.
67  /// Transition coefficient in total/diffusive flux b.c.
69  /// Initial concentrations.
71  /// Longitudal dispersivity (for each substance).
73  /// Transversal dispersivity (for each substance).
75  /// Molecular diffusivity (for each substance).
77 
78  Field<3, FieldValue<3>::Scalar > rock_density; ///< Rock matrix density.
79  MultiField<3, FieldValue<3>::Scalar > sorption_coefficient; ///< Coefficient of linear sorption.
80 
81 
83 
84 
85 
86  ModelEqData();
87 
88  static constexpr const char * name() { return "Solute_AdvectionDiffusion"; }
89 
90  static string default_output_field() { return "\"conc\""; }
91 
92  static const Input::Type::Selection & get_bc_type_selection();
93 
94  static IT::Selection get_output_selection();
95 
96  };
97 
98 
100 
101 
102  ConcentrationTransportModel(Mesh &mesh, const Input::Record &in_rec);
103 
104  void init_from_input(const Input::Record &in_rec) override;
105 
106  void compute_mass_matrix_coefficient(const Armor::array &point_list,
107  const ElementAccessor<3> &ele_acc,
108  std::vector<double> &mm_coef) override;
109 
110  void compute_retardation_coefficient(const Armor::array &point_list,
111  const ElementAccessor<3> &ele_acc,
112  std::vector<std::vector<double> > &ret_coef) override;
113 
114 
115 
116  void compute_advection_diffusion_coefficients(const Armor::array &point_list,
117  const std::vector<arma::vec3> &velocity,
118  const ElementAccessor<3> &ele_acc,
120  std::vector<std::vector<arma::mat33> > &dif_coef) override;
121 
122  void compute_init_cond(const Armor::array &point_list,
123  const ElementAccessor<3> &ele_acc,
124  std::vector<std::vector<double> > &init_values) override;
125 
126  void get_bc_type(const ElementAccessor<3> &ele_acc,
127  arma::uvec &bc_types) override;
128 
129  void get_flux_bc_data(unsigned int index,
130  const Armor::array &point_list,
131  const ElementAccessor<3> &ele_acc,
132  std::vector< double > &bc_flux,
133  std::vector< double > &bc_sigma,
134  std::vector< double > &bc_ref_value) override;
135 
136  void get_flux_bc_sigma(unsigned int index,
137  const Armor::array &point_list,
138  const ElementAccessor<3> &ele_acc,
139  std::vector< double > &bc_sigma) override;
140 
141  void compute_source_coefficients(const Armor::array &point_list,
142  const ElementAccessor<3> &ele_acc,
143  std::vector<std::vector<double> > &sources_conc,
144  std::vector<std::vector<double> > &sources_density,
145  std::vector<std::vector<double> > &sources_sigma) override;
146 
147  void compute_sources_sigma(const Armor::array &point_list,
148  const ElementAccessor<3> &ele_acc,
149  std::vector<std::vector<double> > &sources_sigma) override;
150 
151  ~ConcentrationTransportModel() override;
152 
153  /// Returns number of transported substances.
154  inline unsigned int n_substances() override
155  { return substances_.size(); }
156 
157  /// Returns reference to the vector of substance names.
158  inline SubstanceList &substances() override
159  { return substances_; }
160 
161 
162  // Methods inherited from ConcentrationTransportBase:
163 
164  // Must be implemented in descendants.
165  void set_target_time(double) override {};
166 
167  void set_balance_object(std::shared_ptr<Balance> balance) override;
168 
170  { return subst_idx; }
171 
172  void set_output_stream(std::shared_ptr<OutputTime> stream)
173  { output_stream_ = stream; }
174 
175  std::shared_ptr<OutputTime> output_stream() override
176  { return output_stream_; }
177 
178 
179  /// Derived class should implement getter for ModelEqData instance.
180  virtual ModelEqData &data() = 0;
181 
182 protected:
183 
184  /**
185  * Create input type that can be passed to the derived class.
186  * @param implementation String characterizing the numerical method, e.g. DG, FEM, FVM.
187  * @param description Comment used to describe the record key.
188  * @return
189  */
190  static IT::Record get_input_type(const string &implementation, const string &description);
191 
192  /**
193  * Formula to calculate the dispersivity tensor.
194  * @param velocity Fluid velocity.
195  * @param Dm Molecular diffusivity.
196  * @param alphaL Longitudal dispersivity.
197  * @param alphaT Transversal dispersivity.
198  * @param porosity Porosity.
199  * @param cross_cut Cross-section.
200  * @param K Dispersivity tensor (output).
201  */
202  void calculate_dispersivity_tensor(const arma::vec3 &velocity,
203  const arma::mat33 &Dm,
204  double alphaL,
205  double alphaT,
206  double water_content,
207  double porosity,
208  double cross_cut,
209  arma::mat33 &K);
210 
211  /// Transported substances.
213 
214  /// List of indices used to call balance methods for a set of quantities.
216 
217  /// Density of liquid (a global constant).
219 
220  std::shared_ptr<OutputTime> output_stream_;
221 };
222 
223 
224 
225 
226 
227 
228 
229 
230 #endif /* CONC_TRANS_MODEL_HH_ */
SubstanceList substances_
Transported substances.
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.
MultiField< 3, FieldValue< 3 >::Scalar > sorption_coefficient
Coefficient of linear sorption.
Abstract linear system class.
Definition: balance.hh:40
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:92
SubstanceList & substances() override
Returns reference to the vector of substance names.
Definition: mesh.h:78
ConcentrationTransportBase FactoryBaseType
static constexpr const char * name()
double solvent_density_
Density of liquid (a global constant).
Field< 3, FieldValue< 3 >::Scalar > rock_density
Rock matrix density.
const vector< unsigned int > & get_subst_idx()
Return substance indices used in balance.
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.
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
unsigned int n_substances() override
Returns number of transported substances.
The class for outputting data during time.
Definition: output_time.hh:50
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Transition coefficient in total/diffusive flux b.c.
std::shared_ptr< OutputTime > output_stream() override
Getter for output stream.
MultiField< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal dispersivity (for each substance).
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.
Classes for storing substance data.
void set_target_time(double) override
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:87
Template for classes storing finite set of named values.