v0.16.0
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
OpCalculateRotationAndSpatialGradient Struct Reference

#include "users_modules/eshelbian_plasticity/src/EshelbianOperators.hpp"

Inheritance diagram for OpCalculateRotationAndSpatialGradient:
[legend]
Collaboration diagram for OpCalculateRotationAndSpatialGradient:
[legend]

Public Member Functions

 OpCalculateRotationAndSpatialGradient (boost::shared_ptr< DataAtIntegrationPts > data_ptr, double alpha_omega=0)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 Operator for linear form, usually to calculate values on right hand side.
 
- Public Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
int getNumNodes ()
 get element number of nodes
 
const EntityHandlegetConn ()
 get element connectivity
 
double getVolume () const
 element volume (linear geometry)
 
doublegetVolume ()
 element volume (linear geometry)
 
FTensor::Tensor2< double *, 3, 3 > & getJac ()
 get element Jacobian
 
FTensor::Tensor2< double *, 3, 3 > & getInvJac ()
 get element inverse Jacobian
 
VectorDoublegetCoords ()
 nodal coordinates
 
VolumeElementForcesAndSourcesCoregetVolumeFE () const
 return pointer to Generic Volume Finite Element object
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, const bool symm=true)
 Constructor for operators working on finite element spaces.
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 Constructor for operators working on a single field.
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 Constructor for operators working on two fields (bilinear forms)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement.
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle.
 
int getFEDim () const
 Get dimension of finite element.
 
EntityType getFEType () const
 Get dimension of finite element.
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer.
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity.
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element.
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices.
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices.
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object.
 
int getOpType () const
 Get operator types.
 
void setOpType (const OpType type)
 Set operator type.
 
void addOpType (const OpType type)
 Add operator type.
 
int getNinTheLoop () const
 get number of finite element in the loop
 
int getLoopSize () const
 get size of elements in the loop
 
std::string getFEName () const
 Get name of the element.
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element
 
auto getFTensor0IntegrationWeight ()
 Get integration weights.
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3)
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry.
 
double getMeasure () const
 get measure of element
 
doublegetMeasure ()
 get measure of element
 
MoFEM::InterfacegetMField ()
 
moab::Interface & getMoab ()
 
virtual boost::weak_ptr< ForcesAndSourcesCoregetSubPipelinePtr () const
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, boost::shared_ptr< Range > fe_range=nullptr, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
 User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopRange (const string &fe_name, ForcesAndSourcesCore *range_fe, boost::shared_ptr< Range > fe_range, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 Iterate over range of elements.
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side.
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not.
 
void setSymm ()
 set if operator is executed taking in account symmetry
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem
 

Private Attributes

boost::shared_ptr< DataAtIntegrationPtsdataAtPts
 data at integration pts
 
double alphaOmega
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType {
  OPROW = 1 << 0 , OPCOL = 1 << 1 , OPROWCOL = 1 << 2 , OPSPACE = 1 << 3 ,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
using AdjCache = std::map< EntityHandle, std::vector< boost::weak_ptr< NumeredEntFiniteElement > > >
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
bool sYmm
 If true assume that matrix is symmetric structure.
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity.
 
booldoVertices
 \deprectaed If false skip vertices
 
booldoEdges
 \deprectaed If false skip edges
 
booldoQuads
 \deprectaed
 
booldoTris
 \deprectaed
 
booldoTets
 \deprectaed
 
booldoPrisms
 \deprectaed
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
- Protected Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 272 of file EshelbianOperators.hpp.

Constructor & Destructor Documentation

◆ OpCalculateRotationAndSpatialGradient()

OpCalculateRotationAndSpatialGradient::OpCalculateRotationAndSpatialGradient ( boost::shared_ptr< DataAtIntegrationPts data_ptr,
double  alpha_omega = 0 
)
inline

Definition at line 274 of file EshelbianOperators.hpp.

277 alphaOmega(alpha_omega) {}
@ NOSPACE
Definition definitions.h:83
VolumeElementForcesAndSourcesCore::UserDataOperator VolUserDataOperator
@ OPSPACE
operator do Work is execute on space data
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
data at integration pts

Member Function Documentation

◆ doWork()

MoFEMErrorCode OpCalculateRotationAndSpatialGradient::doWork ( int  side,
EntityType  type,
EntData data 
)
virtual

Operator for linear form, usually to calculate values on right hand side.

Reimplemented from MoFEM::DataOperator.

Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianOperators.cpp.

Definition at line 56 of file EshelbianOperators.cpp.

58 {
60
61 auto ts_ctx = getTSCtx();
62 int nb_integration_pts = getGaussPts().size2();
63
64 // space size indices
72
73 // sym size indices
75
76 auto t_L = symm_L_tensor();
77
79 *dataAtPts->getStretchTensorAtPts(), nb_integration_pts);
81 *dataAtPts->getDiffStretchTensorAtPts(), nb_integration_pts);
83 *dataAtPts->getStretchH1AtPts(), nb_integration_pts);
84 MatrixSizeHelper<GetFTensor4FromMatType<3, 3, 3, 3, -1, DL>, DL>::size(
85 *dataAtPts->getDiffStretchH1AtPts(), nb_integration_pts);
87 *dataAtPts->getAdjointPdstretchAtPts(), nb_integration_pts);
89 *dataAtPts->getAdjointPdUAtPts(), nb_integration_pts);
91 *dataAtPts->getAdjointPdUdPAtPts(), nb_integration_pts);
93 *dataAtPts->getAdjointPdUdOmegaAtPts(), nb_integration_pts);
94
96 *dataAtPts->getDeformationGradient(), nb_integration_pts);
97 MatrixSizeHelper<GetFTensor3FromMatType<3, 3, 3, -1, DL>, DL>::size(
98 dataAtPts->hdOmegaAtPts, nb_integration_pts);
100 dataAtPts->hdLogStretchAtPts, nb_integration_pts);
101
103 dataAtPts->leviKirchhoffAtPts, nb_integration_pts);
104 MatrixSizeHelper<GetFTensor2FromMatType<3, 3, -1, DL>, DL>::size(
105 dataAtPts->leviKirchhoffdOmegaAtPts, nb_integration_pts);
107 dataAtPts->leviKirchhoffdLogStreatchAtPts, nb_integration_pts);
108 MatrixSizeHelper<GetFTensor3FromMatType<3, 3, 3, -1, DL>, DL>::size(
109 dataAtPts->leviKirchhoffPAtPts, nb_integration_pts);
110
111 MatrixSizeHelper<GetFTensor2FromMatType<3, 3, -1, DL>, DL>::size(
112 dataAtPts->rotMatAtPts, nb_integration_pts);
114 *dataAtPts->getEigenVals(), nb_integration_pts);
115 MatrixSizeHelper<GetFTensor2FromMatType<3, 3, -1, DL>, DL>::size(
116 *dataAtPts->getEigenVecs(), nb_integration_pts);
117 dataAtPts->nbUniq.resize(nb_integration_pts, false);
119 dataAtPts->eigenValsC, nb_integration_pts);
120 MatrixSizeHelper<GetFTensor2FromMatType<3, 3, -1, DL>, DL>::size(
121 dataAtPts->eigenVecsC, nb_integration_pts);
122 dataAtPts->nbUniqC.resize(nb_integration_pts, false);
123
125 dataAtPts->logStretch2H1AtPts, nb_integration_pts);
127 dataAtPts->logStretchTotalTensorAtPts, nb_integration_pts);
128
129 MatrixSizeHelper<GetFTensor2FromMatType<3, 3, -1, DL>, DL>::size(
130 dataAtPts->internalStressAtPts, nb_integration_pts);
131 dataAtPts->internalStressAtPts.clear();
132
133 // Calculated values
134 auto t_h = dataAtPts->getFTensorSmallH(getGaussPts().size2());
135 auto t_h_domega = dataAtPts->getFTensorSmallHdOmega(getGaussPts().size2());
136 auto t_h_dlog_u =
137 dataAtPts->getFTensorSmallHdLogStretch(getGaussPts().size2());
138 auto t_levi_kirchhoff =
139 dataAtPts->getFTensorLeviKirchhoff(getGaussPts().size2());
140 auto t_levi_kirchhoff_domega =
141 dataAtPts->getFTensorLeviKirchhoffdOmega(getGaussPts().size2());
142 auto t_levi_kirchhoff_dstreach =
143 dataAtPts->getFTensorLeviKirchhoffdLogStretch(getGaussPts().size2());
144 auto t_levi_kirchhoff_dP =
145 dataAtPts->getFTensorLeviKirchhoffP(getGaussPts().size2());
146 auto t_approx_P_adjoint_dstretch =
147 dataAtPts->getFTensorAdjointPdstretch(getGaussPts().size2());
148 auto t_approx_P_adjoint_log_du =
149 dataAtPts->getFTensorAdjointPdU(getGaussPts().size2());
150 auto t_approx_P_adjoint_log_du_dP =
151 dataAtPts->getFTensorAdjointPdUdP(getGaussPts().size2());
152 auto t_approx_P_adjoint_log_du_domega =
153 dataAtPts->getFTensorAdjointPdUdOmega(getGaussPts().size2());
154 auto t_R = dataAtPts->getFTensorRotMat(getGaussPts().size2());
155 auto t_u = dataAtPts->getFTensorStretch(getGaussPts().size2());
156 auto t_diff_u = dataAtPts->getFTensorDiffStretch(getGaussPts().size2());
157 auto t_eigen_vals = dataAtPts->getFTensorEigenVals(getGaussPts().size2());
158 auto t_eigen_vecs = dataAtPts->getFTensorEigenVecs(getGaussPts().size2());
159 auto &nbUniq = dataAtPts->nbUniq;
160 auto t_nb_uniq =
161 FTensor::Tensor0<FTensor::PackPtr<int *, 1>>(nbUniq.data().data());
162 auto t_eigen_vals_C = dataAtPts->getFTensorEigenValsC(nb_integration_pts);
163 auto t_eigen_vecs_C = dataAtPts->getFTensorEigenVecsC(nb_integration_pts);
164 auto &nbUniqC = dataAtPts->nbUniqC;
165 auto t_nb_uniq_C =
166 FTensor::Tensor0<FTensor::PackPtr<int *, 1>>(nbUniqC.data().data());
167
168 auto t_u_h1 = dataAtPts->getFTensorStretchH1(getGaussPts().size2());
169 auto t_diff_u_h1 = dataAtPts->getFTensorDiffStretchH1(getGaussPts().size2());
170 auto t_log_stretch_total =
171 dataAtPts->getFTensorLogStretchTotal(getGaussPts().size2());
172 auto t_log_u2_h1 = dataAtPts->getFTensorLogStretch2H1(getGaussPts().size2());
173
174 // Field values
175 auto t_grad_h1 = dataAtPts->getFTensorSmallWGradH1(getGaussPts().size2());
176 auto t_omega = dataAtPts->getFTensorRotAxis(getGaussPts().size2());
177 auto t_approx_P = dataAtPts->getFTensorApproxP(getGaussPts().size2());
178 auto t_log_u = dataAtPts->getFTensorLogStretch(getGaussPts().size2());
179
180 // Rot axis 0
181 auto t_omega0 = dataAtPts->getFTensorRotAxis0(getGaussPts().size2());
182
183 auto next = [&]() {
184 // calculated values
185 ++t_h;
186 ++t_h_domega;
187 ++t_h_dlog_u;
188 ++t_levi_kirchhoff;
189 ++t_levi_kirchhoff_domega;
190 ++t_levi_kirchhoff_dstreach;
191 ++t_levi_kirchhoff_dP;
192 ++t_approx_P_adjoint_dstretch;
193 ++t_approx_P_adjoint_log_du;
194 ++t_approx_P_adjoint_log_du_dP;
195 ++t_approx_P_adjoint_log_du_domega;
196 ++t_R;
197 ++t_u;
198 ++t_diff_u;
199 ++t_eigen_vals;
200 ++t_eigen_vecs;
201 ++t_nb_uniq;
202 ++t_eigen_vals_C;
203 ++t_eigen_vecs_C;
204 ++t_nb_uniq_C;
205 ++t_u_h1;
206 ++t_diff_u_h1;
207 ++t_log_u2_h1;
208 ++t_log_stretch_total;
209 // field values
210 ++t_omega;
211 ++t_omega0;
212 ++t_grad_h1;
213 ++t_approx_P;
214 ++t_log_u;
215 };
216
219
220 auto bound_eig = [&](auto &eig) {
222 const auto zero = std::exp(std::numeric_limits<double>::min_exponent);
223 const auto large = std::exp(std::numeric_limits<double>::max_exponent);
224 for (int ii = 0; ii != 3; ++ii) {
225 eig(ii) = std::min(std::max(zero, eig(ii)), large);
226 }
228 };
229
230 auto calculate_log_stretch = [&]() {
234 eigen_vec(i, j) = t_log_u(i, j);
235 if (computeEigenValuesSymmetric(eigen_vec, eig) != MB_SUCCESS) {
236 MOFEM_LOG("SELF", Sev::error) << "Failed to compute eigen values";
237 }
238 // CHKERR bound_eig(eig);
239 // rare case when two eigen values are equal
240 t_nb_uniq = get_uniq_nb<3>(&eig(0));
241 if (t_nb_uniq < 3) {
242 sort_eigen_vals(eig, eigen_vec);
243 }
244 t_eigen_vals(i) = eig(i);
245 t_eigen_vecs(i, j) = eigen_vec(i, j);
246 t_u(i, j) =
247 EigenMatrix::getMat(t_eigen_vals, t_eigen_vecs, EshelbianCore::f)(i, j);
248 auto get_t_diff_u = [&]() {
249 return EigenMatrix::getDiffMat(t_eigen_vals, t_eigen_vecs,
251 t_nb_uniq);
252 };
253 t_diff_u(i, j, k, l) = get_t_diff_u()(i, j, k, l);
255 t_Ldiff_u(i, j, L) = t_diff_u(i, j, m, n) * t_L(m, n, L);
257 // return t_Ldiff_u;
258 };
259
260 auto calculate_total_stretch = [&](auto &t_h1) {
262 if (EshelbianCore::gradApproximator == NO_H1_CONFIGURATION) {
263
264 t_log_u2_h1(i, j) = 0;
265 t_log_stretch_total(i, j) = t_log_u(i, j);
266
267 } else {
268
271
273 t_C_h1(i, j) = t_h1(k, i) * t_h1(k, j);
274 t_eigen_vec(i, j) = t_C_h1(i, j);
275 if (computeEigenValuesSymmetric(t_eigen_vec, t_eig) != MB_SUCCESS) {
276 MOFEM_LOG("SELF", Sev::error) << "Failed to compute eigen values";
277 }
278 // rare case when two eigen values are equal
279 t_nb_uniq_C = get_uniq_nb<3>(&t_eig(0));
280 if (t_nb_uniq_C < 3) {
281 sort_eigen_vals(t_eig, t_eigen_vec);
282 }
283 if (EshelbianCore::stretchSelector >= StretchSelector::LOG) {
284 CHKERR bound_eig(t_eig);
285 }
286 t_eigen_vals_C(i) = t_eig(i);
287 t_eigen_vecs_C(i, j) = t_eigen_vec(i, j);
288
289 t_log_u2_h1(i, j) =
290 EigenMatrix::getMat(t_eig, t_eigen_vec, EshelbianCore::inv_f)(i, j);
291 t_log_stretch_total(i, j) = t_log_u2_h1(i, j) / 2 + t_log_u(i, j);
292 }
294 };
295
296 auto no_h1_loop = [&]() {
298
300 case LARGE_ROT:
301 case MODERATE_ROT:
302 break;
303 default:
304 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
305 "no_h1_loop is implemented only for LARGE_ROT");
306 };
307
308 for (int gg = 0; gg != nb_integration_pts; ++gg) {
309
311
313 t_h1(i, j) = t_kd(i, j);
314
315 // calculate streach
316 CHKERR calculate_log_stretch();
317 // calculate total stretch
318 CHKERR calculate_total_stretch(t_h1);
319
320 t_u_h1(i, j) = t_u(i, j);
321 t_diff_u_h1(i, j, k, l) = t_diff_u(i, j, k, l);
323 t_Ldiff_u(i, j, L) = t_diff_u(i, j, m, n) * t_L(m, n, L);
324
327
328 auto large_rot = [&]() {
329 t_R(i, j) = LieGroups::SO3::exp(t_omega, t_omega.l2())(i, j);
330 t_diff_R(i, j, k) =
331 LieGroups::SO3::diffExp(t_omega, t_omega.l2())(i, j, k);
332 t_diff_diff_R(i, j, k, l) =
333 LieGroups::SO3::diffDiffExp(t_omega, t_omega.l2())(i, j, k, l);
334
335 t_h(i, k) = t_R(i, l) * t_u(l, k);
336
337 t_approx_P_adjoint_dstretch(l, k) = t_R(i, l) * t_approx_P(i, k);
338 t_approx_P_adjoint_log_du(L) =
339 t_approx_P_adjoint_dstretch(l, k) * t_Ldiff_u(l, k, L);
340
341 t_levi_kirchhoff(m) =
342 t_diff_R(i, l, m) * (t_u(l, k) * t_approx_P(i, k));
343
345 t_h_domega(i, k, m) = t_diff_R(i, l, m) * t_u(l, k);
346 t_h_dlog_u(i, k, L) = t_R(i, l) * t_Ldiff_u(l, k, L);
347
348 t_approx_P_adjoint_log_du_dP(i, k, L) =
349 t_R(i, l) * t_Ldiff_u(l, k, L);
350
352 t_A(k, l, m) = t_diff_R(i, l, m) * t_approx_P(i, k);
353 t_approx_P_adjoint_log_du_domega(m, L) =
354 t_A(k, l, m) * t_Ldiff_u(k, l, L);
355
356 t_levi_kirchhoff_dstreach(m, L) =
357 t_diff_R(i, l, m) * (t_Ldiff_u(l, k, L) * t_approx_P(i, k));
358 t_levi_kirchhoff_dP(m, i, k) = t_diff_R(i, l, m) * t_u(l, k);
359 t_levi_kirchhoff_domega(m, n) =
360 t_diff_diff_R(i, l, m, n) * (t_u(l, k) * t_approx_P(i, k));
361 }
362 };
363
364 auto moderate_rot = [&]() {
366 FTensor::Tensor1<double, 3> t_delta_omega;
367 t_delta_omega(m) = t_omega(m) - t_omega0(m);
368 t_R0(i, j) = LieGroups::SO3::exp(t_omega0, t_omega0.l2())(i, j);
369
370 // Store the base rotation and add only the linearised increment to F.
371 t_R(i, j) = t_R0(i, j);
372 t_h(i, k) =
373 t_R0(i, l) *
374 (t_u(l, k) + levi_civita(l, k, m) * t_delta_omega(m));
375
376 t_approx_P_adjoint_dstretch(l, k) = t_R0(i, l) * t_approx_P(i, k);
377 t_approx_P_adjoint_log_du(L) =
378 t_approx_P_adjoint_dstretch(l, k) * t_Ldiff_u(l, k, L);
379
380 t_levi_kirchhoff(m) = t_R0(i, l) * levi_civita(l, k, m) *
381 t_approx_P(i, k);
382
384 t_h_domega(i, k, m) = t_R0(i, l) * levi_civita(l, k, m);
385 t_h_dlog_u(i, k, L) = t_R0(i, l) * t_Ldiff_u(l, k, L);
386
387 t_approx_P_adjoint_log_du_dP(i, k, L) =
388 t_R0(i, l) * t_Ldiff_u(l, k, L);
389 t_approx_P_adjoint_log_du_domega(m, L) = 0;
390
391 t_levi_kirchhoff_dstreach(m, L) = 0;
392 t_levi_kirchhoff_dP(m, i, k) =
393 t_R0(i, l) * levi_civita(l, k, m);
394 t_levi_kirchhoff_domega(m, n) = 0;
395 }
396 };
397
398 // rotation
400 case LARGE_ROT:
401 large_rot();
402 break;
403 case MODERATE_ROT:
404 moderate_rot();
405 break;
406 default:
407 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
408 "rotationSelector not handled");
409 }
410
411 next();
412 }
413
415 };
416
417 auto large_loop = [&]() {
419
421 case LARGE_ROT:
422 break;
423 case SMALL_ROT:
424 break;
425 default:
426 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
427 "rotSelector should be large or small");
428 };
429
430 for (int gg = 0; gg != nb_integration_pts; ++gg) {
431
433
436 case LARGE_ROT:
437 t_h1(i, j) = t_grad_h1(i, j) + t_kd(i, j);
438 break;
439 default:
440 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
441 "Selected grad approximator not handled");
442 };
443
444 // calculate streach
445 CHKERR calculate_log_stretch();
446 // calculate total stretch
447 CHKERR calculate_total_stretch(t_h1);
448
449 t_u_h1(l, k) = t_u(l, o) * t_h1(o, k);
450 t_diff_u_h1(i, j, k, l) = t_diff_u(i, o, k, l) * t_h1(o, j);
452 t_Ldiff_u_h1(l, k, L) = t_diff_u_h1(l, k, i, j) * t_L(i, j, L);
453
456
457 // rotation
459 case SMALL_ROT:
460 t_R(i, k) = t_kd(i, k) + levi_civita(i, k, l) * t_omega(l);
461 t_diff_R(i, j, k) = levi_civita(i, j, k);
462 t_diff_diff_R(i, j, l, m) = 0;
463 break;
464 case LARGE_ROT:
465 t_R(i, j) = LieGroups::SO3::exp(t_omega, t_omega.l2())(i, j);
466 t_diff_R(i, j, k) =
467 LieGroups::SO3::diffExp(t_omega, t_omega.l2())(i, j, k);
468 t_diff_diff_R(i, j, k, l) =
469 LieGroups::SO3::diffDiffExp(t_omega, t_omega.l2())(i, j, k, l);
470 break;
471
472 default:
473 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
474 "rotationSelector not handled");
475 }
476
477 // calculate gradient
478 t_h(i, k) = t_R(i, l) * t_u_h1(l, k);
479
480 // Adjoint stress
481 t_approx_P_adjoint_dstretch(l, o) =
482 (t_R(i, l) * t_approx_P(i, k)) * t_h1(o, k);
483 t_approx_P_adjoint_log_du(L) =
484 t_R(i, l) * t_approx_P(i, k) * t_Ldiff_u_h1(l, k, L);
485
486 // Kirchhoff stress
487 t_levi_kirchhoff(m) = t_diff_R(i, l, m) * t_u_h1(l, k) * t_approx_P(i, k);
488
490
491 t_h_domega(i, k, m) = t_diff_R(i, l, m) * t_u_h1(l, k);
492 t_h_dlog_u(i, k, L) = t_R(i, l) * t_Ldiff_u_h1(l, k, L);
493
494 t_approx_P_adjoint_log_du_dP(i, k, L) =
495 t_R(i, l) * t_Ldiff_u_h1(l, k, L);
496
498 t_A(m, L, i, k) = t_diff_R(i, l, m) * t_Ldiff_u_h1(l, k, L);
499 t_approx_P_adjoint_log_du_domega(m, L) =
500 t_A(m, L, i, k) * t_approx_P(i, k);
501
502 t_levi_kirchhoff_dstreach(m, L) =
503 t_diff_R(i, l, m) * (t_Ldiff_u_h1(l, k, L) * t_approx_P(i, k));
504
505 t_levi_kirchhoff_dP(m, i, k) = t_diff_R(i, l, m) * t_u_h1(l, k);
506 t_levi_kirchhoff_domega(m, n) =
507 t_diff_diff_R(i, l, m, n) * (t_u_h1(l, k) * t_approx_P(i, k));
508 }
509
510 next();
511 }
512
514 };
515
516 auto moderate_loop = [&]() {
518
520 case LARGE_ROT:
521 break;
522 case SMALL_ROT:
523 break;
524 default:
525 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
526 "rotSelector should be large or small");
527 };
528
529 for (int gg = 0; gg != nb_integration_pts; ++gg) {
530
532
535 case MODERATE_ROT:
536 t_h1(i, j) = t_grad_h1(i, j) + t_kd(i, j);
537 break;
538 default:
539 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
540 "Selected grad approximator not handled");
541 };
542
543 // calculate streach
544 CHKERR calculate_log_stretch();
545 // calculate total stretch
546 CHKERR calculate_total_stretch(t_h1);
547
548 auto t_diff = diff_tensor();
549
550 t_u_h1(l, k) = (t_kd(l, o) + t_log_u(l, o)) * t_h1(o, k);
551 t_diff_u_h1(i, j, k, l) = t_diff(i, o, k, l) * t_h1(o, j);
553 t_Ldiff_u_h1(l, k, L) = t_diff_u_h1(l, k, i, j) * t_L(i, j, L);
554
557
558 // rotation
560 case SMALL_ROT:
561 t_R(i, k) = t_kd(i, k) + levi_civita(i, k, l) * t_omega(l);
562 t_diff_R(i, j, k) = levi_civita(i, j, k);
563 t_diff_diff_R(i, j, l, m) = 0;
564 break;
565 case LARGE_ROT:
566 t_R(i, j) = LieGroups::SO3::exp(t_omega, t_omega.l2())(i, j);
567 t_diff_R(i, j, k) =
568 LieGroups::SO3::diffExp(t_omega, t_omega.l2())(i, j, k);
569 t_diff_diff_R(i, j, k, l) =
570 LieGroups::SO3::diffDiffExp(t_omega, t_omega.l2())(i, j, k, l);
571 break;
572
573 default:
574 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
575 "rotationSelector not handled");
576 }
577
578 // calculate gradient
579 t_h(i, k) = t_R(i, l) * t_u_h1(l, k);
580
581 // Adjoint stress
582 t_approx_P_adjoint_dstretch(l, o) =
583 (t_R(i, l) * t_approx_P(i, k)) * t_h1(o, k);
584 t_approx_P_adjoint_log_du(L) =
585 t_R(i, l) * t_approx_P(i, k) * t_Ldiff_u_h1(l, k, L);
586
587 // Kirchhoff stress
588 t_levi_kirchhoff(m) = t_diff_R(i, l, m) * t_u_h1(l, k) * t_approx_P(i, k);
589
591
592 t_h_domega(i, k, m) = t_diff_R(i, l, m) * t_u_h1(l, k);
593 t_h_dlog_u(i, k, L) = t_R(i, l) * t_Ldiff_u_h1(l, k, L);
594
595 t_approx_P_adjoint_log_du_dP(i, k, L) =
596 t_R(i, l) * t_Ldiff_u_h1(l, k, L);
597
599 t_A(m, L, i, k) = t_diff_R(i, l, m) * t_Ldiff_u_h1(l, k, L);
600 t_approx_P_adjoint_log_du_domega(m, L) =
601 t_A(m, L, i, k) * t_approx_P(i, k);
602
603 t_levi_kirchhoff_dstreach(m, L) =
604 t_diff_R(i, l, m) * (t_Ldiff_u_h1(l, k, L) * t_approx_P(i, k));
605
606 t_levi_kirchhoff_dP(m, i, k) = t_diff_R(i, l, m) * t_u_h1(l, k);
607 t_levi_kirchhoff_domega(m, n) =
608 t_diff_diff_R(i, l, m, n) * (t_u_h1(l, k) * t_approx_P(i, k));
609 }
610
611 next();
612 }
613
615 };
616
617 auto small_loop = [&]() {
620 case SMALL_ROT:
621 break;
622 default:
623 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
624 "rotSelector should be small");
625 };
626
627 for (int gg = 0; gg != nb_integration_pts; ++gg) {
628
631 case SMALL_ROT:
632 t_h1(i, j) = t_kd(i, j);
633 break;
634 default:
635 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
636 "gradApproximator not handled");
637 };
638
640 if (EshelbianCore::stretchSelector > LINEAR) {
641 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
642 "stretchSelector should be linear for small loop");
643 } else {
644 t_u(i, j) = t_symm_kd(i, j) + t_log_u(i, j);
645 t_u_h1(i, j) = t_u(i, j);
646 t_diff_u_h1(i, j, k, l) =
647 (t_kd(i, k) * t_kd(j, l) + t_kd(i, l) * t_kd(j, k));
648 t_diff_u_h1(i, j, k, l) /= 2.;
649 t_Ldiff_u(i, j, L) = t_L(i, j, L);
650 }
651 t_log_u2_h1(i, j) = 0;
652 t_log_stretch_total(i, j) = t_log_u(i, j);
653
654 t_R(i, j) = t_kd(i, j) + levi_civita(i, j, k) * t_omega(k);
655 t_h(i, j) = levi_civita(i, j, k) * t_omega(k) + t_u(i, j);
656
657 t_h_domega(i, j, k) = levi_civita(i, j, k);
658 t_h_dlog_u(i, j, L) = t_Ldiff_u(i, j, L);
659
660 // Adjoint stress
661 t_approx_P_adjoint_dstretch(i, j) = t_approx_P(i, j);
662 t_approx_P_adjoint_log_du(L) =
663 t_approx_P_adjoint_dstretch(i, j) * t_Ldiff_u(i, j, L);
664 t_approx_P_adjoint_log_du_dP(i, j, L) = t_Ldiff_u(i, j, L);
665 t_approx_P_adjoint_log_du_domega(m, L) = 0;
666
667 // Kirchhoff stress
668 t_levi_kirchhoff(k) = levi_civita(i, j, k) * t_approx_P(i, j);
669 t_levi_kirchhoff_dstreach(m, L) = 0;
670 t_levi_kirchhoff_dP(k, i, j) = levi_civita(i, j, k);
671 t_levi_kirchhoff_domega(m, n) = 0;
672
673 next();
674 }
675
677 };
678
681 CHKERR no_h1_loop();
682 break;
683 case LARGE_ROT:
684 CHKERR large_loop();
686 break;
687 case MODERATE_ROT:
688 CHKERR moderate_loop();
690 break;
691 case SMALL_ROT:
692 CHKERR small_loop();
694 break;
695 default:
696 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
697 "gradApproximator not handled");
698 break;
699 };
700
702}
#define FTENSOR_INDEX(DIM, I)
constexpr int SPACE_DIM
Kronecker Delta class symmetric.
Kronecker Delta class.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#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()
#define CHKERR
Inline error check.
constexpr auto t_kd
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
const double n
refractive index of diffusive medium
MoFEM::TsCtx * ts_ctx
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
auto getMat(A &&t_val, B &&t_vec, Fun< double > f)
Get the Mat object.
auto getDiffMat(A &&t_val, B &&t_vec, Fun< double > f, Fun< double > d_f, const int nb)
Get the Diff Mat object.
constexpr std::enable_if<(Dim0<=2 &&Dim1<=2), Tensor2_Expr< Levi_Civita< T >, T, Dim0, Dim1, i, j > >::type levi_civita(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
levi_civita functions to make for easy adhoc use
auto sort_eigen_vals(FTensor::Tensor1< double, DIM > &eig, FTensor::Tensor2< double, DIM, DIM > &eigen_vec)
Definition HenckyOps.hpp:32
DataLayoutTraits< DataLayout::GaussByCoeffs > DL
Definition MatHuHu.hpp:33
decltype(GetFTensor2SymmetricFromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor2SymmetricFromMatType
decltype(GetFTensor4FromMatImpl< Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor4FromMatType
decltype(GetFTensor4DdgFromMatImpl< Tensor_Dim01, Tensor_Dim23, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor4DdgFromMatType
decltype(GetFTensor1FromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor1FromMatType
MoFEMErrorCode computeEigenValuesSymmetric(const MatrixDouble &mat, VectorDouble &eig, MatrixDouble &eigen_vec)
compute eigenvalues of a symmetric matrix using lapack dsyev
decltype(GetFTensor3FromMatImpl< Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor3FromMatType
decltype(GetFTensor2FromMatImpl< Tensor_Dim0, Tensor_Dim1, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor2FromMatType
auto symm_L_tensor(FTensor::Number< DIM >)
auto diff_tensor(FTensor::Number< DIM >)
[Lambda functions]
FTensor::Index< 'm', 3 > m
static enum StretchSelector stretchSelector
static enum RotSelector rotSelector
static enum RotSelector gradApproximator
static boost::function< double(const double)> f
static boost::function< double(const double)> d_f
static boost::function< double(const double)> inv_f
static auto diffDiffExp(A &&t_w_vee, B &&theta)
Definition Lie.hpp:105
static auto diffExp(A &&t_w_vee, B &&theta)
Definition Lie.hpp:100
static auto exp(A &&t_w_vee, B &&theta)
Definition Lie.hpp:69
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
@ CTX_TSSETIJACOBIAN
Setting up implicit Jacobian.
constexpr auto size_symm
Definition plastic.cpp:42

Member Data Documentation

◆ alphaOmega

double OpCalculateRotationAndSpatialGradient::alphaOmega
private

Definition at line 283 of file EshelbianOperators.hpp.

◆ dataAtPts

boost::shared_ptr<DataAtIntegrationPts> OpCalculateRotationAndSpatialGradient::dataAtPts
private

data at integration pts

Definition at line 282 of file EshelbianOperators.hpp.


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