Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
ShallowWaterSolver.cpp File Reference
#include <SolverUtils/EquationSystem.h>
#include <LibUtilities/BasicUtils/SessionReader.h>
Include dependency graph for ShallowWaterSolver.cpp:

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 42 of file ShallowWaterSolver.cpp.

References ASSERTL0, Nektar::LibUtilities::SessionReader::CreateInstance(), Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), and Nektar::SolverUtils::GetEquationSystemFactory().

43 {
44  // Create session reader.
46  session = LibUtilities::SessionReader::CreateInstance(argc, argv);
47 
48  time_t starttime, endtime;
49  NekDouble CPUtime;
51 
52  // Record start time.
53  time(&starttime);
54 
55  // Create instance of module to solve the equation specified in the session.
56  try
57  {
59  session->GetSolverInfo("EQTYPE"), session);
60  }
61  catch (int e)
62  {
63  ASSERTL0(e == -1, "No such solver class defined.");
64  }
65 
66  // Print a summary of solver and problem parameters and initialise the
67  // solver.
68  equ->PrintSummary(cout);
69  equ->DoInitialise();
70 
71  // Solve the problem.
72  equ->DoSolve();
73 
74  // Record end time.
75  time(&endtime);
76  CPUtime = (1.0/60.0/60.0)*difftime(endtime,starttime);
77 
78  // Write output to .fld file
79  equ->Output();
80 
81  // Evaluate and output computation time and solution accuracy.
82  // The specific format of the error output is essential for the
83  // regression tests to work.
84  cout << "-------------------------------------------" << endl;
85  cout << "Total Computation Time = " << CPUtime << " hr." << endl;
86 
87 
88  for(int i = 0; i < equ->GetNvariables(); ++i)
89  {
90  cout << "L 2 error (variable " << equ->GetVariable(i) << "): " << equ->L2Error(i,true) << endl;
91  cout << "L inf error (variable " << equ->GetVariable(i) << "): " << equ->LinfError(i) << endl;
92  }
93 
94  session->Finalise();
95 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
boost::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
double NekDouble
EquationSystemFactory & GetEquationSystemFactory()