Flow123d  3.9.0-094ba6f5a
assembly_richards.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 assembly_richards.hh
15  * @brief
16  */
17 
18 #ifndef ASSEMBLY_RICHARDS_HH_
19 #define ASSEMBLY_RICHARDS_HH_
20 
23 #include "flow/assembly_lmh.hh"
24 #include "flow/soil_models.hh"
26 
27 
28 template <unsigned int dim>
30 {
31 public:
32  typedef typename RichardsLMH::EqFields EqFields;
33  typedef typename RichardsLMH::EqData EqData;
34 
35  static constexpr const char * name() { return "InitCondPostprocessAssembly"; }
36 
37  /// Constructor.
39  : AssemblyBase<dim>(0), eq_fields_(eq_fields), eq_data_(eq_data) {
41  this->used_fields_ += this->eq_fields_->storativity;
47  this->used_fields_ += this->eq_fields_->conductivity;
48  this->used_fields_ += this->eq_fields_->cross_section;
49  }
50 
51  /// Destructor.
53 
54  /// Initialize auxiliary vectors and other data members
55  void initialize(ElementCacheMap *element_cache_map) {
56  //this->balance_ = eq_data_->balance_;
57  this->element_cache_map_ = element_cache_map;
58  }
59 
60  inline void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx) {
61  ASSERT_EQ(cell.dim(), dim).error("Dimension of element mismatch!");
62 
65  const DHCellAccessor dh_cell = cell.cell_with_other_dh(this->eq_data_->dh_.get());
66 
67  auto p = *( this->bulk_points(element_patch_idx).begin() );
68  bool genuchten_on = reset_soil_model(cell, p);
70  + this->eq_fields_->extra_storativity(p);
71  VectorMPI water_content_vec = this->eq_fields_->water_content_ptr->vec();
72  double diagonal_coef = cell.elm().measure() * eq_fields_->cross_section(p) / cell.elm()->n_sides();
73 
74  for (unsigned int i=0; i<cell.elm()->n_sides(); i++) {
75  const int local_side = cr_disc_dofs_[i];
76  capacity = 0;
77  water_content = 0;
79 
80  if (genuchten_on) {
81  fadbad::B<double> x_phead(phead);
82  fadbad::B<double> evaluated( this->eq_data_->soil_model_->water_content_diff(x_phead) );
83  evaluated.diff(0,1);
84  water_content = evaluated.val();
85  capacity = x_phead.d(0);
86  }
88  water_content_vec.set( cr_disc_dofs_[i], water_content + storativity_ * phead);
89 
90  this->eq_data_->balance_->add_mass_values(eq_data_->water_balance_idx, dh_cell, {local_side},
91  {0.0}, diagonal_coef*(water_content + storativity_ * phead) );
92  }
93  }
94 
95  /// Implements @p AssemblyBase::begin.
96  void begin() override
97  {
98  this->eq_data_->balance_->start_mass_assembly(this->eq_data_->water_balance_idx);
99  }
100 
101 
102  /// Implements @p AssemblyBase::end.
103  void end() override
104  {
105  this->eq_data_->balance_->finish_mass_assembly(this->eq_data_->water_balance_idx);
106  }
107 
108 
109 private:
110  bool reset_soil_model(const DHCellAccessor& cell, BulkPoint &p) {
111  bool genuchten_on = (this->eq_fields_->genuchten_p_head_scale.field_result({cell.elm().region()}) != result_zeros);
112  if (genuchten_on) {
113  SoilData soil_data;
114  soil_data.n = this->eq_fields_->genuchten_n_exponent(p);
115  soil_data.alpha = this->eq_fields_->genuchten_p_head_scale(p);
116  soil_data.Qr = this->eq_fields_->water_content_residual(p);
117  soil_data.Qs = this->eq_fields_->water_content_saturated(p);
118  soil_data.Ks = this->eq_fields_->conductivity(p);
119  //soil_data.cut_fraction = 0.99; // set by model
120 
121  this->eq_data_->soil_model_->reset(soil_data);
122  }
123  return genuchten_on;
124  }
125 
126 
127  /// Sub field set contains fields used in calculation.
129 
130  /// Data objects shared with ConvectionTransport
133 
134  LocDofVec cr_disc_dofs_; ///< Vector of local DOF indices pre-computed on different DOF handlers
135  LocDofVec edge_indices_; ///< Dofs of discontinuous fields on element edges.
136  double storativity_;
138 
139  template < template<IntDim...> class DimAssembly>
140  friend class GenericAssembly;
141 };
142 
143 
144 template <unsigned int dim>
146 {
147 public:
148  typedef typename RichardsLMH::EqFields EqFields;
149  typedef typename RichardsLMH::EqData EqData;
150 
151  static constexpr const char * name() { return "MHMatrixAssemblyRichards"; }
152 
154  : MHMatrixAssemblyLMH<dim>(eq_fields, eq_data), eq_fields_(eq_fields), eq_data_(eq_data) {
159  this->used_fields_ += eq_fields_->sigma;
168  this->used_fields_ += eq_fields_->bc_type;
170  this->used_fields_ += eq_fields_->bc_flux;
174  }
175 
176  /// Destructor.
178 
179  /// Initialize auxiliary vectors and other data members
180  void initialize(ElementCacheMap *element_cache_map) {
181  //this->balance_ = eq_data_->balance_;
182  MHMatrixAssemblyLMH<dim>::initialize(element_cache_map);
183  }
184 
185 
186  /// Integral over element.
187  inline void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
188  {
189  ASSERT_EQ(cell.dim(), dim).error("Dimension of element mismatch!");
190 
191  // evaluation point
192  auto p = *( this->bulk_points(element_patch_idx).begin() );
193  this->bulk_local_idx_ = cell.local_idx();
194 
195  this->asm_sides(cell, p, this->compute_conductivity(cell, p));
196  this->asm_element();
197  this->asm_source_term_richards(cell, p);
198  }
199 
200 
201  /// Assembles between boundary element and corresponding side on bulk element.
202  inline void boundary_side_integral(DHCellSide cell_side)
203  {
204  ASSERT_EQ(cell_side.dim(), dim).error("Dimension of element mismatch!");
205  if (!cell_side.cell().is_own()) return;
206 
207  auto p_side = *( this->boundary_points(cell_side).begin() );
208  auto p_bdr = p_side.point_bdr(cell_side.cond().element_accessor() );
209  ElementAccessor<3> b_ele = cell_side.side().cond().element_accessor(); // ??
210 
211  this->precompute_boundary_side(cell_side, p_side, p_bdr);
212 
213  if (this->type_==DarcyMH::EqFields::seepage) {
214  this->use_dirichlet_switch(cell_side, b_ele, p_bdr);
215  }
216 
217  this->boundary_side_integral_in(cell_side, b_ele, p_bdr);
218  }
219 
220 
221  /// Implements @p AssemblyBase::begin.
222  void begin() override
223  {
224  this->begin_mh_matrix();
225  }
226 
227 
228  /// Implements @p AssemblyBase::end.
229  void end() override
230  {
231  this->end_mh_matrix();
232  }
233 
234 
235 protected:
236  /// Part of cell_integral method, specialized in Richards equation
237  inline void asm_source_term_richards(const DHCellAccessor& cell, BulkPoint &p)
238  {
239  update_water_content(cell, p);
240  const ElementAccessor<3> ele = cell.elm();
241 
242  // set lumped source
243  diagonal_coef_ = ele.measure() * eq_fields_->cross_section(p) / ele->n_sides();
245 
246  VectorMPI water_content_vec = eq_fields_->water_content_ptr->vec();
247 
248  const DHCellAccessor cr_cell = cell.cell_with_other_dh(eq_data_->dh_cr_.get());
249  auto loc_dof_vec = cr_cell.get_loc_dof_indices();
250 
251  for (unsigned int i=0; i<ele->n_sides(); i++)
252  {
253 
254  const int local_side = cr_disc_dofs_[i];
255  /*if (this->dirichlet_edge[i] == 0)*/ { //TODO Fix condition evaluating dirichlet_edge
256 
257  water_content_diff_ = -water_content_vec.get(local_side) + eq_data_->water_content_previous_time.get(local_side);
259 
260  /*
261  DebugOut().fmt("w diff: {:g} mass: {:g} w prev: {:g} w time: {:g} c: {:g} p: {:g} z: {:g}",
262  water_content_diff,
263  mass_diagonal * eq_data_->p_edge_solution[local_edge],
264  -eq_data_->water_content_previous_it[local_side],
265  eq_data_->water_content_previous_time[local_side],
266  capacity,
267  eq_data_->p_edge_solution[local_edge],
268  ele.centre()[0] );
269  */
270 
271 
274 
275  /*
276  DBGCOUT(<< "source [" << loc_system_.row_dofs[this->loc_edge_dofs[i]] << ", " << loc_system_.row_dofs[this->loc_edge_dofs[i]]
277  << "] mat: " << -mass_diagonal/this->eq_data_->time_step_
278  << " rhs: " << -source_diagonal_ - mass_rhs
279  << "\n");
280  */
281  eq_data_->loc_system_[cell.local_idx()].add_value(eq_data_->loc_edge_dofs[dim-1][i], eq_data_->loc_edge_dofs[dim-1][i],
284  }
285 
286  eq_data_->balance->add_mass_values(eq_data_->water_balance_idx, cell, {local_side},
287  {0.0}, diagonal_coef_*water_content_vec.get(local_side));
288  eq_data_->balance->add_source_values(eq_data_->water_balance_idx, ele.region().bulk_idx(),
289  {this->eq_data_->loc_system_[cell.local_idx()].row_dofs[eq_data_->loc_edge_dofs[dim-1][i]]},
290  {0},{source_diagonal_});
291  }
292  }
293 
294  bool reset_soil_model(const DHCellAccessor& cell, BulkPoint &p) {
295  bool genuchten_on = (this->eq_fields_->genuchten_p_head_scale.field_result({cell.elm().region()}) != result_zeros);
296  if (genuchten_on) {
297  SoilData soil_data;
298  soil_data.n = this->eq_fields_->genuchten_n_exponent(p);
299  soil_data.alpha = this->eq_fields_->genuchten_p_head_scale(p);
300  soil_data.Qr = this->eq_fields_->water_content_residual(p);
301  soil_data.Qs = this->eq_fields_->water_content_saturated(p);
302  soil_data.Ks = this->eq_fields_->conductivity(p);
303  //soil_data.cut_fraction = 0.99; // set by model
304 
305  this->eq_data_->soil_model_->reset(soil_data);
306  }
307  return genuchten_on;
308  }
309 
310 
312  edge_indices_ = cell.cell_with_other_dh(this->eq_data_->dh_cr_.get()).get_loc_dof_indices();
313  cr_disc_dofs_ = cell.cell_with_other_dh(this->eq_data_->dh_cr_disc_.get()).get_loc_dof_indices();
314 
315  bool genuchten_on = reset_soil_model(cell, p);
316  storativity_ = this->eq_fields_->storativity(p)
317  + this->eq_fields_->extra_storativity(p);
318  VectorMPI water_content_vec = this->eq_fields_->water_content_ptr->vec();
319 
320  for (unsigned int i=0; i<cell.elm()->n_sides(); i++) {
321  capacity = 0;
322  water_content = 0;
323  phead = this->eq_data_->p_edge_solution.get( edge_indices_[i] );
324 
325  if (genuchten_on) {
326  fadbad::B<double> x_phead(phead);
327  fadbad::B<double> evaluated( this->eq_data_->soil_model_->water_content_diff(x_phead) );
328  evaluated.diff(0,1);
329  water_content = evaluated.val();
330  capacity = x_phead.d(0);
331  }
332  this->eq_data_->capacity.set( cr_disc_dofs_[i], capacity + storativity_ );
333  water_content_vec.set( cr_disc_dofs_[i], water_content + storativity_ * phead);
334  }
335  }
336 
337  /// Precompute conductivity on bulk point.
339  {
340  bool genuchten_on = reset_soil_model(cell, p);
341 
342  double conductivity = 0;
343  if (genuchten_on) {
344  const DHCellAccessor cr_cell = cell.cell_with_other_dh(eq_data_->dh_cr_.get());
345  auto loc_dof_vec = cr_cell.get_loc_dof_indices();
346 
347  for (unsigned int i=0; i<cell.elm()->n_sides(); i++)
348  {
349  double phead = eq_data_->p_edge_solution.get( loc_dof_vec[i] );
350  conductivity += eq_data_->soil_model_->conductivity(phead);
351  }
352  conductivity /= cell.elm()->n_sides();
353  }
354  else {
355  conductivity = eq_fields_->conductivity(p);
356  }
357  return conductivity;
358  }
359 
360 
361  /// Postprocess velocity after calculating of cell integral.
363  {
364  this->postprocess_velocity(dh_cell, p);
365 
366  this->update_water_content(dh_cell, p);
367 
368  VectorMPI water_content_vec = eq_fields_->water_content_ptr->vec();
369 
370  for (unsigned int i=0; i<dh_cell.elm()->n_sides(); i++) {
371  water_content = water_content_vec.get( this->cr_disc_dofs_[i] );
372  water_content_previous_time = eq_data_->water_content_previous_time.get( this->cr_disc_dofs_[i] );
373 
374  solution[eq_data_->loc_side_dofs[dim-1][i]]
375  += this->edge_source_term_ - this->edge_scale_ * (water_content - water_content_previous_time) / eq_data_->time_step_;
376  }
377 
378  IntIdx p_dof = dh_cell.cell_with_other_dh(eq_data_->dh_p_.get()).get_loc_dof_indices()(0);
379  eq_fields_->conductivity_ptr->vec().set( p_dof, compute_conductivity(dh_cell, p) );
380  }
381 
382 
383  /// Data objects shared with ConvectionTransport
386 
387  LocDofVec cr_disc_dofs_; ///< Vector of local DOF indices pre-computed on different DOF handlers
388  LocDofVec edge_indices_; ///< Dofs of discontinuous fields on element edges.
389  double storativity_;
390  double capacity, phead;
391  double water_content, water_content_previous_time;
392  double diagonal_coef_, source_diagonal_;
393  double water_content_diff_, mass_diagonal_, mass_rhs_;
394 
395  template < template<IntDim...> class DimAssembly>
396  friend class GenericAssembly;
397 };
398 
399 
400 template <unsigned int dim>
402 {
403 public:
404  typedef typename RichardsLMH::EqFields EqFields;
405  typedef typename RichardsLMH::EqData EqData;
406 
407  static constexpr const char * name() { return "ReconstructSchurAssemblyRichards"; }
408 
410  : MHMatrixAssemblyRichards<dim>(eq_fields, eq_data) {
411  }
412 
413  /// Integral over element.
414  inline void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
415  {
416  ASSERT_EQ(cell.dim(), dim).error("Dimension of element mismatch!");
417 
418  // evaluation point
419  auto p = *( this->bulk_points(element_patch_idx).begin() );
420  this->bulk_local_idx_ = cell.local_idx();
421 
422  { // postprocess the velocity
423  this->eq_data_->postprocess_solution_[this->bulk_local_idx_].zeros(this->eq_data_->schur_offset_[dim-1]);
424  this->postprocess_velocity_richards(cell, p, this->eq_data_->postprocess_solution_[this->bulk_local_idx_]);
425  }
426  }
427 
428 
429  /// Assembles between boundary element and corresponding side on bulk element.
431  {}
432 
433  inline void dimjoin_intergral(FMT_UNUSED DHCellAccessor cell_lower_dim, FMT_UNUSED DHCellSide neighb_side)
434  {}
435 
436 
437  /// Implements @p AssemblyBase::begin.
438  void begin() override
439  {
440  this->begin_reconstruct_schur();
441  }
442 
443 
444  /// Implements @p AssemblyBase::end.
445  void end() override
446  {
447  this->end_reconstruct_schur();
448  }
449 protected:
450  template < template<IntDim...> class DimAssembly>
451  friend class GenericAssembly;
452 };
453 
454 
455 
456 #endif /* ASSEMBLY_RICHARDS_HH_ */
457 
DarcyMH::EqFields::bc_pressure
BCField< 3, FieldValue< 3 >::Scalar > bc_pressure
Definition: darcy_flow_mh.hh:176
MHMatrixAssemblyLMH::precompute_boundary_side
void precompute_boundary_side(DHCellSide &cell_side, BoundaryPoint &p_side, BulkPoint &p_bdr)
Precompute values used in boundary side integral on given DHCellSide.
Definition: assembly_lmh.hh:475
LocDofVec
arma::Col< IntIdx > LocDofVec
Definition: index_types.hh:28
MHMatrixAssemblyRichards::eq_fields_
EqFields * eq_fields_
Data objects shared with ConvectionTransport.
Definition: assembly_richards.hh:384
InitCondPostprocessAssembly::water_content
double water_content
Definition: assembly_richards.hh:137
result_zeros
@ result_zeros
Definition: field_algo_base.hh:74
InitCondPostprocessAssembly::used_fields_
FieldSet used_fields_
Sub field set contains fields used in calculation.
Definition: assembly_richards.hh:128
MHMatrixAssemblyLMH::boundary_side_integral_in
void boundary_side_integral_in(DHCellSide cell_side, const ElementAccessor< 3 > &b_ele, BulkPoint &p_bdr)
Definition: assembly_lmh.hh:530
RichardsLMH::EqFields::genuchten_p_head_scale
Field< 3, FieldValue< 3 >::Scalar > genuchten_p_head_scale
Definition: richards_lmh.hh:77
DarcyMH::EqFields::sigma
Field< 3, FieldValue< 3 >::Scalar > sigma
Definition: darcy_flow_mh.hh:173
Armor::vec
ArmaVec< double, N > vec
Definition: armor.hh:885
InitCondPostprocessAssembly::begin
void begin() override
Implements AssemblyBase::begin.
Definition: assembly_richards.hh:96
DHCellSide::side
Side side() const
Return Side of given cell and side_idx.
Definition: dh_cell_accessor.hh:198
MHMatrixAssemblyRichards::water_content_diff_
double water_content_diff_
Definition: assembly_richards.hh:393
MHMatrixAssemblyRichards::storativity_
double storativity_
Definition: assembly_richards.hh:389
MHMatrixAssemblyRichards::cell_integral
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Integral over element.
Definition: assembly_richards.hh:187
DarcyLMH::EqData
Definition: darcy_flow_lmh.hh:158
InitCondPostprocessAssembly::EqData
RichardsLMH::EqData EqData
Definition: assembly_richards.hh:33
DarcyLMH::EqData::p_edge_solution
VectorMPI p_edge_solution
Definition: darcy_flow_lmh.hh:176
MHMatrixAssemblyRichards::cr_disc_dofs_
LocDofVec cr_disc_dofs_
Vector of local DOF indices pre-computed on different DOF handlers.
Definition: assembly_richards.hh:387
DarcyMH::EqFields::bc_robin_sigma
BCField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Definition: darcy_flow_mh.hh:178
MHMatrixAssemblyRichards::edge_indices_
LocDofVec edge_indices_
Dofs of discontinuous fields on element edges.
Definition: assembly_richards.hh:388
ReconstructSchurAssemblyRichards
Definition: assembly_richards.hh:401
MHMatrixAssemblyRichards::compute_conductivity
double compute_conductivity(const DHCellAccessor &cell, BulkPoint &p)
Precompute conductivity on bulk point.
Definition: assembly_richards.hh:338
DHCellSide::cond
Boundary cond() const
Definition: dh_cell_accessor.hh:231
InitCondPostprocessAssembly
Definition: assembly_richards.hh:29
assembly_lmh.hh
DarcyMH::EqFields::bc_flux
BCField< 3, FieldValue< 3 >::Scalar > bc_flux
Definition: darcy_flow_mh.hh:177
MHMatrixAssemblyRichards::boundary_side_integral
void boundary_side_integral(DHCellSide cell_side)
Assembles between boundary element and corresponding side on bulk element.
Definition: assembly_richards.hh:202
ElementCacheMap
Directing class of FieldValueCache.
Definition: field_value_cache.hh:151
SoilData::n
double n
Definition: soil_models.hh:40
IntIdx
int IntIdx
Definition: index_types.hh:25
DarcyMH::EqData::dh_cr_
std::shared_ptr< SubDOFHandlerMultiDim > dh_cr_
DOF handler represents DOFs of edges.
Definition: darcy_flow_mh.hh:219
MHMatrixAssemblyRichards::diagonal_coef_
double diagonal_coef_
Definition: assembly_richards.hh:392
DarcyMH::EqFields::extra_source
Field< 3, FieldValue< 3 >::Scalar > extra_source
Externally added storativity.
Definition: darcy_flow_mh.hh:184
DHCellAccessor::is_own
bool is_own() const
Return true if accessor represents own element (false for ghost element)
Definition: dh_cell_accessor.hh:130
BulkPoint
Base point accessor class.
Definition: eval_subset.hh:55
SoilData::Qr
double Qr
Definition: soil_models.hh:42
DarcyLMH::EqData::schur_offset_
std::array< unsigned int, 3 > schur_offset_
Index offset in the local system for the Schur complement (of dim = 1,2,3).
Definition: darcy_flow_lmh.hh:205
RichardsLMH::EqData::soil_model_
std::shared_ptr< SoilModelBase > soil_model_
Definition: richards_lmh.hh:98
ElementAccessor< 3 >
RichardsLMH::EqFields::water_content_residual
Field< 3, FieldValue< 3 >::Scalar > water_content_residual
Definition: richards_lmh.hh:76
RichardsLMH::EqFields::genuchten_n_exponent
Field< 3, FieldValue< 3 >::Scalar > genuchten_n_exponent
Definition: richards_lmh.hh:78
DHCellAccessor::dim
unsigned int dim() const
Return dimension of element appropriate to cell.
Definition: dh_cell_accessor.hh:101
DarcyLMH::EqFields
Definition: darcy_flow_lmh.hh:151
DHCellSide::dim
unsigned int dim() const
Return dimension of element appropriate to the side.
Definition: dh_cell_accessor.hh:214
MHMatrixAssemblyLMH::used_fields_
FieldSet used_fields_
Sub field set contains fields used in calculation.
Definition: assembly_lmh.hh:759
Side::cond
Boundary cond() const
Definition: accessors_impl.hh:231
MHMatrixAssemblyLMH::end_mh_matrix
void end_mh_matrix()
Common code of end method of MH matrix assembly (Darcy and Richards)
Definition: assembly_lmh.hh:292
assembly_base.hh
MHMatrixAssemblyLMH::begin_reconstruct_schur
void begin_reconstruct_schur()
Common code of begin method of Reconstruct Schur assembly (Darcy and Richards)
Definition: assembly_lmh.hh:327
DarcyMH::EqData::dh_
std::shared_ptr< DOFHandlerMultiDim > dh_
full DOF handler represents DOFs of sides, elements and edges
Definition: darcy_flow_mh.hh:218
InitCondPostprocessAssembly::eq_fields_
EqFields * eq_fields_
Data objects shared with ConvectionTransport.
Definition: assembly_richards.hh:131
RichardsLMH::EqData::water_content_previous_time
VectorMPI water_content_previous_time
Definition: richards_lmh.hh:95
InitCondPostprocessAssembly::phead
double phead
Definition: assembly_richards.hh:137
InitCondPostprocessAssembly::cr_disc_dofs_
LocDofVec cr_disc_dofs_
Vector of local DOF indices pre-computed on different DOF handlers.
Definition: assembly_richards.hh:134
RichardsLMH::EqData
Definition: richards_lmh.hh:89
VectorMPI::set
void set(unsigned int pos, double val)
Set value on given position.
Definition: vector_mpi.hh:111
DHCellSide
Side accessor allows to iterate over sides of DOF handler cell.
Definition: dh_cell_accessor.hh:176
InitCondPostprocessAssembly::InitCondPostprocessAssembly
InitCondPostprocessAssembly(EqFields *eq_fields, EqData *eq_data)
Constructor.
Definition: assembly_richards.hh:38
ReconstructSchurAssemblyRichards::ReconstructSchurAssemblyRichards
ReconstructSchurAssemblyRichards(EqFields *eq_fields, EqData *eq_data)
Definition: assembly_richards.hh:409
MHMatrixAssemblyRichards::reset_soil_model
bool reset_soil_model(const DHCellAccessor &cell, BulkPoint &p)
Definition: assembly_richards.hh:294
MHMatrixAssemblyLMH::type_
DarcyMH::EqFields::BC_Type type_
Type of boundary condition.
Definition: assembly_lmh.hh:781
DarcyMH::EqFields::cross_section
Field< 3, FieldValue< 3 >::Scalar > cross_section
Definition: darcy_flow_mh.hh:171
ReconstructSchurAssemblyRichards::name
static constexpr const char * name()
Definition: assembly_richards.hh:407
MHMatrixAssemblyRichards::update_water_content
void update_water_content(const DHCellAccessor &cell, BulkPoint &p)
Definition: assembly_richards.hh:311
DarcyLMH::EqData::loc_edge_dofs
std::array< std::vector< unsigned int >, 3 > loc_edge_dofs
Definition: darcy_flow_lmh.hh:198
DHCellAccessor::cell_with_other_dh
DHCellAccessor cell_with_other_dh(const DOFHandlerMultiDim *dh) const
Create new accessor with same local idx and given DOF handler. Actual and given DOF handler must be c...
Definition: dh_cell_accessor.hh:135
DarcyMH::EqFields::water_source_density
Field< 3, FieldValue< 3 >::Scalar > water_source_density
Definition: darcy_flow_mh.hh:172
DHCellSide::cell
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
Definition: dh_cell_accessor.hh:204
InitCondPostprocessAssembly::storativity_
double storativity_
Definition: assembly_richards.hh:136
DarcyMH::EqFields::conductivity
Field< 3, FieldValue< 3 >::Scalar > conductivity
Definition: darcy_flow_mh.hh:170
DarcyLMH::EqData::postprocess_solution_
std::vector< arma::vec > postprocess_solution_
Definition: darcy_flow_lmh.hh:196
generic_assembly.hh
DHCellAccessor::local_idx
unsigned int local_idx() const
Return local index to element (index of DOF handler).
Definition: dh_cell_accessor.hh:58
DarcyLMH::EqData::loc_system_
std::vector< LocalSystem > loc_system_
Following data members are stored in vectors, one item for every cell.
Definition: darcy_flow_lmh.hh:194
DarcyMH::EqFields::bc_switch_pressure
BCField< 3, FieldValue< 3 >::Scalar > bc_switch_pressure
Definition: darcy_flow_mh.hh:179
InitCondPostprocessAssembly::initialize
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
Definition: assembly_richards.hh:55
Field::field_result
FieldResult field_result(RegionSet region_set) const override
Indicates special field states.
Definition: field.impl.hh:420
DHCellAccessor::elm
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
Definition: dh_cell_accessor.hh:71
MHMatrixAssemblyRichards::end
void end() override
Implements AssemblyBase::end.
Definition: assembly_richards.hh:229
ReconstructSchurAssemblyRichards::begin
void begin() override
Implements AssemblyBase::begin.
Definition: assembly_richards.hh:438
ASSERT_EQ
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:333
MHMatrixAssemblyLMH::asm_element
void asm_element()
Part of cell_integral method, common in all descendants.
Definition: assembly_lmh.hh:410
soil_models.hh
FieldSet
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:159
Boundary::element_accessor
ElementAccessor< 3 > element_accessor()
Definition: accessors_impl.hh:259
DarcyMH::EqFields::bc_type
BCField< 3, FieldValue< 3 >::Enum > bc_type
Definition: darcy_flow_mh.hh:175
coupling
@ coupling
Definition: generic_assembly.hh:35
ReconstructSchurAssemblyRichards::EqFields
RichardsLMH::EqFields EqFields
Definition: assembly_richards.hh:404
RichardsLMH::EqFields
Definition: richards_lmh.hh:71
DarcyLMH::EqData::time_step_
double time_step_
Definition: darcy_flow_lmh.hh:173
MHMatrixAssemblyRichards::initialize
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
Definition: assembly_richards.hh:180
MHMatrixAssemblyRichards::mass_diagonal_
double mass_diagonal_
Definition: assembly_richards.hh:393
InitCondPostprocessAssembly::cell_integral
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Definition: assembly_richards.hh:60
AssemblyBase::bulk_points
Range< BulkPoint > bulk_points(unsigned int element_patch_idx) const
Return BulkPoint range of appropriate dimension.
Definition: assembly_base.hh:104
ReconstructSchurAssemblyRichards::end
void end() override
Implements AssemblyBase::end.
Definition: assembly_richards.hh:445
InitCondPostprocessAssembly::end
void end() override
Implements AssemblyBase::end.
Definition: assembly_richards.hh:103
InitCondPostprocessAssembly::EqFields
RichardsLMH::EqFields EqFields
Definition: assembly_richards.hh:32
MHMatrixAssemblyRichards::MHMatrixAssemblyRichards
MHMatrixAssemblyRichards(EqFields *eq_fields, EqData *eq_data)
Definition: assembly_richards.hh:153
Element::n_sides
unsigned int n_sides() const
Definition: elements.h:131
bulk
@ bulk
Definition: generic_assembly.hh:33
DHCellAccessor
Cell accessor allow iterate over DOF handler cells.
Definition: dh_cell_accessor.hh:43
ReconstructSchurAssemblyRichards::EqData
RichardsLMH::EqData EqData
Definition: assembly_richards.hh:405
DarcyMH::EqData::dh_cr_disc_
std::shared_ptr< DOFHandlerMultiDim > dh_cr_disc_
DOF handler represents DOFs of sides.
Definition: darcy_flow_mh.hh:220
DarcyMH::EqData::water_balance_idx
uint water_balance_idx
Definition: darcy_flow_mh.hh:223
MHMatrixAssemblyLMH::begin_mh_matrix
void begin_mh_matrix()
Common code of begin method of MH matrix assembly (Darcy and Richards)
Definition: assembly_lmh.hh:275
MHMatrixAssemblyLMH
Definition: assembly_lmh.hh:116
ElementAccessor::region
Region region() const
Definition: accessors.hh:198
field_value_cache.hh
MHMatrixAssemblyRichards
Definition: assembly_richards.hh:145
AssemblyBase::active_integrals_
int active_integrals_
Holds mask of active integrals.
Definition: assembly_base.hh:191
MHMatrixAssemblyRichards::name
static constexpr const char * name()
Definition: assembly_richards.hh:151
SoilData::alpha
double alpha
Definition: soil_models.hh:41
DarcyMH::EqData::balance
std::shared_ptr< Balance > balance
Definition: darcy_flow_mh.hh:227
InitCondPostprocessAssembly::reset_soil_model
bool reset_soil_model(const DHCellAccessor &cell, BulkPoint &p)
Definition: assembly_richards.hh:110
SoilData::Ks
double Ks
Definition: soil_models.hh:45
RichardsLMH::EqFields::water_content_ptr
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > water_content_ptr
Definition: richards_lmh.hh:82
MHMatrixAssemblyLMH::use_dirichlet_switch
void use_dirichlet_switch(DHCellSide &cell_side, const ElementAccessor< 3 > &b_ele, BulkPoint &p_bdr)
Update BC switch dirichlet in MH matrix assembly if BC type is seepage.
Definition: assembly_lmh.hh:488
DHCellAccessor::get_loc_dof_indices
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
Definition: dh_cell_accessor.hh:88
ReconstructSchurAssemblyRichards::cell_integral
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Integral over element.
Definition: assembly_richards.hh:414
MHMatrixAssemblyLMH::bulk_local_idx_
unsigned int bulk_local_idx_
Local idx of bulk element.
Definition: assembly_lmh.hh:779
InitCondPostprocessAssembly::name
static constexpr const char * name()
Definition: assembly_richards.hh:35
DarcyMH::EqFields::seepage
@ seepage
Definition: darcy_flow_mh.hh:153
InitCondPostprocessAssembly::eq_data_
EqData * eq_data_
Definition: assembly_richards.hh:132
InitCondPostprocessAssembly::capacity
double capacity
Definition: assembly_richards.hh:137
MHMatrixAssemblyRichards::asm_source_term_richards
void asm_source_term_richards(const DHCellAccessor &cell, BulkPoint &p)
Part of cell_integral method, specialized in Richards equation.
Definition: assembly_richards.hh:237
SoilData
Definition: soil_models.hh:39
DarcyMH::EqFields::extra_storativity
Field< 3, FieldValue< 3 >::Scalar > extra_storativity
Definition: darcy_flow_mh.hh:183
AssemblyBase
Definition: assembly_base.hh:34
MHMatrixAssemblyRichards::phead
double phead
Definition: assembly_richards.hh:390
MHMatrixAssemblyRichards::source_diagonal_
double source_diagonal_
Definition: assembly_richards.hh:392
VectorMPI::get
double get(unsigned int pos) const
Return value on given position.
Definition: vector_mpi.hh:105
MHMatrixAssemblyRichards::water_content_previous_time
double water_content_previous_time
Definition: assembly_richards.hh:391
MHMatrixAssemblyRichards::begin
void begin() override
Implements AssemblyBase::begin.
Definition: assembly_richards.hh:222
MHMatrixAssemblyRichards::~MHMatrixAssemblyRichards
~MHMatrixAssemblyRichards()
Destructor.
Definition: assembly_richards.hh:177
DarcyMH::EqFields::storativity
Field< 3, FieldValue< 3 >::Scalar > storativity
Definition: darcy_flow_mh.hh:182
InitCondPostprocessAssembly::~InitCondPostprocessAssembly
~InitCondPostprocessAssembly()
Destructor.
Definition: assembly_richards.hh:52
MHMatrixAssemblyRichards::eq_data_
EqData * eq_data_
Definition: assembly_richards.hh:385
DarcyLMH::EqData::balance_
std::shared_ptr< Balance > balance_
Shared Balance object.
Definition: darcy_flow_lmh.hh:183
MHMatrixAssemblyRichards::EqFields
RichardsLMH::EqFields EqFields
Definition: assembly_richards.hh:148
VectorMPI
Definition: vector_mpi.hh:43
InitCondPostprocessAssembly::edge_indices_
LocDofVec edge_indices_
Dofs of discontinuous fields on element edges.
Definition: assembly_richards.hh:135
ReconstructSchurAssemblyRichards::dimjoin_intergral
void dimjoin_intergral(FMT_UNUSED DHCellAccessor cell_lower_dim, FMT_UNUSED DHCellSide neighb_side)
Assembles the fluxes between elements of different dimensions.
Definition: assembly_richards.hh:433
boundary
@ boundary
Definition: generic_assembly.hh:36
MHMatrixAssemblyRichards::mass_rhs_
double mass_rhs_
Definition: assembly_richards.hh:393
MHMatrixAssemblyLMH::initialize
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
Definition: assembly_lmh.hh:149
MHMatrixAssemblyRichards::EqData
RichardsLMH::EqData EqData
Definition: assembly_richards.hh:149
RegionIdx::bulk_idx
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
Definition: region.hh:90
DarcyMH::EqFields::anisotropy
Field< 3, FieldValue< 3 >::TensorFixed > anisotropy
Definition: darcy_flow_mh.hh:169
MHMatrixAssemblyLMH::end_reconstruct_schur
void end_reconstruct_schur()
Common code of end method of Reconstruct Schur assembly (Darcy and Richards)
Definition: assembly_lmh.hh:336
GenericAssembly
Generic class of assemblation.
Definition: generic_assembly.hh:160
RichardsLMH::EqData::capacity
VectorMPI capacity
Definition: richards_lmh.hh:96
AssemblyBase::boundary_points
Range< BoundaryPoint > boundary_points(const DHCellSide &cell_side) const
Return BoundaryPoint range of appropriate dimension.
Definition: assembly_base.hh:121
ReconstructSchurAssemblyRichards::boundary_side_integral
void boundary_side_integral(FMT_UNUSED DHCellSide cell_side)
Assembles between boundary element and corresponding side on bulk element.
Definition: assembly_richards.hh:430
AssemblyBase::element_cache_map_
ElementCacheMap * element_cache_map_
ElementCacheMap shared with GenericAssembly object.
Definition: assembly_base.hh:193
SoilData::Qs
double Qs
Definition: soil_models.hh:43
RichardsLMH::EqFields::water_content_saturated
Field< 3, FieldValue< 3 >::Scalar > water_content_saturated
Definition: richards_lmh.hh:75
ElementAccessor::measure
double measure() const
Computes the measure of the element.
Definition: accessors_impl.hh:59
FMT_UNUSED
#define FMT_UNUSED
Definition: posix.h:75
MHMatrixAssemblyRichards::postprocess_velocity_richards
void postprocess_velocity_richards(const DHCellAccessor &dh_cell, BulkPoint &p, arma::vec &solution)
Postprocess velocity after calculating of cell integral.
Definition: assembly_richards.hh:362
MHMatrixAssemblyLMH::asm_sides
void asm_sides(const DHCellAccessor &cell, BulkPoint &p, double conductivity)
Part of cell_integral method, common in all descendants.
Definition: assembly_lmh.hh:361
IntDim
unsigned int IntDim
A dimension index type.
Definition: mixed.hh:19