19 {
20
22 "-pc_type lu \n"
23 "-pc_factor_mat_solver_type mumps \n"
24 "-mat_mumps_icntl_20 0 \n"
25 "-mat_mumps_icntl_13 1 \n"
26 "-ksp_monitor \n"
27 "-mat_mumps_icntl_24 1 \n"
28 "-mat_mumps_icntl_13 1 \n";
29
31 if (!
static_cast<bool>(ifstream(
param_file))) {
32 std::ofstream file(
param_file.c_str(), std::ios::ate);
33 if (file.is_open()) {
35 file.close();
36 }
37 }
38
40
41 try {
42
43 moab::Core mb_instance;
44 moab::Interface &moab = mb_instance;
45
46 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
47 auto moab_comm_wrap =
48 boost::make_shared<WrapMPIComm>(PETSC_COMM_WORLD, false);
49 if (pcomm == NULL)
50 pcomm =
51 new ParallelComm(&moab, moab_comm_wrap->get_comm());
52
53
54 PetscBool flg_file;
57 PetscBool is_partitioned = PETSC_FALSE;
58 PetscBool regression_test = PETSC_FALSE;
59
60 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Magnetostatics options",
61 "none");
62 CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
64 CHKERR PetscOptionsInt(
"-my_order",
"default approximation order",
"",
67 "-regression_test",
68 "if set norm of solution vector is check agains expected value ",
69 "",
70 PETSC_FALSE, ®ression_test, PETSC_NULL);
71
72 ierr = PetscOptionsEnd();
74
75
76 const char *option;
77 option = "PARALLEL=READ_PART;"
78 "PARALLEL_RESOLVE_SHARED_ENTS;"
79 "PARTITION=PARALLEL_PARTITION;";
81
82
85
87 magnetic.blockData.oRder =
order;
88 CHKERR magnetic.getNaturalBc();
89 CHKERR magnetic.getEssentialBc();
90 CHKERR magnetic.createFields();
91 CHKERR magnetic.createElements();
92 CHKERR magnetic.createProblem();
93 CHKERR magnetic.solveProblem(regression_test == PETSC_TRUE);
94 CHKERR magnetic.postProcessResults();
95 CHKERR magnetic.destroyProblem();
96
97
98 CHKERR moab.write_file(
"solution.h5m",
"MOAB",
"PARALLEL=WRITE_PART");
99 }
101
103 return 0;
104}
const std::string default_options
#define CATCH_ERRORS
Catch errors.
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
#define CHKERR
Inline error check.
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Implementation of magneto-static problem (basic Implementation)
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.