25#include <boost/program_options.hpp>
27namespace po = boost::program_options;
41int main(
int argc,
char *argv[]) {
48 PetscBool flg_file = PETSC_FALSE;
49 PetscBool flg_elastic_only = PETSC_FALSE;
51 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);
61 moab::Core mb_instance;
62 moab::Interface &moab = mb_instance;
65 if (flg_file != PETSC_TRUE) {
66 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
71 option =
"PARALLEL=READ_PART;"
72 "PARALLEL_RESOLVE_SHARED_ENTS;"
73 "PARTITION=PARALLEL_PARTITION;";
75 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
77 pcomm =
new ParallelComm(&moab, PETSC_COMM_WORLD);
87 PetscPrintf(PETSC_COMM_WORLD,
"Read meshset. Added meshsets for bc.cfg\n");
89 PetscPrintf(PETSC_COMM_WORLD,
"%s",
90 static_cast<std::ostringstream &
>(
91 std::ostringstream().seekp(0) << *it << endl)
102 common_data.
preProcRhs = boost::shared_ptr<Remodeling::FePrePostProcessRhs>(
104 common_data.
preProcLhs = boost::shared_ptr<Remodeling::FePrePostProcessLhs>(
112 if (!flg_elastic_only) {
119 bool flag_cubit_disp =
false;
122 flag_cubit_disp =
true;
125 boost::shared_ptr<FEMethod> dirihlet_bc_ptr;
128 if (!flag_cubit_disp) {
131 m_field,
"DISPLACEMENTS",
"DISPLACEMENT"));
135 dirihlet_bc_ptr = boost::shared_ptr<FEMethod>(
146 dirihlet_bc_ptr.get(), NULL);
148 common_data.
feRhs.get(), NULL, NULL);
156 for (boost::ptr_map<string, NeummanForcesSurface>::iterator fit =
160 &fit->second->getLoopFe(), NULL, NULL);
164 for (boost::ptr_map<std::string, EdgeForce>::iterator fit =
168 &fit->second->getLoopFe(), NULL, NULL);
172 for (boost::ptr_map<std::string, NodalForce>::iterator fit =
176 &fit->second->getLoopFe(), NULL, NULL);
180 dirihlet_bc_ptr.get());
189 dirihlet_bc_ptr.get(), NULL);
191 common_data.
feLhs.get(), NULL, NULL);
198 dirihlet_bc_ptr.get());
202 CHKERR DMCreateMatrix(common_data.
dm, &common_data.
A);
203 CHKERR DMCreateGlobalVector(common_data.
dm, &common_data.
D);
204 CHKERR DMCreateGlobalVector(common_data.
dm, &common_data.
F);
208 INSERT_VALUES, SCATTER_FORWARD);
210 CHKERR TSCreate(PETSC_COMM_WORLD, &common_data.
ts);
211 CHKERR TSSetType(common_data.
ts, TSBEULER);
215 CHKERR MatDestroy(&common_data.
A);
216 CHKERR VecDestroy(&common_data.
D);
217 CHKERR VecDestroy(&common_data.
F);
#define CATCH_ERRORS
Catch errors.
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERR
Inline error check.
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 DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
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
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
boost::shared_ptr< FePrePostProcessRhs > preProcRhs
boost::shared_ptr< Fe > feLhs
FE to make left hand side.
boost::shared_ptr< Fe > feRhs
FE to make right hand side.
boost::ptr_map< string, NeummanForcesSurface > neumannForces
Forces on surface.
MoFEMErrorCode getParameters()
boost::ptr_map< string, EdgeForce > edgeForces
Forces on edges.
DM dm
Discretization manager.
boost::shared_ptr< FePrePostProcessLhs > preProcLhs
boost::ptr_map< string, NodalForce > nodalForces
Nodal forces.
boost::shared_ptr< NonlinearElasticElement > elasticPtr
Not used at this stage. Could be used to do some calculations, before assembly of local elements.
Not used at this stage. Could be used to do some calculations, before assembly of local elements.
Implementation of bone remodeling finite element.
MoFEMErrorCode addElements()
Set and add finite elements.
MoFEMErrorCode solveDM()
Solve problem set up in DM.
MoFEMErrorCode buildDM()
Set problem and DM.
MoFEMErrorCode getParameters()
Get parameters form line command or config file.
MoFEMErrorCode addFields()
Set and add entities to approximation fields.
MoFEMErrorCode addMomentumFluxes()
Finite elements to calculate tractions.
Set Dirichlet boundary conditions on displacements.
boost::ptr_vector< MethodForForceScaling > methodsOp
Add boundary conditions form block set having 6 attributes.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode setMeshsetFromFile(const string file_name, const bool clean_file_options=true)
add blocksets reading config file
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Force scale operator for reading two columns.