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

Public Member Functions

 CohesiveTAOCtxImpl (EshelbianCore *ep, ForcesAndSourcesCore::GaussHookFun set_integration_at_front_face, SmartPetscObj< TS > time_solver)
 
SmartPetscObj< Vec > duplicateKappaVec () override
 
SmartPetscObj< Vec > duplicateDissipationVec () override
 
SmartPetscObj< Vec > duplicateGradientVec () override
 
CommInterface::EntitiesPetscVectorgetKappaVec () override
 
- Public Member Functions inherited from EshelbianPlasticity::CohesiveTAOCtx
 CohesiveTAOCtx ()=default
 

Private Attributes

EshelbianCoreep_ptr
 
ForcesAndSourcesCore::GaussHookFun setIntegrationAtFrontFace
 
SmartPetscObj< TS > timeSolver
 
SmartPetscObj< Vec > kspSolVec
 
SmartPetscObj< Vec > lambdaVec
 
CommInterface::EntitiesPetscVector kappaVec
 
CommInterface::EntitiesPetscVector dissipationVec
 
CommInterface::EntitiesPetscVector gradDissipationVec
 

Friends

MoFEMErrorCode cohesiveEvaluateObjectiveAndGradient (Tao tao, Vec x, PetscReal *f, Vec g, void *ctx)
 

Detailed Description

Definition at line 1266 of file EshelbianCohesive.cpp.

Constructor & Destructor Documentation

◆ CohesiveTAOCtxImpl()

EshelbianPlasticity::CohesiveTAOCtxImpl::CohesiveTAOCtxImpl ( EshelbianCore ep,
ForcesAndSourcesCore::GaussHookFun  set_integration_at_front_face,
SmartPetscObj< TS >  time_solver 
)
inline

Definition at line 1267 of file EshelbianCohesive.cpp.

1271 : ep_ptr(ep), setIntegrationAtFrontFace(set_integration_at_front_face),
1272 timeSolver(time_solver),
1273
1277 ep->mField.get_comm(), ep->mField.get_moab(),
1278 [&ep](Range r) { return intersect(*(ep->interfaceFaces), r); }, 1,
1279 Sev::noisy)),
1281 ep->mField.get_comm(), ep->mField.get_moab(),
1282 [&ep](Range r) { return intersect(*(ep->interfaceFaces), r); }, 1,
1283 Sev::noisy)),
1285 ep->mField.get_comm(), ep->mField.get_moab(),
1286 [&ep](Range r) { return intersect(*(ep->interfaceFaces), r); }, 1,
1287 Sev::noisy)) {}
auto createDMVector(DM dm)
Get smart vector from DM.
Definition DMMoFEM.hpp:1234
MoFEM::Interface & mField
SmartPetscObj< DM > dmElastic
Elastic problem.
ForcesAndSourcesCore::GaussHookFun setIntegrationAtFrontFace
CommInterface::EntitiesPetscVector gradDissipationVec
CommInterface::EntitiesPetscVector kappaVec
CommInterface::EntitiesPetscVector dissipationVec
static EntitiesPetscVector createEntitiesPetscVector(MPI_Comm comm, moab::Interface &moab, int dim, const int nb_coeffs, Sev sev=Sev::verbose, int root_rank=0)
Create a ghost vector for exchanging data.
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0

Member Function Documentation

◆ duplicateDissipationVec()

SmartPetscObj< Vec > EshelbianPlasticity::CohesiveTAOCtxImpl::duplicateDissipationVec ( )
inlineoverridevirtual

Implements EshelbianPlasticity::CohesiveTAOCtx.

Definition at line 1293 of file EshelbianCohesive.cpp.

1293 {
1294 return vectorDuplicate(dissipationVec.second);
1295 }
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.

◆ duplicateGradientVec()

SmartPetscObj< Vec > EshelbianPlasticity::CohesiveTAOCtxImpl::duplicateGradientVec ( )
inlineoverridevirtual

Implements EshelbianPlasticity::CohesiveTAOCtx.

Definition at line 1297 of file EshelbianCohesive.cpp.

1297 {
1298 return vectorDuplicate(gradDissipationVec.second);
1299 }

◆ duplicateKappaVec()

SmartPetscObj< Vec > EshelbianPlasticity::CohesiveTAOCtxImpl::duplicateKappaVec ( )
inlineoverridevirtual

Implements EshelbianPlasticity::CohesiveTAOCtx.

Definition at line 1289 of file EshelbianCohesive.cpp.

1289 {
1290 return vectorDuplicate(kappaVec.second);
1291 }

◆ getKappaVec()

CommInterface::EntitiesPetscVector & EshelbianPlasticity::CohesiveTAOCtxImpl::getKappaVec ( )
inlineoverridevirtual

Implements EshelbianPlasticity::CohesiveTAOCtx.

Definition at line 1301 of file EshelbianCohesive.cpp.

1301 {
1302 return kappaVec;
1303 }

Friends And Related Symbol Documentation

◆ cohesiveEvaluateObjectiveAndGradient

MoFEMErrorCode cohesiveEvaluateObjectiveAndGradient ( Tao  tao,
Vec  x,
PetscReal *  f,
Vec  g,
void *  ctx 
)
friend

Definition at line 1328 of file EshelbianCohesive.cpp.

1330 {
1331
1333 auto cohesive_ctx = static_cast<CohesiveTAOCtxImpl *>(ctx);
1334 auto &ep = *(cohesive_ctx->ep_ptr);
1335
1336#ifndef NDEBUG
1337 CHKERR VecView(delta_kappa, PETSC_VIEWER_STDOUT_WORLD);
1338#endif
1339 // Set delta_kappa values to the tag
1340 CHKERR VecCopy(delta_kappa, cohesive_ctx->kappaVec.second);
1341 CHKERR VecGhostUpdateBegin(cohesive_ctx->kappaVec.second, INSERT_VALUES,
1342 SCATTER_FORWARD);
1343 CHKERR VecGhostUpdateEnd(cohesive_ctx->kappaVec.second, INSERT_VALUES,
1344 SCATTER_FORWARD);
1345 CHKERR CommInterface::setTagFromVector(
1346 ep.mField.get_moab(), cohesive_ctx->kappaVec,
1347 get_delta_kappa_tag(ep.mField.get_moab()));
1348
1349 // solve primal problem
1350 CHKERR evaluatePrimalProblemCohesiveImpl(ep, cohesive_ctx->timeSolver,
1351 cohesive_ctx->kspSolVec);
1352 // solve adjoint problem to get lambda
1353 auto ksp = snesGetKSP(tsGetSNES(cohesive_ctx->timeSolver));
1354 CHKERR evaluateCohesiveLambdaImpl(ep, cohesive_ctx->setIntegrationAtFrontFace,
1355 ksp, cohesive_ctx->lambdaVec);
1356 // evaluate dissipation and its gradient
1358 ep, cohesive_ctx->setIntegrationAtFrontFace, cohesive_ctx->lambdaVec,
1359 cohesive_ctx->dissipationVec, cohesive_ctx->gradDissipationVec);
1360
1361 CHKERR VecSum(cohesive_ctx->dissipationVec.second, f);
1362 CHKERR VecCopy(cohesive_ctx->gradDissipationVec.second, g);
1363
1364 MOFEM_LOG("EP", Sev::inform)
1365 << "Cohesive objective function (negative total dissipation): " << *f;
1366
1368}
#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.
#define MOFEM_LOG(channel, severity)
Log.
Tag get_delta_kappa_tag(moab::Interface &moab)
static MoFEMErrorCode evaluateDissipationAndGradImpl(EshelbianCore &ep, ForcesAndSourcesCore::GaussHookFun set_integration_at_front_face, SmartPetscObj< Vec > lambda_vec, CommInterface::EntitiesPetscVector &dissipation_vec, CommInterface::EntitiesPetscVector &grad_dissipation_vec)
static MoFEMErrorCode evaluatePrimalProblemCohesiveImpl(EshelbianCore &ep, SmartPetscObj< TS > ts, SmartPetscObj< Vec > x)
static MoFEMErrorCode evaluateCohesiveLambdaImpl(EshelbianCore &ep, ForcesAndSourcesCore::GaussHookFun set_integration_at_front_face, SmartPetscObj< KSP > ksp, SmartPetscObj< Vec > lambda_vec)
constexpr double g
CohesiveTAOCtxImpl(EshelbianCore *ep, ForcesAndSourcesCore::GaussHookFun set_integration_at_front_face, SmartPetscObj< TS > time_solver)

Member Data Documentation

◆ dissipationVec

CommInterface::EntitiesPetscVector EshelbianPlasticity::CohesiveTAOCtxImpl::dissipationVec
private

Definition at line 1313 of file EshelbianCohesive.cpp.

◆ ep_ptr

EshelbianCore* EshelbianPlasticity::CohesiveTAOCtxImpl::ep_ptr
private

Definition at line 1306 of file EshelbianCohesive.cpp.

◆ gradDissipationVec

CommInterface::EntitiesPetscVector EshelbianPlasticity::CohesiveTAOCtxImpl::gradDissipationVec
private

Definition at line 1314 of file EshelbianCohesive.cpp.

◆ kappaVec

CommInterface::EntitiesPetscVector EshelbianPlasticity::CohesiveTAOCtxImpl::kappaVec
private

Definition at line 1312 of file EshelbianCohesive.cpp.

◆ kspSolVec

SmartPetscObj<Vec> EshelbianPlasticity::CohesiveTAOCtxImpl::kspSolVec
private

Definition at line 1310 of file EshelbianCohesive.cpp.

◆ lambdaVec

SmartPetscObj<Vec> EshelbianPlasticity::CohesiveTAOCtxImpl::lambdaVec
private

Definition at line 1311 of file EshelbianCohesive.cpp.

◆ setIntegrationAtFrontFace

ForcesAndSourcesCore::GaussHookFun EshelbianPlasticity::CohesiveTAOCtxImpl::setIntegrationAtFrontFace
private

Definition at line 1307 of file EshelbianCohesive.cpp.

◆ timeSolver

SmartPetscObj<TS> EshelbianPlasticity::CohesiveTAOCtxImpl::timeSolver
private

Definition at line 1308 of file EshelbianCohesive.cpp.


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