8 #ifndef SRC_FLOW_ASSEMBLY_LMH_HH_
9 #define SRC_FLOW_ASSEMBLY_LMH_HH_
69 soil_data.
n =
af_->genuchten_n_exponent.value(ele.
centre(), ele);
70 soil_data.
alpha =
af_->genuchten_p_head_scale.value(ele.
centre(), ele);
71 soil_data.
Qr =
af_->water_content_residual.value(ele.
centre(), ele);
72 soil_data.
Qs =
af_->water_content_saturated.value(ele.
centre(), ele);
73 soil_data.
Ks =
af_->conductivity.value(ele.
centre(), ele);
76 ad_->soil_model_->reset(soil_data);
82 double conductivity = 0;
84 for (
unsigned int i=0; i<ele->
n_sides(); i++)
86 double phead =
ad_->p_edge_solution.get( this->loc_schur_.row_dofs[i] );
87 conductivity +=
ad_->soil_model_->conductivity(phead);
92 conductivity = this->
af_->conductivity.value(ele.
centre(), ele);
105 double storativity =
af_->storativity.value(ele.
centre(), ele)
106 +
af_->extra_storativity.value(ele.
centre(), ele);
107 VectorMPI water_content_vec =
af_->water_content_ptr->vec();
109 for (
unsigned int i=0; i<ele->
n_sides(); i++) {
111 double water_content = 0;
115 fadbad::B<double> x_phead(phead);
116 fadbad::B<double> evaluated(
ad_->soil_model_->water_content_diff(x_phead) );
118 water_content = evaluated.val();
119 capacity = x_phead.d(0);
122 water_content_vec.
set(
cr_disc_dofs[i], water_content + storativity * phead);
148 double source_diagonal = diagonal_coef *
149 (
af_->water_source_density.value(ele.
centre(), ele)
150 +
af_->extra_source.value(ele.
centre(), ele));
152 VectorMPI water_content_vec =
af_->water_content_ptr->vec();
154 for (
unsigned int i=0; i<ele->
n_sides(); i++)
158 if (this->dirichlet_edge[i] == 0) {
160 double capacity =
ad_->capacity.get(local_side);
161 double water_content_diff = -water_content_vec.get(local_side) +
ad_->water_content_previous_time.get(local_side);
162 double mass_diagonal = diagonal_coef * capacity;
176 double mass_rhs = mass_diagonal *
ad_->p_edge_solution.get( this->loc_schur_.row_dofs[i] ) /
ad_->time_step_
177 + diagonal_coef * water_content_diff /
ad_->time_step_;
183 this->loc_system_.add_value(this->loc_edge_dofs[i], this->loc_edge_dofs[i],
184 -mass_diagonal/
ad_->time_step_,
185 -source_diagonal - mass_rhs);
188 ad_->balance->add_mass_values(
ad_->water_balance_idx, dh_cell, {local_side},
189 {0.0}, diagonal_coef*water_content_vec.get(local_side));
191 {this->loc_system_.row_dofs[this->loc_edge_dofs[i]]},
192 {0},{source_diagonal});
206 double edge_scale,
double edge_source_term)
override
208 update_water_content(dh_cell);
212 VectorMPI water_content_vec = af_->water_content_ptr->vec();
214 for (
unsigned int i=0; i<ele->
n_sides(); i++) {
216 double water_content = water_content_vec.
get( cr_disc_dofs[i] );
217 double water_content_previous_time = ad_->water_content_previous_time.get( cr_disc_dofs[i] );
219 solution[this->loc_side_dofs[i]]
220 += edge_source_term - edge_scale * (water_content - water_content_previous_time) / ad_->time_step_;
224 af_->conductivity_ptr->vec().set( p_dof, compute_conductivity(ele) );