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
51 double height = 1.0;
52 int dim = 2;
53
54 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"ADD_PRISMS_LAYER",
"none");
55
56 CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
58 CHKERR PetscOptionsString(
"-my_out_file",
"out file name",
"",
"out.h5m",
60
61 CHKERR PetscOptionsInt(
"-my_dim",
"dimension (2 or 3)",
"", dim, &dim,
62 PETSC_NULL);
63
64 CHKERR PetscOptionsReal(
"-my_lambda",
"roughness wavelength",
"",
lambda,
66 CHKERR PetscOptionsReal(
"-my_delta",
"roughness amplitude",
"",
delta,
68 CHKERR PetscOptionsReal(
"-my_height",
"vertical dimension of the mesh",
"",
69 height, &height, PETSC_NULL);
70
71 int ierr = PetscOptionsEnd();
73
74 if (flg_mesh_file != PETSC_TRUE) {
75 SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
76 }
77
78
79 const char *option;
80 option = "";
82 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
83 if (pcomm == NULL)
84 pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
85
86
89
90 Range tets, tris, nodes, all_nodes;
92 if (
bit->getName().compare(0, 11,
"MAT_ELASTIC") == 0) {
93 const int id =
bit->getMeshsetId();
94 if (id == 1) {
96 3, tets, true);
98 2, tris, true);
99 }
100 }
101 }
102
104 all_nodes.merge(nodes);
105 nodes.clear();
107 all_nodes.merge(nodes);
108
109 double coords[3];
110 for (Range::iterator nit = all_nodes.begin(); nit != all_nodes.end();
111 nit++) {
112 CHKERR moab.get_coords(&*nit, 1, coords);
113 double x = coords[0];
114 double y = coords[1];
115 double z = coords[2];
116 double coef = (height + z) / height;
117 switch (dim) {
118 case 2:
119 coords[2] -= coef *
delta * (1. - cos(2. * M_PI * x /
lambda));
120 break;
121 case 3:
122 coords[2] -=
124 (1. - cos(2. * M_PI * x /
lambda) * cos(2. * M_PI * y /
lambda));
125 break;
126 default:
128 "Wrong dimension = %d", dim);
129 }
130
131 CHKERR moab.set_coords(&*nit, 1, coords);
132 }
133
136 MOFEM_LOG_C(
"WORLD", Sev::inform,
"Write file %s\n",
138 }
140
142 return 0;
143}
#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
static constexpr double delta
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.