Flow123d  JS_before_hm-2208-g558930b9a
richards_lmh.hh
Go to the documentation of this file.
1 /*
2  * richards_lmh.hh
3  *
4  * Created on: Sep 16, 2015
5  * Author: jb
6  */
7 
8 #ifndef SRC_FLOW_RICHARDS_LMH_HH_
9 #define SRC_FLOW_RICHARDS_LMH_HH_
10 
11 
12 #include <memory> // for shared_ptr
13 #include "fields/field.hh" // for Field
14 #include "fields/field_fe.hh" // for FieldFE
15 #include "fields/field_values.hh" // for FieldValue<>::Scalar, FieldValue
16 #include "la/vector_mpi.hh" // for VectorMPI
17 #include "flow/darcy_flow_lmh.hh" // for DarcyLMH, DarcyLMH::EqData
18 #include "flow/darcy_flow_mh_output.hh" // for DarcyFlowMHOutput
19 #include "input/type_base.hh" // for Array
20 #include "input/type_generic.hh" // for Instance
21 
22 class Mesh;
23 class SoilModelBase;
24 namespace Input {
25  class Record;
26  namespace Type {
27  class Record;
28  }
29 }
30 
31 /**
32  * @brief Edge lumped mixed-hybrid solution of unsteady Darcy flow.
33  *
34  * The time term and sources are evenly distributed form an element to its edges.
35  * This applies directly to the second Schur complement. After this system for pressure traces is solved we reconstruct pressures and side flows as follows:
36  *
37  * -# Element pressure is average of edge pressure. This is in fact same as the MH for steady case so we let SchurComplement class do its job.
38  *
39  * -# We let SchurComplement to reconstruct fluxes and then account time term and sources which are evenly distributed from an element to its sides.
40  * It can be proved, that this keeps continuity of the fluxes over the edges.
41  *
42  * This lumping technique preserves discrete maximum principle for any time step provided one use acute mesh. But in practice even worse meshes are tractable.
43  *
44  * Ideas how to unify steady and unsteady flow:
45  * zero_time_step:
46  *
47  * -# Set initial time.
48  * -# Read initial condition. Reconstruct pressures.
49  * -# Assembly system (possibly in matrix free way).
50  * -# Reconstruct velocities (schur complement resolve).
51  * -# Solve iteratively as regular time step if an input flag "steady_initial_time" is set.
52  * -# (Detect that there is no time term. I such case use arbitrary long time step up to next change of data.
53  * Some kind of time step estimator would be nice.
54  *
55  * update solution:
56  *
57  * -# Move to the next time.
58  * -# Update fields
59  * -# Nonlinear solve.
60  * -# In case of slow convergence, use shorter time-step, within estimated limits. Otherwise there is a different problem.
61  */
62 class RichardsLMH : public DarcyLMH
63 {
64 public:
65  /// Class with all fields used in the equation DarcyFlow.
66  /// This is common to all implementations since this provides interface
67  /// to this equation for possible coupling.
68  class EqFields : public DarcyLMH::EqFields {
69  public:
70  EqFields();
71  // input fields
72  Field<3, FieldValue<3>::Scalar > water_content_saturated; // corresponds to the porosity (theta_s = Vw/V = porosity)
76 
77  //output fields
79  std::shared_ptr<FieldFE<3, FieldValue<3>::Scalar>> water_content_ptr;
80 
82 // FieldFE<3, FieldValue<3>::Scalar > conductivity_richards;
83  std::shared_ptr<FieldFE<3, FieldValue<3>::Scalar>> conductivity_ptr;
84  };
85 
86  class EqData : public DarcyLMH::EqData {
87  public:
88  /// Constructor
89  EqData();
90 
91  // Auxiliary assembly fields.
94 
95  std::shared_ptr<SoilModelBase> soil_model_;
96  };
97 
98  RichardsLMH(Mesh &mesh, const Input::Record in_rec, TimeGovernor *tm = nullptr);
99 
100  static const Input::Type::Record & get_input_type();
101 
102  void accept_time_step() override;
103 
104 protected:
105  /// Registrar of class to factory
106  static const int registrar;
107 
108  bool zero_time_term(bool time_global=false) override;
109 
110  void initialize_specific() override;
111 
112  void initial_condition_postprocess() override;
113  void assembly_linear_system() override;
114 private:
115 
116  std::shared_ptr<EqFields> eq_fields_;
117  std::shared_ptr<EqData> eq_data_;
118 };
119 
120 
121 
122 
123 #endif /* SRC_FLOW_RICHARDS_LMH_HH_ */
RichardsLMH::accept_time_step
void accept_time_step() override
postprocess velocity field (add sources)
Definition: richards_lmh.cc:179
RichardsLMH::EqFields::conductivity_richards
Field< 3, FieldValue< 3 >::Scalar > conductivity_richards
Definition: richards_lmh.hh:81
RichardsLMH::EqFields::conductivity_ptr
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > conductivity_ptr
Definition: richards_lmh.hh:83
RichardsLMH::EqFields::water_content
Field< 3, FieldValue< 3 >::Scalar > water_content
Definition: richards_lmh.hh:78
RichardsLMH::EqFields::genuchten_p_head_scale
Field< 3, FieldValue< 3 >::Scalar > genuchten_p_head_scale
Definition: richards_lmh.hh:74
vector_mpi.hh
DarcyLMH::EqData
Definition: darcy_flow_lmh.hh:152
Input
Abstract linear system class.
Definition: balance.hh:40
RichardsLMH::EqData::EqData
EqData()
Constructor.
Definition: richards_lmh.cc:79
RichardsLMH::eq_data_
std::shared_ptr< EqData > eq_data_
Definition: richards_lmh.hh:117
RichardsLMH::initial_condition_postprocess
void initial_condition_postprocess() override
Definition: richards_lmh.cc:168
RichardsLMH::zero_time_term
bool zero_time_term(bool time_global=false) override
Definition: richards_lmh.cc:189
RichardsLMH::EqData::soil_model_
std::shared_ptr< SoilModelBase > soil_model_
Definition: richards_lmh.hh:95
RichardsLMH::EqFields::water_content_residual
Field< 3, FieldValue< 3 >::Scalar > water_content_residual
Definition: richards_lmh.hh:73
RichardsLMH::EqFields::genuchten_n_exponent
Field< 3, FieldValue< 3 >::Scalar > genuchten_n_exponent
Definition: richards_lmh.hh:75
DarcyLMH::EqFields
Definition: darcy_flow_lmh.hh:146
field_fe.hh
type_base.hh
darcy_flow_lmh.hh
Lumped mixed-hybrid model of linear Darcy flow, possibly unsteady.
RichardsLMH::EqData::water_content_previous_time
VectorMPI water_content_previous_time
Definition: richards_lmh.hh:92
RichardsLMH::EqData
Definition: richards_lmh.hh:86
SoilModelBase
Definition: soil_models.hh:53
RichardsLMH::eq_fields_
std::shared_ptr< EqFields > eq_fields_
Definition: richards_lmh.hh:116
EquationBase::mesh
Mesh & mesh()
Definition: equation.hh:179
RichardsLMH::EqFields::EqFields
EqFields()
Definition: richards_lmh.cc:41
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
darcy_flow_mh_output.hh
Output class for darcy_flow_mh model.
type_generic.hh
TimeGovernor
Basic time management functionality for unsteady (and steady) solvers (class Equation).
Definition: time_governor.hh:317
field_values.hh
RichardsLMH::EqFields
Definition: richards_lmh.hh:68
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
Mesh
Definition: mesh.h:359
RichardsLMH::get_input_type
static const Input::Type::Record & get_input_type()
Definition: richards_lmh.cc:83
RichardsLMH::registrar
static const int registrar
Registrar of class to factory.
Definition: richards_lmh.hh:106
DarcyLMH
Mixed-hybrid model of linear Darcy flow, possibly unsteady.
Definition: darcy_flow_lmh.hh:128
RichardsLMH::EqFields::water_content_ptr
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > water_content_ptr
Definition: richards_lmh.hh:79
RichardsLMH
Edge lumped mixed-hybrid solution of unsteady Darcy flow.
Definition: richards_lmh.hh:62
RichardsLMH::RichardsLMH
RichardsLMH(Mesh &mesh, const Input::Record in_rec, TimeGovernor *tm=nullptr)
Definition: richards_lmh.cc:125
VectorMPI
Definition: vector_mpi.hh:43
Field
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:92
RichardsLMH::assembly_linear_system
void assembly_linear_system() override
Definition: richards_lmh.cc:203
RichardsLMH::EqData::capacity
VectorMPI capacity
Definition: richards_lmh.hh:93
field.hh
RichardsLMH::EqFields::water_content_saturated
Field< 3, FieldValue< 3 >::Scalar > water_content_saturated
Definition: richards_lmh.hh:72
RichardsLMH::initialize_specific
void initialize_specific() override
Definition: richards_lmh.cc:137