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

Public Types

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

Public Member Functions

ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update) override
 
MoFEMErrorCode getOptions (MoFEM::Interface *m_field_ptr=nullptr) override
 
MoFEMErrorCode setParams (FEMethod *fe_ptr, int gg) override
 
MoFEMErrorCode recordTape () 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)
 
 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 setParams (FEMethod *fe_ptr, int gg)=0
 
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 K = 1e-6
 
std::vector< doubledefaultMaterialParameters = {K}
 

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
 

Detailed Description

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

Definition at line 21 of file MatHuHu.cpp.

Member Typedef Documentation

◆ A

template<int DIM>
using MatOps::MatHuHu< DIM >::A = PhysicalEquations

Definition at line 23 of file MatHuHu.cpp.

Member Function Documentation

◆ createOp() [1/3]

ForcesAndSourcesCore::UserDataOperator * MatOps::MatHuHu< 3 >::createOp ( boost::shared_ptr< PhysicalEquations physical_ptr,
bool  eval_stress,
bool  eval_tangent,
bool  update 
)
virtual

Implements MatOps::PhysicalEquations.

Definition at line 291 of file MatHuHu.cpp.

292 {
293 using EleOp = ForcesAndSourcesCore::UserDataOperator;
294 return createOpImpl<3, EleOp>(physical_ptr, eval_stress, eval_tangent,
295 update);
296}

◆ createOp() [2/3]

ForcesAndSourcesCore::UserDataOperator * MatOps::MatHuHu< 2 >::createOp ( boost::shared_ptr< PhysicalEquations physical_ptr,
bool  eval_stress,
bool  eval_tangent,
bool  update 
)
virtual

Implements MatOps::PhysicalEquations.

Definition at line 300 of file MatHuHu.cpp.

301 {
302 using EleOp = ForcesAndSourcesCore::UserDataOperator;
303 return createOpImpl<2, EleOp>(physical_ptr, eval_stress, eval_tangent,
304 update);
305}

◆ createOp() [3/3]

template<int DIM>
ForcesAndSourcesCore::UserDataOperator * MatOps::MatHuHu< DIM >::createOp ( boost::shared_ptr< PhysicalEquations physical_ptr,
bool  eval_stress,
bool  eval_tangent,
bool  update 
)
overridevirtual

◆ getOptions()

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

Implements MatOps::PhysicalEquations.

Definition at line 28 of file MatHuHu.cpp.

28 {
30 MOFEM_LOG_CHANNEL("WORLD");
31
32 PetscOptionsBegin(PETSC_COMM_WORLD, "huhu_", "", "none");
33 CHKERR PetscOptionsScalar("-K", "Bulk modulus K", "", K, &K, PETSC_NULLPTR);
34 PetscOptionsEnd();
35
36 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "Default HuHu parameters:")
37 << " K = " << K;
39
40 std::string block_name = "MAT_HUHU";
41
42 for (auto &m :
43
44 m_field_ptr->getInterface<MeshsetsManager>()->
45
46 getCubitMeshsetPtr(
47 std::regex((boost::format("%s(.*)") % block_name).str()))
48
49 ) {
50
51 std::vector<double> block_data;
52 CHKERR m->getAttributes(block_data);
53 if (block_data.size() < 1) {
54 block_data.push_back(
55 K); // Use default K if not provided in block attributes
56 }
57 auto get_block_ents = [&]() {
58 Range ents;
59 CHK_MOAB_THROW(m_field_ptr->get_moab().get_entities_by_handle(
60 m->meshset, ents, true),
61 "can not get block entities");
62 return ents;
63 };
64
65 A::paramVecByRange.push_back({get_block_ents(), {block_data[0]}});
66
67 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock for HuHu")
68 << *m << " K = " << block_data[0];
69 }
70
72 };
#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 ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
#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
Definition MatHuHu.cpp:132
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
Definition MatOps.hpp:152
virtual moab::Interface & get_moab()=0
Interface for managing meshsets containing materials and boundary conditions.

◆ PhysicalEquations() [1/2]

template<int DIM>
MatOps::PhysicalEquations::PhysicalEquations ( )
delete

◆ PhysicalEquations() [2/2]

template<int DIM>
MatOps::PhysicalEquations::PhysicalEquations ( boost::shared_ptr< MatOpsData mat_ops_data_ptr,
int  tag,
boost::shared_ptr< std::map< int, Range > >  tag_vs_range_ptr = nullptr 
)
inline

Definition at line 114 of file MatOps.hpp.

117 : matOpsDataPtr(mat_ops_data_ptr), tAg(tag),
118 tagVsRangePtr(tag_vs_range_ptr) {}
boost::shared_ptr< std::map< int, Range > > tagVsRangePtr
Definition MatOps.hpp:151
boost::shared_ptr< MatOpsData > matOpsDataPtr
Definition MatOps.hpp:154

◆ recordTape()

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

Implements MatOps::PhysicalEquations.

Definition at line 88 of file MatHuHu.cpp.

88 {
90
91 A::matOpsDataPtr->insertCommonData("grad", MatrixDouble(DIM * DIM, 1));
92 A::matOpsDataPtr->insertCommonData("k", MatrixDouble(1, 1));
93 A::matOpsDataPtr->insertCommonData("k_dF", MatrixDouble(DIM * DIM, 1));
94
95 A::matOpsDataPtr->insertActiveData("F", MatrixDouble(DIM, DIM));
96 A::matOpsDataPtr->insertDependentData("k", MatrixDouble(1, 1));
97 A::matOpsDataPtr->insertDependentDerivativesData("k_dF",
98 MatrixDouble(DIM, DIM));
99
100 auto t_F = getFTensor2FromPtr<DIM, DIM>(
101 A::matOpsDataPtr->getActiveDataPtr("F")->data().data());
102 auto k = (*A::matOpsDataPtr->getDependentDataPtr("k"))(0, 0);
103
105
106 FTENSOR_INDEX(DIM, i);
107 FTENSOR_INDEX(DIM, j);
108 FTENSOR_INDEX(DIM, I);
109 FTENSOR_INDEX(DIM, J);
110
111 t_F(i, J) = t_kd(i, J);
112
114 adouble ta_k;
115
116 adouble det_aF;
118
119 trace_on(A::tAg);
120 auto p_K = mkparam(K);
121 ta_F(i, J) <<= t_F(i, J);
122 ta_k = p_K;
123 ta_k >>= k;
124
125 trace_off();
126
128 }
#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
FTensor::Index< 'k', 3 > k
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
constexpr IntegrationType I

◆ setParams()

template<int DIM>
MoFEMErrorCode MatOps::MatHuHu< DIM >::setParams ( FEMethod fe_ptr,
int  gg 
)
inlineoverride

Definition at line 74 of file MatHuHu.cpp.

74 {
75 (void)gg;
76 const auto ent = fe_ptr->getFEEntityHandle();
77 for (auto &[range, param_vec] : A::paramVecByRange) {
78 if (std::find(range.begin(), range.end(), ent) != range.end()) {
79 set_param_vec(A::tAg, param_vec.size(), param_vec.data());
80 return 0;
81 }
82 }
83 set_param_vec(A::tAg, defaultMaterialParameters.size(),
85 return 0;
86 }
PhysicalEquations A
Definition MatHuHu.cpp:23
EntityHandle getFEEntityHandle() const
Get the entity handle of the current finite element.

Member Data Documentation

◆ defaultMaterialParameters

template<int DIM>
std::vector<double> MatOps::MatHuHu< DIM >::defaultMaterialParameters = {K}
protected

Definition at line 132 of file MatHuHu.cpp.

132{K};

◆ K

template<int DIM>
double MatOps::MatHuHu< DIM >::K = 1e-6
protected

Definition at line 131 of file MatHuHu.cpp.


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