v0.16.3
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions
MatAmentumUmat.hpp File Reference

Amentum-specific UMAT registration surface. More...

#include <MatUmat.hpp>
#include <functional>

Go to the source code of this file.

Classes

struct  MatOps::AMENTUM_UMAT
 

Namespaces

namespace  MatOps
 

Macros

#define TSADAPTAMENTUM   "amentum"
 

Typedefs

using MatOps::AmentumTimeSource = std::function< void(PetscReal &, PetscReal &, PetscInt &)>
 

Functions

template<>
boost::shared_ptr< PhysicalEquations > MatOps::createMatOpsPhysicalEquationsPtr< AMENTUM_UMAT, MODEL_3D > (boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag)
 
template<>
boost::shared_ptr< PhysicalEquations > MatOps::createMatOpsPhysicalEquationsPtr< AMENTUM_UMAT, MODEL_2D_PLANE_STRAIN > (boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag)
 
MoFEMErrorCode MatOps::getAmentumElasticProperties (boost::shared_ptr< PhysicalEquations > physics_ptr, FEMethod *fe_ptr, int nb_gauss_pts, const double *&young_modulus, double &poisson_ratio, const double *endpoint_modulus)
 
MoFEMErrorCode MatOps::setAmentumTimeSource (boost::shared_ptr< PhysicalEquations > material, AmentumTimeSource source)
 
static PetscErrorCode TSAdaptChooseAmentum (TSAdapt adapt, TS ts, PetscReal h, PetscInt *next_sc, PetscReal *next_h, PetscBool *accept, PetscReal *wlte, PetscReal *wltea, PetscReal *wlter)
 
static PetscErrorCode TSAdaptResetAmentum (TSAdapt adapt)
 
static PetscErrorCode TSAdaptDestroyAmentum (TSAdapt adapt)
 
PetscErrorCode TSAdaptCreateAmentum (TSAdapt adapt)
 
PetscErrorCode TSAdaptChooseAmentumRejected (TSAdapt adapt, TS ts, PetscReal h, PetscReal *next_h)
 

Detailed Description

Amentum-specific UMAT registration surface.

Definition in file MatAmentumUmat.hpp.

Macro Definition Documentation

◆ TSADAPTAMENTUM

#define TSADAPTAMENTUM   "amentum"

Definition at line 11 of file MatAmentumUmat.hpp.

Function Documentation

◆ TSAdaptChooseAmentum()

static PetscErrorCode TSAdaptChooseAmentum ( TSAdapt  adapt,
TS  ts,
PetscReal  h,
PetscInt *  next_sc,
PetscReal *  next_h,
PetscBool *  accept,
PetscReal *  wlte,
PetscReal *  wltea,
PetscReal *  wlter 
)
static

Definition at line 792 of file MatAmentumUmat.cpp.

795 {
797
798 auto ts_adapt_amentum = static_cast<TSAdaptAmentum *>(adapt->data);
799 const PetscReal accepted_step_len = h;
800
801 *next_sc = 0; /* Reuse the same order scheme */
802 *wlte = -1; /* Weighted local truncation error was not evaluated */
803 *wltea = -1; /* Weighted absolute local truncation error is not used */
804 *wlter = -1; /* Weighted relative local truncation error is not used */
805
806 *accept = PETSC_TRUE;
807 *next_h = h; /* Reuse the old step */
808
809 CHKERR chooseAmentumStepSize(adapt, ts, h, next_h);
810
811 PetscReal current_t;
812 CHKERR TSGetTime(ts, &current_t);
813
814 const PetscReal accepted_t = current_t + accepted_step_len;
815
816 if (ts_adapt_amentum->restoreAfterShutdown) {
818 ts_adapt_amentum->restoreAfterShutdown = PETSC_FALSE;
819 ts_adapt_amentum->rampUpAfterShutdown = PETSC_TRUE;
820 MOFEM_LOG_C("TSWORLD", Sev::inform,
821 "\tShutdown step complete: t = %3.12g set restore h = %3.4g\n",
822 accepted_t, *next_h);
823 } else if (ts_adapt_amentum->rampUpAfterShutdown) {
824 *next_h = ts_adapt_amentum->regularStepLen;
825 ts_adapt_amentum->rampUpAfterShutdown = PETSC_FALSE;
826 while (!ts_adapt_amentum->shutdownTimes.empty() &&
827 accepted_t >= ts_adapt_amentum->shutdownTimes.front() -
829 ts_adapt_amentum->shutdownTimes.erase(
830 ts_adapt_amentum->shutdownTimes.begin());
831 }
832 MOFEM_LOG_C("TSWORLD", Sev::inform,
833 "\tField restore step complete: t = %3.12g set h = %3.4g\n",
834 accepted_t, *next_h);
835 } else if (!ts_adapt_amentum->shutdownTimes.empty()) {
836 const PetscReal nextShutdownTime = ts_adapt_amentum->shutdownTimes.front();
837
838 if (PetscAbsReal(accepted_t - nextShutdownTime) <=
841 ts_adapt_amentum->restoreAfterShutdown = PETSC_TRUE;
842 MOFEM_LOG_C("TSWORLD", Sev::inform,
843 "\tShutdown step after t = %3.12g set h = %3.4g \n",
844 accepted_t, *next_h);
845 } else {
846 const PetscReal next_t = accepted_t + *next_h;
847 if (accepted_t < nextShutdownTime && next_t >= nextShutdownTime) {
848 *next_h = nextShutdownTime - accepted_t;
849 MOFEM_LOG_C("TSWORLD", Sev::inform,
850 "\tClip step to shutdown: t = %3.12g shutdown = "
851 "%3.12g set h = %3.4g \n",
852 accepted_t, nextShutdownTime, *next_h);
853 }
854 }
855 }
856
858}
std::function< bool(size_t)> accept
Definition CGALTools.cpp:61
int h
Corner vertex and its two front neighbours.
#define MOFEM_LOG_C(channel, severity, format,...)
static PetscErrorCode chooseAmentumStepSize(TSAdapt adapt, TS ts, PetscReal h, PetscReal *next_h)
#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.
static constexpr PetscReal AMENTUM_SHUTDOWN_TIME_TOL
static constexpr PetscReal AMENTUM_SHUTDOWN_STEP_LEN
Custom TSAdaptivity in MoFEM for Amentum Umat.

◆ TSAdaptChooseAmentumRejected()

PetscErrorCode TSAdaptChooseAmentumRejected ( TSAdapt  adapt,
TS  ts,
PetscReal  h,
PetscReal *  next_h 
)

Apply the same step-size rule to a failed physical trial, without advancing the shutdown state. The supplied TS carries the failed SNES feedback.

Definition at line 779 of file MatAmentumUmat.cpp.

780 {
782 PetscBool amentum = PETSC_FALSE;
783 CHKERR PetscObjectTypeCompare(reinterpret_cast<PetscObject>(adapt),
784 TSADAPTAMENTUM, &amentum);
785 if (!amentum)
786 SETERRQ(PetscObjectComm(reinterpret_cast<PetscObject>(adapt)),
787 MOFEM_INVALID_DATA, "Rejected physical step requires Amentum adaptivity");
788 CHKERR chooseAmentumStepSize(adapt, ts, h, next_h);
790}
#define TSADAPTAMENTUM
@ MOFEM_INVALID_DATA
Definition definitions.h:36

◆ TSAdaptCreateAmentum()

PetscErrorCode TSAdaptCreateAmentum ( TSAdapt  adapt)

Definition at line 876 of file MatAmentumUmat.cpp.

876 {
877 PetscFunctionBegin;
878 adapt->data = new TSAdaptAmentum();
879 adapt->ops->choose = TSAdaptChooseAmentum;
880 adapt->ops->setfromoptions = TSAdaptSetFromOptionsAmentum;
881 adapt->ops->reset = TSAdaptResetAmentum;
882 adapt->ops->destroy = TSAdaptDestroyAmentum;
883 PetscFunctionReturn(0);
884}
PetscErrorCode TSAdaptChooseAmentum(TSAdapt adapt, TS ts, PetscReal h, PetscInt *next_sc, PetscReal *next_h, PetscBool *accept, PetscReal *wlte, PetscReal *wltea, PetscReal *wlter)
PetscErrorCode TSAdaptResetAmentum(TSAdapt adapt)
PetscErrorCode TSAdaptDestroyAmentum(TSAdapt adapt)
static PetscErrorCode TSAdaptSetFromOptionsAmentum(TSAdapt adapt, PetscOptionItems *options)

◆ TSAdaptDestroyAmentum()

static PetscErrorCode TSAdaptDestroyAmentum ( TSAdapt  adapt)
static

Definition at line 869 of file MatAmentumUmat.cpp.

869 {
871 delete static_cast<TSAdaptAmentum *>(adapt->data);
872 adapt->data = nullptr;
874}

◆ TSAdaptResetAmentum()

static PetscErrorCode TSAdaptResetAmentum ( TSAdapt  adapt)
static

Definition at line 860 of file MatAmentumUmat.cpp.

860 {
861 PetscFunctionBegin;
862 if (adapt->data) {
863 *static_cast<TSAdaptAmentum *>(adapt->data) = TSAdaptAmentum();
864 PetscCall(readAmentumOptions(adapt));
865 }
866 PetscFunctionReturn(0);
867}
static PetscErrorCode readAmentumOptions(TSAdapt adapt)