GRINS-0.8.0
vorticity_qoi.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 
26 #include "grins_config.h"
27 
28 #include <iostream>
29 
30 // GRINS
31 #include "grins/runner.h"
32 
33 //libMesh
34 #include "libmesh/exact_solution.h"
35 
36 int main(int argc, char* argv[])
37 {
38  GRINS::Runner grins(argc,argv);
39  grins.init();
40 
41  // Solve
42  grins.run();
43 
44  GRINS::Simulation & sim = grins.get_simulation();
45 
46  libMesh::Number qoi = sim.get_qoi_value( 0 );
47 
48  int return_flag = 0;
49  const libMesh::Number exact_value = -0.5;
50  const libMesh::Number rel_error = std::fabs( (qoi - exact_value )/exact_value );
51  const libMesh::Number tol = 1.0e-11;
52  if( rel_error > tol )
53  {
54  std::cerr << "Computed voriticity QoI mismatch greater than tolerance." << std::endl
55  << "Computed value = " << qoi << std::endl
56  << "Exact value = " << exact_value << std::endl
57  << "Relative error = " << rel_error << std::endl
58  << "Tolerance = " << tol << std::endl;
59  return_flag = 1;
60  }
61 
62  return return_flag;
63 }
void init()
Initialize the Simulation objects.
Definition: runner.C:53
int main(int argc, char *argv[])
Definition: vorticity_qoi.C:36
libMesh::Number get_qoi_value(unsigned int qoi_index) const
Definition: simulation.C:398
Class to encapsulate initializing and running GRINS Simulation.
Definition: runner.h:47
void run()
Runs the simulation that was setup at construction time.
Definition: runner.C:104
Simulation & get_simulation()
Definition: runner.h:66

Generated on Tue Dec 19 2017 12:47:29 for GRINS-0.8.0 by  doxygen 1.8.9.1