GRINS-0.6.0
Functions
test_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 "grins/parabolic_profile.h"
#include "libmesh/exact_solution.h"
Include dependency graph for test_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 44 of file test_vorticity_qoi.C.

References GRINS::Simulation::run().

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

Generated on Mon Jun 22 2015 21:32:21 for GRINS-0.6.0 by  doxygen 1.8.9.1