OGS
ProcessLib::HydroMechanics Namespace Reference

Classes

struct  IntegrationPointData
 
struct  SecondaryData
 
class  HydroMechanicsLocalAssembler
 
class  HydroMechanicsProcess
 
struct  HydroMechanicsProcessData
 
struct  LocalAssemblerInterface
 

Functions

template<int DisplacementDim>
std::unique_ptr< ProcesscreateHydroMechanicsProcess (std::string 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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &media)
 
template std::unique_ptr< ProcesscreateHydroMechanicsProcess< 2 > (std::string 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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &media)
 
template std::unique_ptr< ProcesscreateHydroMechanicsProcess< 3 > (std::string 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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &media)
 

Function Documentation

◆ createHydroMechanicsProcess()

template<int DisplacementDim>
std::unique_ptr< Process > ProcessLib::HydroMechanics::createHydroMechanicsProcess ( std::string  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,
std::optional< ParameterLib::CoordinateSystem > const &  local_coordinate_system,
unsigned const  integration_order,
BaseLib::ConfigTree const &  config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &  media 
)
Input File Parameter:
prj__processes__process__type
Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__coupling_scheme
Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__coupling_scheme_parameter

Process Variables

Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__process_variables

Primary process variables as they appear in the global component vector:

Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__process_variables__pressure
Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__process_variables__displacement

Process Parameters

Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__specific_body_force
Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__mass_lumping
Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__initial_stress

Definition at line 32 of file CreateHydroMechanicsProcess.cpp.

41 {
43  config.checkConfigParameter("type", "HYDRO_MECHANICS");
44  DBUG("Create HydroMechanicsProcess.");
45 
46  if (DisplacementDim == 2)
47  {
48  if (mesh.isAxiallySymmetric() &&
50  {
51  OGS_FATAL(
52  "Mesh {:s} is on a plane rotated around the vertical axis. The "
53  "axisymmetric problem can not use such mesh.",
54  mesh.getName());
55  }
56  }
57 
58  auto const coupling_scheme =
60  config.getConfigParameterOptional<std::string>("coupling_scheme");
61  const bool use_monolithic_scheme =
62  !(coupling_scheme && (*coupling_scheme == "staggered"));
63 
64  auto coupling_scheme_parameter_optional =
66  config.getConfigParameterOptional<double>("coupling_scheme_parameter");
67  double coupling_scheme_parameter = std::numeric_limits<double>::quiet_NaN();
68 
69  if (use_monolithic_scheme)
70  {
71  if (coupling_scheme_parameter_optional)
72  {
73  WARN(
74  "Monolithic scheme ignores coupling scheme parameter set in "
75  "project file.");
76  }
77  }
78  else
79  {
80  if (coupling_scheme_parameter_optional)
81  {
82  coupling_scheme_parameter =
83  coupling_scheme_parameter_optional.value();
84  // optimum not a-priori known, but within certain interval [Storvik
85  // & Nordbotten]
86  double const csp_min = 1.0 / 6.0;
87  double const csp_max = 1.0;
88  if (coupling_scheme_parameter < csp_min ||
89  coupling_scheme_parameter > csp_max)
90  {
91  WARN(
92  "Value of coupling scheme parameter = {:g} is out of "
93  "reasonable range ({:g}, {:g}).",
94  coupling_scheme_parameter, csp_min, csp_max);
95  }
96  }
97  else
98  {
99  coupling_scheme_parameter =
100  0.5; // default value recommended [Mikelic & Wheeler]
101  }
102  DBUG("Using value {:g} for coupling parameter of staggered scheme.",
103  coupling_scheme_parameter);
104  }
105 
107 
109  auto const pv_config = config.getConfigSubtree("process_variables");
110 
111  ProcessVariable* variable_p;
112  ProcessVariable* variable_u;
113  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
114  process_variables;
115 
116  int const hydraulic_process_id = 0;
117  int mechanics_related_process_id = 0;
118 
119  if (use_monolithic_scheme) // monolithic scheme.
120  {
123  auto per_process_variables = findProcessVariables(
124  variables, pv_config,
125  {
126  "pressure",
128  "displacement"});
129  variable_p = &per_process_variables[0].get();
130  variable_u = &per_process_variables[1].get();
131  process_variables.push_back(std::move(per_process_variables));
132  }
133  else // staggered scheme.
134  {
135  using namespace std::string_literals;
136  for (auto const& variable_name : {"pressure"s, "displacement"s})
137  {
138  auto per_process_variables =
139  findProcessVariables(variables, pv_config, {variable_name});
140  process_variables.push_back(std::move(per_process_variables));
141  }
142  mechanics_related_process_id = 1;
143  variable_p = &process_variables[hydraulic_process_id][0].get();
144  variable_u = &process_variables[mechanics_related_process_id][0].get();
145  }
146 
147  DBUG("Associate displacement with process variable '{:s}'.",
148  variable_u->getName());
149 
150  if (variable_u->getNumberOfGlobalComponents() != DisplacementDim)
151  {
152  OGS_FATAL(
153  "Number of components of the process variable '{:s}' is different "
154  "from the displacement dimension: got {:d}, expected {:d}",
155  variable_u->getName(),
156  variable_u->getNumberOfGlobalComponents(),
157  DisplacementDim);
158  }
159 
160  DBUG("Associate pressure with process variable '{:s}'.",
161  variable_p->getName());
162  if (variable_p->getNumberOfGlobalComponents() != 1)
163  {
164  OGS_FATAL(
165  "Pressure process variable '{:s}' is not a scalar variable but has "
166  "{:d} components.",
167  variable_p->getName(),
168  variable_p->getNumberOfGlobalComponents());
169  }
170 
171  auto solid_constitutive_relations =
172  MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
173  parameters, local_coordinate_system, config);
174 
176  // Specific body force
177  Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
178  {
179  std::vector<double> const b =
181  config.getConfigParameter<std::vector<double>>(
182  "specific_body_force");
183  if (b.size() != DisplacementDim)
184  {
185  OGS_FATAL(
186  "The size of the specific body force vector does not match the "
187  "displacement dimension. Vector size is {:d}, displacement "
188  "dimension is {:d}",
189  b.size(), DisplacementDim);
190  }
191 
192  std::copy_n(b.data(), b.size(), specific_body_force.data());
193  }
194 
196  auto mass_lumping = config.getConfigParameter<bool>("mass_lumping", false);
197 
198  auto media_map =
200 
201  std::array const requiredMediumProperties = {
205  std::array const requiredFluidProperties = {MaterialPropertyLib::viscosity,
207  std::array const requiredSolidProperties = {MaterialPropertyLib::density};
208 
209  for (auto const& element : mesh.getElements())
210  {
211  auto const element_id = element->getID();
212  media_map->checkElementHasMedium(element_id);
213  auto const& medium = *media_map->getMedium(element_id);
214  checkRequiredProperties(medium, requiredMediumProperties);
215  checkRequiredProperties(fluidPhase(medium), requiredFluidProperties);
216  checkRequiredProperties(medium.phase("Solid"), requiredSolidProperties);
217  }
218  DBUG("Media properties verified.");
219 
220  // Initial stress conditions
221  auto const initial_stress = ParameterLib::findOptionalTagParameter<double>(
223  config, "initial_stress", parameters,
224  // Symmetric tensor size, 4 or 6, not a Kelvin vector.
226  &mesh);
227 
228  const bool use_taylor_hood_elements = variable_p->getShapeFunctionOrder() !=
229  variable_u->getShapeFunctionOrder();
230 
231  HydroMechanicsProcessData<DisplacementDim> process_data{
232  materialIDs(mesh), std::move(media_map),
233  std::move(solid_constitutive_relations), initial_stress,
234  specific_body_force, mass_lumping,
235  coupling_scheme_parameter, // this parameter gets its specific meaning
236  // in the process depending on implemented
237  // coupling scheme
238  hydraulic_process_id, mechanics_related_process_id,
239  use_taylor_hood_elements};
240 
241  SecondaryVariableCollection secondary_variables;
242 
243  ProcessLib::createSecondaryVariables(config, secondary_variables);
244 
245  return std::make_unique<HydroMechanicsProcess<DisplacementDim>>(
246  std::move(name), mesh, std::move(jacobian_assembler), parameters,
247  integration_order, std::move(process_variables),
248  std::move(process_data), std::move(secondary_variables),
249  use_monolithic_scheme);
250 }
#define OGS_FATAL(...)
Definition: Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:29
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:39
bool isAxiallySymmetric() const
Definition: Mesh.h:131
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:103
const std::string getName() const
Get name of the mesh.
Definition: Mesh.h:97
std::unique_ptr< MaterialSpatialDistributionMap > createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium >> const &media, MeshLib::Mesh const &mesh)
Phase const & fluidPhase(Medium const &medium)
Returns a gas or aqueous liquid phase of the given medium.
Definition: Medium.cpp:84
void checkRequiredProperties(Component const &c, Container const &required_properties)
Definition: Component.h:96
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Definition: KelvinVector.h:24
static const double s
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:264
bool is2DMeshOnRotatedVerticalPlane(Mesh const &mesh)
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)

References MaterialPropertyLib::biot_coefficient, BaseLib::ConfigTree::checkConfigParameter(), MaterialPropertyLib::checkRequiredProperties(), MaterialPropertyLib::createMaterialSpatialDistributionMap(), ProcessLib::createSecondaryVariables(), DBUG(), MaterialPropertyLib::density, ProcessLib::findProcessVariables(), MaterialPropertyLib::fluidPhase(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtree(), MeshLib::Mesh::getElements(), MeshLib::Mesh::getName(), ProcessLib::ProcessVariable::getName(), ProcessLib::ProcessVariable::getNumberOfGlobalComponents(), ProcessLib::ProcessVariable::getShapeFunctionOrder(), MeshLib::is2DMeshOnRotatedVerticalPlane(), MeshLib::Mesh::isAxiallySymmetric(), MathLib::KelvinVector::kelvin_vector_dimensions(), MeshLib::materialIDs(), MaterialPropertyLib::name, OGS_FATAL, MaterialPropertyLib::permeability, MaterialPropertyLib::porosity, MaterialPropertyLib::reference_temperature, MathLib::s, MaterialPropertyLib::viscosity, and WARN().

Referenced by ProjectData::parseProcesses().

◆ createHydroMechanicsProcess< 2 >()

template std::unique_ptr< Process > ProcessLib::HydroMechanics::createHydroMechanicsProcess< 2 > ( std::string  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,
std::optional< ParameterLib::CoordinateSystem > const &  local_coordinate_system,
unsigned const  integration_order,
BaseLib::ConfigTree const &  config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &  media 
)

◆ createHydroMechanicsProcess< 3 >()

template std::unique_ptr< Process > ProcessLib::HydroMechanics::createHydroMechanicsProcess< 3 > ( std::string  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,
std::optional< ParameterLib::CoordinateSystem > const &  local_coordinate_system,
unsigned const  integration_order,
BaseLib::ConfigTree const &  config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &  media 
)