v0.16.3
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
EshelbianPlasticity::OpSensitivityInteriorGradient Struct Reference
Inheritance diagram for EshelbianPlasticity::OpSensitivityInteriorGradient:
[legend]
Collaboration diagram for EshelbianPlasticity::OpSensitivityInteriorGradient:
[legend]

Public Member Functions

 OpSensitivityInteriorGradient (const std::string field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< TopologicalData > topo_ptr, SmartPetscObj< Vec > assemble_vec, const double alpha, const double rho, const double alpha_viscous_omega=0, boost::shared_ptr< double > J_ptr=nullptr)
 
MoFEMErrorCode integrate (EntData &data)
 
- Public Member Functions inherited from EshelbianPlasticity::OpAssembleTopologicalObjectiveDerivativeImplBase< OpAssembleVolume >
 OpAssembleTopologicalObjectiveDerivativeImplBase (const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< TopologicalData > topo_ptr, boost::shared_ptr< double > J_ptr, SmartPetscObj< Vec > assemble_vec, Tag topo_tag)
 
MoFEMErrorCode assemble (int side, EntityType type, EntData &data) override
 
- Public Member Functions inherited from OpAssembleVolume
MoFEMErrorCode assemble (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 
- Public Member Functions inherited from OpAssembleBasic< VolUserDataOperator >
 OpAssembleBasic (const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const char type)
 
 OpAssembleBasic (std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const char type, const bool assemble_symmetry, ScaleOff scale_off=[]() { return 1;})
 
 OpAssembleBasic (const FieldSpace space)
 
virtual MoFEMErrorCode integrate (int, EntityType, EntData &data)
 
virtual MoFEMErrorCode integrate (EntData &, EntData &)
 
virtual MoFEMErrorCode assemble (EntData &data)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 
- Public Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
int getNumNodes ()
 get element number of nodes
 
const EntityHandle * getConn ()
 get element connectivity
 
double getVolume () const
 element volume (linear geometry)
 
double & getVolume ()
 element volume (linear geometry)
 
FTensor::Tensor2< double *, 3, 3 > & getJac ()
 get element Jacobian
 
FTensor::Tensor2< double *, 3, 3 > & getInvJac ()
 get element inverse Jacobian
 
VectorDouble & getCoords ()
 nodal coordinates
 
VolumeElementForcesAndSourcesCore * getVolumeFE () 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 NumeredEntFiniteElement > getNumeredEntFiniteElementPtr () 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< SideNumber > getSideNumberPtr (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 FEMethod * getFEMethod () 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.
 
ForcesAndSourcesCore * getPtrFE () const
 
ForcesAndSourcesCore * getSidePtrFE () const
 
ForcesAndSourcesCore * getRefinePtrFE () const
 
const PetscData::Switches & getDataCtx () const
 
KspMethod::KSPContext getKSPCtx () const
 
SnesMethod::SNESContext getSNESCtx () 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
 
MatrixDouble & getGaussPts ()
 matrix of integration (Gauss) points for Volume Element
 
auto getFTensor0IntegrationWeight ()
 Get integration weights.
 
MatrixDouble & getCoordsAtGaussPts ()
 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
 
double & getMeasure ()
 get measure of element
 
MoFEM::Interface & getMField ()
 
moab::Interface & getMoab ()
 
virtual boost::weak_ptr< ForcesAndSourcesCore > getSubPipelinePtr () 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 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

const double alphaW
 
const double alphaRho
 
const double alphaViscousOmega
 

Additional Inherited Members

- Public Types inherited from EshelbianPlasticity::OpAssembleTopologicalObjectiveDerivativeImplBase< OpAssembleVolume >
using OP = OpAssembleVolume
 
- Public Types inherited from OpAssembleVolume
using OP = OpAssembleBasic< VolUserDataOperator >
 
using ScaleOff = typename OP::ScaleOff
 
- Public Types inherited from OpAssembleBasic< VolUserDataOperator >
using ScaleOff = boost::function< double()>
 
- 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 OpAssembleBasic< VolUserDataOperator >
const bool assembleSymmetry
 
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
 data at integration pts
 
VectorDouble nF
 local right hand side vector
 
MatrixDouble K
 local tangent matrix
 
MatrixDouble transposeK
 
ScaleOff scaleOff
 
- 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.
 
bool & doVertices
 \deprectaed If false skip vertices
 
bool & doEdges
 \deprectaed If false skip edges
 
bool & doQuads
 \deprectaed
 
bool & doTris
 \deprectaed
 
bool & doTets
 \deprectaed
 
bool & doPrisms
 \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 EshelbianPlasticity::OpAssembleTopologicalObjectiveDerivativeImplBase< OpAssembleVolume >
double locJ
 
boost::shared_ptr< double > JPtr
 
SmartPetscObj< Vec > assembleVec
 
Tag topoTag
 
boost::shared_ptr< TopologicalData > topoData
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCore * ptrFE
 
- Static Protected Attributes inherited from OpAssembleVolume
static std::map< std::pair< std::string, std::string >, MatrixDouble > mapMatrix
 

Detailed Description

Definition at line 1576 of file EshelbianTopologicalDerivativeOperators.cpp.

Constructor & Destructor Documentation

◆ OpSensitivityInteriorGradient()

EshelbianPlasticity::OpSensitivityInteriorGradient::OpSensitivityInteriorGradient ( const std::string  field_name,
boost::shared_ptr< DataAtIntegrationPts >  data_ptr,
boost::shared_ptr< TopologicalData >  topo_ptr,
SmartPetscObj< Vec >  assemble_vec,
const double  alpha,
const double  rho,
const double  alpha_viscous_omega = 0,
boost::shared_ptr< double >  J_ptr = nullptr 
)
inline

Member Function Documentation

◆ integrate()

MoFEMErrorCode EshelbianPlasticity::OpSensitivityInteriorGradient::integrate ( EntData &  data)
inlinevirtual

Reimplemented from OpAssembleBasic< VolUserDataOperator >.

Definition at line 1589 of file EshelbianTopologicalDerivativeOperators.cpp.

1589 {
1591#ifndef NDEBUG
1593 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1594 "L2 user base scale is set to %d, current inplementation only "
1595 "hanlde case for false",
1597 }
1598#endif // NDEBUG
1599
1600#ifndef NDEBUG
1601 if (!dataAtPts)
1602 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1603 "DataAtIntegrationPts pointer is null");
1604#endif // NDEBUG
1605
1606 const int nb_dofs = data.getIndices().size();
1607 if (!nb_dofs)
1609
1610 const int nb_integration_pts = getGaussPts().size2();
1611
1612 const auto v = getVolume();
1613 auto t_w = getFTensor0IntegrationWeight();
1614 // OpSpatialEquilibrium
1615 auto t_div_P = dataAtPts->getFTensorDivP(nb_integration_pts);
1616 auto t_var_w = dataAtPts->getFTensorVarWL2(nb_integration_pts);
1617 // OpSpatialRotation
1618 auto t_approx_P = dataAtPts->getFTensorApproxP(nb_integration_pts);
1619 auto t_u_h1 = dataAtPts->getFTensorStretchH1(nb_integration_pts);
1620 auto t_var_omega = dataAtPts->getFTensorVarRotAxis(nb_integration_pts);
1621 // OpSpatialConsistencyP
1622 auto t_h = dataAtPts->getFTensorSmallH(nb_integration_pts);
1623 auto t_var_P = dataAtPts->getFTensorVarPiola(nb_integration_pts);
1624 auto t_w_l2 = dataAtPts->getFTensorSmallWL2(nb_integration_pts);
1625 auto t_var_div_P = dataAtPts->getFTensorDivVarPiola(nb_integration_pts);
1626
1627 auto t_jac = topoData->getFTensorJacobian(nb_integration_pts);
1628
1629 auto get_ftensor1 = [](auto &v) {
1631 &v[0], &v[1], &v[2]);
1632 };
1633
1634 auto next = [&]() {
1635 ++t_w;
1636 ++t_div_P;
1637 ++t_var_w;
1638 ++t_approx_P;
1639 ++t_u_h1;
1640 ++t_var_omega;
1641 ++t_h;
1642 ++t_var_P;
1643 ++t_w_l2;
1644 ++t_var_div_P;
1645 ++t_jac;
1646 };
1647
1654
1657
1658 constexpr auto t_kd = FTensor::Kronecker_Delta<double>();
1659
1660 locJ = 0;
1661 for (int gg = 0; gg != nb_integration_pts; ++gg) {
1662 double a = v * t_w;
1663
1664 // The adjoint direction varies both element-constant and higher modes.
1667 using namespace LogarithmicDirectionalDerivatives;
1668 const auto read = [&](MatrixPtr values) {
1669 Vector result;
1670 auto view = GetFTensor1FromMatImpl<3, -1, DL, MatrixDouble>::get(
1671 *values, gg, 0);
1672 result(i) = view(i);
1673 return result;
1674 };
1675 const SplitRotation rotation(read(dataAtPts->constantRotation),
1676 read(dataAtPts->higherRotation));
1677 variation_R(i, j) =
1678 rotation.first(read(dataAtPts->varConstantRotation),
1679 read(dataAtPts->varHigherRotation))(i, j);
1680 } else {
1681 variation_R(i, j) = levi_civita(i, j, k) * t_var_omega(k);
1682 }
1683
1685 t_diff;
1686 t_diff(i, j, l, k) = t_kd(i, l) * t_kd(j, k);
1687
1688 // OpSpatialEqulibrium
1689 {
1690 const auto beta = a * (t_div_P(i) * t_var_w(i));
1691 locJ -= beta;
1692 }
1693 // OpSpatialEquilibrium
1694 {
1695 double beta;
1699 case LARGE_ROT:
1700 case MODERATE_ROT:
1701 beta =
1702
1703 (variation_R(j, k) * t_u_h1(k, l))
1704
1705 * (t_approx_P(j, n) * t_jac(l, n));
1706
1707 t_beta_dX(I, J) =
1708
1709 (variation_R(j, k) * t_u_h1(k, l))
1710
1711 * (t_approx_P(j, n) * t_diff(l, n, I, J));
1712
1713 break;
1714 case SMALL_ROT:
1715 beta =
1716
1717 variation_R(i, j)
1718
1719 * (t_approx_P(i, n) * t_jac(j, n));
1720
1721 t_beta_dX(I, J) =
1722
1723 variation_R(i, j)
1724
1725 * (t_approx_P(i, n) * t_diff(j, n, I, J));
1726
1727 break;
1728 default:
1729 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1730 "gradApproximator not handled");
1731 break;
1732 };
1733
1734 locJ -= a * beta;
1735 auto t_nf = get_ftensor1(nF);
1736 auto t_base_diff = data.getFTensor1DiffN<3>(gg, 0);
1737 for (int bb = 0; bb != nb_dofs / SPACE_DIM; ++bb) {
1738 t_nf(i) -= a * (t_beta_dX(i, j) * t_base_diff(j));
1739 ++t_nf;
1740 ++t_base_diff;
1741 }
1742 }
1743 // OpSpatialConsistency
1744 {
1745 const auto beta =
1746 (t_h(i, j) - t_kd(i, j)) * (t_var_P(i, n) * t_jac(j, n));
1748 t_beta_dX(I, J) =
1749 (t_h(i, j) - t_kd(i, j)) * (t_var_P(i, n) * t_diff(j, n, I, J));
1750 locJ -= a * beta;
1751 auto t_nf = get_ftensor1(nF);
1752 auto t_base_diff = data.getFTensor1DiffN<3>(gg, 0);
1753 for (int bb = 0; bb != nb_dofs / SPACE_DIM; ++bb) {
1754 t_nf(i) -= a * (t_beta_dX(i, j) * t_base_diff(j));
1755 ++t_nf;
1756 ++t_base_diff;
1757 }
1758 }
1759 // OpSpatialConsistency, cont
1760 {
1761 const auto beta = t_w_l2(i) * t_var_div_P(i);
1762 locJ -= a * beta;
1763 }
1764
1765 next();
1766 }
1767
1769 }
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
boost::shared_ptr< DataAtIntegrationPts > data
SmartPetscObj< Vec > values
#define FTENSOR_INDEX(DIM, I)
constexpr double a
constexpr int SPACE_DIM
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()
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)
const double n
refractive index of diffusive medium
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
boost::shared_ptr< MatrixDouble > MatrixPtr
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
constexpr IntegrationType I
FTensor::Index< 'm', 3 > m
static PetscBool l2UserBaseScale
static enum RotSelector rotSelector
static enum RotSelector gradApproximator
auto getFTensor0IntegrationWeight()
Get integration weights.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
VectorDouble nF
local right hand side vector

Member Data Documentation

◆ alphaRho

const double EshelbianPlasticity::OpSensitivityInteriorGradient::alphaRho
private

◆ alphaViscousOmega

const double EshelbianPlasticity::OpSensitivityInteriorGradient::alphaViscousOmega
private

◆ alphaW

const double EshelbianPlasticity::OpSensitivityInteriorGradient::alphaW
private

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