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

Public Types

using A = AdolCElasticImpl< DIM >
 

Public Member Functions

MoFEMErrorCode getOptions (MoFEM::Interface *m_field_ptr=nullptr) override
 
MoFEMErrorCode setParams (EntityHandle ent, int gg) override
 
MoFEMErrorCode recordTape () override
 
- Public Member Functions inherited from AdolCOps::AdolCElasticImpl< DIM >
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent) override
 
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent)
 
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent)
 
 PhysicalEquations ()=delete
 
 PhysicalEquations (boost::shared_ptr< ADolCData > adolc_data_ptr, int tag, boost::shared_ptr< std::map< int, Range > > tag_vs_range_ptr=nullptr)
 
- Public Member Functions inherited from AdolCOps::PhysicalEquations
 PhysicalEquations ()=delete
 
 PhysicalEquations (boost::shared_ptr< ADolCData > adolc_data_ptr, int tag, boost::shared_ptr< std::map< int, Range > > tag_vs_range_ptr=nullptr)
 
virtual ~PhysicalEquations ()=default
 
MoFEMErrorCode setActiveContinuousVector ()
 
MoFEMErrorCode setDependentContinuousVector ()
 
MoFEMErrorCode setDependentDerivativesContinuousVector ()
 
MoFEMErrorCode getActiveContinuousVector ()
 
MoFEMErrorCode getDependentContinuousVector ()
 
MoFEMErrorCode getDependentDerivativesContinuousVector ()
 

Protected Attributes

double C10 = 1
 
double K = 1
 
std::vector< doubledefaultMaterialParameters = {C10, K}
 

Additional Inherited Members

- Public Attributes inherited from AdolCOps::PhysicalEquations
int tAg
 
boost::shared_ptr< std::map< int, Range > > tagVsRangePtr
 
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
 
boost::shared_ptr< ADolCDataadolcDataPtr
 
std::vector< doubleactiveVariables
 
std::vector< doubledependentVariables
 
std::vector< doubledependentVariablesDerivatives
 

Detailed Description

template<int DIM>
struct AdolCOps::AdolCNeohookean< DIM >

Definition at line 14 of file AdolCNeohookean.cpp.

Member Typedef Documentation

◆ A

template<int DIM>
using AdolCOps::AdolCNeohookean< DIM >::A = AdolCElasticImpl<DIM>

Definition at line 17 of file AdolCNeohookean.cpp.

Member Function Documentation

◆ getOptions()

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

Implements AdolCOps::PhysicalEquations.

Definition at line 19 of file AdolCNeohookean.cpp.

19 {
21
22 MOFEM_LOG_CHANNEL("WORLD");
23
24 PetscOptionsBegin(PETSC_COMM_WORLD, "neo_hookean_", "", "none");
25 CHKERR PetscOptionsScalar("-c10", "C10", "", C10, &C10, PETSC_NULLPTR);
26 CHKERR PetscOptionsScalar("-K", "Bulk modulus K", "", K, &K, PETSC_NULLPTR);
27 PetscOptionsEnd();
28
29 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "Default Neohookean parameters:")
30 << " C10 = " << C10 << " K = " << K;
32
33 std::string block_name = "MAT_NEOHOOKEAN";
34
35 for (auto &m :
36
37 m_field_ptr->getInterface<MeshsetsManager>()->
38
39 getCubitMeshsetPtr(
40 std::regex((boost::format("%s(.*)") % block_name).str()))
41
42 ) {
43
44 std::vector<double> block_data;
45 CHKERR m->getAttributes(block_data);
46 if (block_data.size() < 2) {
48 "Expected that block has two attribute");
49 }
50 auto get_block_ents = [&]() {
51 Range ents;
52 CHK_MOAB_THROW(m_field_ptr->get_moab().get_entities_by_handle(
53 m->meshset, ents, true),
54 "can not get block entities");
55 return ents;
56 };
57
58 A::paramVecByRange.push_back(
59 {get_block_ents(), {block_data[0], block_data[1]}});
60
61 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock for Neohookean")
62 << *m << " C10 = " << block_data[0] << " K = " << block_data[1];
63 }
64
66 };
#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 AdolCOps.hpp:165
virtual moab::Interface & get_moab()=0

◆ recordTape()

template<int DIM>
MoFEMErrorCode AdolCOps::AdolCNeohookean< DIM >::recordTape ( )
inlineoverridevirtual

Implements AdolCOps::PhysicalEquations.

Definition at line 80 of file AdolCNeohookean.cpp.

80 {
82
83 A::adolcDataPtr->insertCommonData("grad", MatrixDouble(DIM * DIM, 1));
84 A::adolcDataPtr->insertCommonData("P", MatrixDouble(DIM * DIM, 1));
85 A::adolcDataPtr->insertCommonData("P_dF",
86 MatrixDouble(DIM * DIM, DIM * DIM));
87
88 A::adolcDataPtr->insertActiveData("F", MatrixDouble(DIM, DIM));
89 A::adolcDataPtr->insertDependentData("P", MatrixDouble(DIM, DIM));
90 A::adolcDataPtr->insertDependentDerivativesData(
91 "P_dF", MatrixDouble(DIM * DIM, DIM * DIM));
92
93 auto t_F = getFTensor2FromPtr<DIM, DIM>(
94 A::adolcDataPtr->getActiveDataPtr("F")->data().data());
95 auto t_P = getFTensor2FromPtr<DIM, DIM>(
96 A::adolcDataPtr->getDependentDataPtr("P")->data().data());
97
99
100 FTENSOR_INDEX(DIM, i);
101 FTENSOR_INDEX(DIM, j);
102 FTENSOR_INDEX(DIM, I);
103 FTENSOR_INDEX(DIM, J);
104
105 t_F(i, J) = 0;
106
109
110 adouble det_aF;
112
113 trace_on(A::tAg);
114 auto p_c10 = mkparam(C10);
115 auto p_K = mkparam(K);
116
117 ta_F(i, J) <<= t_F(i, J);
118 // assume that gradient from approximated displacement, that why we add diagonal
119 ta_F(i, J) += t_kd(i, J);
120
121 det_aF = determinantTensor(ta_F);
122 CHKERR invertTensor(ta_F, det_aF, ta_invF);
123
124 ta_P(i, I) = 2. * p_c10 * (ta_F(i, I) - ta_invF(i, I)) +
125 p_K * log(det_aF) * ta_invF(i, I);
126
127 ta_P(i, I) >>= t_P(i, I);
128
129 trace_off();
130
132 }
#define FTENSOR_INDEX(DIM, I)
Kronecker Delta class.
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
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
boost::shared_ptr< ADolCData > adolcDataPtr
Definition AdolCOps.hpp:167

◆ setParams()

template<int DIM>
MoFEMErrorCode AdolCOps::AdolCNeohookean< DIM >::setParams ( EntityHandle  ent,
int  gg 
)
inlineoverridevirtual

Implements AdolCOps::PhysicalEquations.

Definition at line 68 of file AdolCNeohookean.cpp.

68 {
69 for (auto &[range, param_vec] : A::paramVecByRange) {
70 if (std::find(range.begin(), range.end(), ent) != range.end()) {
71 set_param_vec(A::tAg, param_vec.size(), param_vec.data());
72 return 0;
73 }
74 }
75 set_param_vec(A::tAg, defaultMaterialParameters.size(),
77 return 0;
78 }
AdolCElasticImpl< DIM > A

Member Data Documentation

◆ C10

template<int DIM>
double AdolCOps::AdolCNeohookean< DIM >::C10 = 1
protected

Definition at line 135 of file AdolCNeohookean.cpp.

◆ defaultMaterialParameters

template<int DIM>
std::vector<double> AdolCOps::AdolCNeohookean< DIM >::defaultMaterialParameters = {C10, K}
protected

Definition at line 137 of file AdolCNeohookean.cpp.

137{C10, K};

◆ K

template<int DIM>
double AdolCOps::AdolCNeohookean< DIM >::K = 1
protected

Definition at line 136 of file AdolCNeohookean.cpp.


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