17 "incremental_optimization",
20 "test_topological_derivative",
21 "test_equilibrated_mechanical_value",
22 "test_incremental_optimization_layout",
23 "test_incremental_optimization_transaction",
24 "test_incremental_optimization_objective_derivative",
25 "test_incremental_optimization_constraint_derivative"};
104 static inline std::vector<std::string>
123 "Broken HDIV base not implemented");
131 static boost::function<
double(
const double)>
f;
138 static inline constexpr double v_max = 24;
142 double e =
static_cast<double>(std::exp(
v_max));
144 return 0.5 * e * dv * dv + e * dv + e;
146 return static_cast<double>(std::exp(
v));
152 double e =
static_cast<double>(std::exp(
v_max));
156 return static_cast<double>(std::exp(
v));
162 return static_cast<double>(std::exp(
v_max));
164 return static_cast<double>(std::exp(
v));
169 const double transition_stretch = std::exp(
v_max);
170 if (stretch <= transition_stretch) {
171 return std::log(stretch);
173 return v_max - 1. + std::sqrt(2. * stretch / transition_stretch - 1.);
177 const double transition_stretch = std::exp(
v_max);
178 if (stretch <= transition_stretch) {
181 const double root = std::sqrt(2. * stretch / transition_stretch - 1.);
182 return 1. / (transition_stretch * root);
186 const double transition_stretch = std::exp(
v_max);
187 if (stretch <= transition_stretch) {
188 return -1. / (stretch * stretch);
190 const double root = std::sqrt(2. * stretch / transition_stretch - 1.);
191 return -1. / (transition_stretch * transition_stretch * root * root * root);
194 static double f_log_e(
const double v) {
return std::exp(
v); }
215 MoFEMErrorCode
query_interface(boost::typeindex::type_index type_index,
216 UnknownInterface **iface)
const;
228 boost::shared_ptr<ForcesAndSourcesCore>
231 SmartPetscObj<DM>
dM;
298 boost::shared_ptr<AnalyticalDisplacementBcVec>
312 const int meshset_id,
313 const std::string ¶m_name) {
314 const auto string_params =
316 type_name, meshset_id);
317 if (
const auto it = string_params.find(param_name);
318 it != string_params.end()) {
326 const std::string ¶m_name,
327 std::string ¶m_value) {
331 std::regex((boost::format(
"%s(.*)") % type_name).str()))) {
333 type_name, it->getMeshsetId(), param_name);
334 if (block_param.empty()) {
337 if (!param_value.empty() && param_value != block_param) {
339 "JSON %s blocksets specify different '%s' values",
340 type_name.c_str(), param_name.c_str());
342 param_value = block_param;
347 template <
typename BC>
348 MoFEMErrorCode
getBc(boost::shared_ptr<BC> &bc_vec_ptr,
349 const std::string block_name,
const int nb_attributes) {
354 (boost::format(
"%s(.*)") % block_name).str()
359 std::vector<double> block_attributes;
360 CHKERR it->getAttributes(block_attributes);
361 if (block_attributes.size() <
static_cast<size_t>(nb_attributes)) {
363 "In block %s expected %d attributes, but given %ld",
364 it->getName().c_str(), nb_attributes, block_attributes.size());
369 bc_vec_ptr->emplace_back(
370 it->getName(), block_attributes, faces,
387 <<
"Found spatial rotation BC on block " << bc.blockName;
388 MOFEM_LOG(
"EP", Sev::inform) <<
" with attributes: " << bc.vals;
389 MOFEM_LOG(
"EP", Sev::inform) <<
" and rotation angle: " << bc.theta;
390 MOFEM_LOG(
"EP", Sev::inform) <<
" and nb of faces: " << bc.faces.size();
394 boost::make_shared<DynamicRelaxationTimeScale>(
"rotation_history.txt");
396 if (!bc.loadHistoryFile.empty()) {
398 <<
"Rotation load history from JSON for " << bc.blockName <<
": "
399 << bc.loadHistoryFile;
401 boost::make_shared<DynamicRelaxationTimeScale>(bc.loadHistoryFile);
404 GetBlockScalingMethod<DynamicRelaxationTimeScale>::get(
405 ts_rotation,
"rotation_history",
".txt", bc.blockName);
425 boost::shared_ptr<TractionFreeBc> &bc_ptr,
426 const std::string contact_set_name);
428 inline MoFEMErrorCode
431 boost::shared_ptr<TractionFreeBc>(
new TractionFreeBc());
440 MoFEMErrorCode
addFields(
const EntityHandle meshset = 0,
441 const bool add_bubble =
true);
447 const bool add_bubble =
true);
449 MoFEMErrorCode
addDMs(
const BitRefLevel
bit = BitRefLevel().set(0),
450 const EntityHandle meshset = 0);
453 const int tag,
const bool do_rhs,
const bool do_lhs,
454 const bool calc_rates,
455 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe,
456 const bool add_bubble =
true);
459 const int tag,
const bool add_elastic,
const bool add_material,
460 boost::shared_ptr<VolumeElementForcesAndSourcesCore> &fe_rhs,
461 boost::shared_ptr<VolumeElementForcesAndSourcesCore> &fe_lhs);
464 pushVolumeA00Ops(boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
467 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
470 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
474 boost::shared_ptr<FaceElementForcesAndSourcesCore> &fe_rhs,
475 boost::shared_ptr<FaceElementForcesAndSourcesCore> &fe_lhs);
479 boost::shared_ptr<ForcesAndSourcesCore> &fe_contact_tree
556 TS ts, Vec x,
int start_step,
double start_time);
559 TS ts, Vec x,
int start_step,
double start_time);
564 std::vector<Tag> tags_to_transfer = {});
567 Vec f_residual = PETSC_NULLPTR,
568 Vec var_vec = PETSC_NULLPTR,
569 Vec gradient = PETSC_NULLPTR,
570 std::vector<Tag> tags_to_transfer = {},
571 TS ts = PETSC_NULLPTR);
573 const int tag,
const std::string file, Vec f_residual = PETSC_NULLPTR,
574 std::vector<Tag> tags_to_transfer = {}, TS ts = PETSC_NULLPTR);
577 boost::shared_ptr<double> &area_ptr);
587 virtual MoFEMErrorCode
setUp(TS) = 0;
595 using TimeScale::TimeScale;
601 return TimeScale::getScale(time);
606 const int tag, TS ts,
607 SmartPetscObj<Vec> *adjoint_gradient_vector =
nullptr);
623 boost::shared_ptr<ParentFiniteElementAdjacencyFunctionSkeleton<2>>
644 Mat
S = PETSC_NULLPTR;
648 std::vector<boost::shared_ptr<Range>>
655 static inline int stress(
const int o) {
return o; }
656 static inline int bubble(
const int o) {
return o; }
657 static inline int disp(
const int o) {
return o - 1; }
658 static inline int rot(
const int o) {
return o - 1; }
659 static inline int stretch(
const int o) {
return o; }
663 static inline int hybrid(
const int o) {
return o - 1; }
667 static inline int stress(
const int o) {
return o; }
668 static inline int bubble(
const int o) {
return o + 1; }
669 static inline int disp(
const int o) {
return o - 1; }
670 static inline int rot(
const int o) {
return o; }
671 static inline int stretch(
const int o) {
return o + 1; }
675 static inline int hybrid(
const int o) {
return o; }
FieldApproximationBase
approximation base
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#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.
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
double getScale(const double time) override
static int logDeviator(const int o)
static int logJacobian(const int o)
static int disp(const int o)
static int stress(const int o)
static int bubble(const int o)
static int rot(const int o)
static int stretch(const int o)
static int hybrid(const int o)
static int auxiliaryLogStress(const int o)
static int logJacobian(const int o)
static int stretch(const int o)
static int disp(const int o)
static int stress(const int o)
static int logDeviator(const int o)
static int auxiliaryLogStress(const int o)
static int bubble(const int o)
static int hybrid(const int o)
static int rot(const int o)
virtual MoFEMErrorCode setUp(TS)=0
static boost::shared_ptr< SetUpSchur > createSetUpSchur(MoFEM::Interface &m_field, EshelbianCore *ep_core_ptr)
SmartPetscObj< Vec > incrementalTrialControl
std::vector< boost::shared_ptr< Range > > a00RangeList
MoFEMErrorCode setElasticElementOps(const int tag)
boost::shared_ptr< ExternalStrainVec > externalStrainVecPtr
static PetscBool physicalH1Update
static enum StretchSelector stretchSelector
boost::shared_ptr< Range > frontAdjEdges
MoFEMErrorCode createCrackSurfaceMeshset()
static int interfaceRemoveLevel
MoFEMErrorCode addBoundaryFiniteElement(const EntityHandle meshset=0)
const std::string skeletonElement
static double inv_dd_f_linear(const double)
static double inv_f_linear(const double v)
MoFEMErrorCode getSpatialRotationBc()
boost::shared_ptr< TractionBcVec > bcSpatialTractionVecPtr
boost::shared_ptr< Range > contactFaces
static double dd_f_log_e_quadratic(const double v)
static double inv_d_f_linear(const double)
double dynamicInitialResidual
static double dd_f_linear(const double)
BitRefLevel bitAdjEnt
bit ref level for parent
static boost::function< double(const double)> inv_dd_f
MoFEM::Interface & mField
static constexpr double v_max
const std::string spatialL2Disp
std::map< std::string, boost::shared_ptr< ScalingMethod > > timeScaleMap
static enum SolverType solverType
MoFEMErrorCode postProcessSkeletonResults(const int tag, const std::string file, Vec f_residual=PETSC_NULLPTR, std::vector< Tag > tags_to_transfer={}, TS ts=PETSC_NULLPTR)
static PetscBool l2UserBaseScale
SmartPetscObj< DM > dM
Coupled problem all fields.
boost::shared_ptr< FaceElementForcesAndSourcesCore > elasticBcRhs
MoFEMErrorCode solveSchapeOptimisation(TS ts, Vec x, int start_step, double start_time)
Solve shape optimisation problem.
SmartPetscObj< IS > crackHybridIs
boost::shared_ptr< Range > plasticVolumes
boost::shared_ptr< TractionFreeBc > bcSpatialFreeTractionVecPtr
static const char * listSolvers[]
const std::string materialH1Positions
static int nbJIntegralContours
static bool noCrackExtension
MoFEMErrorCode applyTestSolverMonitorOptions(TS ts)
MoFEMErrorCode setBlockTagsOnSkin()
std::vector< Tag > listTagsToTransfer
list of tags to transfer to postprocessor
boost::shared_ptr< FaceElementForcesAndSourcesCore > elasticBcLhs
static PetscBool crackingOn
MoFEMErrorCode getTractionFreeBc(const EntityHandle meshset, boost::shared_ptr< TractionFreeBc > &bc_ptr, const std::string contact_set_name)
Remove all, but entities where kinematic constrains are applied.
MoFEMErrorCode applyProjectionSolverMonitorOptions()
static double griffithEnergy
Griffith energy.
boost::shared_ptr< VolumeElementForcesAndSourcesCore > elasticFeRhs
MoFEMErrorCode postProcessRestartMesh(const int tag, const std::string file, std::vector< Tag > tags_to_transfer={})
MoFEMErrorCode pushVolumeA00Ops(boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe_lhs)
const std::string elementVolumeName
static double dd_f_log_e(const double v)
static double d_f_linear(const double)
static enum RotSelector rotSelector
MoFEMErrorCode addDebugModel(TS ts)
Add debug to model.
static enum RotSelector gradApproximator
PetscBool loadFactorTSSolveExecuted
MoFEMErrorCode postProcessResults(const int tag, const std::string file, Vec f_residual=PETSC_NULLPTR, Vec var_vec=PETSC_NULLPTR, Vec gradient=PETSC_NULLPTR, std::vector< Tag > tags_to_transfer={}, TS ts=PETSC_NULLPTR)
MoFEMErrorCode getBc(boost::shared_ptr< BC > &bc_vec_ptr, const std::string block_name, const int nb_attributes)
static double inv_dd_f_log_e_quadratic(const double stretch)
CommInterface::EntitiesPetscVector vertexExchange
static std::vector< std::string > listTagsToProject
boost::shared_ptr< BcRotVec > bcSpatialRotationVecPtr
boost::shared_ptr< Range > maxMovedFaces
static std::string heterogeneousYoungModTagName
MoFEMErrorCode solveTestIncrementalOptimizationLayout(TS ts, Vec x, int start_step, double start_time)
const std::string spatialH1Disp
static FieldApproximationBase brokenHdivBase
static double maxCrackExtension
static int physicalMaxSteps
MoFEMErrorCode solveElastic(TS ts, Vec x)
@ TestIncrementalOptimizationConstraintDerivative
@ TestIncrementalOptimizationLayout
@ TestIncrementalOptimizationTransaction
@ TestIncrementalOptimizationObjectiveDerivative
@ IncrementalOptimization
@ TestTopologicalDerivative
@ TestEquilibratedMechanicalValue
boost::shared_ptr< NormalDisplacementBcVec > bcSpatialNormalDisplacementVecPtr
MoFEMErrorCode solveTestIncrementalOptimizationTransaction(TS ts, Vec x, int start_step, double start_time)
static double crackingStartTime
const std::string logDeviator
MoFEMErrorCode getOptions()
MoFEMErrorCode calculateCrackArea(boost::shared_ptr< double > &area_ptr)
const std::string plasticHField
const std::string piolaStress
MoFEMErrorCode setElasticElementToTs(DM dm)
static double inv_d_f_log_e(const double v)
std::string getStringArgumentFromJsonBlockset(const std::string &type_name, const int meshset_id, const std::string ¶m_name)
int contactRefinementLevels
static int physicalStepNumber
MoFEMErrorCode gettingNorms()
[Getting norms]
MoFEMErrorCode solveTestEquilibratedMechanicalValue(TS ts, Vec x, int start_step, double start_time)
const std::string logJacobian
boost::shared_ptr< Range > interfaceFaces
std::vector< std::string > a00FieldList
MoFEMErrorCode setVolumeElementOps(const int tag, const bool add_elastic, const bool add_material, boost::shared_ptr< VolumeElementForcesAndSourcesCore > &fe_rhs, boost::shared_ptr< VolumeElementForcesAndSourcesCore > &fe_lhs)
static PetscBool physicalTimeFlg
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Getting interface of core database.
const std::string bubbleField
MoFEMErrorCode solveIncrementalOptimizationTAO(TS ts, Vec x, int start_step, double start_time)
Solve the incremental constitutive optimization with TAO.
boost::shared_ptr< AnalyticalDisplacementBcVec > bcSpatialAnalyticalDisplacementVecPtr
const std::string plasticFlowField
SmartPetscObj< DM > dmMaterial
Material problem.
MoFEMErrorCode calculateOrientation(const int tag, bool set_orientation)
MoFEMErrorCode runIncrementalOptimizationTAO(TS ts, Vec x)
boost::shared_ptr< VolumeElementForcesAndSourcesCore > elasticFeLhs
MoFEMErrorCode solveTestIncrementalOptimizationObjectiveDerivative(TS ts, Vec x, int start_step, double start_time)
MoFEMErrorCode resolveDissipationEntities(const EntityHandle meshset=0)
MoFEMErrorCode setNewFrontCoordinates()
boost::shared_ptr< ParentFiniteElementAdjacencyFunctionSkeleton< 2 > > parentAdjSkeletonFunctionDim2
static double crackingAddTime
MoFEMErrorCode setFaceElementOps(const bool add_elastic, const bool add_material, boost::shared_ptr< FaceElementForcesAndSourcesCore > &fe_rhs, boost::shared_ptr< FaceElementForcesAndSourcesCore > &fe_lhs)
MoFEMErrorCode projectGeometry(const EntityHandle meshset=0, double time=0)
static double currentPhysicalTime
boost::shared_ptr< AnalyticalExprPython > AnalyticalExprPythonPtr
boost::shared_ptr< SpringBcVec > bcSpatialSpringVecPtr
static constexpr enum SymmetrySelector symmetrySelector
const std::string auxiliaryLogStress
static double crackingAtol
Cracking absolute tolerance.
MoFEMErrorCode projectMaterialTags(const EntityHandle meshset=0)
boost::shared_ptr< Range > skeletonFaces
static double crackingRtol
Cracking relative tolerance.
boost::shared_ptr< PhysicalEquations > physicalEquations
const std::string rotAxis
static PetscBool meshTransferHybridInterp
BitRefLevel bitAdjParentMask
bit ref level for parent parent
MoFEMErrorCode solveDynamicRelaxation(TS ts, Vec x, int start_step, double start_time)
Solve problem using dynamic relaxation method.
const std::string contactDisp
static std::string internalStressTagName
CommInterface::EntitiesPetscVector edgeExchange
SmartPetscObj< DM > dmPrjSpatial
Projection spatial displacement.
static boost::function< double(const double)> f
MoFEMErrorCode solveTestTopologicalDerivative(TS ts, Vec x, int start_step, double start_time)
static int nbStepsNoCrackExtension
boost::shared_ptr< BcDispVec > bcSpatialDispVecPtr
static double finalPhysicalTime
boost::shared_ptr< ForcesAndSourcesCore > contactTreeRhs
Make a contact tree.
const std::string skinElement
static PetscBool internalStressVoigt
MoFEMErrorCode addVolumeFiniteElement(const EntityHandle meshset=0, const bool add_bubble=true)
MoFEMErrorCode solveTestIncrementalOptimizationConstraintDerivative(TS ts, Vec x, int start_step, double start_time)
MoFEMErrorCode getSpatialTractionFreeBc(const EntityHandle meshset=0)
static double inv_dd_f_log_e(const double v)
MoFEMErrorCode getExternalStrain()
MoFEMErrorCode getSpatialTractionBc()
static PetscBool setSingularity
MoFEMErrorCode setBaseVolumeElementOps(const int tag, const bool do_rhs, const bool do_lhs, const bool calc_rates, boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe, const bool add_bubble=true)
static double d_f_log_e(const double v)
boost::shared_ptr< AnalyticalTractionBcVec > bcSpatialAnalyticalTractionVecPtr
static PetscBool plasticVolume
boost::shared_ptr< double > currentCrackAreaPtr
static PetscBool meshTransferSourceMeshFileSpecified
static double f_log_e_quadratic(const double v)
double avgGriffithsEnergy
MoFEMErrorCode addCrackSurfaces(const bool debug=false)
static double inv_f_log_e_quadratic(const double stretch)
MoFEMErrorCode addDMs(const BitRefLevel bit=BitRefLevel().set(0), const EntityHandle meshset=0)
MoFEMErrorCode getSpatialDispBc()
[Getting norms]
BitRefLevel bitAdjParent
bit ref level for parent
MoFEMErrorCode setContactElementRhsOps(boost::shared_ptr< ForcesAndSourcesCore > &fe_contact_tree)
static PetscBool interfaceCrack
MoFEMErrorCode solveLoadFactor(TS ts, Vec x, int start_step, double start_time)
Solve load factor crack growth problem.
MoFEMErrorCode getStringArgumentFromJsonBlocksets(const std::string &type_name, const std::string ¶m_name, std::string ¶m_value)
static double d_f_log_e_quadratic(const double v)
CommInterface::EntitiesPetscVector volumeExchange
const std::string naturalBcElement
MoFEMErrorCode calculateFaceMaterialForce(const int tag, TS ts, SmartPetscObj< Vec > *adjoint_gradient_vector=nullptr)
static boost::function< double(const double)> dd_f
static double f_log_e(const double v)
static bool potentialCrackArrest
static int addCrackMeshsetId
static PetscBool propagateUnderCompression
static double inv_f_log_e(const double v)
MoFEMErrorCode createExchangeVectors(Sev sev)
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
boost::shared_ptr< Range > crackFaces
static boost::function< double(const double)> d_f
boost::shared_ptr< Range > frontVertices
static enum EnergyReleaseSelector energyReleaseSelector
static boost::function< double(const double)> inv_d_f
boost::shared_ptr< PressureBcVec > bcSpatialPressureVecPtr
static int meshTransferInterpOrder
const std::string hybridSpatialDisp
SmartPetscObj< Vec > solTSStep
static double inv_d_f_log_e_quadratic(const double stretch)
CommInterface::EntitiesPetscVector faceExchange
SmartPetscObj< DM > dmElastic
Elastic problem.
static std::string meshTransferSourceMeshFileName
const std::string plasticKappaField
boost::shared_ptr< Range > frontEdges
static boost::function< double(const double)> inv_f
const std::string stretchTensor
BitRefLevel bitAdjEntMask
bit ref level for parent parent
static double f_linear(const double v)
SmartPetscObj< DM > dmIncrementalOptimization
Incremental-optimization control problem.
MoFEMErrorCode addFields(const EntityHandle meshset=0, const bool add_bubble=true)
MoFEMErrorCode withFieldOrders(Op &&op) const
MoFEMErrorCode pushStressGramOps(boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe_lhs)
const std::string contactElement
MoFEMErrorCode pushPiolaStressGramOps(boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe_lhs)
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Deprecated interface functions.
base class for all interface classes
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.