OGS
CreateRichardsFlowProcess.cpp
Go to the documentation of this file.
1
12
16#include "ParameterLib/Utils.h"
19#include "RichardsFlowProcess.h"
21
22namespace ProcessLib
23{
24namespace RichardsFlow
25{
27 MeshLib::Mesh const& mesh,
29{
30 std::array const required_medium_properties = {
37
38 std::array const required_liquid_properties = {
41
42 std::array<MaterialPropertyLib::PropertyType, 0> const
43 required_solid_properties{};
44
45 std::array<MaterialPropertyLib::PropertyType, 0> const empty{};
46
48 mesh, media_map, required_medium_properties, required_solid_properties,
49 required_liquid_properties, empty);
50}
51
52std::unique_ptr<Process> createRichardsFlowProcess(
53 std::string const& name,
54 MeshLib::Mesh& mesh,
55 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
56 std::vector<ProcessVariable> const& variables,
57 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
58 unsigned const integration_order,
59 BaseLib::ConfigTree const& config,
60 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
61{
63 config.checkConfigParameter("type", "RICHARDS_FLOW");
64
65 DBUG("Create RichardsFlowProcess.");
66
68
70 auto const pv_config = config.getConfigSubtree("process_variables");
71
73 auto per_process_variables = findProcessVariables(
74 variables, pv_config,
75 {
76 "process_variable"});
77 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
78 process_variables;
79 process_variables.push_back(std::move(per_process_variables));
80
81 SecondaryVariableCollection secondary_variables;
82
83 ProcessLib::createSecondaryVariables(config, secondary_variables);
84
86 // Specific body force
87 std::vector<double> const b =
89 config.getConfigParameter<std::vector<double>>("specific_body_force");
90 assert(!b.empty() && b.size() < 4);
91 Eigen::VectorXd specific_body_force(b.size());
92 bool const has_gravity = MathLib::toVector(b).norm() > 0;
93 if (has_gravity)
94 {
95 std::copy_n(b.data(), b.size(), specific_body_force.data());
96 }
97
98 // has mass lumping
100 auto mass_lumping = config.getConfigParameter<bool>("mass_lumping");
101
102 auto media_map =
104
105 DBUG("Check the media properties of RichardsFlow process ...");
106 checkMPLProperties(mesh, media_map);
107 DBUG("Media properties verified.");
108
109 RichardsFlowProcessData process_data{
110 std::move(media_map), specific_body_force, has_gravity, mass_lumping};
111
112 return std::make_unique<RichardsFlowProcess>(
113 std::move(name), mesh, std::move(jacobian_assembler), parameters,
114 integration_order, std::move(process_variables),
115 std::move(process_data), std::move(secondary_variables));
116}
117
118} // namespace RichardsFlow
119} // namespace ProcessLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
T getConfigParameter(std::string const &param) const
ConfigTree getConfigSubtree(std::string const &root) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
Handles configuration of several secondary variables from the project file.
void checkMaterialSpatialDistributionMap(MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map, ContainerMedium const &required_properties_medium, ContainerSolid const &required_properties_solid_phase, ContainerLiquid const &required_properties_liquid_phase, ContainerGas const &required_properties_gas_phase)
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
Eigen::Map< const Vector > toVector(std::vector< double > const &data, Eigen::VectorXd::Index size)
Creates an Eigen mapped vector from the given data vector.
void checkMPLProperties(MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map)
std::unique_ptr< Process > createRichardsFlowProcess(std::string const &name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)