Flow123d  DF_patch_fe_darcy_complete-579fe1e
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 template<unsigned int dim, class TEqData> class InitCondPostprocessAssembly;
31 template<unsigned int dim, class TEqData> class MHMatrixAssemblyRichards;
32 template<unsigned int dim, class TEqData> class ReconstructSchurAssemblyRichards;
33 template< template<IntDim...> class DimAssembly> class GenericAssembly;
34 
35 /**
36  * @brief Edge lumped mixed-hybrid solution of unsteady Darcy flow.
37  *
38  * The time term and sources are evenly distributed form an element to its edges.
39  * This applies directly to the second Schur complement. After this system for pressure traces is solved we reconstruct pressures and side flows as follows:
40  *
41  * -# 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.
42  *
43  * -# We let SchurComplement to reconstruct fluxes and then account time term and sources which are evenly distributed from an element to its sides.
44  * It can be proved, that this keeps continuity of the fluxes over the edges.
45  *
46  * This lumping technique preserves discrete maximum principle for any time step provided one use acute mesh. But in practice even worse meshes are tractable.
47  *
48  * Ideas how to unify steady and unsteady flow:
49  * zero_time_step:
50  *
51  * -# Set initial time.
52  * -# Read initial condition. Reconstruct pressures.
53  * -# Assembly system (possibly in matrix free way).
54  * -# Reconstruct velocities (schur complement resolve).
55  * -# Solve iteratively as regular time step if an input flag "steady_initial_time" is set.
56  * -# (Detect that there is no time term. I such case use arbitrary long time step up to next change of data.
57  * Some kind of time step estimator would be nice.
58  *
59  * update solution:
60  *
61  * -# Move to the next time.
62  * -# Update fields
63  * -# Nonlinear solve.
64  * -# In case of slow convergence, use shorter time-step, within estimated limits. Otherwise there is a different problem.
65  */
66 class RichardsLMH : public DarcyLMH
67 {
68 public:
69  /// Class with all fields used in the equation DarcyFlow.
70  /// This is common to all implementations since this provides interface
71  /// to this equation for possible coupling.
72  class EqFields : public DarcyLMH::EqFields {
73  public:
74  EqFields();
75  // input fields
76  Field<3, FieldValue<3>::Scalar > water_content_saturated; // corresponds to the porosity (theta_s = Vw/V = porosity)
80 
81  //output fields
84 
86 // FieldFE<3, FieldValue<3>::Scalar > conductivity_richards;
88  };
89 
90  class EqData : public DarcyLMH::EqData {
91  public:
93 
94  /// Constructor
95  EqData(shared_ptr<EqFields> eq_fields);
96 
97  /// Shared pointer of EqFields
98  std::shared_ptr<EqFields> eq_fields_;
99 
100  // Auxiliary assembly fields.
103 
104  std::shared_ptr<SoilModelBase> soil_model_;
105  };
106 
110 
111  RichardsLMH(Mesh &mesh, const Input::Record in_rec, TimeGovernor *tm = nullptr);
112 
113  static const Input::Type::Record & get_input_type();
114 
115  void accept_time_step() override;
116 
117  virtual ~RichardsLMH() override;
118 
119 protected:
120  /// Registrar of class to factory
121  static const int registrar;
122 
123  bool zero_time_term(bool time_global=false) override;
124 
125  void initialize_specific() override;
126 
127 // void initial_condition_postprocess() override;
128  void assembly_linear_system() override;
129 
130  /// Create and initialize assembly objects
131  void initialize_asm() override;
132 
133  /// Call assemble of read_init_cond_assembly_ and init_cond_postprocess_assembly_
134  void read_init_cond_asm() override;
135 
136 private:
137 
138  std::shared_ptr<EqFields> eq_fields_;
139  std::shared_ptr<EqData> eq_data_;
140 
141  /// general assembly object, hold assembly objects of appropriate dimension
143 
144  static std::string equation_name()
145  { return "Flow_Richards_LMH";}
146 
147 };
148 
149 
150 
151 
152 #endif /* SRC_FLOW_RICHARDS_LMH_HH_ */
Mixed-hybrid model of linear Darcy flow, possibly unsteady.
EqFields & eq_fields()
Mesh & mesh()
Definition: equation.hh:181
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:92
Generic class of assemblation.
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
Record type proxy class.
Definition: type_record.hh:182
Definition: mesh.h:362
std::shared_ptr< SoilModelBase > soil_model_
EqData(shared_ptr< EqFields > eq_fields)
Constructor.
Definition: richards_lmh.cc:79
std::shared_ptr< EqFields > eq_fields_
Shared pointer of EqFields.
Definition: richards_lmh.hh:98
VectorMPI water_content_previous_time
RichardsLMH::EqFields EqFields
Definition: richards_lmh.hh:92
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > conductivity_ptr
Definition: richards_lmh.hh:87
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > water_content_ptr
Definition: richards_lmh.hh:83
Field< 3, FieldValue< 3 >::Scalar > genuchten_p_head_scale
Definition: richards_lmh.hh:78
Field< 3, FieldValue< 3 >::Scalar > water_content_saturated
Definition: richards_lmh.hh:76
Field< 3, FieldValue< 3 >::Scalar > water_content
Definition: richards_lmh.hh:82
Field< 3, FieldValue< 3 >::Scalar > water_content_residual
Definition: richards_lmh.hh:77
Field< 3, FieldValue< 3 >::Scalar > conductivity_richards
Definition: richards_lmh.hh:85
Field< 3, FieldValue< 3 >::Scalar > genuchten_n_exponent
Definition: richards_lmh.hh:79
Edge lumped mixed-hybrid solution of unsteady Darcy flow.
Definition: richards_lmh.hh:67
bool zero_time_term(bool time_global=false) override
static const int registrar
Registrar of class to factory.
void read_init_cond_asm() override
Call assemble of read_init_cond_assembly_ and init_cond_postprocess_assembly_.
virtual ~RichardsLMH() override
void accept_time_step() override
postprocess velocity field (add sources)
static const Input::Type::Record & get_input_type()
Definition: richards_lmh.cc:83
void initialize_specific() override
void assembly_linear_system() override
GenericAssembly< InitCondPostprocessAssemblyDim > * init_cond_postprocess_assembly_
general assembly object, hold assembly objects of appropriate dimension
RichardsLMH(Mesh &mesh, const Input::Record in_rec, TimeGovernor *tm=nullptr)
std::shared_ptr< EqFields > eq_fields_
void initialize_asm() override
Create and initialize assembly objects.
std::shared_ptr< EqData > eq_data_
static std::string equation_name()
Basic time management functionality for unsteady (and steady) solvers (class Equation).
Lumped mixed-hybrid model of linear Darcy flow, possibly unsteady.
Output class for darcy_flow_mh model.
unsigned int IntDim
A dimension index type.
Definition: mixed.hh:19
Abstract linear system class.
Definition: balance.hh:40
double Scalar
Definition: op_accessors.hh:25