45 char data_file_name1[255];
46 char data_file_name2[255];
47 PetscBool flg_file = PETSC_FALSE;
49 PetscBool flg_n_part = PETSC_FALSE;
50 PetscInt n_partas = 1;
52 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"none",
"none");
53 CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
56 CHKERR PetscOptionsString(
"-my_data_x",
"data file name",
"",
"data_x.h5m",
57 data_file_name1, 255, PETSC_NULL);
59 CHKERR PetscOptionsString(
"-my_data_y",
"data file name",
"",
"data_y.h5m",
60 data_file_name2, 255, PETSC_NULL);
62 CHKERR PetscOptionsInt(
"-my_order",
"default approximation order",
"", 1,
65 CHKERR PetscOptionsInt(
"-my_nparts",
"number of parts",
"", 1, &n_partas,
68 ierr = PetscOptionsEnd();
71 if (flg_file != PETSC_TRUE) {
72 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
75 if (flg_n_part != PETSC_TRUE) {
76 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR partitioning number not given");
82 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
84 pcomm =
new ParallelComm(&moab, PETSC_COMM_WORLD);
141 DMType dm_name =
"DM_DISP";
144 CHKERR DMCreate(PETSC_COMM_WORLD, &dm_disp);
145 CHKERR DMSetType(dm_disp, dm_name);
150 CHKERR DMSetFromOptions(dm_disp);
161 string file1(data_file_name1);
163 CHKERR data_from_files.fromOptions();
164 CHKERR data_from_files.loadFileData();
166 string file2(data_file_name2);
168 CHKERR data_from_files2.fromOptions();
169 CHKERR data_from_files2.loadFileData();
171 boost::ptr_vector<MoFEM::ForcesAndSourcesCore::UserDataOperator>
172 &list_of_operators = fe_face.getOpPtrVector();
176 CHKERR DMCreateMatrix(dm_disp, &
A);
182 CHKERR VecDuplicate(Fx, &Fy);
183 CHKERR VecDuplicate(Dx, &Dy);
186 CHKERR VecZeroEntries(Fx);
187 CHKERR VecZeroEntries(Fy);
192 common_data.
globF = Fx;
193 list_of_operators.push_back(
194 new OpCalculateInvJacForFace(common_data.
invJac));
196 list_of_operators.push_back(
197 new OpCalculateLhs(
"DISP_X",
"DISP_X", common_data, data_from_files));
198 list_of_operators.push_back(
200 list_of_operators.push_back(
new OpAssmbleRhs(
"DISP_X", common_data));
205 CHKERR MatAssemblyBegin(
A, MAT_FINAL_ASSEMBLY);
206 CHKERR MatAssemblyEnd(
A, MAT_FINAL_ASSEMBLY);
207 CHKERR VecGhostUpdateBegin(Fx, ADD_VALUES, SCATTER_REVERSE);
208 CHKERR VecGhostUpdateEnd(Fx, ADD_VALUES, SCATTER_REVERSE);
209 CHKERR VecAssemblyBegin(Fx);
210 CHKERR VecAssemblyEnd(Fx);
213 common_data.
globF = Fy;
214 list_of_operators.clear();
215 list_of_operators.push_back(
216 new OpCalculateInvJacForFace(common_data.
invJac));
218 list_of_operators.push_back(
220 list_of_operators.push_back(
new OpAssmbleRhs(
"DISP_X", common_data));
225 CHKERR VecGhostUpdateBegin(Fy, ADD_VALUES, SCATTER_REVERSE);
226 CHKERR VecGhostUpdateEnd(Fy, ADD_VALUES, SCATTER_REVERSE);
227 CHKERR VecAssemblyBegin(Fy);
228 CHKERR VecAssemblyEnd(Fy);
238 CHKERR KSPCreate(PETSC_COMM_WORLD, &ksp);
240 CHKERR KSPSetFromOptions(ksp);
241 CHKERR KSPSolve(ksp, Fx, Dx);
242 CHKERR KSPSolve(ksp, Fy, Dy);
245 CHKERR VecGhostUpdateBegin(Dx, INSERT_VALUES, SCATTER_FORWARD);
246 CHKERR VecGhostUpdateEnd(Dx, INSERT_VALUES, SCATTER_FORWARD);
248 "DM_DISP",
COL, Dx, INSERT_VALUES, SCATTER_REVERSE);
249 CHKERR VecGhostUpdateBegin(Dy, INSERT_VALUES, SCATTER_FORWARD);
250 CHKERR VecGhostUpdateEnd(Dy, INSERT_VALUES, SCATTER_FORWARD);
252 "DM_DISP",
"DISP_X",
"DISP_Y",
COL, Dy, INSERT_VALUES, SCATTER_REVERSE);
259 sum_dx += (*dof)->getFieldData();
265 (*dof)->getFieldData() -= sum_dx;
271 sum_dy += (*dof)->getFieldData();
277 (*dof)->getFieldData() -= sum_dy;
281 CHKERR post_proc.generateReferenceElementMesh();
282 CHKERR post_proc.addFieldValuesPostProc(
"DISP_X");
283 CHKERR post_proc.addFieldValuesPostProc(
"DISP_Y");
286 CHKERR post_proc.postProcMesh.write_file(
"out_disp.h5m",
"MOAB",
287 "PARALLEL=WRITE_PART");
294 CHKERR DMDestroy(&dm_disp);
303 Range ents_1st_layer;
305 ents_1st_layer,
true);
308 CHKERR moab.get_connectivity(ents_1st_layer[0], conn, num_nodes);
311 CHKERR skin.find_skin(0, ents_1st_layer,
false, skin_edges);
313 CHKERR moab.get_adjacencies(&*ents_1st_layer.begin(), 1, 1,
false, edges);
316 CHKERR moab.add_entities(meshset, conn, 1);
317 CHKERR moab.add_entities(meshset, skin_edges);
322 CHKERR moab.get_entities_by_type(0, MBTET, tets,
false);
326 CHKERR moab.write_file(
"analysis_mesh.h5m");