OGS
ProcessLib::HydroMechanics Namespace Reference

Namespaces

 detail
 

Classes

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

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)
 
template<int GlobalDim, template< typename, typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
void createLocalAssemblers (const unsigned, std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
 

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__process_variables
Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__process_variables__pressure
Input File Parameter:
prj__processes__process__HYDRO_MECHANICS__process_variables__displacement
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  // Process variable.
65 
67  auto const pv_config = config.getConfigSubtree("process_variables");
68 
69  ProcessVariable* variable_p;
70  ProcessVariable* variable_u;
71  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
72  process_variables;
73 
74  int const hydraulic_process_id = 0;
75  int mechanics_related_process_id = 0;
76 
77  if (use_monolithic_scheme) // monolithic scheme.
78  {
79  auto per_process_variables = findProcessVariables(
80  variables, pv_config,
81  {
82  "pressure",
84  "displacement"});
85  variable_p = &per_process_variables[0].get();
86  variable_u = &per_process_variables[1].get();
87  process_variables.push_back(std::move(per_process_variables));
88  }
89  else // staggered scheme.
90  {
91  using namespace std::string_literals;
92  for (auto const& variable_name : {"pressure"s, "displacement"s})
93  {
94  auto per_process_variables =
95  findProcessVariables(variables, pv_config, {variable_name});
96  process_variables.push_back(std::move(per_process_variables));
97  }
98  mechanics_related_process_id = 1;
99  variable_p = &process_variables[hydraulic_process_id][0].get();
100  variable_u = &process_variables[mechanics_related_process_id][0].get();
101  }
102 
103  DBUG("Associate displacement with process variable '{:s}'.",
104  variable_u->getName());
105 
106  if (variable_u->getNumberOfGlobalComponents() != DisplacementDim)
107  {
108  OGS_FATAL(
109  "Number of components of the process variable '{:s}' is different "
110  "from the displacement dimension: got {:d}, expected {:d}",
111  variable_u->getName(),
112  variable_u->getNumberOfGlobalComponents(),
113  DisplacementDim);
114  }
115 
116  DBUG("Associate pressure with process variable '{:s}'.",
117  variable_p->getName());
118  if (variable_p->getNumberOfGlobalComponents() != 1)
119  {
120  OGS_FATAL(
121  "Pressure process variable '{:s}' is not a scalar variable but has "
122  "{:d} components.",
123  variable_p->getName(),
124  variable_p->getNumberOfGlobalComponents());
125  }
126 
127  auto solid_constitutive_relations =
128  MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
129  parameters, local_coordinate_system, config);
130 
131  // Specific body force
132  Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
133  {
134  std::vector<double> const b =
136  config.getConfigParameter<std::vector<double>>(
137  "specific_body_force");
138  if (b.size() != DisplacementDim)
139  {
140  OGS_FATAL(
141  "The size of the specific body force vector does not match the "
142  "displacement dimension. Vector size is {:d}, displacement "
143  "dimension is {:d}",
144  b.size(), DisplacementDim);
145  }
146 
147  std::copy_n(b.data(), b.size(), specific_body_force.data());
148  }
149 
151  auto mass_lumping = config.getConfigParameter<bool>("mass_lumping", false);
152 
153  auto media_map =
155 
156  std::array const requiredMediumProperties = {
160  std::array const requiredFluidProperties = {MaterialPropertyLib::viscosity,
162  std::array const requiredSolidProperties = {MaterialPropertyLib::density};
163 
164  for (auto const& element : mesh.getElements())
165  {
166  auto const element_id = element->getID();
167  media_map->checkElementHasMedium(element_id);
168  auto const& medium = *media_map->getMedium(element_id);
169  checkRequiredProperties(medium, requiredMediumProperties);
170  checkRequiredProperties(fluidPhase(medium), requiredFluidProperties);
171  checkRequiredProperties(medium.phase("Solid"), requiredSolidProperties);
172  }
173  DBUG("Media properties verified.");
174 
175  // Initial stress conditions
176  auto const initial_stress = ParameterLib::findOptionalTagParameter<double>(
178  config, "initial_stress", parameters,
179  // Symmetric tensor size, 4 or 6, not a Kelvin vector.
181  &mesh);
182 
183  HydroMechanicsProcessData<DisplacementDim> process_data{
184  materialIDs(mesh),
185  std::move(media_map),
186  std::move(solid_constitutive_relations),
187  initial_stress,
188  specific_body_force,
189  mass_lumping,
190  hydraulic_process_id,
191  mechanics_related_process_id};
192 
193  SecondaryVariableCollection secondary_variables;
194 
195  ProcessLib::createSecondaryVariables(config, secondary_variables);
196 
197  return std::make_unique<HydroMechanicsProcess<DisplacementDim>>(
198  std::move(name), mesh, std::move(jacobian_assembler), parameters,
199  integration_order, std::move(process_variables),
200  std::move(process_data), std::move(secondary_variables),
201  use_monolithic_scheme);
202 }
#define OGS_FATAL(...)
Definition: Error.h:26
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
bool isAxiallySymmetric() const
Definition: Mesh.h:126
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:98
const std::string getName() const
Get name of the mesh.
Definition: Mesh.h:92
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:82
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:23
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:258
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(), MeshLib::is2DMeshOnRotatedVerticalPlane(), MeshLib::Mesh::isAxiallySymmetric(), MathLib::KelvinVector::kelvin_vector_dimensions(), MeshLib::materialIDs(), MaterialPropertyLib::name, OGS_FATAL, MaterialPropertyLib::permeability, MaterialPropertyLib::porosity, MaterialPropertyLib::reference_temperature, and MaterialPropertyLib::viscosity.

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 
)

◆ createLocalAssemblers()

template<int GlobalDim, template< typename, typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
void ProcessLib::HydroMechanics::createLocalAssemblers ( const unsigned  ,
std::vector< MeshLib::Element * > const &  mesh_elements,
NumLib::LocalToGlobalIndexMap const &  dof_table,
const unsigned  shapefunction_order,
std::vector< std::unique_ptr< LocalAssemblerInterface >> &  local_assemblers,
ExtraCtorArgs &&...  extra_ctor_args 
)

Creates local assemblers for each element of the given mesh.

Template Parameters
LocalAssemblerImplementationthe individual local assembler type
LocalAssemblerInterfacethe general local assembler interface
ExtraCtorArgstypes of additional constructor arguments. Those arguments will be passed to the constructor of LocalAssemblerImplementation.

The first two template parameters cannot be deduced from the arguments. Therefore they always have to be provided manually.

Definition at line 70 of file CreateLocalAssemblers.h.

77 {
78  DBUG("Create local assemblers.");
79 
80  detail::createLocalAssemblers<GlobalDim, LocalAssemblerImplementation>(
81  dof_table, shapefunction_order, mesh_elements, local_assemblers,
82  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
83 }

References DBUG().

Referenced by ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess().