v0.15.0
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions | Variables
thermoplastic.cpp File Reference
#include <MoFEM.hpp>
#include <MatrixFunction.hpp>
#include <IntegrationRules.hpp>
#include <cstdlib>
#include <phg-quadrule/quad.h>
#include <HenckyOps.hpp>
#include <PlasticOps.hpp>
#include <PlasticNaturalBCs.hpp>
#include <ThermoElasticOps.hpp>
#include <FiniteThermalOps.hpp>
#include <ThermoPlasticOps.hpp>
#include <ThermalOps.hpp>
#include <EdgeFlippingOps.hpp>
#include <SolutionMapping.hpp>
#include <ThermalConvection.hpp>
#include <ThermalRadiation.hpp>

Go to the source code of this file.

Classes

struct  ElementsAndOps< 2 >
 
struct  ElementsAndOps< 3 >
 
struct  TSPrePostProc
 Set of functions called by PETSc solver used to refine and update mesh. More...
 
struct  ResizeCtx
 
struct  Example
 [Example] More...
 
struct  Example::ScaledTimeScale
 
struct  SetUpSchur
 [Push operators to pipeline] More...
 
struct  MyTsCtx
 
struct  SetUpSchurImpl
 

Macros

#define EXECUTABLE_DIMENSION   3
 

Typedefs

using EntData = EntitiesFieldData::EntData
 
using DomainEle = ElementsAndOps< SPACE_DIM >::DomainEle
 
using DomainEleOnRange = ElementsAndOps< SPACE_DIM >::DomainEleOnRange
 
using DomainEleOp = DomainEle::UserDataOperator
 
using BoundaryEle = ElementsAndOps< SPACE_DIM >::BoundaryEle
 
using BoundaryEleOp = BoundaryEle::UserDataOperator
 
using PostProcEle = PostProcBrokenMeshInMoab< DomainEle >
 
using SkinPostProcEle = PostProcBrokenMeshInMoab< BoundaryEle >
 
using SideEle = ElementsAndOps< SPACE_DIM >::SideEle
 
using SetPtsData = FieldEvaluatorInterface::SetPtsData
 
using AssemblyDomainEleOp = FormsIntegrators< DomainEleOp >::Assembly< AT >::OpBase
 
using ScalerFunTwoArgs = boost::function< double(const double, const double)>
 
using ScalerFunThreeArgs = boost::function< double(const double, const double, const double)>
 
using DomainRhsBCs = NaturalBC< DomainEleOp >::Assembly< AT >::LinearForm< IT >
 
using OpDomainRhsBCs = DomainRhsBCs::OpFlux< PlasticOps::DomainBCs, 1, SPACE_DIM >
 
using BoundaryRhsBCs = NaturalBC< BoundaryEleOp >::Assembly< AT >::LinearForm< IT >
 
using OpBoundaryRhsBCs = BoundaryRhsBCs::OpFlux< PlasticOps::BoundaryBCs, 1, SPACE_DIM >
 
using BoundaryLhsBCs = NaturalBC< BoundaryEleOp >::Assembly< AT >::BiLinearForm< IT >
 
using OpBoundaryLhsBCs = BoundaryLhsBCs::OpFlux< PlasticOps::BoundaryBCs, 1, SPACE_DIM >
 
using DomainNaturalBCRhs = NaturalBC< DomainEleOp >::Assembly< AT >::LinearForm< IT >
 [Body and heat source]
 
using OpBodyForce = DomainNaturalBCRhs::OpFlux< NaturalMeshsetType< BLOCKSET >, 1, SPACE_DIM >
 
using OpHeatSource = DomainNaturalBCRhs::OpFlux< NaturalMeshsetType< BLOCKSET >, 1, 1 >
 
using DomainNaturalBCLhs = NaturalBC< DomainEleOp >::Assembly< AT >::BiLinearForm< IT >
 
using BoundaryNaturalBC = NaturalBC< BoundaryEleOp >::Assembly< AT >::LinearForm< IT >
 [Body and heat source]
 
using OpForce = BoundaryNaturalBC::OpFlux< NaturalForceMeshsets, 1, SPACE_DIM >
 
using OpTemperatureBC = BoundaryNaturalBC::OpFlux< NaturalTemperatureMeshsets, 3, SPACE_DIM >
 
using OpEssentialFluxRhs = EssentialBC< BoundaryEleOp >::Assembly< AT >::LinearForm< IT >::OpEssentialRhs< HeatFluxCubitBcData, 3, SPACE_DIM >
 [Natural boundary conditions]
 
using OpEssentialFluxLhs = EssentialBC< BoundaryEleOp >::Assembly< AT >::BiLinearForm< IT >::OpEssentialLhs< HeatFluxCubitBcData, 3, SPACE_DIM >
 
using OpSetTemperatureRhs = DomainNaturalBCRhs::OpFlux< SetTargetTemperature, 1, 1 >
 [Essential boundary conditions (Least square approach)]
 
using OpSetTemperatureLhs = DomainNaturalBCLhs::OpFlux< SetTargetTemperature, 1, 1 >
 

Enumerations

enum  ICType { IC_UNIFORM , IC_GAUSSIAN , IC_LINEAR }
 

Functions

double H_thermal (double H, double omega_h, double temp_0, double temp)
 
double dH_thermal_dtemp (double H, double omega_h)
 
double y_0_thermal (double sigmaY, double omega_0, double temp_0, double temp)
 
double dy_0_thermal_dtemp (double sigmaY, double omega_0)
 
double Qinf_thermal (double Qinf, double omega_h, double temp_0, double temp)
 
double dQinf_thermal_dtemp (double Qinf, double omega_h)
 
double iso_hardening_exp (double tau, double b_iso)
 
double temp_hat (double temp)
 
double exp_softening (double temp_hat)
 
double iso_hardening (double tau, double H, double omega_0, double Qinf, double omega_h, double b_iso, double sigmaY, double temp_0, double temp)
 
double iso_hardening_dtau (double tau, double H, double omega_0, double Qinf, double omega_h, double b_iso, double sigmaY, double temp_0, double temp)
 
double iso_hardening_dtemp (double tau, double H, double omega_0, double Qinf, double omega_h, double b_iso, double sigmaY, double temp_0, double temp)
 
template<typename T , int DIM>
auto kinematic_hardening (FTensor::Tensor2_symmetric< T, DIM > &t_plastic_strain, double C1_k)
 
template<int DIM>
auto kinematic_hardening_dplastic_strain (double C1_k)
 
auto postProcessHere (MoFEM::Interface &m_field, SmartPetscObj< DM > &dm, std::string output_name, int &counter= *(new int(0)))
 
auto postProcessPETScHere (MoFEM::Interface &m_field, SmartPetscObj< DM > &dm, Vec sol, std::string output_name)
 
auto printOnAllCores (MoFEM::Interface &m_field, const std::string &out_put_string, const auto &out_put_quantity)
 
MoFEMErrorCode TSIterationPreStage (TS ts, PetscReal stagetime)
 
MoFEMErrorCode SNESIterationMonitor (SNES snes, PetscInt its, PetscReal norm, void *ctx)
 
PetscErrorCode MyTSResizeSetup (TS ts, PetscInt nstep, PetscReal time, Vec sol, PetscBool *resize, void *ctx)
 
PetscErrorCode MyTSResizeTransfer (TS ts, PetscInt nv, Vec ts_vecsin[], Vec ts_vecsout[], void *ctx)
 
int main (int argc, char *argv[])
 

Variables

constexpr int SPACE_DIM
 
constexpr auto size_symm = (SPACE_DIM * (SPACE_DIM + 1)) / 2
 
constexpr bool IS_LARGE_STRAINS
 
constexpr AssemblyType AT
 
constexpr IntegrationType IT
 
constexpr FieldSpace CONTACT_SPACE = ElementsAndOps<SPACE_DIM>::CONTACT_SPACE
 
double exp_C = -6.284
 
double exp_D = -1.024
 
const bool is_large_strains
 
PetscBool set_timer = PETSC_FALSE
 Set timer.
 
PetscBool do_eval_field = PETSC_FALSE
 Evaluate field.
 
char restart_file [255]
 
PetscBool restart_flg = PETSC_TRUE
 
double restart_time = 0
 
int restart_step = 0
 
PetscBool is_distributed_mesh = PETSC_TRUE
 
double scale = 1.
 
double default_thermal_conductivity_scale = 1.
 
double default_heat_capacity_scale = 1.
 
ScalerFunTwoArgs thermal_conductivity_scaling
 
ScalerFunTwoArgs heat_capacity_scaling
 
ScalerFunThreeArgs inelastic_heat_fraction_scaling
 
double young_modulus = 115000
 Young modulus.
 
double poisson_ratio = 0.31
 Poisson ratio.
 
double sigmaY = 936.2
 Yield stress.
 
double H = 584.3
 Hardening.
 
double visH = 0
 Viscous hardening.
 
double zeta = 5e-2
 regularisation parameter
 
double Qinf = 174.2
 Saturation yield stress.
 
double b_iso = 63.69
 Saturation exponent.
 
double C1_k = 0
 Kinematic hardening.
 
double cn0 = 1
 
double cn1 = 1
 
double default_ref_temp = 20.0
 
const char *const ICTypes []
 
ICType ic_type = IC_UNIFORM
 
double init_temp = 20.0
 
double peak_temp = 1000.0
 
double width = 10.0
 Width of Gaussian distribution.
 
double default_coeff_expansion = 1e-5
 
double default_heat_conductivity
 
double default_heat_capacity = 2.332
 
double omega_0 = 2e-3
 flow stress softening
 
double omega_h = 2e-3
 hardening softening
 
double inelastic_heat_fraction
 fraction of plastic dissipation converted to heat
 
double temp_0 = 20
 reference temperature for thermal softening
 
int order = 2
 Order displacement.
 
int tau_order = order - 2
 Order of tau field.
 
int ep_order = order - 1
 Order of ep field.
 
int flux_order = order
 Order of tau field.
 
int T_order = order - 1
 Order of ep field.
 
int geom_order = 2
 Order if fixed.
 
int atom_test = 0
 
PetscBool order_edge = PETSC_FALSE
 
PetscBool order_face = PETSC_FALSE
 
PetscBool order_volume = PETSC_FALSE
 
PetscBool is_quasi_static = PETSC_TRUE
 
double rho = 0.0
 
double alpha_damping = 0
 
double init_dt = 0.05
 
double min_dt = 1e-12
 
double qual_tol = 0
 
auto Gaussian_distribution
 
auto linear_distribution
 
auto uniform_distribution
 
auto init_T
 Initialisation function for temperature field.
 
int post_processing_counter = 0
 
auto save_range
 
static boost::weak_ptr< TSPrePostProctsPrePostProc
 
static std::unordered_map< TS, ResizeCtx * > ts_to_rctx
 
static std::unordered_map< TS, MyTsCtx * > ts_to_ctx
 
Examplethermoplastic_raw_ptr = nullptr
 
static char help [] = "...\n\n"
 [Solve]
 

Macro Definition Documentation

◆ EXECUTABLE_DIMENSION

#define EXECUTABLE_DIMENSION   3

Definition at line 13 of file thermoplastic.cpp.

Typedef Documentation

◆ AssemblyDomainEleOp

Definition at line 76 of file thermoplastic.cpp.

◆ BoundaryEle

Definition at line 69 of file thermoplastic.cpp.

◆ BoundaryEleOp

Definition at line 70 of file thermoplastic.cpp.

◆ BoundaryLhsBCs

Definition at line 510 of file thermoplastic.cpp.

◆ BoundaryNaturalBC

[Body and heat source]

[Natural boundary conditions]

Definition at line 525 of file thermoplastic.cpp.

◆ BoundaryRhsBCs

Definition at line 507 of file thermoplastic.cpp.

◆ DomainEle

Definition at line 66 of file thermoplastic.cpp.

◆ DomainEleOnRange

Definition at line 67 of file thermoplastic.cpp.

◆ DomainEleOp

Definition at line 68 of file thermoplastic.cpp.

◆ DomainNaturalBCLhs

Definition at line 520 of file thermoplastic.cpp.

◆ DomainNaturalBCRhs

[Body and heat source]

Definition at line 515 of file thermoplastic.cpp.

◆ DomainRhsBCs

Definition at line 504 of file thermoplastic.cpp.

◆ EntData

Definition at line 65 of file thermoplastic.cpp.

◆ OpBodyForce

Definition at line 516 of file thermoplastic.cpp.

◆ OpBoundaryLhsBCs

using OpBoundaryLhsBCs = BoundaryLhsBCs::OpFlux<PlasticOps::BoundaryBCs, 1, SPACE_DIM>

Definition at line 511 of file thermoplastic.cpp.

◆ OpBoundaryRhsBCs

using OpBoundaryRhsBCs = BoundaryRhsBCs::OpFlux<PlasticOps::BoundaryBCs, 1, SPACE_DIM>

Definition at line 508 of file thermoplastic.cpp.

◆ OpDomainRhsBCs

using OpDomainRhsBCs = DomainRhsBCs::OpFlux<PlasticOps::DomainBCs, 1, SPACE_DIM>

Definition at line 505 of file thermoplastic.cpp.

◆ OpEssentialFluxLhs

Definition at line 535 of file thermoplastic.cpp.

◆ OpEssentialFluxRhs

[Natural boundary conditions]

[Essential boundary conditions (Least square approach)]

Definition at line 533 of file thermoplastic.cpp.

◆ OpForce

Definition at line 527 of file thermoplastic.cpp.

◆ OpHeatSource

Definition at line 518 of file thermoplastic.cpp.

◆ OpSetTemperatureLhs

using OpSetTemperatureLhs = DomainNaturalBCLhs::OpFlux<SetTargetTemperature, 1, 1>

Definition at line 541 of file thermoplastic.cpp.

◆ OpSetTemperatureRhs

using OpSetTemperatureRhs = DomainNaturalBCRhs::OpFlux<SetTargetTemperature, 1, 1>

[Essential boundary conditions (Least square approach)]

Definition at line 539 of file thermoplastic.cpp.

◆ OpTemperatureBC

Definition at line 528 of file thermoplastic.cpp.

◆ PostProcEle

Definition at line 71 of file thermoplastic.cpp.

◆ ScalerFunThreeArgs

using ScalerFunThreeArgs = boost::function<double(const double, const double, const double)>

Definition at line 79 of file thermoplastic.cpp.

◆ ScalerFunTwoArgs

using ScalerFunTwoArgs = boost::function<double(const double, const double)>

Definition at line 78 of file thermoplastic.cpp.

◆ SetPtsData

Definition at line 74 of file thermoplastic.cpp.

◆ SideEle

Definition at line 73 of file thermoplastic.cpp.

◆ SkinPostProcEle

Definition at line 72 of file thermoplastic.cpp.

Enumeration Type Documentation

◆ ICType

enum ICType
Enumerator
IC_UNIFORM 
IC_GAUSSIAN 
IC_LINEAR 

Definition at line 217 of file thermoplastic.cpp.

@ IC_UNIFORM
@ IC_LINEAR
@ IC_GAUSSIAN

Function Documentation

◆ dH_thermal_dtemp()

double dH_thermal_dtemp ( double  H,
double  omega_h 
)
inline
Examples
thermoplastic.cpp.

Definition at line 86 of file thermoplastic.cpp.

86 {
87 return -H * omega_h;
88}
double H
Hardening.
double omega_h
hardening softening

◆ dQinf_thermal_dtemp()

double dQinf_thermal_dtemp ( double  Qinf,
double  omega_h 
)
inline
Examples
thermoplastic.cpp.

Definition at line 104 of file thermoplastic.cpp.

104 {
105 return -Qinf * omega_h;
106}
double Qinf
Saturation yield stress.

◆ dy_0_thermal_dtemp()

double dy_0_thermal_dtemp ( double  sigmaY,
double  omega_0 
)
inline
Examples
thermoplastic.cpp.

Definition at line 95 of file thermoplastic.cpp.

95 {
96 return -sigmaY * omega_0;
97}
double omega_0
flow stress softening
double sigmaY
Yield stress.

◆ exp_softening()

double exp_softening ( double  temp_hat)
inline
Examples
thermoplastic.cpp.

Definition at line 122 of file thermoplastic.cpp.

122 {
123 return std::exp(exp_C * pow(temp_hat, 2) + exp_D * temp_hat);
124}
double exp_D
double temp_hat(double temp)
double exp_C

◆ H_thermal()

double H_thermal ( double  H,
double  omega_h,
double  temp_0,
double  temp 
)
inline
Examples
thermoplastic.cpp.

Definition at line 82 of file thermoplastic.cpp.

82 {
83 return H * (1. - omega_h * (temp - temp_0));
84}
void temp(int x, int y=10)
Definition simple.cpp:4
double temp_0
reference temperature for thermal softening

◆ iso_hardening()

double iso_hardening ( double  tau,
double  H,
double  omega_0,
double  Qinf,
double  omega_h,
double  b_iso,
double  sigmaY,
double  temp_0,
double  temp 
)
inline

Isotropic hardening

Definition at line 129 of file thermoplastic.cpp.

131 {
132 return (sigmaY + H * tau + Qinf * (1. - iso_hardening_exp(tau, b_iso))) *
134}
double exp_softening(double temp_hat)
double iso_hardening_exp(double tau, double b_iso)
double b_iso
Saturation exponent.

◆ iso_hardening_dtau()

double iso_hardening_dtau ( double  tau,
double  H,
double  omega_0,
double  Qinf,
double  omega_h,
double  b_iso,
double  sigmaY,
double  temp_0,
double  temp 
)
inline

Definition at line 136 of file thermoplastic.cpp.

138 {
139 return (H + Qinf * b_iso * iso_hardening_exp(tau, b_iso)) *
141}

◆ iso_hardening_dtemp()

double iso_hardening_dtemp ( double  tau,
double  H,
double  omega_0,
double  Qinf,
double  omega_h,
double  b_iso,
double  sigmaY,
double  temp_0,
double  temp 
)
inline
Examples
PlasticOpsGeneric.hpp, and thermoplastic.cpp.

Definition at line 143 of file thermoplastic.cpp.

145 {
146 double JC_ref_temp = 0.;
147 double JC_melt_temp = 1650.;
148 double T_hat = temp_hat(temp);
149
150 return (sigmaY + H * tau + Qinf * (1. - iso_hardening_exp(tau, b_iso))) *
151 (exp_D + 2 * T_hat * exp_C) *
152 std::exp(exp_D * T_hat + pow(T_hat, 2) * exp_C) /
153 (JC_melt_temp - JC_ref_temp);
154}

◆ iso_hardening_exp()

double iso_hardening_exp ( double  tau,
double  b_iso 
)
inline

Definition at line 108 of file thermoplastic.cpp.

108 {
109 return std::exp(-b_iso * tau);
110}

◆ kinematic_hardening()

template<typename T , int DIM>
auto kinematic_hardening ( FTensor::Tensor2_symmetric< T, DIM > &  t_plastic_strain,
double  C1_k 
)
inline

Kinematic hardening

Definition at line 161 of file thermoplastic.cpp.

162 {
163 FTensor::Index<'i', DIM> i;
164 FTensor::Index<'j', DIM> j;
166 if (C1_k < std::numeric_limits<double>::epsilon()) {
167 t_alpha(i, j) = 0;
168 return t_alpha;
169 }
170 t_alpha(i, j) = C1_k * t_plastic_strain(i, j);
171 return t_alpha;
172}
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
double C1_k
Kinematic hardening.

◆ kinematic_hardening_dplastic_strain()

template<int DIM>
auto kinematic_hardening_dplastic_strain ( double  C1_k)
inline

Definition at line 175 of file thermoplastic.cpp.

175 {
176 FTensor::Index<'i', DIM> i;
177 FTensor::Index<'j', DIM> j;
178 FTensor::Index<'k', DIM> k;
179 FTensor::Index<'l', DIM> l;
182 t_diff(i, j, k, l) = C1_k * (t_kd(i, k) ^ t_kd(j, l)) / 4.;
183 return t_diff;
184}
Kronecker Delta class symmetric.
constexpr auto t_kd
FTensor::Index< 'l', 3 > l
FTensor::Index< 'k', 3 > k

◆ main()

int main ( int  argc,
char *  argv[] 
)

[Register MoFEM discrete manager in PETSc]

[Register MoFEM discrete manager in PETSc

[Create MoAB]

< mesh database

< mesh database interface

[Create MoAB]

[Create MoFEM]

< finite element database

< finite element database interface

[Create MoFEM]

[Load mesh]

[Load mesh]

[Example]

[Example]

Definition at line 5339 of file thermoplastic.cpp.

5339 {
5340
5341#ifdef ADD_CONTACT
5342 #ifdef ENABLE_PYTHON_BINDING
5343 Py_Initialize();
5344 np::initialize();
5345 #endif
5346#endif // ADD_CONTACT
5347
5348 // Initialisation of MoFEM/PETSc and MOAB data structures
5349 const char param_file[] = "param_file.petsc";
5350 MoFEM::Core::Initialize(&argc, &argv, param_file, help);
5351
5352 // Add logging channel for example
5353 auto core_log = logging::core::get();
5354 core_log->add_sink(
5356 core_log->add_sink(
5358 core_log->add_sink(
5359 LogManager::createSink(LogManager::getStrmWorld(), "THERMOPLASTICITY"));
5360 core_log->add_sink(
5362 core_log->add_sink(
5364 LogManager::setLog("PLASTICITY");
5365 LogManager::setLog("THERMAL");
5366 LogManager::setLog("THERMOPLASTICITY");
5367 LogManager::setLog("REMESHING");
5368 MOFEM_LOG_TAG("PLASTICITY", "Plasticity");
5369 MOFEM_LOG_TAG("THERMAL", "Thermal");
5370 MOFEM_LOG_TAG("THERMOPLASTICITY", "Thermoplasticity");
5371 MOFEM_LOG_TAG("REMESHING", "Remeshing");
5372
5373#ifdef ADD_CONTACT
5374 core_log->add_sink(
5376 LogManager::setLog("CONTACT");
5377 MOFEM_LOG_TAG("CONTACT", "Contact");
5378#endif // ADD_CONTACT
5379
5380 try {
5381
5382 //! [Register MoFEM discrete manager in PETSc]
5383 DMType dm_name = "DMMOFEM";
5384 CHKERR DMRegister_MoFEM(dm_name);
5385 //! [Register MoFEM discrete manager in PETSc
5386
5387 //! [Create MoAB]
5388 moab::Core mb_instance; ///< mesh database
5389 moab::Interface &moab = mb_instance; ///< mesh database interface
5390 //! [Create MoAB]
5391
5392 //! [Create MoFEM]
5393 MoFEM::Core core(moab); ///< finite element database
5394 MoFEM::Interface &m_field = core; ///< finite element database interface
5395 //! [Create MoFEM]
5396
5397 //! [Load mesh]
5398 Simple *simple = m_field.getInterface<Simple>();
5400 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-is_distributed_mesh",
5401 &is_distributed_mesh, PETSC_NULLPTR);
5402 if (is_distributed_mesh == PETSC_TRUE) {
5403 CHKERR simple->loadFile();
5404 } else {
5405 char meshFileName[255];
5406 CHKERR PetscOptionsGetString(PETSC_NULLPTR, PETSC_NULLPTR, "-file_name",
5407 meshFileName, 255, PETSC_NULLPTR);
5408 CHKERR simple->loadFile("", meshFileName);
5409 }
5410 //! [Load mesh]
5411
5412 //! [Example]
5413 Example ex(m_field);
5414 CHKERR ex.runProblem();
5415 //! [Example]
5416 }
5418
5420
5421#ifdef ADD_CONTACT
5422 #ifdef ENABLE_PYTHON_BINDING
5423 if (Py_FinalizeEx() < 0) {
5424 exit(120);
5425 }
5426 #endif
5427#endif // ADD_CONTACT
5428
5429 return 0;
5430}
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition acoustic.cpp:69
#define CATCH_ERRORS
Catch errors.
#define CHKERR
Inline error check.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
[Example]
Definition plastic.cpp:216
Core (interface) class.
Definition Core.hpp:82
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:72
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:118
Deprecated interface functions.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Simple interface for fast problem set-up.
Definition Simple.hpp:27
MoFEMErrorCode getOptions()
get options
Definition Simple.cpp:180
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
static char help[]
[Solve]
PetscBool is_distributed_mesh

◆ MyTSResizeSetup()

PetscErrorCode MyTSResizeSetup ( TS  ts,
PetscInt  nstep,
PetscReal  time,
Vec  sol,
PetscBool *  resize,
void *  ctx 
)
Examples
thermoplastic.cpp.

Definition at line 3858 of file thermoplastic.cpp.

3859 {
3860 PetscFunctionBegin;
3861 ResizeCtx *rctx = static_cast<ResizeCtx *>(ctx);
3862 *resize = rctx->mesh_changed;
3863 PetscFunctionReturn(0);
3864}
PetscBool mesh_changed

◆ MyTSResizeTransfer()

PetscErrorCode MyTSResizeTransfer ( TS  ts,
PetscInt  nv,
Vec  ts_vecsin[],
Vec  ts_vecsout[],
void *  ctx 
)
Examples
thermoplastic.cpp.

Definition at line 3866 of file thermoplastic.cpp.

3867 {
3868 PetscFunctionBegin;
3869 ResizeCtx *rctx = static_cast<ResizeCtx *>(ctx);
3870
3871 MOFEM_LOG("REMESHING", Sev::verbose) << "number of vectors to map = " << nv;
3872
3873 for (PetscInt i = 0; i < nv; ++i) {
3874 double nrm;
3875 CHKERR VecNorm(ts_vecsin[i], NORM_2, &nrm);
3876 MOFEM_LOG("REMESHING", Sev::warning)
3877 << "Before remeshing: ts_vecsin[" << i << "] norm = " << nrm;
3878 }
3879
3880 if (auto ptr = tsPrePostProc.lock()) {
3881
3882 MoFEM::Interface &m_field = *(rctx->m_field);
3883
3884 MOFEM_LOG("REMESHING", Sev::verbose)
3885 << "rctx->all_old_els = " << rctx->all_old_els;
3886 MOFEM_LOG("REMESHING", Sev::verbose)
3887 << "rctx->new_elements = " << rctx->new_elements;
3888 MOFEM_LOG("REMESHING", Sev::verbose)
3889 << "rctx->flipped_els = " << rctx->flipped_els;
3890
3891 auto scatter_mng = m_field.getInterface<VecManager>();
3892 auto simple = m_field.getInterface<Simple>();
3893
3894 // Rebuilding DM with old and new mesh entities
3895 auto bit = BitRefLevel().set();
3897 {"T", "TAU", "EP"}, {T_order, tau_order, ep_order}, bit);
3898
3899 auto intermediate_dm = createDM(m_field.get_comm(), "DMMOFEM");
3900 CHKERR DMMoFEMCreateMoFEM(intermediate_dm, &m_field, "INTERMEDIATE_DM",
3901 BitRefLevel().set(),
3902 BitRefLevel().set(BITREFLEVEL_SIZE - 1).flip());
3903 CHKERR DMMoFEMSetDestroyProblem(intermediate_dm, PETSC_TRUE);
3904 CHKERR DMSetFromOptions(intermediate_dm);
3905 CHKERR DMMoFEMAddElement(intermediate_dm, simple->getDomainFEName());
3906 CHKERR DMMoFEMSetSquareProblem(intermediate_dm, PETSC_TRUE);
3908 CHKERR DMSetUp(intermediate_dm);
3909
3910 Vec vec_in[nv], vec_out[nv];
3911 for (PetscInt i = 0; i < nv; ++i) {
3912 CHKERR DMCreateGlobalVector(intermediate_dm, &vec_in[i]);
3913 CHKERR VecDuplicate(vec_in[i], &vec_out[i]);
3914 }
3915
3916 VecScatter scatter_to_intermediate;
3917
3918 for (PetscInt i = 0; i < nv; ++i) {
3919 CHKERR scatter_mng->vecScatterCreate(
3920 ts_vecsin[i], simple->getProblemName(), RowColData::ROW, vec_in[i],
3921 "INTERMEDIATE_DM", RowColData::ROW, &scatter_to_intermediate);
3922 CHKERR VecScatterBegin(scatter_to_intermediate, ts_vecsin[i], vec_in[i],
3923 INSERT_VALUES, SCATTER_FORWARD);
3924 CHKERR VecScatterEnd(scatter_to_intermediate, ts_vecsin[i], vec_in[i],
3925 INSERT_VALUES, SCATTER_FORWARD);
3926 }
3927
3928 CHKERR VecScatterDestroy(&scatter_to_intermediate);
3929
3931 CHKERR DMSetUp_MoFEM(intermediate_dm);
3932
3933 constexpr bool do_fake_mapping = false;
3934 if (do_fake_mapping) {
3935 auto tmp_D = createDMVector(intermediate_dm);
3936 CHKERR DMoFEMMeshToLocalVector(intermediate_dm, tmp_D, INSERT_VALUES,
3937 SCATTER_FORWARD);
3938 CHKERR VecCopy(vec_in[0], vec_out[0]);
3939
3940 auto sub_dm = createDM(m_field.get_comm(), "DMMOFEM");
3941 CHKERR DMSetType(sub_dm, "DMMOFEM");
3942 CHKERR DMMoFEMCreateSubDM(sub_dm, intermediate_dm, "SUB_MAPPING");
3943 CHKERR DMMoFEMAddElement(sub_dm, simple->getDomainFEName());
3944 CHKERR DMMoFEMSetSquareProblem(sub_dm, PETSC_TRUE);
3945 CHKERR DMMoFEMSetDestroyProblem(sub_dm, PETSC_TRUE);
3946
3947 MOFEM_LOG("REMESHING", Sev::inform) << "Created sub DpoM";
3948
3949 for (auto f : {"T", "TAU", "EP"}) {
3951 sub_dm, f, boost::make_shared<Range>(rctx->new_elements));
3953 sub_dm, f, boost::make_shared<Range>(rctx->new_elements));
3954 }
3955
3956 auto bit = BitRefLevel().set();
3957 CHKERR m_field.modify_problem_ref_level_set_bit("SUB_MAPPING", bit);
3958 CHKERR m_field.modify_problem_mask_ref_level_set_bit("SUB_MAPPING", bit);
3959
3961 CHKERR DMSubDMSetUp_MoFEM(sub_dm);
3962
3963 auto fe_method = boost::make_shared<DomainEle>(m_field);
3964 CHKERR DMoFEMLoopFiniteElements(sub_dm, simple->getDomainFEName(),
3965 fe_method);
3966
3967 CHKERR DMoFEMMeshToLocalVector(intermediate_dm, tmp_D, INSERT_VALUES,
3968 SCATTER_REVERSE);
3969 } else {
3971 intermediate_dm, rctx->all_old_els, rctx->new_elements,
3972 rctx->flipped_els, nv, vec_in, vec_out);
3973 }
3974
3975 // Build problem on new bit ref level
3976 auto ts_problem_name = simple->getProblemName();
3977 CHKERR m_field.modify_problem_ref_level_set_bit(ts_problem_name,
3978 BitRefLevel().set(1));
3980 ts_problem_name, BitRefLevel().set(BITREFLEVEL_SIZE - 1).flip());
3982 CHKERR DMSetUp_MoFEM(simple->getDM());
3983
3984#ifndef NDEBUG
3985
3986 // e10 -> e11 (old to new) no flipped
3987 // e10 -> e10 old flipped
3988 // -> e01 new flliped
3989 // e11, e01 -> bit01 mask 11 (all)
3990
3991 if (m_field.get_comm_rank() == 0) {
3992 MOFEM_LOG("REMESHING", Sev::verbose)
3993 << "Writing debug VTK files for remeshing verification";
3994 CHKERR m_field.getInterface<BitRefManager>()->writeBitLevelByDim(
3995 BitRefLevel().set(0), BitRefLevel().set(0), 2, "bit_0_mask_0.vtk",
3996 "VTK", ""); // that are elements on old which are flipped
3997 CHKERR m_field.getInterface<BitRefManager>()->writeBitLevelByDim(
3998 BitRefLevel().set(0), BitRefLevel().set(), 2, "bit_0_mask_all.vtk",
3999 "VTK", ""); // all old elements
4000 CHKERR m_field.getInterface<BitRefManager>()->writeBitLevelByDim(
4001 BitRefLevel().set(1), BitRefLevel().set(1), 2, "bit_1_mask_1.vtk",
4002 "VTK", ""); // that are new elements
4003 CHKERR m_field.getInterface<BitRefManager>()->writeBitLevelByDim(
4004 BitRefLevel().set(1), BitRefLevel().set(), 2, "bit_1_mask_all.vtk",
4005 "VTK", ""); // all new elements
4006 }
4007#endif // NDEBUG
4008
4009 VecScatter scatter_to_final;
4010
4011 for (PetscInt i = 0; i < nv; ++i) {
4012 CHKERR DMCreateGlobalVector(simple->getDM(), &ts_vecsout[i]);
4013 CHKERR scatter_mng->vecScatterCreate(
4014 ts_vecsout[i], simple->getProblemName(), RowColData::ROW, vec_out[i],
4015 "INTERMEDIATE_DM", RowColData::ROW, &scatter_to_final);
4016 CHKERR VecScatterBegin(scatter_to_final, vec_out[i], ts_vecsout[i],
4017 INSERT_VALUES, SCATTER_REVERSE);
4018 CHKERR VecScatterEnd(scatter_to_final, vec_out[i], ts_vecsout[i],
4019 INSERT_VALUES, SCATTER_REVERSE);
4020 CHKERR VecScatterDestroy(&scatter_to_final);
4021 }
4022
4023 for (PetscInt i = 0; i < nv; ++i) {
4024 CHKERR VecDestroy(&vec_in[i]);
4025 CHKERR VecDestroy(&vec_out[i]);
4026 }
4027
4028 // Squash and change bit ref level back
4029 auto bit_mng = m_field.getInterface<BitRefManager>();
4030
4031 Range flipped_ents;
4032 CHKERR bit_mng->getEntitiesByRefLevel(BitRefLevel().set(0),
4033 BitRefLevel().set(0), flipped_ents);
4034 CHKERR bit_mng->addBitRefLevel(flipped_ents,
4035 BitRefLevel().set(BITREFLEVEL_SIZE - 1));
4036 BitRefLevel shift_mask = BitRefLevel().set(BITREFLEVEL_SIZE - 1);
4037 shift_mask.flip();
4038 CHKERR bit_mng->shiftRightBitRef(1, shift_mask);
4039 CHKERR m_field.modify_problem_ref_level_set_bit(ts_problem_name,
4040 BitRefLevel().set(0));
4041 // CHKERR DMMoFEMSetIsPartitioned(simple->getDM(), is_distributed_mesh);
4042 // CHKERR DMSetUp_MoFEM(simple->getDM());
4043
4044 CHKERR TSSetDM(ts, simple->getDM());
4045 auto B = createDMMatrix(simple->getDM());
4046 CHKERR TSSetIJacobian(ts, B, B, nullptr, nullptr);
4047 rctx->mesh_changed = PETSC_FALSE;
4048 }
4049
4050 for (PetscInt i = 0; i < nv; ++i) {
4051 double nrm;
4052 CHKERR VecNorm(ts_vecsout[i], NORM_2, &nrm);
4053 MOFEM_LOG("REMESHING", Sev::warning)
4054 << "After remeshing: ts_vecsout[" << i << "] norm = " << nrm;
4055 }
4056
4057 PetscFunctionReturn(0);
4058}
@ ROW
#define BITREFLEVEL_SIZE
max number of refinements
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
Definition DMMoFEM.cpp:1113
PetscErrorCode DMMoFEMCreateSubDM(DM subdm, DM dm, const char problem_name[])
Must be called by user to set Sub DM MoFEM data structures.
Definition DMMoFEM.cpp:215
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Definition DMMoFEM.cpp:488
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
Definition DMMoFEM.cpp:450
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
Definition DMMoFEM.cpp:114
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition DMMoFEM.cpp:514
PetscErrorCode DMMoFEMAddSubFieldRow(DM dm, const char field_name[])
Definition DMMoFEM.cpp:238
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition DMMoFEM.cpp:576
auto createDMVector(DM dm)
Get smart vector from DM.
Definition DMMoFEM.hpp:1234
PetscErrorCode DMMoFEMAddSubFieldCol(DM dm, const char field_name[])
Definition DMMoFEM.cpp:280
auto createDMMatrix(DM dm)
Get smart matrix from DM.
Definition DMMoFEM.hpp:1191
PetscErrorCode DMSubDMSetUp_MoFEM(DM subdm)
Definition DMMoFEM.cpp:1344
PetscErrorCode DMSetUp_MoFEM(DM dm)
Definition DMMoFEM.cpp:1297
#define MOFEM_LOG(channel, severity)
Log.
virtual MoFEMErrorCode modify_problem_mask_ref_level_set_bit(const std::string &name_problem, const BitRefLevel &bit)=0
set dof mask ref level for problem
virtual MoFEMErrorCode modify_problem_ref_level_set_bit(const std::string &name_problem, const BitRefLevel &bit)=0
set ref level for problem
auto bit
set bit
const FTensor::Tensor2< T, Dim, Dim > Vec
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
PetscErrorCode DMMoFEMSetDestroyProblem(DM dm, PetscBool destroy_problem)
Definition DMMoFEM.cpp:434
auto createDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
Managing BitRefLevels.
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Vector manager is used to create vectors \mofem_vectors.
MoFEM::Interface * m_field
MoFEMErrorCode reSetUp(std::vector< std::string > fIelds, std::vector< int > oRders, BitRefLevel bIt)
MoFEMErrorCode mapFields(SmartPetscObj< DM > &intermediateDM, Range elsToRemove=Range(), Range elsToAdd=Range(), Range elsToFlip=Range(), PetscInt numVecs=1, Vec vecsToMapFrom[]=PETSC_NULLPTR, Vec vecsToMapTo[]=PETSC_NULLPTR)
static boost::weak_ptr< TSPrePostProc > tsPrePostProc
int T_order
Order of ep field.
int tau_order
Order of tau field.
int ep_order
Order of ep field.

◆ postProcessHere()

auto postProcessHere ( MoFEM::Interface m_field,
SmartPetscObj< DM > &  dm,
std::string  output_name,
int &  counter = *(new int(0)) 
)
Examples
thermoplastic.cpp.

Definition at line 331 of file thermoplastic.cpp.

332 {
334
335 auto create_post_process_elements = [&]() {
337 auto pp_fe = boost::make_shared<PostProcEle>(m_field);
338
339 auto push_vol_post_proc_ops = [&](auto &pp_fe) {
341
342 auto &pip = pp_fe->getOpPtrVector();
343
344 auto TAU_ptr = boost::make_shared<VectorDouble>();
345 pip.push_back(new OpCalculateScalarFieldValues("TAU", TAU_ptr));
346 auto T_ptr = boost::make_shared<VectorDouble>();
347 pip.push_back(new OpCalculateScalarFieldValues("T", T_ptr));
348
349 auto T_grad_ptr = boost::make_shared<MatrixDouble>();
350 pip.push_back(
351 new OpCalculateScalarFieldGradient<SPACE_DIM>("T", T_grad_ptr));
352 auto U_ptr = boost::make_shared<MatrixDouble>();
353 pip.push_back(new OpCalculateVectorFieldValues<SPACE_DIM>("U", U_ptr));
354 auto FLUX_ptr = boost::make_shared<MatrixDouble>();
355 pip.push_back(
356 new OpCalculateHVecVectorField<3, SPACE_DIM>("FLUX", FLUX_ptr));
357
358 auto EP_ptr = boost::make_shared<MatrixDouble>();
359 pip.push_back(
361
363
364 pip.push_back(
365
366 new OpPPMap(
367
368 pp_fe->getPostProcMesh(), pp_fe->getMapGaussPts(),
369
370 {{"TAU", TAU_ptr}, {"T", T_ptr}},
371
372 {{"U", U_ptr}, {"FLUX", FLUX_ptr}, {"T_GRAD", T_grad_ptr}},
373
374 {},
375
376 {{"EP", EP_ptr}}
377
378 )
379
380 );
381
383 };
384
385 CHKERR push_vol_post_proc_ops(pp_fe);
386
387 if (m_field.get_comm_size() == 1) {
388
389 CHKERR DMoFEMLoopFiniteElements(dm, "dFE", pp_fe);
390 CHKERR pp_fe->writeFile("out_" + std::to_string(counter) + "_" +
391 output_name + ".h5m");
392 } else {
393
395 m_field.get_comm_size());
396 auto &post_proc_moab = pp_fe->getPostProcMesh();
397 auto file_name = "out_" + std::to_string(counter) + "_" + output_name +
398 "_" + std::to_string(m_field.get_comm_rank()) + ".vtk";
399 MOFEM_LOG("WORLD", Sev::inform)
400 << "Writing file " << file_name << std::endl;
401 CHKERR post_proc_moab.write_file(file_name.c_str(), "VTK");
402 }
403 counter++;
404
406 };
407
408 CHKERR create_post_process_elements();
409
411}
#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()
PetscErrorCode DMoFEMLoopFiniteElementsUpAndLowRank(DM dm, const char fe_name[], MoFEM::FEMethod *method, int low_rank, int up_rank, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition DMMoFEM.cpp:557
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
virtual int get_comm_size() const =0
Get vector field for H-div approximation.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Specialization for double precision scalar field values calculation.
Calculate symmetric tensor field values at integration pts.
Specialization for double precision vector field values calculation.
Post post-proc data at points from hash maps.

◆ postProcessPETScHere()

auto postProcessPETScHere ( MoFEM::Interface m_field,
SmartPetscObj< DM > &  dm,
Vec  sol,
std::string  output_name 
)
Examples
thermoplastic.cpp.

Definition at line 413 of file thermoplastic.cpp.

414 {
416
417 auto smart_sol = SmartPetscObj<Vec>(sol, true);
418
419 auto create_post_process_elements = [&]() {
421 Simple *simple = m_field.getInterface<Simple>();
422 auto pp_fe = boost::make_shared<PostProcEle>(m_field);
423 auto &pip = pp_fe->getOpPtrVector();
424
425 auto push_vol_post_proc_ops = [&](auto &pp_fe) {
427
428 auto &pip = pp_fe->getOpPtrVector();
429
430 auto TAU_ptr = boost::make_shared<VectorDouble>();
431 pip.push_back(
432 new OpCalculateScalarFieldValues("TAU", TAU_ptr, smart_sol));
433 auto T_ptr = boost::make_shared<VectorDouble>();
434 pip.push_back(new OpCalculateScalarFieldValues("T", T_ptr, smart_sol));
435
436 auto U_ptr = boost::make_shared<MatrixDouble>();
437 pip.push_back(
438 new OpCalculateVectorFieldValues<SPACE_DIM>("U", U_ptr, smart_sol));
439 auto FLUX_ptr = boost::make_shared<MatrixDouble>();
441 "FLUX", FLUX_ptr, smart_sol));
442
443 auto EP_ptr = boost::make_shared<MatrixDouble>();
445 "EP", EP_ptr, smart_sol));
446
448
449 pip.push_back(
450
451 new OpPPMap(
452
453 pp_fe->getPostProcMesh(), pp_fe->getMapGaussPts(),
454
455 {{"TAU", TAU_ptr}, {"T", T_ptr}},
456
457 {{"U", U_ptr}, {"FLUX", FLUX_ptr}},
458
459 {},
460
461 {{"EP", EP_ptr}}
462
463 )
464
465 );
466
468 };
469
470 CHKERR push_vol_post_proc_ops(pp_fe);
471
472 CHKERR DMoFEMLoopFiniteElements(dm, "dFE", pp_fe);
473 CHKERR pp_fe->writeFile("out_" + output_name + ".h5m");
474
476 };
477
478 CHKERR create_post_process_elements();
479
481}
intrusive_ptr for managing petsc objects

◆ printOnAllCores()

auto printOnAllCores ( MoFEM::Interface m_field,
const std::string &  out_put_string,
const auto &  out_put_quantity 
)
Examples
thermoplastic.cpp.

Definition at line 483 of file thermoplastic.cpp.

485 {
487 auto rank = m_field.get_comm_rank();
488 auto size = m_field.get_comm_size();
489
490 // Loop through all processes and print one by one
491 for (int i = 0; i < size; ++i) {
492 // If it is this process's turn, print the data
493 if (i == rank) {
494 std::cout << "Proc " << rank << " " + out_put_string + " "
495 << out_put_quantity << std::endl;
496 }
497 // All processes wait here until the current one has finished
498 // printing
499 CHKERR PetscBarrier(NULL);
500 }
502};

◆ Qinf_thermal()

double Qinf_thermal ( double  Qinf,
double  omega_h,
double  temp_0,
double  temp 
)
inline
Examples
thermoplastic.cpp.

Definition at line 99 of file thermoplastic.cpp.

100 {
101 return Qinf * (1. - omega_h * (temp - temp_0));
102}

◆ SNESIterationMonitor()

MoFEMErrorCode SNESIterationMonitor ( SNES  snes,
PetscInt  its,
PetscReal  norm,
void *  ctx 
)
Examples
thermoplastic.cpp.

Definition at line 3850 of file thermoplastic.cpp.

3851 {
3853 MyTsCtx *my_ctx = static_cast<MyTsCtx *>(ctx);
3854 my_ctx->snes_iter_counter++;
3856}
PetscInt snes_iter_counter

◆ temp_hat()

double temp_hat ( double  temp)
inline
Examples
thermoplastic.cpp.

Definition at line 115 of file thermoplastic.cpp.

115 {
116 double JC_ref_temp = 0.;
117 double JC_melt_temp = 1650.;
118
119 return (temp - JC_ref_temp) / (JC_melt_temp - JC_ref_temp);
120}

◆ TSIterationPreStage()

MoFEMErrorCode TSIterationPreStage ( TS  ts,
PetscReal  stagetime 
)
Examples
thermoplastic.cpp.

Definition at line 3842 of file thermoplastic.cpp.

3842 {
3844 MyTsCtx *my_ctx = ts_to_ctx[ts];
3845 my_ctx->snes_iter_counter = 0;
3847}
static std::unordered_map< TS, MyTsCtx * > ts_to_ctx

◆ y_0_thermal()

double y_0_thermal ( double  sigmaY,
double  omega_0,
double  temp_0,
double  temp 
)
inline
Examples
thermoplastic.cpp.

Definition at line 90 of file thermoplastic.cpp.

91 {
92 return sigmaY * (1. - omega_0 * (temp - temp_0));
93}

Variable Documentation

◆ alpha_damping

double alpha_damping = 0

Definition at line 253 of file thermoplastic.cpp.

◆ AT

constexpr AssemblyType AT
constexpr
Initial value:
=
(SCHUR_ASSEMBLE) ? AssemblyType::BLOCK_SCHUR
AssemblyType
[Storage and set boundary conditions]
@ PETSC
Standard PETSc assembly.
#define SCHUR_ASSEMBLE
Definition contact.cpp:18
Examples
thermoplastic.cpp.

Definition at line 55 of file thermoplastic.cpp.

◆ atom_test

int atom_test = 0

Definition at line 245 of file thermoplastic.cpp.

◆ b_iso

double b_iso = 63.69

Saturation exponent.

Definition at line 210 of file thermoplastic.cpp.

◆ C1_k

double C1_k = 0

Kinematic hardening.

Definition at line 211 of file thermoplastic.cpp.

◆ cn0

double cn0 = 1

Definition at line 213 of file thermoplastic.cpp.

◆ cn1

double cn1 = 1

Definition at line 214 of file thermoplastic.cpp.

◆ CONTACT_SPACE

constexpr FieldSpace CONTACT_SPACE = ElementsAndOps<SPACE_DIM>::CONTACT_SPACE
constexpr

Definition at line 63 of file thermoplastic.cpp.

◆ default_coeff_expansion

double default_coeff_expansion = 1e-5

Definition at line 225 of file thermoplastic.cpp.

◆ default_heat_capacity

double default_heat_capacity = 2.332

Definition at line 229 of file thermoplastic.cpp.

◆ default_heat_capacity_scale

double default_heat_capacity_scale = 1.
Examples
thermoplastic.cpp.

Definition at line 198 of file thermoplastic.cpp.

◆ default_heat_conductivity

double default_heat_conductivity
Initial value:
=
11.4

Definition at line 226 of file thermoplastic.cpp.

◆ default_ref_temp

double default_ref_temp = 20.0

Definition at line 216 of file thermoplastic.cpp.

◆ default_thermal_conductivity_scale

double default_thermal_conductivity_scale = 1.
Examples
ThermoElasticOps.hpp, and thermoplastic.cpp.

Definition at line 197 of file thermoplastic.cpp.

◆ do_eval_field

PetscBool do_eval_field = PETSC_FALSE

Evaluate field.

Definition at line 189 of file thermoplastic.cpp.

◆ ep_order

int ep_order = order - 1

Order of ep field.

Definition at line 240 of file thermoplastic.cpp.

◆ exp_C

double exp_C = -6.284
Examples
thermoplastic.cpp.

Definition at line 112 of file thermoplastic.cpp.

◆ exp_D

double exp_D = -1.024
Examples
thermoplastic.cpp.

Definition at line 113 of file thermoplastic.cpp.

◆ flux_order

int flux_order = order

Order of tau field.

Examples
thermoplastic.cpp.

Definition at line 241 of file thermoplastic.cpp.

◆ Gaussian_distribution

auto Gaussian_distribution
Initial value:
= [](double init_temp, double peak_temp, double x,
double y, double z) {
double s =
std::sqrt(-2. * std::log(0.01 * peak_temp / (peak_temp - init_temp)));
return (peak_temp - init_temp) * exp(-pow(y, 2) / (2. * pow(s, 2))) +
}
double peak_temp
double init_temp
double width
Width of Gaussian distribution.
Examples
thermoplastic.cpp.

Definition at line 258 of file thermoplastic.cpp.

259 {
260 double s =
261 width /
262 std::sqrt(-2. * std::log(0.01 * peak_temp / (peak_temp - init_temp)));
263 return (peak_temp - init_temp) * exp(-pow(y, 2) / (2. * pow(s, 2))) +
264 init_temp;
265};

◆ geom_order

int geom_order = 2

Order if fixed.

Examples
thermoplastic.cpp.

Definition at line 243 of file thermoplastic.cpp.

◆ H

double H = 584.3

Hardening.

Examples
thermoplastic.cpp.

Definition at line 206 of file thermoplastic.cpp.

◆ heat_capacity_scaling

ScalerFunTwoArgs heat_capacity_scaling

◆ help

char help[] = "...\n\n"
static

[Solve]

Definition at line 5337 of file thermoplastic.cpp.

◆ ic_type

ICType ic_type = IC_UNIFORM
Examples
thermoplastic.cpp.

Definition at line 221 of file thermoplastic.cpp.

◆ ICTypes

const char* const ICTypes[]
Initial value:
= {"uniform", "gaussian", "linear",
"ICType", "IC_", nullptr}
Examples
thermoplastic.cpp.

Definition at line 218 of file thermoplastic.cpp.

218 {"uniform", "gaussian", "linear",
219 "ICType", "IC_", nullptr};

◆ inelastic_heat_fraction

double inelastic_heat_fraction
Initial value:
=
0.9

fraction of plastic dissipation converted to heat

Examples
thermoplastic.cpp.

Definition at line 234 of file thermoplastic.cpp.

◆ inelastic_heat_fraction_scaling

ScalerFunThreeArgs inelastic_heat_fraction_scaling
Examples
ThermoPlasticOps.hpp, and thermoplastic.cpp.

Definition at line 201 of file thermoplastic.cpp.

◆ init_dt

double init_dt = 0.05
Examples
thermoplastic.cpp.

Definition at line 254 of file thermoplastic.cpp.

◆ init_T

auto init_T
Initial value:
= [](double init_temp, double peak_temp, double x, double y,
double z) {
switch (ic_type) {
case IC_LINEAR:
case IC_UNIFORM:
default:
}
}
ICType ic_type
auto linear_distribution
auto uniform_distribution
auto Gaussian_distribution

Initialisation function for temperature field.

Examples
EdgeFlippingOps.hpp, ThermoElasticOps.hpp, and thermoplastic.cpp.

Definition at line 278 of file thermoplastic.cpp.

279 {
280 switch (ic_type) {
281 case IC_GAUSSIAN:
282 return -Gaussian_distribution(init_temp, peak_temp, x, y, z);
283 case IC_LINEAR:
284 return -linear_distribution(init_temp, peak_temp, x, y, z);
285 case IC_UNIFORM:
286 default:
287 return -uniform_distribution(init_temp, peak_temp, x, y, z);
288 }
289};

◆ init_temp

double init_temp = 20.0
Examples
thermoplastic.cpp.

Definition at line 222 of file thermoplastic.cpp.

◆ is_distributed_mesh

PetscBool is_distributed_mesh = PETSC_TRUE
Examples
SolutionMapping.hpp, and thermoplastic.cpp.

Definition at line 194 of file thermoplastic.cpp.

◆ IS_LARGE_STRAINS

constexpr bool IS_LARGE_STRAINS
constexpr
Initial value:
=
#define FINITE_DEFORMATION_FLAG

Definition at line 52 of file thermoplastic.cpp.

◆ is_large_strains

const bool is_large_strains
Initial value:
=
constexpr bool IS_LARGE_STRAINS

Definition at line 186 of file thermoplastic.cpp.

◆ is_quasi_static

PetscBool is_quasi_static = PETSC_TRUE

Definition at line 251 of file thermoplastic.cpp.

◆ IT

constexpr IntegrationType IT
constexpr
Initial value:
=
IntegrationType::GAUSS
Examples
thermoplastic.cpp.

Definition at line 58 of file thermoplastic.cpp.

◆ linear_distribution

auto linear_distribution
Initial value:
= [](double init_temp, double peak_temp, double x,
double y, double z) {
return ((peak_temp - init_temp) / width) * y + (peak_temp + init_temp) / 2.0;
}
Examples
thermoplastic.cpp.

Definition at line 267 of file thermoplastic.cpp.

268 {
269 return ((peak_temp - init_temp) / width) * y + (peak_temp + init_temp) / 2.0;
270};

◆ min_dt

double min_dt = 1e-12
Examples
thermoplastic.cpp.

Definition at line 255 of file thermoplastic.cpp.

◆ omega_0

double omega_0 = 2e-3

flow stress softening

Examples
thermoplastic.cpp.

Definition at line 232 of file thermoplastic.cpp.

◆ omega_h

double omega_h = 2e-3

hardening softening

Examples
thermoplastic.cpp.

Definition at line 233 of file thermoplastic.cpp.

◆ order

int order = 2

Order displacement.

Definition at line 238 of file thermoplastic.cpp.

◆ order_edge

PetscBool order_edge = PETSC_FALSE

◆ order_face

PetscBool order_face = PETSC_FALSE

◆ order_volume

PetscBool order_volume = PETSC_FALSE

◆ peak_temp

double peak_temp = 1000.0
Examples
thermoplastic.cpp.

Definition at line 223 of file thermoplastic.cpp.

◆ poisson_ratio

double poisson_ratio = 0.31

Poisson ratio.

Definition at line 204 of file thermoplastic.cpp.

◆ post_processing_counter

int post_processing_counter = 0
Examples
thermoplastic.cpp.

Definition at line 329 of file thermoplastic.cpp.

◆ Qinf

double Qinf = 174.2

Saturation yield stress.

Definition at line 209 of file thermoplastic.cpp.

◆ qual_tol

double qual_tol = 0
Examples
thermoplastic.cpp.

Definition at line 256 of file thermoplastic.cpp.

◆ restart_file

char restart_file[255]

◆ restart_flg

PetscBool restart_flg = PETSC_TRUE

◆ restart_step

int restart_step = 0
Examples
PlasticOpsMonitor.hpp, and thermoplastic.cpp.

Definition at line 193 of file thermoplastic.cpp.

◆ restart_time

double restart_time = 0
Examples
thermoplastic.cpp.

Definition at line 192 of file thermoplastic.cpp.

◆ rho

double rho = 0.0

Definition at line 252 of file thermoplastic.cpp.

◆ save_range

auto save_range
Initial value:
= [](moab::Interface &moab, const std::string name,
const Range r) {
auto out_meshset = get_temp_meshset_ptr(moab);
CHKERR moab.add_entities(*out_meshset, r);
CHKERR moab.write_file(name.c_str(), "VTK", "", out_meshset->get_ptr(), 1);
}
auto get_temp_meshset_ptr(moab::Interface &moab)
Create smart pointer to temporary meshset.
Examples
thermoplastic.cpp.

Definition at line 544 of file thermoplastic.cpp.

545 {
547 auto out_meshset = get_temp_meshset_ptr(moab);
548 CHKERR moab.add_entities(*out_meshset, r);
549 CHKERR moab.write_file(name.c_str(), "VTK", "", out_meshset->get_ptr(), 1);
551};

◆ scale

double scale = 1.
Examples
thermoplastic.cpp.

Definition at line 196 of file thermoplastic.cpp.

◆ set_timer

PetscBool set_timer = PETSC_FALSE

Set timer.

Definition at line 188 of file thermoplastic.cpp.

◆ sigmaY

double sigmaY = 936.2

Yield stress.

Definition at line 205 of file thermoplastic.cpp.

◆ size_symm

constexpr auto size_symm = (SPACE_DIM * (SPACE_DIM + 1)) / 2
constexpr

Definition at line 50 of file thermoplastic.cpp.

◆ SPACE_DIM

constexpr int SPACE_DIM
constexpr
Initial value:
=
3
Examples
thermoplastic.cpp.

Definition at line 48 of file thermoplastic.cpp.

◆ T_order

int T_order = order - 1

Order of ep field.

Examples
thermoplastic.cpp.

Definition at line 242 of file thermoplastic.cpp.

◆ tau_order

int tau_order = order - 2

Order of tau field.

Definition at line 239 of file thermoplastic.cpp.

◆ temp_0

double temp_0 = 20

reference temperature for thermal softening

Examples
thermoplastic.cpp.

Definition at line 236 of file thermoplastic.cpp.

◆ thermal_conductivity_scaling

ScalerFunTwoArgs thermal_conductivity_scaling

◆ thermoplastic_raw_ptr

Example* thermoplastic_raw_ptr = nullptr
Examples
thermoplastic.cpp.

Definition at line 4060 of file thermoplastic.cpp.

◆ ts_to_ctx

std::unordered_map<TS, MyTsCtx *> ts_to_ctx
static
Examples
thermoplastic.cpp.

Definition at line 3840 of file thermoplastic.cpp.

◆ ts_to_rctx

std::unordered_map<TS, ResizeCtx *> ts_to_rctx
static
Examples
thermoplastic.cpp.

Definition at line 613 of file thermoplastic.cpp.

◆ tsPrePostProc

boost::weak_ptr<TSPrePostProc> tsPrePostProc
static

◆ uniform_distribution

auto uniform_distribution
Initial value:
= [](double init_temp, double peak_temp, double x,
double y, double z) { return init_temp; }
Examples
thermoplastic.cpp.

Definition at line 272 of file thermoplastic.cpp.

273 { return init_temp; };

◆ visH

double visH = 0

Viscous hardening.

Definition at line 207 of file thermoplastic.cpp.

◆ width

double width = 10.0

Width of Gaussian distribution.

Examples
thermoplastic.cpp.

Definition at line 224 of file thermoplastic.cpp.

◆ young_modulus

double young_modulus = 115000

Young modulus.

Definition at line 203 of file thermoplastic.cpp.

◆ zeta

double zeta = 5e-2

regularisation parameter

Definition at line 208 of file thermoplastic.cpp.