25 #include "grins_config.h"
35 #include "libmesh/parallel.h"
36 #include "libmesh/exact_solution.h"
39 #ifdef GRINS_HAVE_GRVY
47 libMesh::Real
initial_values(
const libMesh::Point& p,
const libMesh::Parameters ¶ms,
48 const std::string& system_name,
const std::string& unknown_name );
50 int main(
int argc,
char* argv[])
52 #ifdef GRINS_USE_GRVY_TIMERS
53 GRVY::GRVY_Timer_Class grvy_timer;
54 grvy_timer.Init(
"GRINS Timer");
60 std::cerr <<
"Error: Must specify libMesh input file." << std::endl;
65 std::string libMesh_input_filename = argv[1];
68 GetPot libMesh_inputfile( libMesh_input_filename );
72 std::ifstream i(libMesh_input_filename.c_str());
75 std::cerr <<
"Error: Could not read from libMesh input file "
76 << libMesh_input_filename << std::endl;
82 libMesh::LibMeshInit libmesh_init(argc, argv);
84 libMesh::out <<
"Starting GRINS with command:\n";
85 for (
int i=0; i != argc; ++i)
86 libMesh::out << argv[i] <<
' ';
87 libMesh::out << std::endl;
93 libmesh_init.comm() );
95 std::string system_name = libMesh_inputfile(
"screen-options/system_name",
"GRINS" );
98 std::tr1::shared_ptr<libMesh::EquationSystems> es = grins.get_equation_system();
99 const libMesh::System& system = es->get_system(system_name);
101 libMesh::Parameters ¶ms = es->parameters;
110 libMesh::ExactSolution exact_sol(*es);
112 libMesh::EquationSystems es_ref( es->get_mesh() );
115 std::string solution_file = std::string(argv[2]);
116 es_ref.read( solution_file );
118 exact_sol.attach_reference_solution( &es_ref );
121 exact_sol.compute_error(system_name,
"u");
122 exact_sol.compute_error(system_name,
"v");
123 exact_sol.compute_error(system_name,
"w");
125 double u_l2error = exact_sol.l2_error(system_name,
"u");
126 double u_h1error = exact_sol.h1_error(system_name,
"u");
128 double v_l2error = exact_sol.l2_error(system_name,
"v");
129 double v_h1error = exact_sol.h1_error(system_name,
"v");
131 double w_l2error = exact_sol.l2_error(system_name,
"w");
132 double w_h1error = exact_sol.h1_error(system_name,
"w");
138 if( u_l2error > tol || u_h1error > tol ||
139 v_l2error > tol || v_h1error > tol ||
140 w_l2error > tol || w_h1error > tol )
144 std::cout <<
"Tolerance exceeded for suspended cable test." << std::endl
145 <<
"tolerance = " << tol << std::endl
146 <<
"u l2 error = " << u_l2error << std::endl
147 <<
"u h1 error = " << u_h1error << std::endl
148 <<
"v l2 error = " << v_l2error << std::endl
149 <<
"v h1 error = " << v_h1error << std::endl
150 <<
"w l2 error = " << w_l2error << std::endl
151 <<
"w h1 error = " << w_h1error << std::endl;
157 libMesh::Real
initial_values(
const libMesh::Point& p,
const libMesh::Parameters &,
158 const std::string& ,
const std::string& unknown_name )
160 libMesh::Real value = 0.0;
163 if( unknown_name ==
"u" )
167 else if( unknown_name ==
"w" )
libMesh::Real initial_values(const libMesh::Point &p, const libMesh::Parameters ¶ms, const std::string &system_name, const std::string &unknown_name)
int main(int argc, char *argv[])