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().

{
// Create session reader.
session = LibUtilities::SessionReader::CreateInstance(argc, argv);
time_t starttime, endtime;
NekDouble CPUtime;
// Record start time.
time(&starttime);
// Create instance of module to solve the equation specified in the session.
try
{
session->GetSolverInfo("EQTYPE"), session);
}
catch (int e)
{
ASSERTL0(e == -1, "No such solver class defined.");
}
// Print a summary of solver and problem parameters and initialise the
// solver.
equ->PrintSummary(cout);
equ->DoInitialise();
// Solve the problem.
equ->DoSolve();
// Record end time.
time(&endtime);
CPUtime = (1.0/60.0/60.0)*difftime(endtime,starttime);
// Write output to .fld file
equ->Output();
// Evaluate and output computation time and solution accuracy.
// The specific format of the error output is essential for the
// regression tests to work.
cout << "-------------------------------------------" << endl;
cout << "Total Computation Time = " << CPUtime << " hr." << endl;
for(int i = 0; i < equ->GetNvariables(); ++i)
{
cout << "L 2 error (variable " << equ->GetVariable(i) << "): " << equ->L2Error(i,true) << endl;
cout << "L inf error (variable " << equ->GetVariable(i) << "): " << equ->LinfError(i) << endl;
}
session->Finalise();
}