14 "QUALITY",
"BARRIER_AND_QUALITY",
"BARRIER_AND_CHANGE_QUALITY",
15 "BARRIER_AND_CHANGE_QUALITY_SCALED_BY_VOLUME"};
23 static inline constexpr std::array<std::array<int, 2>, 6>
edgeNodes = {
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}};
33 PetscOptionsBegin(PETSC_COMM_WORLD,
"",
34 "Get VolumeLengthQuality material options",
"none");
36 "-volume_length_type",
"Volume length quality type",
"",
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);
49 <<
" alpha = " <<
aLpha <<
" gamma = " <<
gAmma;
59 const auto ent = fe_ptr->getFEEntityHandle();
63 "MoFEM interface pointer not set");
69 if (PetscUnlikely(num_nodes != 4)) {
71 "VolumeLengthQuality is implemented for 4-node tetrahedra only");
82 static_assert(DIM == 3,
83 "MatVolumeLengthQuality is implemented for 3D only");
96 auto t_F = getFTensor2FromPtr<DIM, DIM>(
98 auto t_P = getFTensor2FromPtr<DIM, DIM>(
123 std::array<adouble, 12> refCoords;
124 for (
auto dd = 0; dd != 12; ++dd) {
128 ta_F(
i,
J) <<= t_F(
i,
J);
129 det_aF = determinantTensor(ta_F);
130 CHKERR invertTensor(ta_F, det_aF, ta_invF);
132 const auto x00 = refCoords[0];
133 const auto x01 = refCoords[1];
134 const auto x02 = refCoords[2];
135 const auto x10 = refCoords[3];
136 const auto x11 = refCoords[4];
137 const auto x12 = refCoords[5];
138 const auto x20 = refCoords[6];
139 const auto x21 = refCoords[7];
140 const auto x22 = refCoords[8];
141 const auto x30 = refCoords[9];
142 const auto x31 = refCoords[10];
143 const auto x32 = refCoords[11];
145 const auto ax = x10 - x00;
146 const auto ay = x11 - x01;
147 const auto az = x12 - x02;
149 const auto bx = x20 - x00;
150 const auto by = x21 - x01;
151 const auto bz = x22 - x02;
153 const auto cx = x30 - x00;
154 const auto cy = x31 - x01;
155 const auto cz = x32 - x02;
158 (ax * (by * cz - bz * cy) - ay * (bx * cz - bz * cx) +
159 az * (bx * cy - by * cx)) /
162 dX_dChiT(
i,
J) = 0.0;
167 for (
auto ee = 0; ee != 6; ++ee) {
168 for (
auto dd = 0; dd != DIM; ++dd) {
174 delta_X(
i) = ta_F(
i,
J) * delta_chi(
J);
176 lrms_squared += (1. / 6.) * delta_X(
i) * delta_X(
i);
177 lrms_squared0 += (1. / 6.) * delta_chi(
I) * delta_chi(
I);
178 dX_dChiT(
i,
I) += delta_X(
i) * delta_chi(
I);
181 Q(
i,
j) = ta_invF(
j,
i) - 0.5 * dX_dChiT(
i,
j) / lrms_squared;
183 const adouble lrms_cubed0 = lrms_squared0 * sqrt(lrms_squared0);
185 det_aF / (lrms_squared * sqrt(lrms_squared) / lrms_cubed0);
186 const adouble current_volume = det_aF * signed_volume;
188 6. * sqrt(2.) * current_volume / (lrms_squared * sqrt(lrms_squared));
192 ta_P(
i,
J) = q * Q(
i,
J);
196 ta_P(
i,
J) = t_mp * Q(
i,
J);
201 ta_P(
i,
J) = t_mp * Q(
i,
J);
206 t_mp *= b / (1.0 -
gAmma) - 1.0 / (b -
gAmma);
207 ta_P(
i,
J) = t_mp * Q(
i,
J);
212 "Unknown volume-length-quality type");
215 ta_P(
i,
J) *=
aLpha / signed_volume;
216 ta_P(
i,
J) >>= t_P(
i,
J);
240boost::shared_ptr<PhysicalEquations>
242 boost::shared_ptr<MatOpsData> mat_ops_data_ptr,
int tag) {
243 return boost::make_shared<MatVolumeLengthQuality<3>>(mat_ops_data_ptr, tag);
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define FTENSOR_INDEX(DIM, I)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#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< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
FTensor::Index< 'j', 3 > j
static const char * VolumeLengthQualityTypeNames[]
@ BARRIER_AND_CHANGE_QUALITY_SCALED_BY_VOLUME
@ LASTOP_VOLUMELENGTHQUALITYTYPE
@ BARRIER_AND_CHANGE_QUALITY
boost::shared_ptr< PhysicalEquations > createMatOpsPhysicalEquationsPtr< ELASTICITY::VOLUMELENGTHQUALITY, MODEL_3D >(boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag)
constexpr IntegrationType I
MoFEMErrorCode setParams(FEMethod *fe_ptr, int gg) override
MoFEMErrorCode getOptions(MoFEM::Interface *m_field_ptr=nullptr) override
MoFEMErrorCode recordTape() override
static constexpr std::array< std::array< int, 2 >, 6 > edgeNodes
std::array< double, 12 > coordsTet
MoFEM::Interface * mFieldPtr
boost::shared_ptr< MatOpsData > matOpsDataPtr
virtual moab::Interface & get_moab()=0
Deprecated interface functions.