20#include <boost/math/constants/constants.hpp>
41 ep->mField.get_comm(), ep->mField.get_moab(), 0, 3,
Sev::noisy)),
43 ep->mField.get_comm(), ep->mField.get_moab(), 0, 3,
Sev::noisy)) {}
60 return field_ptr->th_FieldDataVerts;
63 Tag getTag(moab::Interface &moab, std::string tag_name,
int size) {
65 rval = moab.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE, tag,
66 MB_TAG_CREAT | MB_TAG_DENSE, NULL);
67 if (
rval == MB_ALREADY_ALLOCATED)
82 const double alpha_omega);
90 return boost::make_shared<TopologicalTAOCtxImpl>(
91 ep, set_integration_at_interior, set_integration_at_face, time_solver);
101 const double alpha,
const double rho,
102 const double alpha_omega) {
108 "Invalid context pointer type");
109 auto &ep = *ctx_impl_ptr->ep_ptr;
110 auto &m_field = ep.mField;
111 auto interior_integration_hook = ctx_impl_ptr->integrationAtInterior;
112 auto boundary_integration_hook = ctx_impl_ptr->integrationAtFace;
113 auto th_top_tag = ctx_impl_ptr->getVertexMaterialH1PositionsTag();
114 auto th_grad_tag = ctx_impl_ptr->getJdXTag(m_field.get_moab());
116 boost::shared_ptr<double> J_ptr = boost::make_shared<double>(0.);
117 auto dJ_dX_vec = ctx_impl_ptr->gradJVec.second;
120 boost::make_shared<VolumeElementForcesAndSourcesCore>(m_field);
122 ep, fe_spatial, interior_integration_hook, boundary_integration_hook);
124 boost::make_shared<VolumeElementForcesAndSourcesCore>(m_field);
126 boundary_integration_hook, J_ptr,
131 CHKERR KSPSolveTranspose(ksp, dJ_dx_vec, lambda_vec);
134 boost::make_shared<VolumeElementForcesAndSourcesCore>(m_field);
136 ep, fe_adjoint, interior_integration_hook, boundary_integration_hook,
137 lambda_vec, dJ_dX_vec, alpha,
rho, alpha_omega);
Auxilary functions for Eshelbian plasticity.
Eshelbian plasticity interface.
Interface for Python-based objective function evaluation in topology optimization.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
auto createDMVector(DM dm)
Get smart vector from DM.
virtual const Field * get_field_structure(const std::string &name, enum MoFEMTypes bh=MF_EXIST) const =0
get field structure
SeverityLevel
Severity levels.
boost::shared_ptr< TopologicalTAOCtx > createTopologicalTAOCtx(EshelbianCore *ep, ForcesAndSourcesCore::GaussHookFun set_integration_at_interior, ForcesAndSourcesCore::GaussHookFun set_integration_at_face, SmartPetscObj< TS > time_solver)
MoFEMErrorCode pushTopologicalOps_dJ_adjont_gradient(EshelbianCore &ep, boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe, ForcesAndSourcesCore::GaussHookFun interior_integration_hook, ForcesAndSourcesCore::GaussHookFun boundary_integration_hook, SmartPetscObj< Vec > lambda_vec, Tag th_grad_tag, const double alpha, const double rho, const double alpha_omega)
SmartPetscObj< Vec > pushTopologicalSpatialOps(EshelbianCore &ep, boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe, ForcesAndSourcesCore::GaussHookFun interior_integration_hook, ForcesAndSourcesCore::GaussHookFun boundary_integration_hook)
MoFEMErrorCode testTopologicalDerivative(EshelbianCore &ep, boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe, ForcesAndSourcesCore::GaussHookFun interior_integration_hook, ForcesAndSourcesCore::GaussHookFun boundary_integration_hook, const double alpha, const double rho, const double alpha_omega)
MoFEMErrorCode pushTopologicalMaterialOps(EshelbianCore &ep, boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe, ForcesAndSourcesCore::GaussHookFun interior_integration_hook, ForcesAndSourcesCore::GaussHookFun boundary_integration_hook, boost::shared_ptr< double > J_ptr, Tag th_grad_tag)
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
auto snesGetKSP(SNES snes)
MoFEM::Interface & mField
const std::string materialH1Positions
SmartPetscObj< TS > timeSolver
CommInterface::EntitiesPetscVector gradJVec
ForcesAndSourcesCore::GaussHookFun integrationAtFace
ForcesAndSourcesCore::GaussHookFun integrationAtInterior
TopologicalTAOCtxImpl(EshelbianCore *ep, ForcesAndSourcesCore::GaussHookFun set_integration_at_interior, ForcesAndSourcesCore::GaussHookFun set_integration_at_face, SmartPetscObj< TS > time_solver)
auto getMaterialH1PositionsStructureRawPtr()
CommInterface::EntitiesPetscVector geometryVec
friend MoFEMErrorCode cohesiveEvaluateObjectiveAndGradient(Tao tao, Vec x, PetscReal *f, Vec g, void *ctx)
friend MoFEMErrorCode testTopologicalDerivative(TopologicalTAOCtx *ctx_ptr, const double alpha, const double rho, const double alpha_omega)
auto getVertexMaterialH1PositionsTag()
Tag getTag(moab::Interface &moab, std::string tag_name, int size)
std::pair< std::pair< Range, Range >, SmartPetscObj< Vec > > EntitiesPetscVector
virtual moab::Interface & get_moab()=0
boost::function< MoFEMErrorCode(ForcesAndSourcesCore *fe_raw_ptr, int order_row, int order_col, int order_data)> GaussHookFun
intrusive_ptr for managing petsc objects