357 {
358
359 const string default_options = "-ksp_type fgmres \n"
360 "-pc_type lu \n"
361 "-pc_factor_mat_solver_type mumps \n"
362 "-mat_mumps_icntl_20 0 \n"
363 "-ksp_monitor\n";
364
365 string param_file = "param_file.petsc";
366 if (!static_cast<bool>(ifstream(param_file))) {
367 std::ofstream file(param_file.c_str(), std::ios::ate);
368 if (file.is_open()) {
369 file << default_options;
370 file.close();
371 }
372 }
373
375
376 try {
377
378 moab::Core mb_instance;
379 moab::Interface &moab = mb_instance;
380 int rank;
381 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
382
383
384 PetscBool flg = PETSC_TRUE;
388 if (flg != PETSC_TRUE) {
390 "*** ERROR -my_file (MESH FILE NEEDED)");
391 }
392
393 const char *option;
394 option = "";
396
397
400
401
405
406 PetscPrintf(PETSC_COMM_WORLD,
407 "Read meshsets add added meshsets for bc.cfg\n");
409 PetscPrintf(PETSC_COMM_WORLD, "%s",
410 static_cast<std::ostringstream &>(
411 std::ostringstream().seekp(0) << *it << endl)
412 .str()
413 .c_str());
414 cerr << *it << endl;
415 }
416
417
419 ref_level.set(0);
421 0, 3, ref_level);
422
423
424
425
428 &flg);
429 if (flg != PETSC_TRUE) {
431 }
432
433
434
437
438
439
441 CHKERR ufe.addFiniteElements(
"FLUXES",
"VALUES");
442
443 CHKERR ufe.addBoundaryElements(ref_level);
444 CHKERR ufe.buildProblem(ref_level);
445 CHKERR ufe.createMatrices();
446 CHKERR ufe.solveLinearProblem();
447 CHKERR ufe.calculateResidual();
448 CHKERR ufe.evaluateError();
449 CHKERR ufe.destroyMatrices();
450 CHKERR ufe.postProc(
"out_0.h5m");
451
453
455 PETSC_NULL);
456
457
458
459 for (
int ll = 1; ll !=
nb_levels; ll++) {
464 bc_flux_map.clear();
465 CHKERR ufe.addBoundaryElements(ref_level);
466 CHKERR ufe.buildProblem(ref_level);
467 CHKERR ufe.createMatrices();
468 CHKERR ufe.solveLinearProblem();
469 CHKERR ufe.calculateResidual();
470 CHKERR ufe.evaluateError();
471 CHKERR ufe.destroyMatrices();
473 static_cast<std::ostringstream &>(std::ostringstream().seekp(0)
475 .str());
476 }
477 }
479
481
482 return 0;
483}
#define CATCH_ERRORS
Catch errors.
#define CHKERR
Inline error check.
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
map< int, BcFluxData > BcFluxMap
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
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.
Application of mix transport data structure.