v0.15.5
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
AdolCOps::AdolCVolumeLengthQuality< DIM > Struct Template Reference
Inheritance diagram for AdolCOps::AdolCVolumeLengthQuality< DIM >:
[legend]
Collaboration diagram for AdolCOps::AdolCVolumeLengthQuality< 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 ()
 

Static Public Attributes

static constexpr std::array< std::array< int, 2 >, 6 > edgeNodes
 

Protected Attributes

int tYpe = BARRIER_AND_QUALITY
 
double aLpha = 1.0
 
double gAmma = 0.0
 
std::array< double, 12 > coordsTet
 
MoFEM::InterfacemFieldPtr = nullptr
 

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::AdolCVolumeLengthQuality< DIM >

Definition at line 18 of file AdolCVolumeLengthQuality.cpp.

Member Typedef Documentation

◆ A

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

Definition at line 21 of file AdolCVolumeLengthQuality.cpp.

Member Function Documentation

◆ getOptions()

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

Implements AdolCOps::PhysicalEquations.

Definition at line 28 of file AdolCVolumeLengthQuality.cpp.

28 {
30
31 MOFEM_LOG_CHANNEL("WORLD");
32
33 PetscOptionsBegin(PETSC_COMM_WORLD, "",
34 "Get VolumeLengthQuality material options", "none");
35 CHKERR PetscOptionsEList(
36 "-volume_length_type", "Volume length quality type", "",
38 VolumeLengthQualityTypeNames[tYpe], &tYpe, PETSC_NULLPTR);
39 CHKERR PetscOptionsScalar("-volume_length_alpha",
40 "volume length alpha parameter", "", aLpha,
41 &aLpha, PETSC_NULLPTR);
42 CHKERR PetscOptionsScalar("-volume_length_gamma",
43 "volume length parameter (barrier)", "", gAmma,
44 &gAmma, PETSC_NULLPTR);
45 PetscOptionsEnd();
46
47 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "VolumeLengthQuality")
48 << " type = " << VolumeLengthQualityTypeNames[tYpe]
49 << " alpha = " << aLpha << " gamma = " << gAmma;
50
51 mFieldPtr = m_field_ptr;
52
54 };
#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 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.
static const char * VolumeLengthQualityTypeNames[]
@ LASTOP_VOLUMELENGTHQUALITYTYPE

◆ recordTape()

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

Implements AdolCOps::PhysicalEquations.

Definition at line 79 of file AdolCVolumeLengthQuality.cpp.

79 {
81 static_assert(DIM == 3,
82 "AdolCVolumeLengthQuality is implemented for 3D only");
83
84 A::adolcDataPtr->insertCommonData("grad", MatrixDouble(DIM * DIM, 1));
85 A::adolcDataPtr->insertCommonData("P", MatrixDouble(DIM * DIM, 1));
86 A::adolcDataPtr->insertCommonData("P_dF",
87 MatrixDouble(DIM * DIM, DIM * DIM));
88
89 A::adolcDataPtr->insertActiveData("F", MatrixDouble(DIM, DIM));
90 A::adolcDataPtr->insertDependentData("P", MatrixDouble(DIM, DIM));
91 A::adolcDataPtr->insertDependentDerivativesData(
92 "P_dF", MatrixDouble(DIM * DIM, DIM * DIM));
93
94 auto t_F = getFTensor2FromPtr<DIM, DIM>(
95 A::adolcDataPtr->getActiveDataPtr("F")->data().data());
96 auto t_P = getFTensor2FromPtr<DIM, DIM>(
97 A::adolcDataPtr->getDependentDataPtr("P")->data().data());
98
100
101 FTENSOR_INDEX(DIM, i);
102 FTENSOR_INDEX(DIM, j);
103 FTENSOR_INDEX(DIM, I);
104 FTENSOR_INDEX(DIM, J);
105
106 // That assumes that nodal positions are approximated.
107 t_F(i, J) = t_kd(i, J);
108
116
117 adouble det_aF;
118
119 trace_on(A::tAg);
120
121 std::array<adouble, 12> refCoords;
122 for (auto dd = 0; dd != 12; ++dd) {
123 refCoords[dd] = mkparam(coordsTet[dd]);
124 }
125
126 ta_F(i, J) <<= t_F(i, J);
127 det_aF = determinantTensor(ta_F);
128 CHKERR invertTensor(ta_F, det_aF, ta_invF);
129
130 const auto x00 = refCoords[0];
131 const auto x01 = refCoords[1];
132 const auto x02 = refCoords[2];
133 const auto x10 = refCoords[3];
134 const auto x11 = refCoords[4];
135 const auto x12 = refCoords[5];
136 const auto x20 = refCoords[6];
137 const auto x21 = refCoords[7];
138 const auto x22 = refCoords[8];
139 const auto x30 = refCoords[9];
140 const auto x31 = refCoords[10];
141 const auto x32 = refCoords[11];
142
143 const auto ax = x10 - x00;
144 const auto ay = x11 - x01;
145 const auto az = x12 - x02;
146
147 const auto bx = x20 - x00;
148 const auto by = x21 - x01;
149 const auto bz = x22 - x02;
150
151 const auto cx = x30 - x00;
152 const auto cy = x31 - x01;
153 const auto cz = x32 - x02;
154
155 const adouble signed_volume =
156 (ax * (by * cz - bz * cy) - ay * (bx * cz - bz * cx) +
157 az * (bx * cy - by * cx)) /
158 6.0;
159
160 dX_dChiT(i, J) = 0.0;
161
162 adouble lrms_squared = 0.0;
163 adouble lrms_squared0 = 0.0;
164
165 for (auto ee = 0; ee != 6; ++ee) {
166 for (auto dd = 0; dd != DIM; ++dd) {
167 delta_chi(dd) =
168 refCoords[3 * edgeNodes[ee][0] + dd] -
169 refCoords[3 * edgeNodes[ee][1] + dd];
170 }
171
172 delta_X(i) = ta_F(i, J) * delta_chi(J);
173
174 lrms_squared += (1. / 6.) * delta_X(i) * delta_X(i);
175 lrms_squared0 += (1. / 6.) * delta_chi(I) * delta_chi(I);
176 dX_dChiT(i, I) += delta_X(i) * delta_chi(I);
177 }
178
179 Q(i, j) = ta_invF(j, i) - 0.5 * dX_dChiT(i, j) / lrms_squared;
180
181 const adouble lrms_cubed0 = lrms_squared0 * sqrt(lrms_squared0);
182 const adouble b =
183 det_aF / (lrms_squared * sqrt(lrms_squared) / lrms_cubed0);
184 const adouble current_volume = det_aF * signed_volume;
185 const adouble q =
186 6. * sqrt(2.) * current_volume / (lrms_squared * sqrt(lrms_squared));
187
188 switch (tYpe) {
189 case QUALITY:
190 ta_P(i, J) = q * Q(i, J);
191 break;
192 case BARRIER_AND_QUALITY: {
193 const adouble t_mp = q / (1.0 - gAmma) - 1.0 / (q - gAmma);
194 ta_P(i, J) = t_mp * Q(i, J);
195 break;
196 }
198 const adouble t_mp = b / (1.0 - gAmma) - 1.0 / (b - gAmma);
199 ta_P(i, J) = t_mp * Q(i, J);
200 break;
201 }
203 adouble t_mp = current_volume;
204 t_mp *= b / (1.0 - gAmma) - 1.0 / (b - gAmma);
205 ta_P(i, J) = t_mp * Q(i, J);
206 break;
207 }
208 default:
209 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
210 "Unknown volume-length-quality type");
211 }
212
213 ta_P(i, J) *= aLpha / signed_volume;
214 ta_P(i, J) >>= t_P(i, J);
215
216 trace_off();
217
219 }
#define FTENSOR_INDEX(DIM, I)
Kronecker Delta class.
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
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
@ BARRIER_AND_CHANGE_QUALITY
@ BARRIER_AND_CHANGE_QUALITY_SCALED_BY_VOLUME
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition ddTensor0.hpp:33
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
constexpr IntegrationType I
static constexpr std::array< std::array< int, 2 >, 6 > edgeNodes
boost::shared_ptr< ADolCData > adolcDataPtr
Definition AdolCOps.hpp:167

◆ setParams()

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

Implements AdolCOps::PhysicalEquations.

Definition at line 56 of file AdolCVolumeLengthQuality.cpp.

56 {
58 (void)gg;
59
60 if (mFieldPtr == nullptr) {
61 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
62 "MoFEM interface pointer not set");
63 }
64
65 const EntityHandle *conn = nullptr;
66 int num_nodes = 0;
67 CHKERR mFieldPtr->get_moab().get_connectivity(ent, conn, num_nodes, true);
68 if (PetscUnlikely(num_nodes != 4)) {
69 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
70 "VolumeLengthQuality is implemented for 4-node tetrahedra only");
71 }
72
73 CHKERR mFieldPtr->get_moab().get_coords(conn, num_nodes, coordsTet.data());
74 set_param_vec(A::tAg, coordsTet.size(), coordsTet.data());
75
77 }
virtual moab::Interface & get_moab()=0

Member Data Documentation

◆ aLpha

template<int DIM>
double AdolCOps::AdolCVolumeLengthQuality< DIM >::aLpha = 1.0
protected

Definition at line 223 of file AdolCVolumeLengthQuality.cpp.

◆ coordsTet

template<int DIM>
std::array<double, 12> AdolCOps::AdolCVolumeLengthQuality< DIM >::coordsTet
protected
Initial value:
= {
0.0, 0.0, 0.0,
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0}

Definition at line 225 of file AdolCVolumeLengthQuality.cpp.

225 {
226
227 0.0, 0.0, 0.0,
228
229 1.0, 0.0, 0.0,
230
231 0.0, 1.0, 0.0,
232
233 0.0, 0.0, 1.0};

◆ edgeNodes

template<int DIM>
constexpr std::array<std::array<int, 2>, 6> AdolCOps::AdolCVolumeLengthQuality< DIM >::edgeNodes
inlinestaticconstexpr
Initial value:
= {
std::array<int, 2>{0, 1}, std::array<int, 2>{0, 2},
std::array<int, 2>{0, 3}, std::array<int, 2>{1, 2},
std::array<int, 2>{1, 3}, std::array<int, 2>{2, 3}}

Definition at line 23 of file AdolCVolumeLengthQuality.cpp.

23 {
24 std::array<int, 2>{0, 1}, std::array<int, 2>{0, 2},
25 std::array<int, 2>{0, 3}, std::array<int, 2>{1, 2},
26 std::array<int, 2>{1, 3}, std::array<int, 2>{2, 3}};

◆ gAmma

template<int DIM>
double AdolCOps::AdolCVolumeLengthQuality< DIM >::gAmma = 0.0
protected

Definition at line 224 of file AdolCVolumeLengthQuality.cpp.

◆ mFieldPtr

template<int DIM>
MoFEM::Interface* AdolCOps::AdolCVolumeLengthQuality< DIM >::mFieldPtr = nullptr
protected

Definition at line 234 of file AdolCVolumeLengthQuality.cpp.

◆ tYpe

template<int DIM>
int AdolCOps::AdolCVolumeLengthQuality< DIM >::tYpe = BARRIER_AND_QUALITY
protected

Definition at line 222 of file AdolCVolumeLengthQuality.cpp.


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