GRINS-0.8.0
Functions
elastic_sheet_regression.C File Reference
#include "grins_config.h"
#include <iostream>
#include "grins/runner.h"
#include "libmesh/parallel.h"
#include "libmesh/exact_solution.h"
Include dependency graph for elastic_sheet_regression.C:

Go to the source code of this file.

Functions

libMesh::Real initial_values (const libMesh::Point &p, const libMesh::Parameters &params, const std::string &system_name, const std::string &unknown_name)
 
int run (char *argv[], GRINS::Runner &grins)
 
int main (int argc, char *argv[])
 

Function Documentation

libMesh::Real initial_values ( const libMesh::Point &  p,
const libMesh::Parameters &  params,
const std::string &  system_name,
const std::string &  unknown_name 
)

Definition at line 77 of file 3d_low_mach_jacobians.C.

Referenced by main().

79 {
80  libMesh::Real value = 0.0;
81 
82  if( unknown_name == "T" )
83  value = params.get<libMesh::Real>("T_init");
84 
85  else if( unknown_name == "p0" )
86  value = params.get<libMesh::Real>("p0_init");
87 
88  else
89  value = 0.0;
90 
91  return value;
92 }
int main ( int  argc,
char *  argv[] 
)

Definition at line 43 of file elastic_sheet_regression.C.

References run().

44 {
45  // Check command line count.
46  if( argc < 3 )
47  {
48  // TODO: Need more consistent error handling.
49  std::cerr << "Error: Must specify libMesh input file and exact solution file." << std::endl;
50  exit(1); // TODO: something more sophisticated for parallel runs?
51  }
52 
53  GRINS::Runner grins(argc,argv);
54 
55  int return_flag = 0;
56 
57  return_flag = run( argv, grins );
58 
59  return return_flag;
60 }
int run(char *argv[], GRINS::Runner &grins)
Class to encapsulate initializing and running GRINS Simulation.
Definition: runner.h:47
int run ( char *  argv[],
GRINS::Runner grins 
)

Definition at line 62 of file elastic_sheet_regression.C.

References GRINS::Simulation::get_equation_system(), GRINS::Runner::get_simulation(), GRINS::Runner::init(), and GRINS::Runner::run().

Referenced by main().

63 {
64  grins.init();
65  grins.run();
66 
67  GRINS::Simulation & sim = grins.get_simulation();
68 
69  // Get equation systems to create ExactSolution object
70  GRINS::SharedPtr<libMesh::EquationSystems>
71  es = sim.get_equation_system();
72 
73  //es->write("foobar.xdr");
74 
75  // Create Exact solution object and attach exact solution quantities
76  libMesh::ExactSolution exact_sol(*es);
77 
78  libMesh::EquationSystems es_ref( es->get_mesh() );
79 
80  // Filename of file where comparison solution is stashed
81  std::string solution_file = std::string(argv[2]);
82  es_ref.read( solution_file );
83 
84  exact_sol.attach_reference_solution( &es_ref );
85 
86  // Compute error and get it in various norms
87  exact_sol.compute_error("StretchedElasticSheet", "u");
88  exact_sol.compute_error("StretchedElasticSheet", "v");
89  exact_sol.compute_error("StretchedElasticSheet", "w");
90 
91  double u_l2error = exact_sol.l2_error("StretchedElasticSheet", "u");
92  double u_h1error = exact_sol.h1_error("StretchedElasticSheet", "u");
93 
94  double v_l2error = exact_sol.l2_error("StretchedElasticSheet", "v");
95  double v_h1error = exact_sol.h1_error("StretchedElasticSheet", "v");
96 
97  double w_l2error = exact_sol.l2_error("StretchedElasticSheet", "w");
98  double w_h1error = exact_sol.h1_error("StretchedElasticSheet", "w");
99 
100  int return_flag = 0;
101 
102  double tol = 5.0e-8;
103 
104  if( u_l2error > tol || u_h1error > tol ||
105  v_l2error > tol || v_h1error > tol ||
106  w_l2error > tol || w_h1error > tol )
107  {
108  return_flag = 1;
109 
110  std::cout << "Tolerance exceeded for thermally driven flow test." << std::endl
111  << "tolerance = " << tol << std::endl
112  << "u l2 error = " << u_l2error << std::endl
113  << "u h1 error = " << u_h1error << std::endl
114  << "v l2 error = " << v_l2error << std::endl
115  << "v h1 error = " << v_h1error << std::endl
116  << "w l2 error = " << w_l2error << std::endl
117  << "w h1 error = " << w_h1error << std::endl;
118  }
119 
120  return return_flag;
121 }
void init()
Initialize the Simulation objects.
Definition: runner.C:53
SharedPtr< libMesh::EquationSystems > get_equation_system()
Definition: simulation.C:393
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