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 addBlockParameters (MoFEM::Interface &, const std::string &block_name, int, const Range &block_entities, const std::vector< double > &block_data) override
 
MoFEMErrorCode setParams (FEMethod *fe_ptr, int gg) override
 
MoFEMErrorCode recordTape () override
 
- Public Member Functions inherited from MatOps::MatElasticImpl< DIM >
ForcesAndSourcesCore::UserDataOperatorcreateOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update) override
 
ForcesAndSourcesCore::UserDataOperatorcreateOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update)
 
ForcesAndSourcesCore::UserDataOperatorcreateOp (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< doublecommandLineParameters
 

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

◆ addBlockParameters()

template<int DIM>
MoFEMErrorCode MatOps::MatStVenantKirchhoff< DIM >::addBlockParameters ( MoFEM::Interface ,
const std::string &  block_name,
int  ,
const Range block_entities,
const std::vector< double > &  block_data 
)
inlineoverridevirtual

Reimplemented from MatOps::PhysicalEquations.

Definition at line 73 of file MatStVenantKirchhoff.cpp.

75 {
77
78 if (block_data.size() < 2) {
79 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
80 "StVenantKirchhoff block %s has %d attributes; expected E "
81 "and nu",
82 block_name.c_str(), static_cast<int>(block_data.size()));
83 }
84 std::vector<double> params = {block_data[0], block_data[1]};
85
86 A::paramVecByRange.push_back({block_entities, params});
87
88 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock for StVenantKirchhoff")
89 << block_name << " E = " << params[0] << " nu = " << params[1];
90
92 }
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
Definition MatOps.hpp:162

◆ 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 if (!A::paramVecByRange.empty()) {
27 }
28
29 PetscOptionsBegin(PETSC_COMM_WORLD, "stvenant_", "", "none");
30 CHKERR PetscOptionsScalar("-young_modulus", "Young modulus", "", E, &E,
31 PETSC_NULLPTR);
32 CHKERR PetscOptionsScalar("-poisson_ratio", "poisson ratio", "", nu, &nu,
33 PETSC_NULLPTR);
34 PetscOptionsEnd();
35
36 std::string block_name = "MAT_STVENANTKIRCHHOFF";
37
38 for (auto &m :
39
40 m_field_ptr->getInterface<MeshsetsManager>()->
41
42 getCubitMeshsetPtr(
43 std::regex((boost::format("%s(.*)") % block_name).str()))
44
45 ) {
46
47 std::vector<double> block_data;
48 CHKERR m->getAttributes(block_data);
49 auto get_block_ents = [&]() {
50 Range ents;
51 CHK_MOAB_THROW(m_field_ptr->get_moab().get_entities_by_handle(
52 m->meshset, ents, true),
53 "can not get block entities");
54 return ents;
55 };
56
57 CHKERR addBlockParameters(*m_field_ptr, m->getName(),
58 m->getMeshsetId(), get_block_ents(),
59 block_data);
60 }
61
62 if (A::paramVecByRange.empty()) {
64 MOFEM_TAG_AND_LOG("WORLD", Sev::inform,
65 "Command line StVenantKirchhoff parameters")
66 << "E = " << E << " nu = " << nu;
67 }
68
70 };
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
#define CHKERR
Inline error check.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'm', 3 > m
MoFEMErrorCode addBlockParameters(MoFEM::Interface &, const std::string &block_name, int, const Range &block_entities, const std::vector< double > &block_data) override
std::vector< double > commandLineParameters
virtual moab::Interface & get_moab()=0

◆ recordTape()

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

Implements MatOps::PhysicalEquations.

Definition at line 114 of file MatStVenantKirchhoff.cpp.

114 {
116
117 A::matOpsDataPtr->insertCommonData("grad", MatrixDouble());
118 A::matOpsDataPtr->insertCommonData("P", MatrixDouble());
119 A::matOpsDataPtr->insertCommonData("P_dF", MatrixDouble());
120
121 A::matOpsDataPtr->insertActiveData("F", MatrixDouble());
122 A::matOpsDataPtr->insertDependentData("P", MatrixDouble());
123 A::matOpsDataPtr->insertDependentDerivativesData("P_dF", MatrixDouble());
124
125 A::matOpsDataPtr->getActiveDataPtr("F")->resize(DIM, DIM, false);
126 A::matOpsDataPtr->getDependentDataPtr("P")->resize(DIM, DIM, false);
127
128
129 auto t_F = getFTensor2FromPtr<DIM, DIM>(
130 A::matOpsDataPtr->getActiveDataPtr("F")->data().data());
131 auto t_P = getFTensor2FromPtr<DIM, DIM>(
132 A::matOpsDataPtr->getDependentDataPtr("P")->data().data());
133
135
136 FTENSOR_INDEX(DIM, i);
137 FTENSOR_INDEX(DIM, j);
138 FTENSOR_INDEX(DIM, I);
139 FTENSOR_INDEX(DIM, J);
140
141 t_F(i, J) = 0;
142
148
149 adouble trE;
150
151 trace_on(A::tAg);
152 auto p_E = mkparam(E);
153 auto p_nu = mkparam(nu);
154
155 const auto calc_lambda = [](const auto &young_modulus,
156 const auto &poisson_ratio) {
157 const auto nu_value = 1 * poisson_ratio;
158 return (young_modulus * nu_value) /
159 ((1. + nu_value) * (1. - 2. * nu_value));
160 };
161
162 const auto calc_mu = [](const auto &young_modulus,
163 const auto &poisson_ratio) {
164 const auto nu_value = 1 * poisson_ratio;
165 return 0.5 * (young_modulus / (1. + nu_value));
166 };
167
168 auto lambda = calc_lambda(p_E, p_nu);
169 auto mu = calc_mu(p_E, p_nu);
170
171 ta_F(i, J) <<= t_F(i, J);
172 // assume that gradient from approximated displacement, that why we add diagonal
174 ta_F(i, J) += t_kd(i, J);
175 }
176
177 ta_C(I, J) = ta_F(i, I) * ta_F(i, J);
178 ta_E(I, J) = (ta_C(I, J) - t_kd(I, J))/2.;
179
180 // Stress Piola II
181 trE = ta_E(I, I);
182 ta_S(I, J) = (2 * mu) * ta_E(I, J) + lambda * trE * t_kd(I, J);
183 // Stress Piola I
184 ta_P(i, J) = ta_F(i, I) * ta_S(I, J);
185
186 ta_P(i, I) >>= t_P(i, I);
187
188 trace_off();
189
191 }
#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:164
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 94 of file MatStVenantKirchhoff.cpp.

94 {
95 (void)gg;
96 const auto ent = fe_ptr->getFEEntityHandle();
97 for (auto &[range, param_vec] : A::paramVecByRange) {
98 if (std::find(range.begin(), range.end(), ent) != range.end()) {
99 set_param_vec(A::tAg, param_vec.size(), param_vec.data());
100 return 0;
101 }
102 }
103 // command line overrides block parameters
104 if (!commandLineParameters.empty()) {
105 set_param_vec(A::tAg, commandLineParameters.size(),
106 commandLineParameters.data());
107 return 0;
108 }
109 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
110 "StVenantKirchhoff material parameters not found for entity %lu",
111 static_cast<unsigned long>(ent));
112 }

Member Data Documentation

◆ commandLineParameters

template<int DIM>
std::vector<double> MatOps::MatStVenantKirchhoff< DIM >::commandLineParameters
protected

Definition at line 196 of file MatStVenantKirchhoff.cpp.

◆ E

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

Definition at line 194 of file MatStVenantKirchhoff.cpp.

◆ nu

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

Definition at line 195 of file MatStVenantKirchhoff.cpp.


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