Flow123d  release_2.2.0-33-g759111d
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 #include "flow/darcy_flow_mh.hh"
12 #include "fields/vec_seq_double.hh"
13 
14 class SoilModelBase;
15 
16 /**
17  * @brief Edge lumped mixed-hybrid solution of unsteady Darcy flow.
18  *
19  * The time term and sources are evenly distributed form an element to its edges.
20  * This applies directly to the second Schur complement. After this system for pressure traces is solved we reconstruct pressures and side flows as follows:
21  *
22  * -# 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.
23  *
24  * -# We let SchurComplement to reconstruct fluxes and then account time term and sources which are evenly distributed from an element to its sides.
25  * It can be proved, that this keeps continuity of the fluxes over the edges.
26  *
27  * This lumping technique preserves discrete maximum principle for any time step provided one use acute mesh. But in practice even worse meshes are tractable.
28  *
29  * Ideas how to unify steady and unsteady flow:
30  * zero_time_step:
31  *
32  * -# Set initial time.
33  * -# Read initial condition. Reconstruct pressures.
34  * -# Assembly system (possibly in matrix free way).
35  * -# Reconstruct velocities (schur complement resolve).
36  * -# Solve iteratively as regular time step if an input flag "steady_initial_time" is set.
37  * -# (Detect that there is no time term. I such case use arbitrary long time step up to next change of data.
38  * Some kind of time step estimator would be nice.
39  *
40  * update solution:
41  *
42  * -# Move to the next time.
43  * -# Update fields
44  * -# Nonlinear solve.
45  * -# In case of slow convergence, use shorter time-step, within estimated limits. Otherwise there is a different problem.
46  */
47 class RichardsLMH : public DarcyMH
48 {
49 public:
50  /// Class with all fields used in the equation DarcyFlow.
51  /// This is common to all implementations since this provides interface
52  /// to this equation for possible coupling.
53  class EqData : public DarcyMH::EqData {
54  public:
55  EqData();
56  // input fields
61 
62  //output fields
63 
64  // Auxiliary assembly fields.
65  //std::unordered_map<unsigned int, unsigned int> *edge_new_local_4_mesh_idx_;
70  // source terms to be added to the side fluxes, in order to get proper (continuous) velocity field
72 
73 
74  // This is necessary in the assembly
75  // TODO: store time information in the field set and in fields, is it ok also for more complex discretization methods?
76  double time_step_;
77  std::shared_ptr<SoilModelBase> soil_model_;
78  };
79 
80  RichardsLMH(Mesh &mesh, const Input::Record in_rec);
81 
82  static const Input::Type::Record & get_input_type();
83 protected:
84  /// Registrar of class to factory
85  static const int registrar;
86 
87  bool zero_time_term(bool time_global=false) override;
88 
89  void initialize_specific() override;
90  //void local_assembly_specific(LocalAssemblyData &local_data) override;
91  void assembly_source_term() override;
92 
93  void read_initial_condition() override;
94  void assembly_linear_system() override;
95  void setup_time_term() override;
96  void prepare_new_time_step() override;
97  void postprocess() override;
98 private:
99 
100  std::shared_ptr<EqData> data_;
101  /// PETSC scatter from the solution vector to the parallel edge vector with ghost values.
103 
104  /*
105  Vec steady_diagonal;
106  Vec steady_rhs;
107  Vec new_diagonal;
108  Vec previous_solution;
109 */
110 
111  //Vec time_term;
112 };
113 
114 
115 
116 
117 #endif /* SRC_FLOW_RICHARDS_LMH_HH_ */
void initialize_specific() override
void postprocess() override
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:62
bool zero_time_term(bool time_global=false) override
std::shared_ptr< SoilModelBase > soil_model_
Definition: richards_lmh.hh:77
Definition: mesh.h:97
VectorMPI postprocess_side_sources
Definition: richards_lmh.hh:71
VectorMPI water_content_previous_time
Definition: richards_lmh.hh:68
void prepare_new_time_step() override
postprocess velocity field (add sources)
VecScatter solution_2_edge_scatter_
PETSC scatter from the solution vector to the parallel edge vector with ghost values.
void setup_time_term() override
Edge lumped mixed-hybrid solution of unsteady Darcy flow.
Definition: richards_lmh.hh:47
Field< 3, FieldValue< 3 >::Scalar > water_content_saturated
Definition: richards_lmh.hh:57
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
std::shared_ptr< EqData > data_
Field< 3, FieldValue< 3 >::Scalar > genuchten_p_head_scale
Definition: richards_lmh.hh:59
Field< 3, FieldValue< 3 >::Scalar > water_content_residual
Definition: richards_lmh.hh:58
static const Input::Type::Record & get_input_type()
Definition: richards_lmh.cc:77
Field< 3, FieldValue< 3 >::Scalar > genuchten_n_exponent
Definition: richards_lmh.hh:60
void read_initial_condition() override
void assembly_linear_system() override
mixed-hybrid model of linear Darcy flow, possibly unsteady.
Record type proxy class.
Definition: type_record.hh:182
static const int registrar
Registrar of class to factory.
Definition: richards_lmh.hh:85
RichardsLMH(Mesh &mesh, const Input::Record in_rec)
VectorMPI water_content_previous_it
Definition: richards_lmh.hh:67
void assembly_source_term() override
Source term is implemented differently in LMH version.
Mixed-hybrid of steady Darcy flow with sources and variable density.