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
206 update_water_content(dh_cell);
210 VectorMPI water_content_vec = ad_->water_content_ptr->vec();
212 for (
unsigned int i=0; i<ele->
n_sides(); i++) {
214 double water_content = water_content_vec.
get( cr_disc_dofs[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_;
222 ad_->conductivity_ptr->vec().set( p_dof, compute_conductivity(ele) );