v0.16.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp > Struct Template Reference
Inheritance diagram for OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >:
[legend]
Collaboration diagram for OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >:
[legend]

Public Types

using OP = DomainBaseOp
 

Public Member Functions

 OpAdJointGradTimesSymTensor (const std::string field_name, boost::shared_ptr< HookeOps::CommonData > comm_ptr, boost::shared_ptr< MatrixDouble > jac, boost::shared_ptr< MatrixDouble > diff_jac, boost::shared_ptr< VectorDouble > cof_vals)
 

Protected Member Functions

MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)
 

Protected Attributes

boost::shared_ptr< HookeOps::CommonDatacommPtr
 
boost::shared_ptr< MatrixDoublejac
 
boost::shared_ptr< MatrixDoublediffJac
 
boost::shared_ptr< VectorDoublecofVals
 

Detailed Description

template<int SPACE_DIM>
struct OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >

Definition at line 1344 of file adjoint.cpp.

Member Typedef Documentation

◆ OP

template<int SPACE_DIM>
using OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >::OP = DomainBaseOp

Definition at line 1347 of file adjoint.cpp.

Constructor & Destructor Documentation

◆ OpAdJointGradTimesSymTensor()

template<int SPACE_DIM>
OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >::OpAdJointGradTimesSymTensor ( const std::string  field_name,
boost::shared_ptr< HookeOps::CommonData comm_ptr,
boost::shared_ptr< MatrixDouble jac,
boost::shared_ptr< MatrixDouble diff_jac,
boost::shared_ptr< VectorDouble cof_vals 
)
inline

Member Function Documentation

◆ iNtegrate()

template<int SPACE_DIM>
MoFEMErrorCode OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >::iNtegrate ( EntitiesFieldData::EntData data)
protected

Definition at line 1367 of file adjoint.cpp.

1368 {
1376
1377 auto t_diff_symm = FTensor::diff_symmetrize<double>();
1378
1379 // get element volume
1380 const double vol = OP::getMeasure();
1381 // get integration weights
1382 auto t_w = OP::getFTensor0IntegrationWeight();
1383 // get Jacobian values
1384 auto t_jac = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*(jac));
1385 // get diff Jacobian values
1386 auto t_diff_jac = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*(diffJac));
1387 // get cofactor values
1388 auto t_cof = getFTensor0FromVec(*(cofVals));
1389 // get base function gradient on rows
1390 auto t_row_grad = row_data.getFTensor1DiffN<SPACE_DIM>();
1391 // get fradient of the field
1392 auto t_grad_u =
1393 getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*(commPtr->matGradPtr));
1394 // get field gradient values
1395 auto t_cauchy_stress =
1396 getFTensor2SymmetricFromMat<SPACE_DIM>(*(commPtr->getMatCauchyStress()));
1397 // material stiffness tensor
1398 auto t_D =
1399 getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*(commPtr->matDPtr));
1400 // loop over integration points
1401 for (int gg = 0; gg != OP::nbIntegrationPts; gg++) {
1402 // take into account Jacobian
1403 const double alpha = t_w * vol;
1404
1405 auto t_det = determinantTensor(t_jac);
1407 CHKERR invertTensor(t_jac, t_det, t_inv_jac);
1408
1409 // Calculate the variation of the gradient due to geometry change
1411 t_diff_inv_jac(i, j) =
1412 -(t_inv_jac(i, I) * t_diff_jac(I, J)) * t_inv_jac(J, j);
1414 t_diff_grad(i, j) = t_grad_u(i, k) * t_diff_inv_jac(k, j);
1415
1416 // Calculate the variation of the strain tensor
1418 t_diff_strain(i, j) = t_diff_symm(i, j, k, l) * t_diff_grad(k, l);
1419
1420 // Calculate the variation of the stress tensor
1422 t_diff_stress(i, j) = t_D(i, j, k, l) * t_diff_strain(k, l);
1423
1424 // get rhs vector
1425 auto t_nf = OP::template getNf<SPACE_DIM>();
1426 // loop over rows base functions
1427 int rr = 0;
1428 for (; rr != OP::nbRows / SPACE_DIM; rr++) {
1429
1431 t_diff_row_grad(k) = t_row_grad(j) * t_diff_inv_jac(j, k);
1432
1433 // Variation due to change in geometry (diff base)
1434 t_nf(j) += alpha * t_diff_row_grad(i) * t_cauchy_stress(i, j);
1435
1436 // Variation due to change in domain (cofactor)
1437 t_nf(j) += (alpha * t_cof) * t_row_grad(i) * t_cauchy_stress(i, j);
1438
1439 // Variation due to change in stress (diff stress)
1440 t_nf(j) += alpha * t_row_grad(i) * t_diff_stress(i, j);
1441
1442 ++t_row_grad;
1443 ++t_nf;
1444 }
1445 for (; rr < OP::nbRowBaseFunctions; ++rr) {
1446 ++t_row_grad;
1447 }
1448
1449 ++t_grad_u;
1450 ++t_cauchy_stress;
1451 ++t_jac;
1452 ++t_diff_jac;
1453 ++t_cof;
1454 ++t_w; // move to another integration weight
1455 }
1457}
#define FTENSOR_INDEX(DIM, I)
constexpr int SPACE_DIM
[Define dimension]
Definition adjoint.cpp:28
constexpr IntegrationType I
Use Gauss quadrature for integration.
Definition adjoint.cpp:34
#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.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
static MoFEMErrorCode invertTensor(FTensor::Tensor2< T1, DIM, DIM > &t, T2 &det, FTensor::Tensor2< T3, DIM, DIM > &inv_t)
static auto determinantTensor(FTensor::Tensor2< T, DIM, DIM > &t)
Calculate the determinant of a tensor of rank DIM.
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.

Member Data Documentation

◆ cofVals

template<int SPACE_DIM>
boost::shared_ptr<VectorDouble> OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >::cofVals
protected

Definition at line 1361 of file adjoint.cpp.

◆ commPtr

template<int SPACE_DIM>
boost::shared_ptr<HookeOps::CommonData> OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >::commPtr
protected

Definition at line 1358 of file adjoint.cpp.

◆ diffJac

template<int SPACE_DIM>
boost::shared_ptr<MatrixDouble> OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >::diffJac
protected

Definition at line 1360 of file adjoint.cpp.

◆ jac

template<int SPACE_DIM>
boost::shared_ptr<MatrixDouble> OpAdJointGradTimesSymTensor< SPACE_DIM, IntegrationType::GAUSS, DomainBaseOp >::jac
protected

Definition at line 1359 of file adjoint.cpp.


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