Flow123d
JB_transport-112d700
|
Go to the documentation of this file.
18 #ifndef ASSEMBLY_RICHARDS_HH_
19 #define ASSEMBLY_RICHARDS_HH_
28 template <
unsigned int dim>
35 static constexpr
const char *
name() {
return "InitCondPostprocessAssembly"; }
61 ASSERT_EQ(cell.
dim(), dim).error(
"Dimension of element mismatch!");
67 auto p = *( this->
bulk_points(element_patch_idx).begin() );
74 for (
unsigned int i=0; i<cell.
elm()->n_sides(); i++) {
81 fadbad::B<double> x_phead(
phead);
139 template <
template<
IntDim...>
class DimAssembly>
144 template <
unsigned int dim>
151 static constexpr
const char *
name() {
return "MHMatrixAssemblyRichards"; }
189 ASSERT_EQ(cell.
dim(), dim).error(
"Dimension of element mismatch!");
192 auto p = *( this->
bulk_points(element_patch_idx).begin() );
204 ASSERT_EQ(cell_side.
dim(), dim).error(
"Dimension of element mismatch!");
251 for (
unsigned int i=0; i<ele->
n_sides(); i++)
295 bool genuchten_on = (this->eq_fields_->genuchten_p_head_scale.field_result({cell.
elm().region()}) !=
result_zeros);
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);
305 this->eq_data_->soil_model_->reset(soil_data);
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();
320 for (
unsigned int i=0; i<cell.
elm()->n_sides(); i++) {
323 phead = this->eq_data_->p_edge_solution.
get( edge_indices_[i] );
326 fadbad::B<double> x_phead(phead);
327 fadbad::B<double> evaluated( this->eq_data_->soil_model_->water_content_diff(x_phead) );
329 water_content = evaluated.val();
330 capacity = x_phead.d(0);
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);
340 bool genuchten_on = reset_soil_model(cell, p);
342 double conductivity = 0;
347 for (
unsigned int i=0; i<cell.
elm()->n_sides(); i++)
349 double phead = eq_data_->p_edge_solution.get( loc_dof_vec[i] );
350 conductivity += eq_data_->soil_model_->conductivity(phead);
355 conductivity = eq_fields_->conductivity(p);
364 this->postprocess_velocity(dh_cell, p);
366 this->update_water_content(dh_cell, p);
368 VectorMPI water_content_vec = eq_fields_->water_content_ptr->vec();
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] );
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_;
379 eq_fields_->conductivity_ptr->vec().set( p_dof, compute_conductivity(dh_cell, p) );
395 template <
template<
IntDim...>
class DimAssembly>
400 template <
unsigned int dim>
407 static constexpr
const char *
name() {
return "ReconstructSchurAssemblyRichards"; }
416 ASSERT_EQ(cell.
dim(), dim).error(
"Dimension of element mismatch!");
419 auto p = *( this->
bulk_points(element_patch_idx).begin() );
450 template <
template<
IntDim...>
class DimAssembly>
void precompute_boundary_side(DHCellSide &cell_side, BoundaryPoint &p_side, BulkPoint &p_bdr)
Precompute values used in boundary side integral on given DHCellSide.
arma::Col< IntIdx > LocDofVec
EqFields * eq_fields_
Data objects shared with ConvectionTransport.
BCField< 3, FieldValue< 3 >::Scalar > bc_flux
FieldSet used_fields_
Sub field set contains fields used in calculation.
Field< 3, FieldValue< 3 >::Scalar > conductivity
void boundary_side_integral_in(DHCellSide cell_side, const ElementAccessor< 3 > &b_ele, BulkPoint &p_bdr)
Field< 3, FieldValue< 3 >::Scalar > genuchten_p_head_scale
void begin() override
Implements AssemblyBase::begin.
Side side() const
Return Side of given cell and side_idx.
std::shared_ptr< DOFHandlerMultiDim > dh_
full DOF handler represents DOFs of sides, elements and edges
double water_content_diff_
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Integral over element.
RichardsLMH::EqData EqData
VectorMPI p_edge_solution
LocDofVec cr_disc_dofs_
Vector of local DOF indices pre-computed on different DOF handlers.
LocDofVec edge_indices_
Dofs of discontinuous fields on element edges.
double compute_conductivity(const DHCellAccessor &cell, BulkPoint &p)
Precompute conductivity on bulk point.
void boundary_side_integral(DHCellSide cell_side)
Assembles between boundary element and corresponding side on bulk element.
Directing class of FieldValueCache.
bool is_own() const
Return true if accessor represents own element (false for ghost element)
Field< 3, FieldValue< 3 >::Tensor > anisotropy
Base point accessor class.
std::array< unsigned int, 3 > schur_offset_
Index offset in the local system for the Schur complement (of dim = 1,2,3).
std::shared_ptr< SoilModelBase > soil_model_
DarcyLMH::EqFields::BC_Type type_
Type of boundary condition.
Field< 3, FieldValue< 3 >::Scalar > water_content_residual
Field< 3, FieldValue< 3 >::Scalar > genuchten_n_exponent
unsigned int dim() const
Return dimension of element appropriate to cell.
unsigned int dim() const
Return dimension of element appropriate to the side.
FieldSet used_fields_
Sub field set contains fields used in calculation.
void end_mh_matrix()
Common code of end method of MH matrix assembly (Darcy and Richards)
void begin_reconstruct_schur()
Common code of begin method of Reconstruct Schur assembly (Darcy and Richards)
Field< 3, FieldValue< 3 >::Scalar > cross_section
EqFields * eq_fields_
Data objects shared with ConvectionTransport.
BCField< 3, FieldValue< 3 >::Scalar > bc_switch_pressure
VectorMPI water_content_previous_time
LocDofVec cr_disc_dofs_
Vector of local DOF indices pre-computed on different DOF handlers.
void set(unsigned int pos, double val)
Set value on given position.
Side accessor allows to iterate over sides of DOF handler cell.
InitCondPostprocessAssembly(EqFields *eq_fields, EqData *eq_data)
Constructor.
BCField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
ReconstructSchurAssemblyRichards(EqFields *eq_fields, EqData *eq_data)
bool reset_soil_model(const DHCellAccessor &cell, BulkPoint &p)
static constexpr const char * name()
void update_water_content(const DHCellAccessor &cell, BulkPoint &p)
std::array< std::vector< unsigned int >, 3 > loc_edge_dofs
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...
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
std::vector< arma::vec > postprocess_solution_
unsigned int local_idx() const
Return local index to element (index of DOF handler).
std::vector< LocalSystem > loc_system_
Following data members are stored in vectors, one item for every cell.
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
FieldResult field_result(RegionSet region_set) const override
Indicates special field states.
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
void end() override
Implements AssemblyBase::end.
void begin() override
Implements AssemblyBase::begin.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
BCField< 3, FieldValue< 3 >::Scalar > bc_pressure
std::shared_ptr< DOFHandlerMultiDim > dh_cr_disc_
DOF handler represents DOFs of sides.
void asm_element()
Part of cell_integral method, common in all descendants.
Container for various descendants of FieldCommonBase.
ElementAccessor< 3 > element_accessor()
RichardsLMH::EqFields EqFields
Field< 3, FieldValue< 3 >::Scalar > extra_source
Externally added storativity.
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Range< BulkPoint > bulk_points(unsigned int element_patch_idx) const
Return BulkPoint range of appropriate dimension.
void end() override
Implements AssemblyBase::end.
Field< 3, FieldValue< 3 >::Scalar > sigma
void end() override
Implements AssemblyBase::end.
RichardsLMH::EqFields EqFields
MHMatrixAssemblyRichards(EqFields *eq_fields, EqData *eq_data)
unsigned int n_sides() const
Cell accessor allow iterate over DOF handler cells.
RichardsLMH::EqData EqData
void begin_mh_matrix()
Common code of begin method of MH matrix assembly (Darcy and Richards)
std::shared_ptr< SubDOFHandlerMultiDim > dh_cr_
DOF handler represents DOFs of edges.
int active_integrals_
Holds mask of active integrals.
static constexpr const char * name()
bool reset_soil_model(const DHCellAccessor &cell, BulkPoint &p)
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > water_content_ptr
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.
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Integral over element.
unsigned int bulk_local_idx_
Local idx of bulk element.
static constexpr const char * name()
Field< 3, FieldValue< 3 >::Scalar > water_source_density
void asm_source_term_richards(const DHCellAccessor &cell, BulkPoint &p)
Part of cell_integral method, specialized in Richards equation.
double get(unsigned int pos) const
Return value on given position.
double water_content_previous_time
void begin() override
Implements AssemblyBase::begin.
~MHMatrixAssemblyRichards()
Destructor.
~InitCondPostprocessAssembly()
Destructor.
std::shared_ptr< Balance > balance_
Shared Balance object.
RichardsLMH::EqFields EqFields
LocDofVec edge_indices_
Dofs of discontinuous fields on element edges.
void dimjoin_intergral(FMT_UNUSED DHCellAccessor cell_lower_dim, FMT_UNUSED DHCellSide neighb_side)
Assembles the fluxes between elements of different dimensions.
Field< 3, FieldValue< 3 >::Scalar > storativity
BCField< 3, FieldValue< 3 >::Enum > bc_type
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
RichardsLMH::EqData EqData
Field< 3, FieldValue< 3 >::Scalar > extra_storativity
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
void end_reconstruct_schur()
Common code of end method of Reconstruct Schur assembly (Darcy and Richards)
Generic class of assemblation.
Range< BoundaryPoint > boundary_points(const DHCellSide &cell_side) const
Return BoundaryPoint range of appropriate dimension.
void boundary_side_integral(FMT_UNUSED DHCellSide cell_side)
Assembles between boundary element and corresponding side on bulk element.
ElementCacheMap * element_cache_map_
ElementCacheMap shared with GenericAssembly object.
Field< 3, FieldValue< 3 >::Scalar > water_content_saturated
double measure() const
Computes the measure of the element.
void postprocess_velocity_richards(const DHCellAccessor &dh_cell, BulkPoint &p, arma::vec &solution)
Postprocess velocity after calculating of cell integral.
void asm_sides(const DHCellAccessor &cell, BulkPoint &p, double conductivity)
Part of cell_integral method, common in all descendants.
unsigned int IntDim
A dimension index type.