v0.16.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
MatOps::MatStVenantKirchhoff< DIM > Struct Template Reference
Inheritance diagram for MatOps::MatStVenantKirchhoff< DIM >:
[legend]
Collaboration diagram for MatOps::MatStVenantKirchhoff< DIM >:
[legend]

Public Types

using A = MatElasticImpl< DIM >
 
- Public Types inherited from MatOps::PhysicalEquations
using HookFunction = std::function< MoFEMErrorCode(boost::shared_ptr< MatOpsData >, int, EntityHandle, int)>
 

Public Member Functions

MoFEMErrorCode getOptions (MoFEM::Interface *m_field_ptr=nullptr) override
 
MoFEMErrorCode setParams (FEMethod *fe_ptr, int gg) override
 
MoFEMErrorCode recordTape () override
 
- Public Member Functions inherited from MatOps::MatElasticImpl< DIM >
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update) override
 
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update)
 
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update)
 
- Public Member Functions inherited from MatOps::MatElastic
 PhysicalEquations ()=delete
 
 PhysicalEquations (boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag, boost::shared_ptr< std::map< int, Range > > tag_vs_range_ptr=nullptr)
 
- Public Member Functions inherited from MatOps::PhysicalEquations
 PhysicalEquations ()=delete
 
 PhysicalEquations (boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag, boost::shared_ptr< std::map< int, Range > > tag_vs_range_ptr=nullptr)
 
virtual ~PhysicalEquations ()=default
 
virtual MoFEMErrorCode evaluateVariable (int tag, EntityHandle entity, int gg)
 
virtual MoFEMErrorCode evaluateDerivatives (int tag, EntityHandle entity, int gg)
 
virtual MoFEMErrorCode updateState (int tag, EntityHandle entity, int gg)
 

Protected Attributes

double E = 1
 
double nu = 0.25
 
std::vector< doubledefaultMaterialParameters = {E, nu}
 

Additional Inherited Members

- Public Attributes inherited from MatOps::PhysicalEquations
HookFunction hookEvaluateVariable = AdolCEvaluation::evaluateVariable
 
HookFunction hookEvaluateDerivatives = AdolCEvaluation::evaluateDerivatives
 
HookFunction hookUpdateState = AdolCEvaluation::evaluateVariable
 
int tAg
 
boost::shared_ptr< std::map< int, Range > > tagVsRangePtr
 
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
 
boost::shared_ptr< MatOpsDatamatOpsDataPtr
 
- Static Public Attributes inherited from MatOps::MatElastic
static bool useDeformationGradient
 

Detailed Description

template<int DIM>
struct MatOps::MatStVenantKirchhoff< DIM >

Definition at line 15 of file MatStVenantKirchhoff.cpp.

Member Typedef Documentation

◆ A

template<int DIM>
using MatOps::MatStVenantKirchhoff< DIM >::A = MatElasticImpl<DIM>

Definition at line 18 of file MatStVenantKirchhoff.cpp.

Member Function Documentation

◆ getOptions()

template<int DIM>
MoFEMErrorCode MatOps::MatStVenantKirchhoff< DIM >::getOptions ( MoFEM::Interface m_field_ptr = nullptr)
inlineoverridevirtual

Implements MatOps::PhysicalEquations.

Definition at line 20 of file MatStVenantKirchhoff.cpp.

20 {
22
23 MOFEM_LOG_CHANNEL("WORLD");
24
25 PetscOptionsBegin(PETSC_COMM_WORLD, "stvenant_", "", "none");
26 CHKERR PetscOptionsScalar("-young_modulus", "Young modulus", "", E, &E,
27 PETSC_NULLPTR);
28 CHKERR PetscOptionsScalar("-poisson_ratio", "poisson ratio", "", nu, &nu,
29 PETSC_NULLPTR);
30 PetscOptionsEnd();
31
32 MOFEM_TAG_AND_LOG("WORLD", Sev::inform,
33 "Default StVenantKirchhoff parameters:")
34 << " E = " << E << " nu = " << nu;
36
37 std::string block_name = "MAT_STVENANTKIRCHHOFF";
38
39 for (auto &m :
40
41 m_field_ptr->getInterface<MeshsetsManager>()->
42
43 getCubitMeshsetPtr(
44 std::regex((boost::format("%s(.*)") % block_name).str()))
45
46 ) {
47
48 std::vector<double> block_data;
49 CHKERR m->getAttributes(block_data);
50 if (block_data.size() < 2) {
52 "Expected that block has two attribute");
53 }
54 auto get_block_ents = [&]() {
55 Range ents;
56 CHK_MOAB_THROW(m_field_ptr->get_moab().get_entities_by_handle(
57 m->meshset, ents, true),
58 "can not get block entities");
59 return ents;
60 };
61
62 A::paramVecByRange.push_back(
63 {get_block_ents(), {block_data[0], block_data[1]}});
64
65 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock for StVenantKirchhoff")
66 << *m << " E = " << block_data[0] << " nu = " << block_data[1];
67 }
68
70 };
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#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 CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'm', 3 > m
std::vector< double > defaultMaterialParameters
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
Definition MatOps.hpp:152
virtual moab::Interface & get_moab()=0

◆ recordTape()

template<int DIM>
MoFEMErrorCode MatOps::MatStVenantKirchhoff< DIM >::recordTape ( )
inlineoverridevirtual

Implements MatOps::PhysicalEquations.

Definition at line 86 of file MatStVenantKirchhoff.cpp.

86 {
88
89 A::matOpsDataPtr->insertCommonData("grad", MatrixDouble());
90 A::matOpsDataPtr->insertCommonData("P", MatrixDouble());
91 A::matOpsDataPtr->insertCommonData("P_dF", MatrixDouble());
92
93 A::matOpsDataPtr->insertActiveData("F", MatrixDouble());
94 A::matOpsDataPtr->insertDependentData("P", MatrixDouble());
95 A::matOpsDataPtr->insertDependentDerivativesData("P_dF", MatrixDouble());
96
97 A::matOpsDataPtr->getActiveDataPtr("F")->resize(DIM, DIM, false);
98 A::matOpsDataPtr->getDependentDataPtr("P")->resize(DIM, DIM, false);
99
100
101 auto t_F = getFTensor2FromPtr<DIM, DIM>(
102 A::matOpsDataPtr->getActiveDataPtr("F")->data().data());
103 auto t_P = getFTensor2FromPtr<DIM, DIM>(
104 A::matOpsDataPtr->getDependentDataPtr("P")->data().data());
105
107
108 FTENSOR_INDEX(DIM, i);
109 FTENSOR_INDEX(DIM, j);
110 FTENSOR_INDEX(DIM, I);
111 FTENSOR_INDEX(DIM, J);
112
113 t_F(i, J) = 0;
114
120
121 adouble trE;
122
123 trace_on(A::tAg);
124 auto p_E = mkparam(E);
125 auto p_nu = mkparam(nu);
126
127 const auto calc_lambda = [](const auto &young_modulus,
128 const auto &poisson_ratio) {
129 const auto nu_value = 1 * poisson_ratio;
130 return (young_modulus * nu_value) /
131 ((1. + nu_value) * (1. - 2. * nu_value));
132 };
133
134 const auto calc_mu = [](const auto &young_modulus,
135 const auto &poisson_ratio) {
136 const auto nu_value = 1 * poisson_ratio;
137 return 0.5 * (young_modulus / (1. + nu_value));
138 };
139
140 auto lambda = calc_lambda(p_E, p_nu);
141 auto mu = calc_mu(p_E, p_nu);
142
143 ta_F(i, J) <<= t_F(i, J);
144 // assume that gradient from approximated displacement, that why we add diagonal
146 ta_F(i, J) += t_kd(i, J);
147 }
148
149 ta_C(I, J) = ta_F(i, I) * ta_F(i, J);
150 ta_E(I, J) = (ta_C(I, J) - t_kd(I, J))/2.;
151
152 // Stress Piola II
153 trE = ta_E(I, I);
154 ta_S(I, J) = (2 * mu) * ta_E(I, J) + lambda * trE * t_kd(I, J);
155 // Stress Piola I
156 ta_P(i, J) = ta_F(i, I) * ta_S(I, J);
157
158 ta_P(i, I) >>= t_P(i, I);
159
160 trace_off();
161
163 }
#define FTENSOR_INDEX(DIM, I)
Kronecker Delta class.
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
static double lambda
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
FTensor::Index< 'j', 3 > j
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
constexpr IntegrationType I
static bool useDeformationGradient
boost::shared_ptr< MatOpsData > matOpsDataPtr
Definition MatOps.hpp:154
double young_modulus
Young modulus.
Definition plastic.cpp:126
double poisson_ratio
Poisson ratio.
Definition plastic.cpp:127

◆ setParams()

template<int DIM>
MoFEMErrorCode MatOps::MatStVenantKirchhoff< DIM >::setParams ( FEMethod fe_ptr,
int  gg 
)
inlineoverridevirtual

Implements MatOps::PhysicalEquations.

Definition at line 72 of file MatStVenantKirchhoff.cpp.

72 {
73 (void)gg;
74 const auto ent = fe_ptr->getFEEntityHandle();
75 for (auto &[range, param_vec] : A::paramVecByRange) {
76 if (std::find(range.begin(), range.end(), ent) != range.end()) {
77 set_param_vec(A::tAg, param_vec.size(), param_vec.data());
78 return 0;
79 }
80 }
81 set_param_vec(A::tAg, defaultMaterialParameters.size(),
83 return 0;
84 }

Member Data Documentation

◆ defaultMaterialParameters

template<int DIM>
std::vector<double> MatOps::MatStVenantKirchhoff< DIM >::defaultMaterialParameters = {E, nu}
protected

Definition at line 168 of file MatStVenantKirchhoff.cpp.

168{E, nu};

◆ E

template<int DIM>
double MatOps::MatStVenantKirchhoff< DIM >::E = 1
protected

Definition at line 166 of file MatStVenantKirchhoff.cpp.

◆ nu

template<int DIM>
double MatOps::MatStVenantKirchhoff< DIM >::nu = 0.25
protected

Definition at line 167 of file MatStVenantKirchhoff.cpp.


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