v0.16.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
MatOpsExampleGeneric Struct Reference

#include "tutorials/vec-2_nonlinear_elasticity/src/MatOpsExampleGeneric.hpp"

Collaboration diagram for MatOpsExampleGeneric:
[legend]

Public Member Functions

 MatOpsExampleGeneric ()
 
auto getMaterialStiffness ()
 

Static Public Member Functions

static MoFEMErrorCode hookEvaluateVariable (boost::shared_ptr< MatOps::MatOpsData > mat_ops_data_ptr, int, EntityHandle, int)
 
static MoFEMErrorCode hookEvaluateDerivatives (boost::shared_ptr< MatOps::MatOpsData > mat_ops_data_ptr, int, EntityHandle, int)
 
static MoFEMErrorCode hookUpdateState (boost::shared_ptr< MatOps::MatOpsData >, int, EntityHandle, int)
 

Static Protected Attributes

static boost::shared_ptr< MatrixDouble > matDPtr
 

Detailed Description

Examples
mofem/tutorials/vec-2_nonlinear_elasticity/src/NonlinearElasticExample.hpp.

Definition at line 12 of file MatOpsExampleGeneric.hpp.

Constructor & Destructor Documentation

◆ MatOpsExampleGeneric()

MatOpsExampleGeneric::MatOpsExampleGeneric ( )
inline

Toggle for plane strain.

Note
If SPACE_DIM == 2 and is_plane_strain is true, the code uses the plane strain elasticity tensor.
If SPACE_DIM == 2 and is_plane_strain is false, the code uses the plane stress elasticity tensor.

Definition at line 13 of file MatOpsExampleGeneric.hpp.

13 {
14 constexpr auto size_symm = (SPACE_DIM * (SPACE_DIM + 1)) / 2;
15 matDPtr = boost::make_shared<MatrixDouble>(1, size_symm * size_symm);
16 auto set_material_stiffness = [this]() {
23 double A = 1.;
24 /**
25 * @brief Toggle for plane strain.
26 *
27 * @note If `SPACE_DIM == 2` and `is_plane_strain` is true, the code uses the
28 * plane strain elasticity tensor.
29 * @note If `SPACE_DIM == 2` and `is_plane_strain` is false, the code uses the
30 * plane stress elasticity tensor.
31 */
32
33 constexpr double bulk_modulus_K = 10;
34 constexpr double shear_modulus_G = 1;
35 if (SPACE_DIM == 2 /*&& !is_plane_strain*/) {
36 A = 2 * shear_modulus_G /
37 (bulk_modulus_K + (4. / 3.) * shear_modulus_G);
38 }
39 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*matDPtr);
40 t_D(i, j, k, l) = 2 * shear_modulus_G * ((t_kd(i, k) ^ t_kd(j, l)) / 4.) +
41 A * (bulk_modulus_K - (2. / 3.) * shear_modulus_G) *
42 t_kd(i, j) * t_kd(k, l);
44 };
45 CHK_THROW_MESSAGE(set_material_stiffness(),
46 "Failed to set material stiffness");
47 }
#define FTENSOR_INDEX(DIM, I)
constexpr int SPACE_DIM
Kronecker Delta class symmetric.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
double bulk_modulus_K
double shear_modulus_G
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
constexpr AssemblyType A
static boost::shared_ptr< MatrixDouble > matDPtr
constexpr auto size_symm
Definition plastic.cpp:42

Member Function Documentation

◆ getMaterialStiffness()

auto MatOpsExampleGeneric::getMaterialStiffness ( )
inline

Definition at line 49 of file MatOpsExampleGeneric.hpp.

49{ return matDPtr; }

◆ hookEvaluateDerivatives()

static MoFEMErrorCode MatOpsExampleGeneric::hookEvaluateDerivatives ( boost::shared_ptr< MatOps::MatOpsData mat_ops_data_ptr,
int  ,
EntityHandle  ,
int   
)
inlinestatic
Examples
mofem/tutorials/vec-2_nonlinear_elasticity/src/NonlinearElasticExample.hpp.

Definition at line 68 of file MatOpsExampleGeneric.hpp.

69 {
70 auto t_dP = getFTensor4FromPtr<SPACE_DIM, SPACE_DIM, SPACE_DIM, SPACE_DIM>(
71 mat_ops_data_ptr->getDependentDerivativesDataPtr("P_dF")->data().data());
76 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*matDPtr);
77 t_dP(i, J, k, L) = t_D(i, J, k, L);
78 return 0;
79 };
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30

◆ hookEvaluateVariable()

static MoFEMErrorCode MatOpsExampleGeneric::hookEvaluateVariable ( boost::shared_ptr< MatOps::MatOpsData mat_ops_data_ptr,
int  ,
EntityHandle  ,
int   
)
inlinestatic
Examples
mofem/tutorials/vec-2_nonlinear_elasticity/src/NonlinearElasticExample.hpp.

Definition at line 52 of file MatOpsExampleGeneric.hpp.

53 {
54 auto t_grad = getFTensor2FromPtr<SPACE_DIM, SPACE_DIM>(
55 mat_ops_data_ptr->getActiveDataPtr("F")->data().data());
56 auto t_P = getFTensor2FromPtr<SPACE_DIM, SPACE_DIM>(
57 mat_ops_data_ptr->getDependentDataPtr("P")->data().data());
62 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*matDPtr);
63 t_P(i, J) = t_D(i, J, k, L) * t_grad(k, L);
64 return 0;
65 }

◆ hookUpdateState()

static MoFEMErrorCode MatOpsExampleGeneric::hookUpdateState ( boost::shared_ptr< MatOps::MatOpsData ,
int  ,
EntityHandle  ,
int   
)
inlinestatic

Member Data Documentation

◆ matDPtr

boost::shared_ptr<MatrixDouble> MatOpsExampleGeneric::matDPtr
inlinestaticprotected

Definition at line 87 of file MatOpsExampleGeneric.hpp.


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