1#ifndef __MESH_SMOOTHING_OP_FACTORY_HPP__
2#define __MESH_SMOOTHING_OP_FACTORY_HPP__
5 #error "MoFEM need to be compiled with ADOL-C"
47 boost::shared_ptr<SurfaceSlidingConstrains::DriverElementOrientation>
50 boost::shared_ptr<MoFEM::VolumeElementForcesAndSourcesCore>
minQualityFe;
64 EntitiesFieldData::EntData &data) {
77 const Range &fixed_vertices,
78 const Range &edge_entities,
86 handles.
feSmootherRhs = boost::make_shared<DomainEle>(m_field);
87 handles.
feSmootherLhs = boost::make_shared<DomainEle>(m_field);
102 template opRhsFactory<PETSC, GAUSS, DomainEleOp>(
108 template opLhsFactory<PETSC, GAUSS, DomainEleOp>(
112 boost::make_shared<MoFEM::VolumeElementForcesAndSourcesCore>(m_field);
114 boost::make_shared<double>(std::numeric_limits<double>::max());
119 if (!fixed_vertices.empty()) {
120 auto *prb_mng = m_field.
getInterface<ProblemsManager>();
123 CHKERR prb_mng->removeDofsOnEntities(
128 CHKERR prb_mng->removeDofsOnEntities(
simple->getProblemName(),
130 fixed_vertices, 0, 1);
135 CHKERR prb_mng->removeDofsOnEntities(
155 CHKERR skin.find_skin(0, tets,
false, skin_faces);
156 if (skin_faces.empty()) {
158 "No skin faces found for edge constrains");
160 handles.
edgeConstraint = boost::make_shared<EdgeSlidingConstrains>(m_field);
172 boost::shared_ptr<ForcesAndSourcesCore> null;
180 CHKERR DMMoFEMSNESSetFunction(
182 CHKERR DMMoFEMSNESSetJacobian(
187 CHKERR DMMoFEMSNESSetFunction(dm,
"EDGE_SLIDING",
189 CHKERR DMMoFEMSNESSetJacobian(dm,
"EDGE_SLIDING",
197 const std::string &domain_fe_name,
199 double &min_quality) {
204 "Min quality operators are not initialised");
208 CHKERR DMoFEMLoopFiniteElements(dm, domain_fe_name.c_str(),
212 CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
214 CHKERR MPI_Allreduce(&local_min, &min_quality, 1, MPI_DOUBLE, MPI_MIN,
222 char gamma_value[64];
223 CHKERR PetscSNPrintf(gamma_value,
sizeof(gamma_value),
"%.17g", gamma);
224 CHKERR PetscOptionsSetValue(NULL,
"-volume_length_gamma", gamma_value);
230inline MoFEMErrorCode
createSnes(DM dm, SmartPetscObj<SNES> &snes) {
233 CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
234 snes = createSNES(m_field_ptr->
get_comm());
235 CHKERR SNESSetFromOptions(snes);
236 CHKERR SNESSetDM(snes, dm);
243 const std::vector<std::string> &zero_vertex_fields = {}) {
245 if (!zero_vertex_fields.empty()) {
247 CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
248 auto field_blas = m_field_ptr->
getInterface<FieldBlas>();
249 for (
const auto &
field_name : zero_vertex_fields) {
257 CHKERR SNESSolve(snes, f, d);
ForcesAndSourcesCore::UserDataOperator UserDataOperator
void simple(double P1[], double P2[], double P3[], double c[], const int N)
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#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 MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
PetscErrorCode DMoFEMMeshToGlobalVector(DM dm, Vec g, InsertMode mode, ScatterMode scatter_mode, RowColData rc=RowColData::COL)
set ghosted vector values on all existing mesh entities
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode, RowColData rc=RowColData::COL)
set local (or ghosted) vector values on mesh for partition only
auto createDMVector(DM dm, RowColData rc=RowColData::COL)
Get smart vector from DM.
virtual bool check_field(const std::string &name) const =0
check if field is in database
boost::shared_ptr< PhysicalEquations > createMatOpsPhysicalEquationsPtr(boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag)
boost::shared_ptr< MatOpsData > createMatOpsDataPtr()
MoFEMErrorCode updateBarrierGamma(Handles &handles, double gamma)
MoFEMErrorCode evaluateMinQuality(DM dm, const std::string &domain_fe_name, const Handles &handles, double &min_quality)
MoFEMErrorCode createSnes(DM dm, SmartPetscObj< SNES > &snes)
MoFEMErrorCode solveSnes(DM dm, SNES snes, const std::vector< std::string > &zero_vertex_fields={})
MoFEMErrorCode createOperators(MoFEM::Interface &m_field, const Config &cfg, const Range &fixed_vertices, const Range &edge_entities, Handles &handles)
MoFEMErrorCode addToSnesDM(DM dm, const Config &cfg, const Handles &handles)
implementation of Data Operators for Forces and Sources
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
constexpr auto field_name
MatOps::VolumeLengthQualityType qualityType
std::string geometryField
std::string lambdaEdgeField
std::string meshReferenceField
std::string lambdaSurfaceField
bool enableSurfaceSliding
boost::shared_ptr< double > minQualityValue
boost::shared_ptr< MatOps::PhysicalEquations > volQualityPhysicalPtr
boost::shared_ptr< ForcesAndSourcesCore > feSmootherLhs
boost::shared_ptr< EdgeSlidingConstrains > edgeConstraint
boost::shared_ptr< MoFEM::VolumeElementForcesAndSourcesCore > minQualityFe
boost::shared_ptr< SurfaceSlidingConstrains > surfaceConstraint
MoFEM::Interface * m_field_ptr
boost::shared_ptr< ForcesAndSourcesCore > feSmootherRhs
boost::shared_ptr< SurfaceSlidingConstrains::DriverElementOrientation > surfaceOrientation
MinQualityOp(const std::string &field_name, double *min_quality_ptr)
MoFEMErrorCode doWork(int, EntityType type, EntitiesFieldData::EntData &data)
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Deprecated interface functions.
friend class ForcesAndSourcesCore
@ OPROW
operator doWork function is executed on FE rows
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Volume finite element base.
Class implemented by user to detect face orientation.
Shape preserving constrains, i.e. nodes sliding on body surface.
Implementing surface sliding constrains.