|
| v0.14.0
|
Go to the documentation of this file.
30 #include <boost/python.hpp>
31 #include <boost/python/def.hpp>
32 #include <boost/python/def.hpp>
33 #include <boost/python/numpy.hpp>
34 namespace bp = boost::python;
35 namespace np = boost::python::numpy;
42 using namespace MoFEM;
45 static char help[] =
"...\n\n";
47 int main(
int argc,
char *argv[]) {
50 const char param_file[] =
"param_file.petsc";
54 auto core_log = logging::core::get();
62 MOFEM_LOG(
"EP", Sev::inform) <<
"Python initialised";
64 MOFEM_LOG(
"EP", Sev::inform) <<
"Python NOT initialised";
77 PetscBool flg = PETSC_TRUE;
83 char restart_file[255];
84 PetscBool restart_flg = PETSC_TRUE;
91 DMType dm_name =
"DMMOFEM";
98 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
100 pcomm =
new ParallelComm(&moab, PETSC_COMM_WORLD);
103 if(pcomm->proc_config().proc_size() == 1)
106 option =
"PARALLEL=READ_PART;"
107 "PARALLEL_RESOLVE_SHARED_ENTS;"
108 "PARTITION=PARALLEL_PARTITION";
135 enum MaterialModel { StVenantKirchhoff, MooneyRivlin, Hencky, LastMaterial };
136 const char *list_materials[LastMaterial] = {
"stvenant_kirchhoff",
137 "mooney_rivlin",
"hencky"};
138 PetscInt choice_material = MooneyRivlin;
140 LastMaterial, &choice_material, PETSC_NULL);
142 switch (choice_material) {
143 case StVenantKirchhoff:
145 <<
"StVenantKirchhoff material model";
150 MOFEM_LOG(
"EP", Sev::inform) <<
"MooneyRivlin material model";
155 MOFEM_LOG(
"EP", Sev::inform) <<
"Hencky material model";
169 CHKERR VecSetOption(f_elastic, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
175 CHKERR PetscViewerBinaryOpen(PETSC_COMM_WORLD, restart_file,
176 FILE_MODE_READ, &viewer);
177 CHKERR VecLoad(x_elastic, viewer);
178 CHKERR PetscViewerDestroy(&viewer);
183 auto ts_elastic =
createTS(PETSC_COMM_WORLD);
184 CHKERR TSSetType(ts_elastic, TSBEULER);
187 CHKERR TSGetAdapt(ts_elastic, &adapt);
191 CHKERR TSSetTime(ts_elastic, time);
200 if (Py_FinalizeEx() < 0) {
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
MoFEMErrorCode addDMs(const BitRefLevel bit=BitRefLevel().set(0))
#define MYPCOMM_INDEX
default communicator number PCOMM
auto createTS(MPI_Comm comm)
virtual MPI_Comm & get_comm() const =0
MoFEMErrorCode addMaterial_Hencky(double E, double nu)
MoFEMErrorCode addBoundaryFiniteElement(const EntityHandle meshset=0)
MoFEMErrorCode setElasticElementToTs(DM dm)
MoFEMErrorCode setElasticElementOps(const int tag)
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
MoFEMErrorCode getSpatialTractionFreeBc(const EntityHandle meshset=0)
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Deprecated interface functions.
DeprecatedCoreInterface Interface
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVector.
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
#define CHKERR
Inline error check.
implementation of Data Operators for Forces and Sources
MoFEMErrorCode addVolumeFiniteElement(const EntityHandle meshset=0)
SmartPetscObj< DM > dmElastic
Elastic problem.
PetscErrorCode TSAdaptCreate_EP(TSAdapt adapt)
MoFEMErrorCode addMaterial_HMHHStVenantKirchhoff(const int tape, const double lambda, const double mu, const double sigma_y)
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Eshelbian plasticity interface.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define MOFEM_LOG(channel, severity)
Log.
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
#define CATCH_ERRORS
Catch errors.
@ MOFEM_DATA_INCONSISTENCY
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
MoFEMErrorCode addFields(const EntityHandle meshset=0)
int main(int argc, char *argv[])
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
MoFEMErrorCode getSpatialTractionBc()
MoFEMErrorCode addMaterial_HMHMooneyRivlin(const int tape, const double alpha, const double beta, const double lambda, const double sigma_y)
MoFEMErrorCode solveElastic(TS ts, Mat m, Vec f, Vec x)
MoFEMErrorCode getSpatialRotationBc()
MoFEMErrorCode getSpatialDispBc()
[Getting norms]