32 {
33
35
36 try {
37
38 moab::Core mb_instance;
39 moab::Interface &moab = mb_instance;
40 int rank;
41 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
42
43
44 PetscBool flg_mesh_file = PETSC_TRUE;
45 PetscBool flg_out_file = PETSC_TRUE;
48
49 double radius = 1.0;
50 double height = 1.0;
51 int dim = 2;
52
53 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"ADD_PRISMS_LAYER",
"none");
54
55 CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
57 CHKERR PetscOptionsString(
"-my_out_file",
"out file name",
"",
"out.h5m",
59
60 CHKERR PetscOptionsInt(
"-my_dim",
"dimension (2 or 3)",
"", dim, &dim,
61 PETSC_NULL);
62
63 CHKERR PetscOptionsReal(
"-my_radius",
"roughness wavelength",
"", radius,
64 &radius, PETSC_NULL);
65 CHKERR PetscOptionsReal(
"-my_height",
"vertical dimension of the mesh",
"",
66 height, &height, PETSC_NULL);
67
68 int ierr = PetscOptionsEnd();
70
71 if (flg_mesh_file != PETSC_TRUE) {
72 SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
73 }
74
75
76 const char *option;
77 option = "";
79 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
80 if (pcomm == NULL)
81 pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
82
83
86
87 Range tets, tris, nodes, all_nodes;
89 if (
bit->getName().compare(0, 11,
"MAT_ELASTIC") == 0) {
90 const int id =
bit->getMeshsetId();
91 if (id == 1) {
93 3, tets, true);
95 2, tris, true);
96 }
97 }
98 }
99
101 all_nodes.merge(nodes);
102 nodes.clear();
104 all_nodes.merge(nodes);
105
106 double coords[3];
107 for (Range::iterator nit = all_nodes.begin(); nit != all_nodes.end();
108 nit++) {
109 CHKERR moab.get_coords(&*nit, 1, coords);
110 double x = coords[0];
111 double y = coords[1];
112 double z = coords[2];
113 double r = sqrt(x * x + y * y);
114 double coef = (height + z) / height;
115 switch (dim) {
116 case 2:
117 coords[2] -= coef * 0.5 * x * x / radius;
118 break;
119 case 3:
120 coords[2] -= coef * 0.5 *
r *
r / radius;
121 break;
122 default:
124 "Wrong dimension = %d", dim);
125 }
126
127 CHKERR moab.set_coords(&*nit, 1, coords);
128 }
129
132 MOFEM_LOG_C(
"WORLD", Sev::inform,
"Write file %s\n",
134 }
136
138 return 0;
139}
#define MOFEM_LOG_C(channel, severity, format,...)
#define CATCH_ERRORS
Catch errors.
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
@ MOFEM_DATA_INCONSISTENCY
#define CHKERR
Inline error check.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
virtual moab::Interface & get_moab()=0
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.