53 const char param_file[] =
"param_file.petsc";
57 auto core_log = logging::core::get();
58 core_log->add_sink(LogManager::createSink(LogManager::getStrmWorld(),
"EP"));
59 LogManager::setLog(
"EP");
65 MOFEM_LOG(
"EP", Sev::inform) <<
"Python initialised";
67 MOFEM_LOG(
"EP", Sev::inform) <<
"Python NOT initialised";
71 LogManager::createSink(LogManager::getStrmSync(),
"EPSYNC"));
72 LogManager::setLog(
"EPSYNC");
78 PetscBool flg = PETSC_TRUE;
84 char restart_file[255];
85 PetscBool restart_flg = PETSC_TRUE;
92 DMType dm_name =
"DMMOFEM";
94 DMType dm_name_mg =
"DMMOFEM_MG";
101 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
103 pcomm =
new ParallelComm(&moab, PETSC_COMM_WORLD);
106 if (pcomm->proc_config().proc_size() == 1)
109 option =
"PARALLEL=READ_PART;"
110 "PARALLEL_RESOLVE_SHARED_ENTS;"
111 "PARTITION=PARALLEL_PARTITION";
128 CHKERR ep.getSpatialDispBc();
129 CHKERR ep.getSpatialRotationBc();
130 CHKERR ep.getSpatialTractionBc();
131 CHKERR ep.getSpatialTractionFreeBc();
134 CHKERR ep.projectGeometry();
135 CHKERR ep.addVolumeFiniteElement();
136 CHKERR ep.addBoundaryFiniteElement();
146 const char *list_materials[LastMaterial] = {
147 "stvenant_kirchhoff",
"mooney_rivlin",
"hencky",
"neo_hookean"};
148 PetscInt choice_material = MooneyRivlin;
150 LastMaterial, &choice_material, PETSC_NULL);
152 switch (choice_material) {
153 case StVenantKirchhoff:
154 MOFEM_LOG(
"EP", Sev::inform) <<
"StVenantKirchhoff material model";
159 MOFEM_LOG(
"EP", Sev::inform) <<
"MooneyRivlin material model";
160 MOFEM_LOG(
"EP", Sev::inform) <<
"MU(1, 0)/2 = " <<
MU(1, 0) / 2;
166 MOFEM_LOG(
"EP", Sev::inform) <<
"Hencky material model";
167 CHKERR ep.addMaterial_Hencky(5., 0.25);
170 MOFEM_LOG(
"EP", Sev::inform) <<
"Neohookean material model";
179 CHKERR ep.setElasticElementToTs(ep.dmElastic);
184 CHKERR VecSetOption(f_elastic, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
188 CHKERR PetscViewerBinaryOpen(PETSC_COMM_WORLD, restart_file,
189 FILE_MODE_READ, &viewer);
190 CHKERR VecLoad(x_elastic, viewer);
191 CHKERR PetscViewerDestroy(&viewer);
196 auto ts_elastic =
createTS(PETSC_COMM_WORLD);
197 CHKERR TSSetType(ts_elastic, TSBEULER);
200 CHKERR TSGetAdapt(ts_elastic, &adapt);
204 CHKERR TSSetTime(ts_elastic, time);
205 CHKERR ep.solveElastic(ts_elastic, x_elastic);
213 if (Py_FinalizeEx() < 0) {