29 "test_topological_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);
174 std::sqrt(2. * stretch / transition_stretch - 1.);
178 const double transition_stretch = std::exp(
v_max);
179 if (stretch <= transition_stretch) {
183 std::sqrt(2. * stretch / transition_stretch - 1.);
184 return 1. / (transition_stretch * root);
188 const double transition_stretch = std::exp(
v_max);
189 if (stretch <= transition_stretch) {
190 return -1. / (stretch * stretch);
193 std::sqrt(2. * stretch / transition_stretch - 1.);
195 (transition_stretch * transition_stretch * root * root * root);
225 MoFEMErrorCode
query_interface(boost::typeindex::type_index type_index,
226 UnknownInterface **iface)
const;
238 boost::shared_ptr<ForcesAndSourcesCore>
241 SmartPetscObj<DM>
dM;
300 boost::shared_ptr<AnalyticalDisplacementBcVec>
314 const int meshset_id,
315 const std::string ¶m_name) {
316 const auto string_params =
318 type_name, meshset_id);
319 if (
const auto it = string_params.find(param_name);
320 it != string_params.end()) {
327 const std::string &type_name,
const std::string ¶m_name,
328 std::string ¶m_value) {
332 std::regex((boost::format(
"%s(.*)") % type_name).str()))) {
334 type_name, it->getMeshsetId(), param_name);
335 if (block_param.empty()) {
338 if (!param_value.empty() && param_value != block_param) {
340 "JSON %s blocksets specify different '%s' values",
341 type_name.c_str(), param_name.c_str());
343 param_value = block_param;
348 template <
typename BC>
349 MoFEMErrorCode
getBc(boost::shared_ptr<BC> &bc_vec_ptr,
350 const std::string block_name,
const int nb_attributes) {
355 (boost::format(
"%s(.*)") % block_name).str()
360 std::vector<double> block_attributes;
361 CHKERR it->getAttributes(block_attributes);
362 if (block_attributes.size() <
static_cast<size_t>(nb_attributes)) {
364 "In block %s expected %d attributes, but given %ld",
365 it->getName().c_str(), nb_attributes, block_attributes.size());
370 bc_vec_ptr->emplace_back(
371 it->getName(), block_attributes, faces,
388 <<
"Found spatial rotation BC on block " << bc.blockName;
389 MOFEM_LOG(
"EP", Sev::inform) <<
" with attributes: " << bc.vals;
390 MOFEM_LOG(
"EP", Sev::inform) <<
" and rotation angle: " << bc.theta;
391 MOFEM_LOG(
"EP", Sev::inform) <<
" and nb of faces: " << bc.faces.size();
395 boost::make_shared<DynamicRelaxationTimeScale>(
"rotation_history.txt");
397 if (!bc.loadHistoryFile.empty()) {
399 <<
"Rotation load history from JSON for " << bc.blockName <<
": "
400 << bc.loadHistoryFile;
402 boost::make_shared<DynamicRelaxationTimeScale>(
406 GetBlockScalingMethod<DynamicRelaxationTimeScale>::get(
407 ts_rotation,
"rotation_history",
".txt", bc.blockName);
427 boost::shared_ptr<TractionFreeBc> &bc_ptr,
428 const std::string contact_set_name);
430 inline MoFEMErrorCode
433 boost::shared_ptr<TractionFreeBc>(
new TractionFreeBc());
441 MoFEMErrorCode
addFields(
const EntityHandle meshset = 0,
442 const bool add_bubble =
true);
448 const bool add_bubble =
true);
450 MoFEMErrorCode
addDMs(
const BitRefLevel
bit = BitRefLevel().set(0),
451 const EntityHandle meshset = 0);
461 boost::weak_ptr<MatOps::PhysicalEquations> mat_physical_equations_ptr);
464 const int tag,
const bool do_rhs,
const bool do_lhs,
465 const bool calc_rates,
466 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe,
467 const bool add_bubble =
true);
470 const int tag,
const bool add_elastic,
const bool add_material,
471 boost::shared_ptr<VolumeElementForcesAndSourcesCore> &fe_rhs,
472 boost::shared_ptr<VolumeElementForcesAndSourcesCore> &fe_lhs);
475 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
479 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
482 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
485 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
489 boost::shared_ptr<FaceElementForcesAndSourcesCore> &fe_rhs,
490 boost::shared_ptr<FaceElementForcesAndSourcesCore> &fe_lhs);
493 const bool add_elastic,
const bool add_material,
494 boost::shared_ptr<FaceElementForcesAndSourcesCore> &fe_rhs,
495 boost::shared_ptr<FaceElementForcesAndSourcesCore> &fe_lhs);
499 boost::shared_ptr<ForcesAndSourcesCore> &fe_contact_tree
563 std::vector<Tag> tags_to_transfer = {});
566 Vec f_residual = PETSC_NULLPTR,
567 Vec var_vec = PETSC_NULLPTR,
568 Vec gradient = PETSC_NULLPTR,
569 std::vector<Tag> tags_to_transfer = {},
570 TS ts = PETSC_NULLPTR);
573 Vec f_residual = PETSC_NULLPTR,
574 std::vector<Tag> tags_to_transfer = {},
575 TS ts = PETSC_NULLPTR);
578 boost::shared_ptr<double>& area_ptr);
588 virtual MoFEMErrorCode
setUp(TS) = 0;
596 using TimeScale::TimeScale;
602 return TimeScale::getScale(time);
607 const int tag, TS ts,
608 SmartPetscObj<Vec> *adjoint_gradient_vector =
nullptr);
624 boost::shared_ptr<ParentFiniteElementAdjacencyFunctionSkeleton<2>>
645 Mat
S = PETSC_NULLPTR;
649 std::vector<boost::shared_ptr<Range>>
656 static inline int stress(
const int o) {
return o; }
657 static inline int bubble(
const int o) {
return o; }
658 static inline int disp(
const int o) {
return o - 1; }
659 static inline int rot(
const int o) {
return o - 1; }
660 static inline int stretch(
const int o) {
return o; }
661 static inline int hybrid(
const int o) {
return o - 1; }
665 static inline int stress(
const int o) {
return o; }
666 static inline int bubble(
const int o) {
return o + 1; }
667 static inline int disp(
const int o) {
return o - 1; }
668 static inline int rot(
const int o) {
return o; }
669 static inline int stretch(
const int o) {
return o + 1; }
670 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 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 stretch(const int o)
static int disp(const int o)
static int stress(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)
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)
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
MoFEMErrorCode addMaterial_Hencky(double E, double nu)
static enum SolverType solverType
friend struct solve_elastic_set_up
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
static enum StretchHandling stretchHandling
boost::shared_ptr< TractionFreeBc > bcSpatialFreeTractionVecPtr
static const char * listSolvers[]
const std::string materialH1Positions
static int nbJIntegralContours
MoFEMErrorCode addMaterial_HMHStorakers(const double eta, const double mu, const double beta)
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.
static double griffithEnergy
Griffith energy.
boost::shared_ptr< VolumeElementForcesAndSourcesCore > elasticFeRhs
MoFEMErrorCode addMaterial_HMHNeohookean(const double c10, const double K)
MoFEMErrorCode postProcessRestartMesh(const int tag, const std::string file, std::vector< Tag > tags_to_transfer={})
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
const std::string spatialH1Disp
static FieldApproximationBase brokenHdivBase
static double maxCrackExtension
static int physicalMaxSteps
MoFEMErrorCode solveElastic(TS ts, Vec x)
@ TestTopologicalDerivative
boost::shared_ptr< NormalDisplacementBcVec > bcSpatialNormalDisplacementVecPtr
static double crackingStartTime
static enum MaterialModel materialModel
MoFEMErrorCode getOptions()
MoFEMErrorCode calculateCrackArea(boost::shared_ptr< double > &area_ptr)
const std::string piolaStress
MoFEMErrorCode setElasticElementToTs(DM dm)
static double inv_d_f_log_e(const double v)
MoFEMErrorCode setFaceInterfaceOps(const bool add_elastic, const bool add_material, boost::shared_ptr< FaceElementForcesAndSourcesCore > &fe_rhs, boost::shared_ptr< FaceElementForcesAndSourcesCore > &fe_lhs)
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]
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
boost::shared_ptr< AnalyticalDisplacementBcVec > bcSpatialAnalyticalDisplacementVecPtr
SmartPetscObj< DM > dmMaterial
Material problem.
MoFEMErrorCode calculateOrientation(const int tag, bool set_orientation)
boost::shared_ptr< VolumeElementForcesAndSourcesCore > elasticFeLhs
MoFEMErrorCode setNewFrontCoordinates()
boost::shared_ptr< ParentFiniteElementAdjacencyFunctionSkeleton< 2 > > parentAdjSkeletonFunctionDim2
static double crackingAddTime
double alphaViscousOmega0
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
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)
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 addMaterial_Core(boost::weak_ptr< MatOps::PhysicalEquations > mat_physical_equations_ptr)
MoFEMErrorCode getSpatialTractionFreeBc(const EntityHandle meshset=0)
static double inv_dd_f_log_e(const double v)
MoFEMErrorCode getExternalStrain()
MoFEMErrorCode getSpatialTractionBc()
MoFEMErrorCode pushNoStretchVolumeA00Ops(boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe_lhs)
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
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)
static bool hasNonHomogeneousMaterialBlock
MoFEMErrorCode addDMs(const BitRefLevel bit=BitRefLevel().set(0), const EntityHandle meshset=0)
MoFEMErrorCode solveCohesiveCrackGrowth(TS ts, Vec x, int start_step, double start_time)
Solve cohesive crack growth problem.
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
MoFEMErrorCode saveOrgCoords()
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 int addCrackMeshsetId
static double inv_f_log_e(const double v)
MoFEMErrorCode createExchangeVectors(Sev sev)
MoFEMErrorCode pushStretchVolumeA00Ops(boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe_lhs)
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
boost::shared_ptr< Range > crackFaces
static boost::function< double(const double)> d_f
static bool isNoStretch()
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
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)
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.