GRINS-0.7.0
Functions
vorticity_qoi.C File Reference
#include "grins_config.h"
#include <iostream>
#include "grins/simulation.h"
#include "grins/simulation_builder.h"
#include "grins/multiphysics_sys.h"
#include "libmesh/exact_solution.h"
Include dependency graph for vorticity_qoi.C:

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 43 of file vorticity_qoi.C.

References GRINS::Simulation::run().

44 {
45 
46 #ifdef GRINS_USE_GRVY_TIMERS
47  GRVY::GRVY_Timer_Class grvy_timer;
48  grvy_timer.Init("GRINS Timer");
49 #endif
50 
51  // Check command line count.
52  if( argc < 2 )
53  {
54  // TODO: Need more consistent error handling.
55  std::cerr << "Error: Must specify libMesh input file." << std::endl;
56  exit(1); // TODO: something more sophisticated for iarallel runs?
57  }
58 
59  // libMesh input file should be first argument
60  std::string libMesh_input_filename = argv[1];
61 
62  // Create our GetPot object.
63  GetPot libMesh_inputfile( libMesh_input_filename );
64 
65 #ifdef GRINS_USE_GRVY_TIMERS
66  grvy_timer.BeginTimer("Initialize Solver");
67 #endif
68 
69  // Initialize libMesh library.
70  libMesh::LibMeshInit libmesh_init(argc, argv);
71 
72  GRINS::SimulationBuilder sim_builder;
73 
74  GRINS::Simulation grins( libMesh_inputfile,
75  sim_builder,
76  libmesh_init.comm() );
77 
78 #ifdef GRINS_USE_GRVY_TIMERS
79  grvy_timer.EndTimer("Initialize Solver");
80 
81  // Attach GRVY timer to solver
82  grins.attach_grvy_timer( &grvy_timer );
83 #endif
84 
85  // Solve
86  grins.run();
87 
88  libMesh::Number qoi = grins.get_qoi_value( 0 );
89 
90  int return_flag = 0;
91  const libMesh::Number exact_value = -0.5;
92  const libMesh::Number rel_error = std::fabs( (qoi - exact_value )/exact_value );
93  const libMesh::Number tol = 1.0e-11;
94  if( rel_error > tol )
95  {
96  std::cerr << "Computed voriticity QoI mismatch greater than tolerance." << std::endl
97  << "Computed value = " << qoi << std::endl
98  << "Exact value = " << exact_value << std::endl
99  << "Relative error = " << rel_error << std::endl
100  << "Tolerance = " << tol << std::endl;
101  return_flag = 1;
102  }
103 
104  return return_flag;
105 }

Generated on Thu Jun 2 2016 21:52:29 for GRINS-0.7.0 by  doxygen 1.8.10