|
| v0.14.0
|
#include <boost/program_options.hpp>
#include <BasicFiniteElements.hpp>
#include <ElasticMaterials.hpp>
#include <Remodeling.hpp>
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
|
static char | help [] = "\n" |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
- Examples
- bone_adaptation.cpp.
Definition at line 41 of file bone_adaptation.cpp.
48 PetscBool flg_file = PETSC_FALSE;
49 PetscBool flg_elastic_only = PETSC_FALSE;
51 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Main set up",
"none");
52 CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
56 "-elastic_only",
"is used for testing, calculates only elastic problem",
57 "", PETSC_FALSE, &flg_elastic_only, PETSC_NULL);
59 ierr = PetscOptionsEnd();
66 if (flg_file != PETSC_TRUE) {
67 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
72 option =
"PARALLEL=READ_PART;"
73 "PARALLEL_RESOLVE_SHARED_ENTS;"
74 "PARTITION=PARALLEL_PARTITION;";
76 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
78 pcomm =
new ParallelComm(&moab, PETSC_COMM_WORLD);
88 PetscPrintf(PETSC_COMM_WORLD,
"Read meshset. Added meshsets for bc.cfg\n");
90 PetscPrintf(PETSC_COMM_WORLD,
"%s",
91 static_cast<std::ostringstream &
>(
92 std::ostringstream().seekp(0) << *it << endl)
103 common_data.
preProcRhs = boost::shared_ptr<Remodeling::FePrePostProcessRhs>(
105 common_data.
preProcLhs = boost::shared_ptr<Remodeling::FePrePostProcessLhs>(
113 if (!flg_elastic_only) {
114 remodelling.getParameters();
115 remodelling.addFields();
116 remodelling.addMomentumFluxes();
117 remodelling.addElements();
118 remodelling.buildDM();
120 bool flag_cubit_disp =
false;
123 flag_cubit_disp =
true;
126 boost::shared_ptr<FEMethod> dirihlet_bc_ptr;
129 if (!flag_cubit_disp) {
132 m_field,
"DISPLACEMENTS",
"DISPLACEMENT"));
136 dirihlet_bc_ptr = boost::shared_ptr<FEMethod>(
147 dirihlet_bc_ptr.get(), NULL);
149 common_data.
feRhs.get(), NULL, NULL);
157 for (boost::ptr_map<string, NeummanForcesSurface>::iterator fit =
161 &fit->second->getLoopFe(), NULL, NULL);
165 for (boost::ptr_map<std::string, EdgeForce>::iterator fit =
169 &fit->second->getLoopFe(), NULL, NULL);
173 for (boost::ptr_map<std::string, NodalForce>::iterator fit =
177 &fit->second->getLoopFe(), NULL, NULL);
181 dirihlet_bc_ptr.get());
190 dirihlet_bc_ptr.get(), NULL);
192 common_data.
feLhs.get(), NULL, NULL);
199 dirihlet_bc_ptr.get());
203 CHKERR DMCreateMatrix(common_data.
dm, &common_data.
A);
204 CHKERR DMCreateGlobalVector(common_data.
dm, &common_data.
D);
205 CHKERR DMCreateGlobalVector(common_data.
dm, &common_data.
F);
209 INSERT_VALUES, SCATTER_FORWARD);
211 CHKERR TSCreate(PETSC_COMM_WORLD, &common_data.
ts);
212 CHKERR TSSetType(common_data.
ts, TSBEULER);
214 CHKERR remodelling.solveDM();
216 CHKERR MatDestroy(&common_data.
A);
217 CHKERR VecDestroy(&common_data.
D);
218 CHKERR VecDestroy(&common_data.
F);
◆ help
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
boost::shared_ptr< Fe > feRhs
FE to make right hand side.
#define MYPCOMM_INDEX
default communicator number PCOMM
boost::ptr_map< string, NeummanForcesSurface > neumannForces
Forces on surface.
boost::ptr_map< string, NodalForce > nodalForces
Nodal forces.
Implementation of bone remodeling finite element.
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Add boundary conditions form block set having 6 attributes.
Set Dirichlet boundary conditions on displacements.
Deprecated interface functions.
DeprecatedCoreInterface Interface
#define CHKERR
Inline error check.
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
Force scale operator for reading two columns.
boost::shared_ptr< NonlinearElasticElement > elasticPtr
MoFEMErrorCode setMeshsetFromFile(const string file_name, const bool clean_file_options=true)
add blocksets reading config file
boost::ptr_map< string, EdgeForce > edgeForces
Forces on edges.
Not used at this stage. Could be used to do some calculations, before assembly of local elements.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
boost::shared_ptr< Fe > feLhs
FE to make left hand side.
#define CATCH_ERRORS
Catch errors.
MoFEMErrorCode getParameters()
DM dm
Discretization manager.
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
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
Interface for managing meshsets containing materials and boundary conditions.
boost::ptr_vector< MethodForForceScaling > methodsOp
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
Not used at this stage. Could be used to do some calculations, before assembly of local elements.
boost::shared_ptr< FePrePostProcessLhs > preProcLhs
boost::shared_ptr< FePrePostProcessRhs > preProcRhs