OGS
ParameterLib::CoordinateSystem Struct Referencefinal

Detailed Description

A local coordinate system used for tensor transformations.

It offers a simple way for input of anisotropic tensors w.r.t. a coordinate system. The basis vectors form a transformation matrix \(R = (e_0, e_1, e_2)\). For a given anisotropic tensor \(A\) parameter with the corresponding [tag] use_local_coordinate_system the tensor is rotated according to the formula: \(A' = R\cdot A\cdot R^T\).

For computations in transverse isotropic material models, we can create a coordinate system with only one base, where the last base is explicitly given. The other bases are set as implicit and computed from the given base as follows:

  • For a 2D coordinate system, the unit vector orthogonal to the given base is used as the first base,
  • For a 3D coordinate system, the given base vector, unit_direction, is set as the third base, \({\vec e}_2\). An arbitrary unit vector orthogonal to \({\vec e}_2\) is selected as the second base \(e_1\), and the first base \({\vec e}_0\) is calculated as \({\vec e}_0 = {\vec e}_1 \times {\vec e}_2\).

Definition at line 48 of file CoordinateSystem.h.

#include <CoordinateSystem.h>

Public Member Functions

 CoordinateSystem (Parameter< double > const &unit_direction)
 
 CoordinateSystem (Parameter< double > const &e0, Parameter< double > const &e1)
 
 CoordinateSystem (Parameter< double > const &e0, Parameter< double > const &e1, Parameter< double > const &e2)
 
template<int Dimension>
Eigen::Matrix< double, Dimension, Dimension > transformation (SpatialPosition const &pos) const
 
Eigen::Matrix< double, 3, 3 > transformation_3d (SpatialPosition const &pos) const
 
template<int Dimension>
Eigen::Matrix< double, Dimension, Dimension > rotateTensor (std::vector< double > const &values, SpatialPosition const &pos) const
 
template<int Dimension, typename Derived >
Eigen::Matrix< double, Dimension, Dimension > rotateTensor (Eigen::MatrixBase< Derived > const &tensor, SpatialPosition const &pos) const
 
template<int Dimension>
Eigen::Matrix< double, Dimension, Dimension > rotateDiagonalTensor (std::vector< double > const &values, SpatialPosition const &pos) const
 
template<>
Eigen::Matrix< double, 2, 2 > transformation (SpatialPosition const &pos) const
 
template<>
Eigen::Matrix< double, 3, 3 > transformation (SpatialPosition const &pos) const
 

Private Member Functions

Eigen::Matrix< double, 3, 3 > transformationFromSingleBase_3d (SpatialPosition const &pos) const
 

Private Attributes

std::array< Parameter< double > const *, 3 > _base
 
bool _has_implicit_base
 

Constructor & Destructor Documentation

◆ CoordinateSystem() [1/3]

ParameterLib::CoordinateSystem::CoordinateSystem ( Parameter< double > const & unit_direction)
explicit

It is used to create a local coordinate system with only one base, where the last base is explicitly given as unit_direction.

Parameters
unit_directionThe specified unit direction.

Definition at line 67 of file CoordinateSystem.cpp.

68 : _base{nullptr, nullptr, &unit_direction}, _has_implicit_base(true)
69{
70 if (_base[2]->isTimeDependent())
71 {
73 "The unit_normal parameter named {} must not be time dependent.",
74 unit_direction.name);
75 }
76}
#define OGS_FATAL(...)
Definition Error.h:26
std::array< Parameter< double > const *, 3 > _base

References _base, ParameterLib::ParameterBase::name, and OGS_FATAL.

◆ CoordinateSystem() [2/3]

ParameterLib::CoordinateSystem::CoordinateSystem ( Parameter< double > const & e0,
Parameter< double > const & e1 )

Definition at line 78 of file CoordinateSystem.cpp.

80 : _base{&e0, &e1, nullptr}, _has_implicit_base(false)
81{
82 if (typeid(_base[0]) != typeid(_base[1]))
83 {
85 "The parameter types for the basis must be equal but they are "
86 "'{:s}' and '{:s}'.",
87 typeid(_base[0]).name(),
88 typeid(_base[1]).name());
89 }
90 if (_base[0]->isTimeDependent() || _base[1]->isTimeDependent())
91 {
92 OGS_FATAL("The parameters for the basis must not be time dependent.");
93 }
94 if (_base[0]->getNumberOfGlobalComponents() != 2 ||
95 _base[1]->getNumberOfGlobalComponents() != 2)
96 {
97 OGS_FATAL("The parameters for the 2D basis must have two components.");
98 }
99}

References _base, and OGS_FATAL.

◆ CoordinateSystem() [3/3]

ParameterLib::CoordinateSystem::CoordinateSystem ( Parameter< double > const & e0,
Parameter< double > const & e1,
Parameter< double > const & e2 )

Definition at line 101 of file CoordinateSystem.cpp.

104 : _base{&e0, &e1, &e2}, _has_implicit_base(false)
105{
106 if ((typeid(_base[0]) != typeid(_base[1])) ||
107 (typeid(_base[1]) != typeid(_base[2])) ||
108 (typeid(_base[2]) != typeid(_base[0])))
109 {
110 OGS_FATAL(
111 "The parameter types for the basis must be equal but they are "
112 "'{:s}', '{:s}', and '{:s}'.",
113 typeid(_base[0]).name(),
114 typeid(_base[1]).name(),
115 typeid(_base[2]).name());
116 }
117 if (_base[0]->isTimeDependent() || _base[1]->isTimeDependent(),
118 _base[2]->isTimeDependent())
119 {
120 OGS_FATAL("The parameters for the basis must not be time dependent.");
121 }
122 if (_base[0]->getNumberOfGlobalComponents() != 3 ||
123 _base[1]->getNumberOfGlobalComponents() != 3 ||
124 _base[2]->getNumberOfGlobalComponents() != 3)
125 {
126 OGS_FATAL(
127 "The parameters for the 3D basis must have three components.");
128 }
129}

References _base, and OGS_FATAL.

Member Function Documentation

◆ rotateDiagonalTensor()

template<int Dimension>
template Eigen::Matrix< double, 3, 3 > ParameterLib::CoordinateSystem::rotateDiagonalTensor< 3 > ( std::vector< double > const & values,
SpatialPosition const & pos ) const

Definition at line 301 of file CoordinateSystem.cpp.

303{
304 assert(values.size() == Dimension ||
305 "Input vector has wrong dimension; expected 2 or 3 entries.");
306 auto const tensor = Eigen::Map<Eigen::Matrix<double, Dimension, 1> const>(
307 values.data(), Dimension, 1);
308 auto const R = transformation<Dimension>(pos);
309 return R * tensor.asDiagonal() * R.transpose();
310}
Eigen::Matrix< double, Dimension, Dimension > transformation(SpatialPosition const &pos) const

References transformation().

◆ rotateTensor() [1/2]

template<int Dimension, typename Derived >
Eigen::Matrix< double, Dimension, Dimension > ParameterLib::CoordinateSystem::rotateTensor ( Eigen::MatrixBase< Derived > const & tensor,
SpatialPosition const & pos ) const

Definition at line 93 of file CoordinateSystem.h.

95{
96 auto const R = transformation<Dimension>(pos);
97 return R * tensor * R.transpose();
98}

References transformation().

◆ rotateTensor() [2/2]

template<int Dimension>
template Eigen::Matrix< double, 3, 3 > ParameterLib::CoordinateSystem::rotateTensor< 3 > ( std::vector< double > const & values,
SpatialPosition const & pos ) const

Definition at line 288 of file CoordinateSystem.cpp.

290{
291 assert(values.size() == Dimension * Dimension ||
292 "Input vector has wrong dimension; expected 4 or 9 entries.");
293 auto const tensor =
294 Eigen::Map<Eigen::Matrix<double, Dimension, Dimension> const>(
295 values.data(), Dimension, Dimension);
296 return rotateTensor<Dimension>(tensor, pos);
297}
Eigen::Matrix< double, Dimension, Dimension > rotateTensor(std::vector< double > const &values, SpatialPosition const &pos) const

References rotateTensor().

Referenced by rotateTensor().

◆ transformation() [1/3]

template<>
Eigen::Matrix< double, 2, 2 > ParameterLib::CoordinateSystem::transformation ( SpatialPosition const & pos) const

Definition at line 131 of file CoordinateSystem.cpp.

150{
152 {
154 }
155
156 if (_base[2] != nullptr)
157 {
158 OGS_FATAL(
159 "The coordinate system is 3D but a transformation for 2D case is "
160 "requested.");
161 }
162
163 Eigen::Matrix<double, 2, 2> t;
164 t.col(0) = Eigen::Map<Eigen::Vector2d>(
165 (*_base[0])(0 /* time independent */, pos).data());
166 t.col(1) = Eigen::Map<Eigen::Vector2d>(
167 (*_base[1])(0 /* time independent */, pos).data());
168
170 return t;
171}
Eigen::Matrix< double, 2, 2 > getTransformationFromSingleBase2D(Parameter< double > const &unit_direction, SpatialPosition const &pos)
static void checkTransformationIsSON(Eigen::Matrix< double, Dim, Dim, Eigen::ColMajor, Dim, Dim > const &t)

References ParameterLib::checkNormalization(), ParameterLib::checkTransformationIsSON(), and ParameterLib::ParameterBase::name.

◆ transformation() [2/3]

template<>
Eigen::Matrix< double, 3, 3 > ParameterLib::CoordinateSystem::transformation ( SpatialPosition const & pos) const

Definition at line 173 of file CoordinateSystem.cpp.

224{
226 {
228 }
229
230 if (_base[2] == nullptr)
231 {
232 OGS_FATAL(
233 "The coordinate system is 2D but a transformation for 3D case is "
234 "requested.");
235 }
236
237 Eigen::Matrix<double, 3, 3> t;
238 t.col(0) = Eigen::Map<Eigen::Vector3d>(
239 (*_base[0])(0 /* time independent */, pos).data());
240 t.col(1) = Eigen::Map<Eigen::Vector3d>(
241 (*_base[1])(0 /* time independent */, pos).data());
242 t.col(2) = Eigen::Map<Eigen::Vector3d>(
243 (*_base[2])(0 /* time independent */, pos).data());
244
246 return t;
247}
Eigen::Matrix< double, 3, 3 > getTransformationFromSingleBase3D(Parameter< double > const &unit_direction, SpatialPosition const &pos)

References ParameterLib::checkNormalization(), ParameterLib::checkTransformationIsSON(), ParameterLib::ParameterBase::name, and ParameterLib::tolerance.

◆ transformation() [3/3]

template<int Dimension>
Eigen::Matrix< double, Dimension, Dimension > ParameterLib::CoordinateSystem::transformation ( SpatialPosition const & pos) const

◆ transformation_3d()

Eigen::Matrix< double, 3, 3 > ParameterLib::CoordinateSystem::transformation_3d ( SpatialPosition const & pos) const

Definition at line 265 of file CoordinateSystem.cpp.

267{
269 {
271 }
272
273 if (_base[2] != nullptr)
274 {
275 return transformation<3>(pos);
276 }
277
278 auto e0 = (*_base[0])(0 /* time independent */, pos);
279 auto e1 = (*_base[1])(0 /* time independent */, pos);
280 Eigen::Matrix<double, 3, 3> t = Eigen::Matrix<double, 3, 3>::Identity();
281 t.template topLeftCorner<2, 2>() << e0[0], e1[0], e0[1], e1[1];
282
284 return t;
285}
Eigen::Matrix< double, 3, 3 > transformationFromSingleBase_3d(SpatialPosition const &pos) const

References _base, _has_implicit_base, ParameterLib::checkTransformationIsSON(), transformation(), and transformationFromSingleBase_3d().

Referenced by MaterialPropertyLib::SaturationDependentSwelling::dValue(), and MaterialPropertyLib::SaturationDependentSwelling::value().

◆ transformationFromSingleBase_3d()

Eigen::Matrix< double, 3, 3 > ParameterLib::CoordinateSystem::transformationFromSingleBase_3d ( SpatialPosition const & pos) const
private

Definition at line 249 of file CoordinateSystem.cpp.

251{
252 // If base 2, which stores the unit direction vector, has three components:
253 if ((*_base[2])(0 /* time independent */, pos).size() == 3)
254 {
256 }
257
258 // If base 2, which stores the unit direction vector, has two components
259 Eigen::Matrix<double, 3, 3> t = Eigen::Matrix<double, 3, 3>::Identity();
260 t.template topLeftCorner<2, 2>() = transformation<2>(pos);
261
262 return t;
263}
constexpr int size(int const displacement_dim)
Vectorized tensor size for given displacement dimension.

References _base, ParameterLib::getTransformationFromSingleBase3D(), and transformation().

Referenced by transformation_3d().

Member Data Documentation

◆ _base

std::array<Parameter<double> const*, 3> ParameterLib::CoordinateSystem::_base
private

◆ _has_implicit_base

bool ParameterLib::CoordinateSystem::_has_implicit_base
private

Definition at line 86 of file CoordinateSystem.h.

Referenced by transformation_3d().


The documentation for this struct was generated from the following files: