GRINS-0.6.0
Functions
elastic_sheet_regression.C File Reference
#include "grins_config.h"
#include <iostream>
#include "grins/simulation.h"
#include "grins/simulation_builder.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 (int argc, char *argv[], const GetPot &input)
 
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 122 of file 3d_low_mach_jacobians.C.

References GRINS::Constants::pi.

Referenced by main(), and run().

124 {
125  libMesh::Real value = 0.0;
126 
127  if( unknown_name == "T" )
128  value = params.get<libMesh::Real>("T_init");
129 
130  else if( unknown_name == "p0" )
131  value = params.get<libMesh::Real>("p0_init");
132 
133  else
134  value = 0.0;
135 
136  return value;
137 }
int main ( int  argc,
char *  argv[] 
)

Definition at line 49 of file elastic_sheet_regression.C.

References run().

50 {
51 #ifdef USE_GRVY_TIMERS
52  GRVY::GRVY_Timer_Class grvy_timer;
53  grvy_timer.Init("GRINS Timer");
54 #endif
55 
56  // Check command line count.
57  if( argc < 3 )
58  {
59  // TODO: Need more consistent error handling.
60  std::cerr << "Error: Must specify libMesh input file and exact solution file." << std::endl;
61  exit(1); // TODO: something more sophisticated for parallel runs?
62  }
63 
64  // libMesh input file should be first argument
65  std::string libMesh_input_filename = argv[1];
66 
67  // Create our GetPot object.
68  GetPot libMesh_inputfile( libMesh_input_filename );
69 
70  int return_flag = 0;
71 
72  return_flag = run( argc, argv, libMesh_inputfile );
73 
74  return return_flag;
75 }
int run(int argc, char *argv[], const GetPot &input)
int run ( int  argc,
char *  argv[],
const GetPot &  input 
)

Definition at line 77 of file elastic_sheet_regression.C.

References GRINS::Simulation::run().

Referenced by main().

78 {
79 #ifdef USE_GRVY_TIMERS
80  grvy_timer.BeginTimer("Initialize Solver");
81 #endif
82 
83  // Initialize libMesh library.
84  libMesh::LibMeshInit libmesh_init(argc, argv);
85 
86  GRINS::SimulationBuilder sim_builder;
87 
88  GRINS::Simulation grins( input,
89  sim_builder,
90  libmesh_init.comm() );
91 
92  grins.run();
93 
94  // Get equation systems to create ExactSolution object
95  std::tr1::shared_ptr<libMesh::EquationSystems>
96  es = grins.get_equation_system();
97 
98  //es->write("foobar.xdr");
99 
100  // Create Exact solution object and attach exact solution quantities
101  libMesh::ExactSolution exact_sol(*es);
102 
103  libMesh::EquationSystems es_ref( es->get_mesh() );
104 
105  // Filename of file where comparison solution is stashed
106  std::string solution_file = std::string(argv[2]);
107  es_ref.read( solution_file );
108 
109  exact_sol.attach_reference_solution( &es_ref );
110 
111  // Compute error and get it in various norms
112  exact_sol.compute_error("StretchedElasticSheet", "u");
113  exact_sol.compute_error("StretchedElasticSheet", "v");
114  exact_sol.compute_error("StretchedElasticSheet", "w");
115 
116  double u_l2error = exact_sol.l2_error("StretchedElasticSheet", "u");
117  double u_h1error = exact_sol.h1_error("StretchedElasticSheet", "u");
118 
119  double v_l2error = exact_sol.l2_error("StretchedElasticSheet", "v");
120  double v_h1error = exact_sol.h1_error("StretchedElasticSheet", "v");
121 
122  double w_l2error = exact_sol.l2_error("StretchedElasticSheet", "w");
123  double w_h1error = exact_sol.h1_error("StretchedElasticSheet", "w");
124 
125  int return_flag = 0;
126 
127  double tol = 5.0e-8;
128 
129  if( u_l2error > tol || u_h1error > tol ||
130  v_l2error > tol || v_h1error > tol ||
131  w_l2error > tol || w_h1error > tol )
132  {
133  return_flag = 1;
134 
135  std::cout << "Tolerance exceeded for thermally driven flow test." << std::endl
136  << "tolerance = " << tol << std::endl
137  << "u l2 error = " << u_l2error << std::endl
138  << "u h1 error = " << u_h1error << std::endl
139  << "v l2 error = " << v_l2error << std::endl
140  << "v h1 error = " << v_h1error << std::endl
141  << "w l2 error = " << w_l2error << std::endl
142  << "w h1 error = " << w_h1error << std::endl;
143  }
144 
145  return return_flag;
146 }

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