OGS
ProcessLib::SmallDeformation Namespace Reference

Namespaces

namespace  ConstitutiveRelations
namespace  detail

Classes

struct  FreeEnergyDensityData
struct  GravityModel
struct  IntegrationPointData
struct  MaterialForcesInterface
class  MaterialStateData
struct  MediaData
struct  SecondaryData
class  SmallDeformationLocalAssembler
struct  SmallDeformationLocalAssemblerInterface
class  SmallDeformationProcess
struct  SmallDeformationProcessData
struct  SolidDensityModel

Typedefs

template<int DisplacementDim>
using VolumetricBodyForce
using SolidDensity = BaseLib::StrongType<double, struct SolidDensityTag>

Functions

template<int GlobalDim, template< typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void createLocalAssemblers (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
void checkMPLProperties (std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
template<int DisplacementDim>
std::unique_ptr< ProcesscreateSmallDeformationProcess (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, 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< ProcesscreateSmallDeformationProcess< 2 > (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, 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< ProcesscreateSmallDeformationProcess< 3 > (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, 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 DisplacementDim, typename ShapeFunction, typename ShapeMatricesType, typename NodalForceVectorType, typename NodalDisplacementVectorType, typename GradientVectorType, typename GradientMatrixType, typename IPData, typename StressData, typename OutputData, typename IntegrationMethod>
std::vector< double > const & getMaterialForces (std::vector< double > const &local_x, std::vector< double > &nodal_values, IntegrationMethod const &integration_method, IPData const &ip_data, StressData const &stress_data, OutputData const &output_data, MeshLib::Element const &element, bool const is_axially_symmetric)
template<typename LocalAssemblerInterface>
void writeMaterialForces (std::unique_ptr< GlobalVector > &material_forces, std::vector< std::unique_ptr< LocalAssemblerInterface > > const &local_assemblers, NumLib::LocalToGlobalIndexMap const &local_to_global_index_map, GlobalVector const &x)

Typedef Documentation

◆ SolidDensity

◆ VolumetricBodyForce

Function Documentation

◆ checkMPLProperties()

void ProcessLib::SmallDeformation::checkMPLProperties ( std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media)

Definition at line 20 of file SmallDeformation/CreateSmallDeformationProcess.cpp.

22{
23 for (auto const& m : media)
24 {
25 checkRequiredProperties(m.second->phase("Solid"),
26 {{MaterialPropertyLib::density}});
27 }
28}

Referenced by createSmallDeformationProcess().

◆ createLocalAssemblers()

template<int GlobalDim, template< typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void ProcessLib::SmallDeformation::createLocalAssemblers ( std::vector< MeshLib::Element * > const & mesh_elements,
NumLib::LocalToGlobalIndexMap const & dof_table,
std::vector< std::unique_ptr< LocalAssemblerInterface > > & local_assemblers,
ProviderOrOrder const & provider_or_order,
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 SmallDeformation/CreateLocalAssemblers.h.

76{
77 DBUG("Create local assemblers.");
78
80 dof_table, mesh_elements, local_assemblers, provider_or_order,
81 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
82}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
void createLocalAssemblers(NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< MeshLib::Element * > const &mesh_elements, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)

References createLocalAssemblers(), ProcessLib::SmallDeformation::detail::createLocalAssemblers(), and DBUG().

Referenced by createLocalAssemblers(), ProcessLib::HMPhaseField::HMPhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::PhaseField::PhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), and ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess().

◆ createSmallDeformationProcess()

template<int DisplacementDim>
std::unique_ptr< Process > ProcessLib::SmallDeformation::createSmallDeformationProcess ( 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,
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

Process Variables

Input File Parameter
prj__processes__process__SMALL_DEFORMATION__process_variables

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

Input File Parameter
prj__processes__process__SMALL_DEFORMATION__process_variables__process_variable

Process Parameters

Input File Parameter
prj__processes__process__SMALL_DEFORMATION__solid_density
Input File Parameter
prj__processes__process__SMALL_DEFORMATION__specific_body_force
Input File Parameter
prj__processes__process__SMALL_DEFORMATION__use_b_bar
Input File Parameter
prj__processes__process__SMALL_DEFORMATION__reference_temperature
Input File Parameter
prj__processes__process__SMALL_DEFORMATION__initial_stress
Input File Parameter
prj__processes__process__linear

Definition at line 31 of file SmallDeformation/CreateSmallDeformationProcess.cpp.

42{
44 config.checkConfigParameter("type", "SMALL_DEFORMATION");
45 DBUG("Create SmallDeformationProcess.");
46
48
50 auto const pv_config = config.getConfigSubtree("process_variables");
51
53 auto per_process_variables = findProcessVariables(
54 variables, pv_config,
55 {
56 "process_variable"});
57
58 DBUG("Associate displacement with process variable '{:s}'.",
59 per_process_variables.back().get().getName());
60
61 if (per_process_variables.back().get().getNumberOfGlobalComponents() !=
62 DisplacementDim)
63 {
65 "Number of components of the process variable '{:s}' is different "
66 "from the displacement dimension: got {:d}, expected {:d}",
67 per_process_variables.back().get().getName(),
68 per_process_variables.back().get().getNumberOfGlobalComponents(),
69 DisplacementDim);
70 }
71 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
72 process_variables;
73 process_variables.push_back(std::move(per_process_variables));
74
76 auto solid_constitutive_relations =
78 parameters, local_coordinate_system, materialIDs(mesh), config);
79
81 if (config.getConfigParameterOptional<std::string>("solid_density"))
82 {
84 "The <solid_density> tag has been removed. Use <media> definitions "
85 "to specify solid's density.");
86 }
87
88 // Specific body force
89 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
90 {
91 std::vector<double> const b =
93 config.getConfigParameter<std::vector<double>>(
94 "specific_body_force");
95 if (b.size() != DisplacementDim)
96 {
98 "The size of the specific body force vector does not match the "
99 "displacement dimension. Vector size is {:d}, displacement "
100 "dimension is {:d}",
101 b.size(), DisplacementDim);
102 }
103
104 std::copy_n(b.data(), b.size(), specific_body_force.data());
105 }
106
108 auto const use_b_bar = config.getConfigParameter<bool>("use_b_bar", false);
109
110 auto media_map =
112 DBUG(
113 "Check the media properties of SmallDeformation process "
114 "...");
115 checkMPLProperties(media);
116 DBUG("Media properties verified.");
117
118 // Reference temperature
120 double>(
122 config, "reference_temperature", parameters, 1, &mesh);
123 if (reference_temperature)
124 {
125 DBUG("Use '{:s}' as reference temperature parameter.",
126 (*reference_temperature).name);
127 }
128
129 // Initial stress conditions
130 auto const initial_stress = ParameterLib::findOptionalTagParameter<double>(
132 config, "initial_stress", parameters,
133 // Symmetric tensor size, 4 or 6, not a Kelvin vector.
135 &mesh);
136
137 auto const is_linear =
139 config.getConfigParameter("linear", false);
140
142 materialIDs(mesh),
143 std::move(media_map),
144 std::move(solid_constitutive_relations),
145 initial_stress,
146 specific_body_force,
148 use_b_bar};
149
150 SecondaryVariableCollection secondary_variables;
151
152 ProcessLib::createSecondaryVariables(config, secondary_variables);
153
154 return std::make_unique<SmallDeformationProcess<DisplacementDim>>(
155 std::move(name), mesh, std::move(jacobian_assembler), parameters,
156 integration_order, std::move(process_variables),
157 std::move(process_data), std::move(secondary_variables), is_linear);
158}
#define OGS_FATAL(...)
Definition Error.h:19
std::map< int, std::shared_ptr< MaterialLib::Solids::MechanicsBase< DisplacementDim > > > createConstitutiveRelations(std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, MeshLib::PropertyVector< int > const *const material_ids, BaseLib::ConfigTree const &config)
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition Mesh.cpp:258
Parameter< ParameterDataType > * findOptionalTagParameter(BaseLib::ConfigTree const &process_config, std::string const &tag, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
void checkMPLProperties(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)

References BaseLib::ConfigTree::checkConfigParameter(), checkMPLProperties(), MaterialLib::Solids::createConstitutiveRelations(), MaterialPropertyLib::createMaterialSpatialDistributionMap(), ProcessLib::createSecondaryVariables(), createSmallDeformationProcess(), DBUG(), ParameterLib::findOptionalTagParameter(), ProcessLib::findProcessVariables(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtree(), MathLib::KelvinVector::kelvin_vector_dimensions(), and OGS_FATAL.

Referenced by createSmallDeformationProcess(), createSmallDeformationProcess< 2 >(), and createSmallDeformationProcess< 3 >().

◆ createSmallDeformationProcess< 2 >()

template std::unique_ptr< Process > ProcessLib::SmallDeformation::createSmallDeformationProcess< 2 > ( 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,
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 )

◆ createSmallDeformationProcess< 3 >()

template std::unique_ptr< Process > ProcessLib::SmallDeformation::createSmallDeformationProcess< 3 > ( 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,
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 )

◆ getMaterialForces()

template<int DisplacementDim, typename ShapeFunction, typename ShapeMatricesType, typename NodalForceVectorType, typename NodalDisplacementVectorType, typename GradientVectorType, typename GradientMatrixType, typename IPData, typename StressData, typename OutputData, typename IntegrationMethod>
std::vector< double > const & ProcessLib::SmallDeformation::getMaterialForces ( std::vector< double > const & local_x,
std::vector< double > & nodal_values,
IntegrationMethod const & integration_method,
IPData const & ip_data,
StressData const & stress_data,
OutputData const & output_data,
MeshLib::Element const & element,
bool const is_axially_symmetric )

Definition at line 36 of file MaterialForces.h.

41{
42 unsigned const n_integration_points =
43 integration_method.getNumberOfPoints();
44
45 nodal_values.clear();
47 nodal_values, ShapeFunction::NPOINTS * DisplacementDim);
48
49 for (unsigned ip = 0; ip < n_integration_points; ip++)
50 {
51 auto const& sigma =
53 DisplacementDim>>(stress_data[ip])
54 .sigma;
55 auto const& N = ip_data[ip].N_u;
56 auto const& dNdx = ip_data[ip].dNdx_u;
57
58 auto const& psi = std::get<FreeEnergyDensityData>(output_data[ip])
59 .free_energy_density;
60
61 auto const x_coord =
63 element, ip_data[ip].N_u);
64
65 // For the 2D case the 33-component is needed (and the four entries
66 // of the non-symmetric matrix); In 3d there are nine entries.
67 GradientMatrixType G(
68 DisplacementDim * DisplacementDim + (DisplacementDim == 2 ? 1 : 0),
69 ShapeFunction::NPOINTS * DisplacementDim);
71 dNdx, G, is_axially_symmetric, N, x_coord);
72
73 GradientVectorType const grad_u =
74 G * Eigen::Map<NodalForceVectorType const>(
75 local_x.data(), ShapeFunction::NPOINTS * DisplacementDim);
76
77 GradientVectorType eshelby_stress;
78 eshelby_stress.setZero(DisplacementDim * DisplacementDim +
79 (DisplacementDim == 2 ? 1 : 0));
80
81 if (DisplacementDim == 3)
82 {
83 eshelby_stress[0] = eshelby_stress[DisplacementDim + 1] =
84 eshelby_stress[8] = psi;
85
86 eshelby_stress[0] -= sigma[0] * grad_u[0] +
87 sigma[3] / std::sqrt(2) * grad_u[3] +
88 sigma[5] / std::sqrt(2) * grad_u[6];
89
90 eshelby_stress[1] -= sigma[3] / std::sqrt(2) * grad_u[0] +
91 sigma[1] * grad_u[3] +
92 sigma[4] / std::sqrt(2) * grad_u[6];
93
94 eshelby_stress[2] -= sigma[5] / std::sqrt(2) * grad_u[0] +
95 sigma[4] / std::sqrt(2) * grad_u[3] +
96 sigma[2] * grad_u[6];
97
98 eshelby_stress[3] -= sigma[0] * grad_u[1] +
99 sigma[3] / std::sqrt(2) * grad_u[4] +
100 sigma[5] / std::sqrt(2) * grad_u[7];
101
102 eshelby_stress[4] -= sigma[3] / std::sqrt(2) * grad_u[1] +
103 sigma[1] * grad_u[4] +
104 sigma[4] / std::sqrt(2) * grad_u[7];
105
106 eshelby_stress[5] -= sigma[5] / std::sqrt(2) * grad_u[1] +
107 sigma[4] / std::sqrt(2) * grad_u[4] +
108 sigma[2] * grad_u[7];
109
110 eshelby_stress[6] -= sigma[0] * grad_u[2] +
111 sigma[3] / std::sqrt(2) * grad_u[5] +
112 sigma[5] / std::sqrt(2) * grad_u[8];
113
114 eshelby_stress[7] -= sigma[3] / std::sqrt(2) * grad_u[2] +
115 sigma[1] * grad_u[5] +
116 sigma[4] / std::sqrt(2) * grad_u[8];
117
118 eshelby_stress[8] -= sigma[5] / std::sqrt(2) * grad_u[2] +
119 sigma[4] / std::sqrt(2) * grad_u[5] +
120 sigma[2] * grad_u[8];
121 }
122 else if (DisplacementDim == 2)
123 {
124 eshelby_stress[0] = eshelby_stress[DisplacementDim + 1] =
125 eshelby_stress[4] = psi;
126
127 eshelby_stress[0] -=
128 sigma[0] * grad_u[0] + sigma[3] / std::sqrt(2) * grad_u[2];
129
130 eshelby_stress[1] -=
131 sigma[3] / std::sqrt(2) * grad_u[0] + sigma[1] * grad_u[2];
132
133 eshelby_stress[2] -=
134 sigma[0] * grad_u[1] + sigma[3] / std::sqrt(2) * grad_u[3];
135
136 eshelby_stress[3] -=
137 sigma[3] / std::sqrt(2) * grad_u[1] + sigma[1] * grad_u[3];
138
139 // for axial-symmetric case the following is not zero in general
140 eshelby_stress[4] -= sigma[2] * grad_u[4];
141 }
142 else
143 {
144 OGS_FATAL(
145 "Material forces not implemented for displacement "
146 "dimension "
147 "other than 2 and 3.");
148 }
149
150 auto const& w = ip_data[ip].integration_weight;
151 local_b += G.transpose() * eshelby_stress * w;
152 }
153
154 return nodal_values;
155}
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)
double interpolateXCoordinate(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
void computeGMatrix(DNDX_Type const &dNdx, GMatrixType &g_matrix, const bool is_axially_symmetric, N_Type const &N, const double radius)
Fills a G-matrix based on given shape function dN/dx values.
Definition GMatrix.h:18

References ProcessLib::Deformation::computeGMatrix(), MathLib::createZeroedVector(), NumLib::interpolateXCoordinate(), and OGS_FATAL.

Referenced by ProcessLib::SmallDeformation::SmallDeformationLocalAssembler< ShapeFunction, DisplacementDim >::getMaterialForces().

◆ writeMaterialForces()

template<typename LocalAssemblerInterface>
void ProcessLib::SmallDeformation::writeMaterialForces ( std::unique_ptr< GlobalVector > & material_forces,
std::vector< std::unique_ptr< LocalAssemblerInterface > > const & local_assemblers,
NumLib::LocalToGlobalIndexMap const & local_to_global_index_map,
GlobalVector const & x )

Definition at line 158 of file MaterialForces.h.

164{
165 DBUG("Compute material forces for small deformation process.");
166
167 // Prepare local storage and fetch values.
169
170 if (!material_forces)
171 {
172 material_forces =
174 }
175
176 MathLib::LinAlg::set(*material_forces, 0);
177
179 [](const std::size_t mesh_item_id,
180 LocalAssemblerInterface& local_assembler,
181 const NumLib::LocalToGlobalIndexMap& dof_table,
182 GlobalVector const& x,
183 GlobalVector& node_values)
184 {
185 auto const indices = NumLib::getIndices(mesh_item_id, dof_table);
186 std::vector<double> local_data;
187 auto const local_x = x.get(indices);
188
189 local_assembler.getMaterialForces(local_x, local_data);
190
191 assert(local_data.size() == indices.size());
192 node_values.add(indices, local_data);
193 },
194 local_assemblers, local_to_global_index_map, x, *material_forces);
195 MathLib::LinAlg::finalizeAssembly(*material_forces);
196}
MathLib::EigenVector GlobalVector
void add(IndexType rowId, double v)
add entry
Definition EigenVector.h:70
double get(IndexType rowId) const
get entry
Definition EigenVector.h:52
void finalizeAssembly(PETScMatrix &A)
Definition LinAlg.cpp:191
void setLocalAccessibleVector(PETScVector const &x)
Definition LinAlg.cpp:20
void set(PETScVector &x, PetscScalar const a)
Definition LinAlg.cpp:25
std::vector< GlobalIndexType > getIndices(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
static void executeDereferenced(F const &f, C const &c, Args_ &&... args)

References MathLib::EigenVector::add(), DBUG(), NumLib::SerialExecutor::executeDereferenced(), MathLib::LinAlg::finalizeAssembly(), MathLib::EigenVector::get(), NumLib::getIndices(), MathLib::LinAlg::set(), and MathLib::LinAlg::setLocalAccessibleVector().

Referenced by ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::postTimestepConcreteProcess().