20 #include "petscviewer.h" 21 #include "petscerror.h" 49 Saturated water content (($ \theta_s $)). 50 relative volume of the water in a reference volume of a saturated porous media. 56 Residual water content (($ \theta_r $)). 57 Relative volume of the water in a reference volume of an ideally dry porous media. 63 The van Genuchten pressure head scaling parameter (($ \alpha $)). 64 The parameter of the van Genuchten's model to scale the pressure head. 65 Related to the inverse of the air entry pressure, i.e. the pressure where the relative water content starts to decrease below 1. 71 "The van Genuchten exponent parameter (($ n $)).",
"2.0");
88 auto soil_rec =
it::Record(
"SoilModel",
"Setting for the soil model.")
91 "Selection of the globally applied soil model. In future we replace this key by a field for selection of the model." 92 "That will allow usage of different soil model in a single simulation.")
94 "Fraction of the water content where we cut and rescale the curve.")
97 return it::Record(
"Flow_Richards_LMH",
"Lumped Mixed-Hybrid solver for unsteady saturated Darcy flow.")
101 "Input data for Darcy flow model.")
103 "Setting for the soil model.")
109 Input::register_class< RichardsLMH, Mesh &, const Input::Record >(
"Flow_Richards_LMH") +
117 data_ = make_shared<EqData>();
127 double fraction= model_rec.val<
double>(
"cut_fraction");
129 data_->soil_model_ = std::make_shared<SoilModel_VanGenuchten>(fraction);
131 data_->soil_model_ = std::make_shared<SoilModel_Irmay>(fraction);
138 data_->phead_edge_.resize( n_local_edges);
139 data_->water_content_previous_it.resize(n_local_sides);
140 data_->water_content_previous_time.resize(n_local_sides);
141 data_->capacity.resize(n_local_sides);
143 Distribution ds_split_edges(n_local_edges, PETSC_COMM_WORLD);
150 ISCreateGeneral(PETSC_COMM_SELF, local_edge_rows.size(),
151 &(local_edge_rows[0]), PETSC_COPY_VALUES, &(is_loc));
172 for (
unsigned int i_loc_el = 0; i_loc_el <
mh_dh.
el_ds->
lsize(); i_loc_el++) {
175 init_value =
data_->init_pressure.value(ele_ac.centre(), ele_ac.element_accessor());
178 int edge_row = ele_ac.edge_row(i);
179 uint n_sides_of_edge = ele_ac.full_iter()->side(i)->edge()->n_sides;
205 data_->water_content_previous_time.copy(
data_->water_content_previous_it);
211 return (
data_->storativity.input_list_size() == 0)
212 && (
data_->water_content_saturated.input_list_size() == 0);
240 auto multidim_assembler = AssemblyBase::create< AssemblyLMH >(
data_);
302 auto multidim_assembler = AssemblyBase::create< AssemblyLMH >(
data_);
307 multidim_assembler[ele_ac.dim()-1]->update_water_content(ele_ac);
309 double ele_scale = ele_ac.measure() *
310 data_->cross_section.value(ele_ac.centre(), ele_ac.element_accessor()) / ele_ac.n_sides();
311 double ele_source =
data_->water_source_density.value(ele_ac.centre(), ele_ac.element_accessor());
316 side_rows[i] = ele_ac.side_row(i);
317 double water_content =
data_->water_content_previous_it[ele_ac.side_local_idx(i)];
318 double water_content_previous_time =
data_->water_content_previous_time[ele_ac.side_local_idx(i)];
320 values[i] = ele_scale * ele_source - ele_scale * (water_content - water_content_previous_time) /
time_->
dt();
322 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