20 #include "petscviewer.h" 21 #include "petscerror.h" 49 Saturated water content (($ \theta_s $)). 50 Relative volume of water in a reference volume of a saturated porous media. 56 Residual water content (($ \theta_r $)). 57 Relative volume of water in a reference volume of an ideally dry porous media. 63 The van Genuchten pressure head scaling parameter (($ \alpha $)). 64 Related to the inverse of the air entry pressure, i.e. the pressure where the relative water content starts to decrease below 1. 70 "The van Genuchten exponent parameter (($ n $)).",
"2.0");
87 auto soil_rec =
it::Record(
"SoilModel",
"Soil model settings.")
90 "Selection of the globally applied soil model. In future we replace this key by a field for selection of the model." 91 "That will allow usage of different soil model in a single simulation.")
93 "Fraction of the water content where we cut and rescale the curve.")
96 return it::Record(
"Flow_Richards_LMH",
"Lumped Mixed-Hybrid solver for unsteady unsaturated Darcy flow.")
100 "Input data for Darcy flow model.")
102 "Soil model settings.")
108 Input::register_class< RichardsLMH, Mesh &, const Input::Record >(
"Flow_Richards_LMH") +
116 data_ = make_shared<EqData>();
126 double fraction= model_rec.val<
double>(
"cut_fraction");
128 data_->soil_model_ = std::make_shared<SoilModel_VanGenuchten>(fraction);
130 data_->soil_model_ = std::make_shared<SoilModel_Irmay>(fraction);
137 data_->phead_edge_.resize( n_local_edges);
138 data_->water_content_previous_it.resize(n_local_sides);
139 data_->water_content_previous_time.resize(n_local_sides);
140 data_->capacity.resize(n_local_sides);
142 Distribution ds_split_edges(n_local_edges, PETSC_COMM_WORLD);
149 ISCreateGeneral(PETSC_COMM_SELF, local_edge_rows.size(),
150 &(local_edge_rows[0]), PETSC_COPY_VALUES, &(is_loc));
171 for (
unsigned int i_loc_el = 0; i_loc_el <
mh_dh.
el_ds->
lsize(); i_loc_el++) {
174 init_value =
data_->init_pressure.value(ele_ac.centre(), ele_ac.element_accessor());
177 int edge_row = ele_ac.edge_row(i);
178 uint n_sides_of_edge = ele_ac.full_iter()->side(i)->edge()->n_sides;
204 data_->water_content_previous_time.copy(
data_->water_content_previous_it);
210 return (
data_->storativity.input_list_size() == 0)
211 && (
data_->water_content_saturated.input_list_size() == 0);
239 auto multidim_assembler = AssemblyBase::create< AssemblyLMH >(
data_);
296 auto multidim_assembler = AssemblyBase::create< AssemblyLMH >(
data_);
301 multidim_assembler[ele_ac.dim()-1]->update_water_content(ele_ac);
303 double ele_scale = ele_ac.measure() *
304 data_->cross_section.value(ele_ac.centre(), ele_ac.element_accessor()) / ele_ac.n_sides();
305 double ele_source =
data_->water_source_density.value(ele_ac.centre(), ele_ac.element_accessor());
310 side_rows[i] = ele_ac.side_row(i);
311 double water_content =
data_->water_content_previous_it[ele_ac.side_local_idx(i)];
312 double water_content_previous_time =
data_->water_content_previous_time[ele_ac.side_local_idx(i)];
314 values[i] = ele_scale * ele_source - ele_scale * (water_content - water_content_previous_time) /
time_->
dt();
316 VecSetValues(
schur0->
get_solution(), ele_ac.n_sides(), side_rows, values, ADD_VALUES);
void initialize_specific() override
Output class for darcy_flow_mh model.
void assembly_mh_matrix(MultidimAssembler ma)
void postprocess() override
virtual void start_add_assembly()
virtual PetscErrorCode mat_zero_entries()
bool zero_time_term(bool time_global=false) override
RegionSet get_region_set(const string &set_name) const
static const Input::Type::Record & type_field_descriptor()
#define FOR_ELEMENT_SIDES(i, j)
virtual void finish_assembly()=0
const RegionDB & region_db() const
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
static const std::string field_descriptor_record_description(const string &record_name)
#define ADD_FIELD(name,...)
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
bool solution_changed_for_scatter
std::shared_ptr< EqData > data_
FLOW123D_FORCE_LINK_IN_CHILD(richards_lmh)
Basic time management class.
std::unordered_map< unsigned int, unsigned int > edge_new_local_4_mesh_idx_
void prepare_new_time_step() override
postprocess velocity field (add sources)
Assembly explicit Schur complement for the given linear system. Provides method for resolution of the...
VecScatter solution_2_edge_scatter_
PETSC scatter from the solution vector to the parallel edge vector with ghost values.
Global macros to enhance readability and debugging, general constants.
void setup_time_term() override
std::shared_ptr< Balance > balance_
const Vec & get_solution()
Field< 3, FieldValue< 3 >::Scalar > water_content_saturated
#define START_TIMER(tag)
Starts a timer with specified tag.
static Input::Type::Abstract & get_input_type()
virtual PetscErrorCode rhs_zero_entries()
std::shared_ptr< EqData > data_
Field< 3, FieldValue< 3 >::Scalar > genuchten_p_head_scale
Field< 3, FieldValue< 3 >::Scalar > water_content_residual
Input::Record input_record_
static const Input::Type::Record & get_input_type()
LocalElementAccessorBase< 3 > accessor(uint local_ele_idx)
unsigned int water_balance_idx_
index of water balance within the Balance object.
Field< 3, FieldValue< 3 >::Scalar > genuchten_n_exponent
void read_initial_condition() override
void assembly_linear_system() override
void set_matrix_changed()
static const int registrar
Registrar of class to factory.
Class for representation SI units of Fields.
RichardsLMH(Mesh &mesh, const Input::Record in_rec)
static UnitSI & dimensionless()
Returns dimensionless unit.
Input::Type::Record make_field_descriptor_type(const std::string &equation_name) const
static const Input::Type::Record & get_input_type()
void assembly_source_term() override
Source term is implemented differently in LMH version.
#define FEAL_ASSERT(expr)
Definition of assert for debug and release mode.
Mixed-hybrid of steady Darcy flow with sources and variable density.
unsigned int lsize(int proc) const
get local size