v0.10.0
Functions | Variables
cylindrical_acoustic.cpp File Reference
#include <MoFEM.hpp>
#include <DirichletBC.hpp>
#include <PotsProcOnRefMesh.hpp>
#include <HelmholtzElementObsolete.hpp>
#include <Projection10NodeCoordsOnField.hpp>
#include <AnalyticalDirichletObsolete.hpp>
#include <boost/iostreams/tee.hpp>
#include <boost/iostreams/stream.hpp>
#include <petsctime.h>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <cmath>
#include <boost/math/special_functions.hpp>
#include <complex>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Variables

static char help [] = "...\n\n"
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 55 of file cylindrical_acoustic.cpp.

55  {
56 
57 
58 
59 
60  PetscInitialize(&argc,&argv,(char *)0,help);
61 
62  //Core mb_instance;
63  moab::Core mb_instance;
64  Interface& moab = mb_instance;
65  int rank;
66  MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
67 
68 
69  PetscBool flg = PETSC_TRUE;
70  char mesh_file_name[255];
71  ierr = PetscOptionsGetString(PETSC_NULL,"-my_file",mesh_file_name,255,&flg); CHKERRQ(ierr);
72  if(flg != PETSC_TRUE) {
73  SETERRQ(PETSC_COMM_SELF,1,"*** ERROR -my_file (MESH FILE NEEDED)");
74  }
75 
76  bool useImpedance;
77  PetscBool use_impedance = PETSC_FALSE;
78  ierr = PetscOptionsGetBool(NULL,"-use_impedance",&use_impedance,&flg); CHKERRQ(ierr);
79  if(flg != PETSC_TRUE) {
80  SETERRQ(PETSC_COMM_SELF,1,"*** ERROR -use_impedance (true of false needed)");
81  }
82 
83  //char impedance[255];
84  //ierr = PetscOptionsGetString(PETSC_NULL,"-use_impedance",impedance,255,&flg); CHKERRQ(ierr);
85  //if(flg != PETSC_TRUE) {
86 // SETERRQ(PETSC_COMM_SELF,1,"*** ERROR -use_impedance (true of false needed)");
87  //}
88  if (use_impedance) {useImpedance = true;}
89  else if(!use_impedance) {useImpedance = false;}
90 
91  ParallelComm* pcomm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
92  if(pcomm == NULL) pcomm = new ParallelComm(&moab,PETSC_COMM_WORLD);
93 
94  const char *option;
95  option = "";//"PARALLEL=BCAST;";//;DEBUG_IO";
96  BARRIER_RANK_START(pcomm)
97  rval = moab.load_file(mesh_file_name, 0, option); CHKERR_PETSC(rval);
98  BARRIER_RANK_END(pcomm)
99 
100  //Create MoFEM (cephas) database
101  //FieldCore core(moab);
102  MoFEM::Core core(moab);
103  MoFEM::Interface& mField = core;
104 
105  //count the comsumption of time by single run
106  PetscLogDouble t1,t2;
107  PetscLogDouble v1,v2;
108  ierr = PetscTime(&v1); CHKERRQ(ierr);
109  ierr = PetscGetCPUTime(&t1); CHKERRQ(ierr);
110 
111  //set entitities bit level
112  BitRefLevel bit_level0;
113  bit_level0.set(0);
114  EntityHandle meshset_level0;
115  rval = moab.create_meshset(MESHSET_SET,meshset_level0); CHKERR_PETSC(rval);
116  ierr = mField.seed_ref_level_3D(0,bit_level0); CHKERRQ(ierr);
117 
118  //Fields
119  ierr = mField.add_field("rePRES",H1,AINSWORTH_LEGENDRE_BASE,1); CHKERRQ(ierr); //field order distinguish the scalar field and vector field.
120  ierr = mField.add_field("imPRES",H1,AINSWORTH_LEGENDRE_BASE,1); CHKERRQ(ierr);
121 
122  //Problem
123  ierr = mField.add_problem("ACOUSTIC_PROBLEM"); CHKERRQ(ierr);
124  ierr = mField.add_problem("BC1_PROBLEM"); CHKERRQ(ierr); //analytical Dirichlet for real field
125  ierr = mField.add_problem("BC2_PROBLEM"); CHKERRQ(ierr); //analytical Dirichlet for imag field
126 
127  //set refinment level for problem
128  ierr = mField.modify_problem_ref_level_add_bit("ACOUSTIC_PROBLEM",bit_level0); CHKERRQ(ierr);
129  ierr = mField.modify_problem_ref_level_add_bit("BC1_PROBLEM",bit_level0); CHKERRQ(ierr); //analytical Dirichlet
130  ierr = mField.modify_problem_ref_level_add_bit("BC2_PROBLEM",bit_level0); CHKERRQ(ierr); //analytical Dirichlet
131 
132  //meshset consisting all entities in mesh
133  EntityHandle root_set = moab.get_root_set();
134  //add entities to field
135  ierr = mField.add_ents_to_field_by_type(root_set,MBTET,"rePRES"); CHKERRQ(ierr);
136  ierr = mField.add_ents_to_field_by_type(root_set,MBTET,"imPRES"); CHKERRQ(ierr);
137 
138  //set app. order
139  //see Hierarchic Finite Element Bases on Unstructured Tetrahedral Meshes (Mark Ainsworth & Joe Coyle)
140  PetscInt order;
141  ierr = PetscOptionsGetInt(PETSC_NULL,"-my_order",&order,&flg); CHKERRQ(ierr);
142  if(flg != PETSC_TRUE) {
143  order = 2;
144  }
145 
146  ierr = mField.set_field_order(root_set,MBTET,"rePRES",order); CHKERRQ(ierr);
147  ierr = mField.set_field_order(root_set,MBTRI,"rePRES",order); CHKERRQ(ierr);
148  ierr = mField.set_field_order(root_set,MBEDGE,"rePRES",order); CHKERRQ(ierr);
149  ierr = mField.set_field_order(root_set,MBVERTEX,"rePRES",1); CHKERRQ(ierr);
150 
151  if(!mField.check_field("MESH_NODE_POSITIONS")) {
152  ierr = mField.add_field("MESH_NODE_POSITIONS",H1,AINSWORTH_LEGENDRE_BASE,3); CHKERRQ(ierr);
153  ierr = mField.add_ents_to_field_by_type(root_set,MBTET,"MESH_NODE_POSITIONS"); CHKERRQ(ierr);
154  ierr = mField.set_field_order(0,MBTET,"MESH_NODE_POSITIONS",2); CHKERRQ(ierr);
155  ierr = mField.set_field_order(0,MBTRI,"MESH_NODE_POSITIONS",2); CHKERRQ(ierr);
156  ierr = mField.set_field_order(0,MBEDGE,"MESH_NODE_POSITIONS",2); CHKERRQ(ierr);
157  ierr = mField.set_field_order(0,MBVERTEX,"MESH_NODE_POSITIONS",1); CHKERRQ(ierr);
158  }
159  ierr = mField.set_field_order(root_set,MBTET,"imPRES",order); CHKERRQ(ierr);
160  ierr = mField.set_field_order(root_set,MBTRI,"imPRES",order); CHKERRQ(ierr);
161  ierr = mField.set_field_order(root_set,MBEDGE,"imPRES",order); CHKERRQ(ierr);
162  ierr = mField.set_field_order(root_set,MBVERTEX,"imPRES",1); CHKERRQ(ierr);
163 
164  HelmholtzElement helmholtz_elements(mField); //Create the HelmholtzElement class in the header-file
165 
166  ierr = helmholtz_elements.addHelmholtzElements("ACOUSTIC_PROBLEM","rePRES","imPRES"); CHKERRQ(ierr);
167  //ierr = helmholtz_elements.addHelmholtzFluxElement("ACOUSTIC_PROBLEM","rePRES","imPRES"); CHKERRQ(ierr);
168  ierr = helmholtz_elements.addHelmholtzIncidentElement("ACOUSTIC_PROBLEM","rePRES","imPRES"); CHKERRQ(ierr);
169  if(useImpedance) {
170  ierr = helmholtz_elements.addHelmholtzImpedanceElement("ACOUSTIC_PROBLEM","rePRES","imPRES"); CHKERRQ(ierr);
171  }
172 
173 
174  //////Set up the analytical Dirichlet BC
175  Range bc_tris;
176  for(_IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(mField,"ANALYTICAL_BC",it)) {
177  rval = moab.get_entities_by_type(it->get_meshset(),MBTRI,bc_tris,true); CHKERR_PETSC(rval);
178  }
179 
180  AnalyticalDirihletBC analytical_bc1(mField,bc_tris);
181  AnalyticalDirihletBC analytical_bc2(mField,bc_tris);
182  ierr = analytical_bc1.initializeProblem(mField,"BC1_PROBLEM","BC1_FE","rePRES"); CHKERRQ(ierr);
183  ierr = analytical_bc2.initializeProblem(mField,"BC2_PROBLEM","BC2_FE","imPRES"); CHKERRQ(ierr);
184  ////End of Dirichlet set up
185 
186  /*** add exact solution data in finite element */
187  if(mField.check_field("reEX") && mField.check_field("imEX")) {
188  ierr = mField.modify_finite_element_add_field_data("HELMHOLTZ_FE","reEX"); CHKERRQ(ierr);
189  ierr = mField.modify_finite_element_add_field_data("HELMHOLTZ_FE","imEX"); CHKERRQ(ierr);
190  }
191 
192 
193  /****/
194  //build database
195  //build field
196  ierr = mField.build_fields(); CHKERRQ(ierr);
197  //build finite elemnts
198  ierr = mField.build_finite_elements(); CHKERRQ(ierr);
199  //build adjacencies
200  ierr = mField.build_adjacencies(bit_level0); CHKERRQ(ierr);
201  //build problem
202  ierr = mField.build_problems(); CHKERRQ(ierr);
203 
204  Projection10NodeCoordsOnField ent_method_material(mField,"MESH_NODE_POSITIONS");
205  ierr = mField.loop_dofs("MESH_NODE_POSITIONS",ent_method_material); CHKERRQ(ierr);
206 
207  /****/
208  //mesh partitioning
209  //partition
210  ierr = mField.partition_problem("ACOUSTIC_PROBLEM"); CHKERRQ(ierr);
211  ierr = mField.partition_finite_elements("ACOUSTIC_PROBLEM"); CHKERRQ(ierr);
212  //what are ghost nodes, see Petsc Manual
213  ierr = mField.partition_ghost_dofs("ACOUSTIC_PROBLEM"); CHKERRQ(ierr);
214 
215  //////mesh partitinoning for analytical Dirichlet
216  ierr = mField.simple_partition_problem("BC1_PROBLEM"); CHKERRQ(ierr);
217  ierr = mField.partition_finite_elements("BC1_PROBLEM"); CHKERRQ(ierr);
218  ierr = mField.simple_partition_problem("BC2_PROBLEM"); CHKERRQ(ierr);
219  ierr = mField.partition_finite_elements("BC2_PROBLEM"); CHKERRQ(ierr);
220  //what are ghost nodes, see Petsc Manual
221  ierr = mField.partition_ghost_dofs("BC1_PROBLEM"); CHKERRQ(ierr);
222  ierr = mField.partition_ghost_dofs("BC2_PROBLEM"); CHKERRQ(ierr);
223 
224  Vec F; //Right hand side vector
225  ierr = mField.VecCreateGhost("ACOUSTIC_PROBLEM",ROW,&F); CHKERRQ(ierr);
226  Vec T; //Solution vector
227  ierr = VecDuplicate(F,&T); CHKERRQ(ierr);
228  Mat A; //Left hand side matrix
229  ierr = mField.MatCreateMPIAIJWithArrays("ACOUSTIC_PROBLEM",&A); CHKERRQ(ierr);
230 
231  //bool useScalar = false;
232  //ierr = helmholtz_elements.setHelmholtzFiniteElementRhs_FOperators("rePRES","imPRES",F,useScalar); CHKERRQ(ierr); //The analytical F source vector
233  ierr = helmholtz_elements.setHelmholtzFiniteElementRhsOperators("rePRES","imPRES",F,useImpedance); CHKERRQ(ierr); //the Rhs of Dirichlet BC
234  ierr = helmholtz_elements.setHelmholtzFiniteElementLhsOperators("rePRES","imPRES",(A)); CHKERRQ(ierr);//Stiffness Matrix
235  //ierr = helmholtz_elements.setHelmholtzFluxFiniteElementRhsOperators("rePRES","rePRES",F); CHKERRQ(ierr); //real Neumann BC
236  ierr = helmholtz_elements.setHelmholtzIncidentWaveFiniteElementRhsOperators("rePRES","imPRES",F); CHKERRQ(ierr); // Incident wave flux.
237  if(useImpedance) {
238  //The boundary Impedance BC.
239  ierr = helmholtz_elements.setHelmholtzImpedanceFiniteElementLhsOperators("rePRES","imPRES",(A)); CHKERRQ(ierr);
240  }
241 
242 
243  ierr = VecZeroEntries(T); CHKERRQ(ierr);
244  ierr = VecGhostUpdateBegin(T,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
245  ierr = VecGhostUpdateEnd(T,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
246  ierr = VecZeroEntries(F); CHKERRQ(ierr);
247  ierr = VecGhostUpdateBegin(F,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
248  ierr = VecGhostUpdateEnd(F,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
249  ierr = MatZeroEntries(A); CHKERRQ(ierr);
250 
251  ////analytical dirichlet bc
252  AnalyticalDirihletBC::DirichletBC analytical_ditihlet_bc1(mField,"rePRES",A,T,F);
253  AnalyticalDirihletBC::DirichletBC analytical_ditihlet_bc2(mField,"imPRES",A,T,F);
254 
255  //solve for analytical dirichlet bc dofs
256  ierr = analytical_bc1.setProblem(mField,"BC1_PROBLEM"); CHKERRQ(ierr);
257  ierr = analytical_bc2.setProblem(mField,"BC2_PROBLEM"); CHKERRQ(ierr);
258 
259  static double aNgularfreq;
260  static double sPeed; //Without static. got error:use of local variable with automatic storage from containing function
261 
263  {
264  cout << endl << *it << endl;
265 
266 
267  if(it->get_Cubit_name().compare(0,13,"MAT_HELMHOLTZ") == 0) {
268 
269  //get block attributes
270  vector<double> attributes;
271  ierr = it->get_Cubit_attributes(attributes); CHKERRQ(ierr);
272  if(attributes.size()<2) {
273  SETERRQ1(PETSC_COMM_SELF,1,"not enough block attributes to deffine fluid pressure element, attributes.size() = %d ",attributes.size());
274  }
275 
276  aNgularfreq = attributes[0];
277  sPeed = attributes[1];
278 
279  }
280  }
281 
282  /* this function compute the scattered field of helmholtz operator */
283  struct AnaliticalFunction {
284  static double fUN(double x,double y,double z,bool use_real) {
285 
286  //const double pi = atan( 1.0 ) * 4.0;
287  double R = sqrt(pow(x,2.0)+pow(y,2.0)); //radius
288  double theta = atan2(y,x)+2*M_PI;// pihe arctan of radians (y/x)
289 
290  const double wAvenumber = aNgularfreq/sPeed;
291 
292  const double k = wAvenumber; //Wave number
293  const double a = 0.5; //radius of the sphere,wait to modify by user
294  const double const1 = k * a;
295  double const2 = k * R;
296  const complex< double > i( 0.0, 1.0 );
297 
298  // magnitude of incident wave
299  //const double phi_incident_mag = 1.0;
300 
301  const double tol = 1.0e-10;
302  double max = 0.0;
303  double min = 999999.0;
304 
305  complex< double > result = 0.0;
306  complex< double > prev_result;
307 
308  double error = 100.0;
309  unsigned int n = 1; //initialized the infinite series loop
310 
311  /*** sound hard ***/
312 
313  double Jn_der_zero = ( - cyl_bessel_j( 1, const1 ));
314  complex< double > Hn_der_zero = ( - cyl_hankel_1( 1, const1 ));
315  complex< double >Hn_zero = cyl_hankel_1( 0, const2 ); //S Hankel first kind function
316 
317  //n=0;
318  result -= (Jn_der_zero * Hn_zero)/Hn_der_zero;
319 
320 
321  while( error > tol ) //finding the acoustic potential in one single point.
322  {
323  prev_result = result;
324  //The derivative of bessel function
325  double Jn_der = (n / const1 * cyl_bessel_j( n, const1 ) - cyl_bessel_j( n + 1, const1 ));
326  //The derivative of Hankel function
327  complex< double > Hn_der = (n / const1 * cyl_hankel_1( n, const1 ) - cyl_hankel_1( n + 1, const1 ));
328 
329  complex< double >Hn = cyl_hankel_1( n, const2 ); //S Hankel first kind function
330 
331  result -= 2.0 * pow( i, n ) * ( (Jn_der*Hn) / Hn_der ) * cos(n*theta);
332  error = abs( abs( result ) - abs( prev_result ) );
333  ++n;
334  }
335 
336  /*** Incident wave ***/
337 
338  //const complex< double > inc_field = - exp( i * k * R * cos( theta ) ); //incident wave
339  //const complex< double > total_field = inc_field + result;
340  //ofs << theta << "\t" << abs( result ) << "\t" << abs( inc_field ) << "\t" << abs( total_field ) << "\t" << R << endl; //write the file
341 
342 
343  //result = inc_field;
344 
345  if(use_real) {
346  return std::real(result);
347  } else {
348  return std::imag(result);
349  }
350 
351 
352  }
353 
354  };
355 
356 
357 
358  ierr = analytical_bc1.setApproxOps(mField,"rePRES",AnaliticalFunction::fUN,true); CHKERRQ(ierr); //Triangles
359  ierr = analytical_bc2.setApproxOps(mField,"imPRES",AnaliticalFunction::fUN,false); CHKERRQ(ierr);
360 
361  ierr = analytical_bc1.solveProblem(mField,"BC1_PROBLEM","BC1_FE",analytical_ditihlet_bc1); CHKERRQ(ierr);
362  ierr = analytical_bc2.solveProblem(mField,"BC2_PROBLEM","BC2_FE",analytical_ditihlet_bc2); CHKERRQ(ierr);
363 
364 
365  ierr = analytical_bc1.destroyProblem(); CHKERRQ(ierr);
366  ierr = analytical_bc2.destroyProblem(); CHKERRQ(ierr);
367 
368  ////preproc
369  ////Preprocess the analytical Dirichlet BC
370  ierr = mField.problem_basic_method_preProcess("ACOUSTIC_PROBLEM",analytical_ditihlet_bc1); CHKERRQ(ierr);
371  ierr = mField.problem_basic_method_preProcess("ACOUSTIC_PROBLEM",analytical_ditihlet_bc2); CHKERRQ(ierr);
372 
373  //std::string wait;
374  //ierr = MatView(A,PETSC_VIEWER_DRAW_WORLD); CHKERRQ(ierr);
375  //std::cin >> wait;
376 
377  ierr = mField.set_global_ghost_vector("ACOUSTIC_PROBLEM",ROW,T,INSERT_VALUES,SCATTER_REVERSE); CHKERRQ(ierr);
378 
379  ierr = mField.loop_finite_elements("ACOUSTIC_PROBLEM","HELMHOLTZ_FE",helmholtz_elements.getLoopFeRhs()); CHKERRQ(ierr);
380  //ierr = mField.loop_finite_elements("ACOUSTIC_PROBLEM","HELMHOLTZ_FE",helmholtz_elements.getLoopFeRhs_Tri()); CHKERRQ(ierr);
381  ierr = mField.loop_finite_elements("ACOUSTIC_PROBLEM","HELMHOLTZ_FE",helmholtz_elements.getLoopFeLhs()); CHKERRQ(ierr);
382  //ierr = mField.loop_finite_elements("ACOUSTIC_PROBLEM","HELMHOLTZ_FLUX_FE",helmholtz_elements.getLoopFeFlux()); CHKERRQ(ierr); //scalar flux
383  ierr = mField.loop_finite_elements("ACOUSTIC_PROBLEM","HELMHOLTZ_INCIDENT_FE",helmholtz_elements.getLoopfeIncidentWave()); CHKERRQ(ierr); //Incident wave flux
384 
385 
386  if(useImpedance) {
387  ierr = mField.loop_finite_elements("ACOUSTIC_PROBLEM","HELMHOLTZ_IMPEDANCE_FE",helmholtz_elements.getLoopFeImpedanceLhs()); CHKERRQ(ierr);
388  }
389  /*above terms related to operators in HelmholtzElement.hpp */
390 
391 
392  //postproc
393  //Postprocess the Analytical Dirichlet BC
394 
395  ierr = mField.problem_basic_method_postProcess("ACOUSTIC_PROBLEM",analytical_ditihlet_bc1); CHKERRQ(ierr);
396  ierr = mField.problem_basic_method_postProcess("ACOUSTIC_PROBLEM",analytical_ditihlet_bc2); CHKERRQ(ierr);
397 
398  ierr = VecGhostUpdateBegin(F,ADD_VALUES,SCATTER_REVERSE); CHKERRQ(ierr);
399  ierr = VecGhostUpdateEnd(F,ADD_VALUES,SCATTER_REVERSE); CHKERRQ(ierr);
400  ierr = VecAssemblyBegin(F); CHKERRQ(ierr);
401  ierr = VecAssemblyEnd(F); CHKERRQ(ierr);
402  ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY); CHKERRQ(ierr);
403  ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY); CHKERRQ(ierr);
404  ierr = VecScale(F,-1); CHKERRQ(ierr);
405 
406  //Solver
407  KSP solver;
408  ierr = KSPCreate(PETSC_COMM_WORLD,&solver); CHKERRQ(ierr);
409  ierr = KSPSetOperators(solver,A,A); CHKERRQ(ierr);
410  ierr = KSPSetFromOptions(solver); CHKERRQ(ierr);
411  ierr = KSPSetUp(solver); CHKERRQ(ierr);
412 
413  ierr = KSPSolve(solver,F,T); CHKERRQ(ierr);
414  ierr = VecGhostUpdateBegin(T,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
415  ierr = VecGhostUpdateEnd(T,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
416 
417  ierr = mField.problem_basic_method_preProcess("ACOUSTIC_PROBLEM",analytical_ditihlet_bc1); CHKERRQ(ierr);
418  ierr = mField.problem_basic_method_preProcess("ACOUSTIC_PROBLEM",analytical_ditihlet_bc2); CHKERRQ(ierr);
419 
420  //Save data on mesh
421  ierr = mField.set_global_ghost_vector("ACOUSTIC_PROBLEM",ROW,T,INSERT_VALUES,SCATTER_REVERSE); CHKERRQ(ierr);
422 
423  ////Wait to putput the data in format
424  //PetscViewer viewer;
425  //ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD,"Acoustic_Impining_Sphere.txt",&viewer); CHKERRQ(ierr);
426  //VecView(T,viewer);
427  //ierr = PetscViewerDestroy(&viewer); CHKERRQ(ierr);
428 
429 
430 
431  //if(pcomm->rank()==0) {
432  rval = moab.write_file("impinging_finite_element.h5m"); CHKERR_PETSC(rval);
433  //}
434 
435  //destroy the KSP solvers
436  ierr = MatDestroy(&A); CHKERRQ(ierr);
437  ierr = VecDestroy(&F); CHKERRQ(ierr);
438  ierr = VecDestroy(&T); CHKERRQ(ierr);
439  ierr = KSPDestroy(&solver); CHKERRQ(ierr);
440 
441 
442  PostProcVolumeOnRefinedMesh post_proc1(mField);
443 
444  ierr = post_proc1.generateRefereneElemenMesh(); CHKERRQ(ierr);
445  ierr = post_proc1.addFieldValuesPostProc("rePRES"); CHKERRQ(ierr);
446  ierr = post_proc1.addFieldValuesPostProc("imPRES"); CHKERRQ(ierr);
447 
448  if(mField.check_field("reEX") && mField.check_field("imEX")) {
449 
450  ierr = post_proc1.addFieldValuesPostProc("reEX"); CHKERRQ(ierr);
451  ierr = post_proc1.addFieldValuesPostProc("imEX"); CHKERRQ(ierr);
452 
453  ierr = post_proc1.addFieldValuesPostProc("MESH_NODE_POSITIONS"); CHKERRQ(ierr);
454  ierr = mField.loop_finite_elements("ACOUSTIC_PROBLEM","HELMHOLTZ_FE",post_proc1); CHKERRQ(ierr);
455 
456  rval = post_proc1.postProcMesh.write_file("four_fields_finite_cylindrical.h5m","MOAB","PARALLEL=WRITE_PART"); CHKERR_PETSC(rval);
457 
458  ////output the results from Docker
459  //char command1[] = "mbconvert ./four_fields_finite_element.h5m ./four_fields_finite_element.vtk && cp ./four_fields_finite_element.vtk ../../../../../mnt/home/Desktop/U_pan/helmholtz_results/";
460  //int todo1 = system( command1 );
461 
462  } else {
463 
464  ierr = post_proc1.addFieldValuesPostProc("MESH_NODE_POSITIONS"); CHKERRQ(ierr);
465  ierr = mField.loop_finite_elements("ACOUSTIC_PROBLEM","HELMHOLTZ_FE",post_proc1); CHKERRQ(ierr);
466  rval = post_proc1.postProcMesh.write_file("cylindrical_acoustic_finite_element_out.h5m","MOAB","PARALLEL=WRITE_PART"); CHKERR_PETSC(rval);
467 
468  }
469 
470  /** get the time interval **/
471  ierr = PetscTime(&v2);CHKERRQ(ierr);
472  ierr = PetscGetCPUTime(&t2);CHKERRQ(ierr);
473  PetscSynchronizedPrintf(PETSC_COMM_WORLD,"Total Rank %d Time = %f S CPU Time = %f S \n",pcomm->rank(),v2-v1,t2-t1);
474 
475 
476 
477 
478  ierr = PetscFinalize(); CHKERRQ(ierr);
479 
480  return 0;
481 
482 }
const double T
struture grouping operators and data used for helmholtz problemsIn order to assemble matrices and rig...
Deprecated interface functions.
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
DEPRECATED MoFEMErrorCode set_global_ghost_vector(const Problem *problem_ptr, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
set values of vector from/to mesh database (collective)collective - need tu be run on all processors ...
CoreTmp< 0 > Core
Definition: Core.hpp:1129
Analytical Dirichlet boundary conditions.
#define BARRIER_RANK_END(PCMB)
Definition: definitions.h:351
virtual DEPRECATED MoFEMErrorCode build_problems(int verb=-1)=0
build problem data structures
#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(MESHSET_MANAGER, NAME, IT)
Iterator that loops over Cubit BlockSet having a particular name.
virtual MoFEMErrorCode add_field(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
char mesh_file_name[255]
Projection of edge entities with one mid-node on hierarchical basis.
static Index< 'n', 3 > n
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
DEPRECATED MoFEMErrorCode partition_finite_elements(const std::string &name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=-1)
partition finite elements
constexpr int order
double tol
static Index< 'i', 3 > i
#define BARRIER_RANK_START(PCMB)
Definition: definitions.h:328
CHKERRQ(ierr)
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:152
Post processing.
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
DEPRECATED MoFEMErrorCode partition_problem(const std::string &name, int verb=-1)
partition problem dofs (collective)
DEPRECATED MoFEMErrorCode VecCreateGhost(const std::string &name, RowColData rc, Vec *V) const
create ghost vector for problem (collective)collective - need to be run on all processors in communic...
virtual MoFEMErrorCode problem_basic_method_preProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
#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.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string &name_filed)=0
set finite element field data
const double R
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:292
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
DEPRECATED MoFEMErrorCode partition_ghost_dofs(const std::string &name, int verb=-1)
determine ghost nodes
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
static Index< 'k', 3 > k
virtual bool check_field(const std::string &name) const =0
check if field is in database
Core (interface) class.
Definition: Core.hpp:77
continuous field
Definition: definitions.h:177
DEPRECATED MoFEMErrorCode MatCreateMPIAIJWithArrays(const std::string &name, Mat *Aij, int verb=DEFAULT_VERBOSITY)
DEPRECATED MoFEMErrorCode seed_ref_level_3D(const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
seed 2D entities in the meshset and their adjacencies (only TETs adjacencies) in a particular BitRefL...
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
virtual MoFEMErrorCode problem_basic_method_postProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethodThis function set data about problem, adjacencies and other multi-indices in ...
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elementsBuild finite element data structures. Have to be run before problem and adjacenc...
DEPRECATED MoFEMErrorCode loop_finite_elements(const Problem *problem_ptr, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, MoFEMTypes bh, int verb=DEFAULT_VERBOSITY)
static char help[]

Variable Documentation

◆ help

char help[] = "...\n\n"
static

Definition at line 53 of file cylindrical_acoustic.cpp.