|
| v0.14.0
|
Go to the documentation of this file.
13 #ifndef __BASICBOUNDARYCONDIONSINTERFACE_HPP__
14 #define __BASICBOUNDARYCONDIONSINTERFACE_HPP__
22 using DomainEle = VolumeElementForcesAndSourcesCore;
27 using OpBodyForce = FormsIntegrators<DomainEleOp>::Assembly<
28 PETSC>::LinearForm<GAUSS>::OpSource<1, 3>;
30 NaturalBC<DomainEleOp>::Assembly<
PETSC>::LinearForm<GAUSS>;
37 PETSC>::LinearForm<GAUSS>::OpBaseTimesVector<1, 3, 1>;
117 string mesh_pos_field_name =
"MESH_NODE_POSITIONS",
118 string problem_name =
"ELASTIC",
119 string domain_element_name =
"ELASTIC_FE",
121 double *snes_load_factor =
nullptr,
bool is_partitioned =
true)
135 PetscBool quasi_static = PETSC_FALSE;
136 PetscBool is_linear = PETSC_FALSE;
160 dirichletBcPtr = boost::make_shared<DirichletSpatialRemoveDofsBc>(
164 dirichletBcPtr = boost::make_shared<DirichletDisplacementRemoveDofsBc>(
220 boost::make_shared<VolumeElementForcesAndSourcesCore>(
mField);
222 boost::make_shared<VolumeElementForcesAndSourcesCore>(
mField);
238 auto get_id_block_param = [&](
string base_name,
int id) {
239 char load_hist_file[255] =
"hist.in";
240 PetscBool ctg_flag = PETSC_FALSE;
241 string param_name_with_id =
"-" + base_name +
"_" + to_string(
id);
243 param_name_with_id.c_str(), load_hist_file,
246 return param_name_with_id;
248 param_name_with_id =
"-" + base_name;
250 param_name_with_id.c_str(), load_hist_file,
254 <<
"Setting one accelerogram for all blocks!";
255 return param_name_with_id;
264 for (
size_t d = 1;
d < 3; ++
d)
266 moab::Interface::UNION);
273 const std::string block_name =
"BODY_FORCE";
274 if (it->getName().compare(0, block_name.size(), block_name) == 0) {
275 std::vector<double> attr;
276 CHKERR it->getAttributes(attr);
277 if (attr.size() > 3) {
279 const int id = it->getMeshsetId();
284 auto bc_ents_ptr = boost::make_shared<Range>(
get_adj_ents(bc_ents));
289 double density = attr[0];
291 attr.size() > 4 ?
bool(std::floor(attr[4])) :
true;
294 std::vector<boost::shared_ptr<TimeScaleVector3>> methods_for_scaling;
295 std::string param_name_for_scaling =
296 get_id_block_param(
"accelerogram",
id);
298 if (!param_name_for_scaling.empty())
299 methods_for_scaling.push_back(
300 boost::make_shared<BasicBCVectorScale>(density,
301 param_name_for_scaling));
303 methods_for_scaling.push_back(
304 boost::make_shared<BasicBCVectorConst>(
312 return density * fe_domain_lhs->ts_aa;
324 pipeline_rhs.push_back(
330 pipeline_rhs,
mField,
"U", {}, methods_for_scaling,
331 it->getName(), Sev::inform);
334 pipeline_lhs.push_back(
336 pipeline_lhs.push_back(
338 auto mat_acceleration = boost::make_shared<MatrixDouble>();
339 pipeline_rhs.push_back(
new OpCalculateVectorFieldValuesDotDot<3>(
343 [&](
double,
double,
double) {
return density; }, bc_ents_ptr));
351 "There should be (1 density + 3 accelerations ) attributes in "
352 "BODY_FORCE blockset, but is %d. Optionally, you can set 5th "
353 "parameter to inertia flag.",
400 bc_mng->getMergedBlocksMarker(vector<string>{
"FIX_",
"ROTATE"});
409 vector<const char *> element_list{
"FORCE_FE",
"PRESSURE_FE",
413 for (
auto &el : element_list) {
415 simple->getOtherFiniteElements().push_back(el);
430 char load_hist_file[255] =
"hist.in";
431 PetscBool ctg_flag = PETSC_FALSE;
432 string new_param_file = string(
"-") + prefix + string(
"_history");
434 load_hist_file, 255, &ctg_flag);
436 return new_param_file;
437 return string(
"-load_history");
440 template <
typename T>
446 template <
typename T>
452 template <
typename T,
bool RHS>
458 auto set_solver_pipelines =
459 [&](PetscErrorCode (*
function)(DM,
const char fe_name[],
MoFEM::FEMethod *,
462 PetscErrorCode (*jacobian)(DM,
const char fe_name[],
MoFEM::FEMethod *,
468 if (std::is_same_v<T, TS>)
478 auto set_neumann_methods = [&](
auto &neumann_el,
string hist_name,
481 for (
auto &&mit : neumann_el) {
482 if constexpr (std::is_same_v<T, SNES>)
483 mit->second->methodsOp.push_back(
485 if constexpr (std::is_same_v<T, TS>)
486 mit->second->methodsOp.push_back(
488 string element_name = mit->first;
491 CHKERR AddHOOps<2, 3, 3>::add(
492 mit->second->getLoopFe().getOpPtrVector(), {},
496 CHKERR AddHOOps<1, 2, 2>::add(
497 mit->second->getLoopFe().getOpPtrVector(), {},
507 CHKERR function(
dM, element_name.c_str(),
508 &mit->second->getLoopFe(), NULL, NULL);
524 CHKERR function(
dM,
"FLUID_PRESSURE_FE",
541 if constexpr (std::is_same_v<T, SNES>) {
545 "SNES lambda factor pointer not set in the module constructor");
550 }
else if constexpr (std::is_same_v<T, TS>) {
567 "This TS is not yet implemented for basic BCs");
572 static_assert(!std::is_same_v<T, KSP>,
573 "this solver has not been implemented for basic BCs yet");
581 CHKERR this->setupSolverFunction<SNES>();
586 CHKERR this->setupSolverJacobian<SNES>();
604 #endif //__BASICBOUNDARYCONDIONSINTERFACE_HPP__
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, 3 > OpMass
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
boost::shared_ptr< KelvinVoigtDamper > damperElementPtr
BasicBoundaryConditionsInterface(MoFEM::Interface &m_field, string postion_field, string mesh_pos_field_name="MESH_NODE_POSITIONS", string problem_name="ELASTIC", string domain_element_name="ELASTIC_FE", bool is_displacement_field=true, bool is_quasi_static=true, double *snes_load_factor=nullptr, bool is_partitioned=true)
MoFEMErrorCode addHOOpsFace3D(const std::string field, E &e, bool hcurl, bool hdiv)
MoFEMErrorCode setupSolverJacobianTS(const TSType type) override
FTensor::Tensor1< double, 3 > tForce
MoFEMErrorCode setupSolverImpl(const TSType type=IM)
Set of functions declaring elements and setting operators for basic boundary conditions interface.
boost::ptr_map< std::string, NeumannForcesSurface > neumann_forces
structure for User Loop Methods on finite elements
MoFEMErrorCode addHOOpsVol(const std::string field, E &e, bool h1, bool hcurl, bool hdiv, bool l2)
VolumeElementForcesAndSourcesCore DomainEle
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
const string domainElementName
TimeScaleVector< 3 > TimeScaleVector3
FTensor::Tensor1< double, 3 > getVector(const double time)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
boost::ptr_map< std::string, NodalForce > nodal_forces
MoFEMErrorCode setupSolverJacobian(const TSType type=IM)
BasicBCVectorConst(double scale, FTensor::Tensor1< double, 3 > t_vec)
MoFEM::Interface & mField
PetscErrorCode DMMoFEMTSSetRHSJacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS the right hand side jacobian
double * snesLambdaLoadFactorPtr
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
MoFEMErrorCode setupSolverJacobianSNES() override
Deprecated interface functions.
BasicBCVectorScale(double scale, std::string file_name)
MoFEMErrorCode setOperators() override
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
#define CHKERR
Inline error check.
boost::ptr_map< std::string, EdgeForce > edge_forces
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
Set of functions declaring elements and setting operators for generic element interface.
virtual moab::Interface & get_moab()=0
PetscErrorCode DMMoFEMTSSetIJacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS Jacobian evaluation function
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string name_row)=0
set field col which finite element use
PetscErrorCode DMMoFEMTSSetI2Jacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS Jacobian evaluation function
Force scale operator for reading two columns.
PetscErrorCode DMMoFEMTSSetI2Function(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS implicit function evaluation function
PetscBool is_quasi_static
MoFEMErrorCode addElementsToDM(SmartPetscObj< DM > dm) override
void simple(double P1[], double P2[], double P3[], double c[], const int N)
MoFEMErrorCode setupSolverFunction(const TSType type=IM)
Class used to scale loads, f.e. in arc-length control.
PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES Jacobian evaluation function
LoadScale(double *my_lambda)
const string domainProblemName
PetscErrorCode DMoFEMPreProcessFiniteElements(DM dm, MoFEM::FEMethod *method)
execute finite element method for each element in dm (problem)
Data structure to exchange data between mofem and User Loop Methods.
BcMarkerPtr mBoundaryMarker
Force scale operator for reading four columns (time and vector)
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
FTensor::Index< 'i', SPACE_DIM > i
NaturalBC< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS > DomainNaturalBC
MoFEMErrorCode addElementFields() override
boost::shared_ptr< VolumeElementForcesAndSourcesCore > bodyForceLhsPtr
PetscErrorCode DMMoFEMTSSetRHSFunction(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS the right hand side function
boost::shared_ptr< FaceElementForcesAndSourcesCore > springLhsPtr
#define MOFEM_LOG(channel, severity)
Log.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
MoFEMErrorCode postProcessElement(int step) override
ForcesAndSourcesCore::UserDataOperator UserDataOperator
MoFEMErrorCode setupSolverFunctionTS(const TSType type) override
boost::shared_ptr< DirichletDisplacementBc > dirichletBcPtr
boost::shared_ptr< FaceElementForcesAndSourcesCore > springRhsPtr
PetscErrorCode DMMoFEMTSSetIFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set TS implicit function evaluation function
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
MoFEMErrorCode scaleNf(const FEMethod *fe, VectorDouble &nf)
string getHistoryParam(string prefix)
UBlasVector< double > VectorDouble
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 3 > OpBodyForce
MoFEMErrorCode updateElementVariables() override
boost::shared_ptr< FluidPressure > fluidPressureElementPtr
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
~BasicBoundaryConditionsInterface()
MoFEMErrorCode createElements() override
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FTensor::Tensor1< double, 3 > getVector(const double time)
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesVector< 1, 3, 1 > OpInertiaForce
boost::shared_ptr< VolumeElementForcesAndSourcesCore > bodyForceRhsPtr
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode setupSolverFunctionSNES() override
MoFEMErrorCode getCommandLineParameters() override
PetscErrorCode DMMoFEMSNESSetFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES residual evaluation function
virtual FTensor::Tensor1< double, SPACE_DIM > getVector(const double time)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)