8 #ifndef SRC_FLOW_ASSEMBLY_LMH_HH_ 9 #define SRC_FLOW_ASSEMBLY_LMH_HH_ 67 soil_data.
n =
ad_->genuchten_n_exponent.value(ele.
centre(), ele);
68 soil_data.
alpha =
ad_->genuchten_p_head_scale.value(ele.
centre(), ele);
69 soil_data.
Qr =
ad_->water_content_residual.value(ele.
centre(), ele);
70 soil_data.
Qs =
ad_->water_content_saturated.value(ele.
centre(), ele);
71 soil_data.
Ks =
ad_->conductivity.value(ele.
centre(), ele);
74 ad_->soil_model_->reset(soil_data);
80 double conductivity = 0;
82 for (
unsigned int i=0; i<ele->
n_sides(); i++)
84 double phead =
ad_->p_edge_solution.get( this->loc_schur_.row_dofs[i] );
85 conductivity +=
ad_->soil_model_->conductivity(phead);
90 conductivity = this->
ad_->conductivity.value(ele.
centre(), ele);
103 double storativity =
ad_->storativity.value(ele.
centre(), ele)
104 +
ad_->extra_storativity.value(ele.
centre(), ele);
105 VectorMPI water_content_vec =
ad_->water_content_ptr->vec();
107 for (
unsigned int i=0; i<ele->
n_sides(); i++) {
109 double water_content = 0;
113 fadbad::B<double> x_phead(phead);
114 fadbad::B<double> evaluated(
ad_->soil_model_->water_content_diff(x_phead) );
116 water_content = evaluated.val();
117 capacity = x_phead.d(0);
120 water_content_vec.
set(
cr_disc_dofs[i], water_content + storativity * phead);
146 double source_diagonal = diagonal_coef *
147 (
ad_->water_source_density.value(ele.
centre(), ele)
148 +
ad_->extra_source.value(ele.
centre(), ele));
150 VectorMPI water_content_vec =
ad_->water_content_ptr->vec();
152 for (
unsigned int i=0; i<ele->
n_sides(); i++)
156 if (this->dirichlet_edge[i] == 0) {
158 double capacity =
ad_->capacity.get(local_side);
159 double water_content_diff = -water_content_vec.
get(local_side) +
ad_->water_content_previous_time.get(local_side);
160 double mass_diagonal = diagonal_coef * capacity;
174 double mass_rhs = mass_diagonal *
ad_->p_edge_solution.get( this->loc_schur_.row_dofs[i] ) /
ad_->time_step_
175 + diagonal_coef * water_content_diff /
ad_->time_step_;
181 this->loc_system_.add_value(this->loc_edge_dofs[i], this->loc_edge_dofs[i],
182 -mass_diagonal/
ad_->time_step_,
183 -source_diagonal - mass_rhs);
186 ad_->balance->add_mass_values(
ad_->water_balance_idx, dh_cell, {local_side},
187 {0.0}, diagonal_coef*water_content_vec.
get(local_side));
189 {this->loc_system_.row_dofs[this->loc_edge_dofs[i]]},
190 {0},{source_diagonal});
204 double edge_scale,
double edge_source_term)
override 210 VectorMPI water_content_vec =
ad_->water_content_ptr->vec();
212 for (
unsigned int i=0; i<ele->
n_sides(); i++) {
215 double water_content_previous_time =
ad_->water_content_previous_time.get(
cr_disc_dofs[i] );
217 solution[this->loc_side_dofs[i]]
218 += edge_source_term - edge_scale * (water_content - water_content_previous_time) /
ad_->time_step_;
225 AssemblyDataPtrRichards
ad_;
arma::Col< IntIdx > LocDofVec
void assemble_sides(const DHCellAccessor &dh_cell) override
double compute_conductivity(ElementAccessor< 3 > ele)
void update_water_content(const DHCellAccessor &dh_cell)
Updates water content in Richards.
AssemblyRichards(AssemblyDataPtrRichards data)
Cell accessor allow iterate over DOF handler cells.
void postprocess_velocity_specific(const DHCellAccessor &dh_cell, arma::vec &solution, double edge_scale, double edge_source_term) override
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
void update_dofs(const DHCellAccessor &dh_cell)
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
unsigned int n_sides() const
AssemblyDataPtrRichards ad_
double measure() const
Computes the measure of the element.
void reset_soil_model(const DHCellAccessor &dh_cell)
LocDofVec cr_disc_dofs
Dofs of discontinuous fields on element edges.
void set(unsigned int pos, double val)
Set value on given position.
double get(unsigned int pos) const
Return value on given position.
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
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...
LocDofVec edge_indices_
Dofs of discontinuous fields on element edges.
void assemble_source_term(const DHCellAccessor &dh_cell) override
std::shared_ptr< RichardsLMH::EqData > AssemblyDataPtrRichards
void assemble_sides_scale(const DHCellAccessor &dh_cell, double scale)