Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Attributes | Friends | List of all members
Nektar::SolverUtils::DriverStandard Class Reference

Base class for the development of solvers. More...

#include <DriverStandard.h>

Inheritance diagram for Nektar::SolverUtils::DriverStandard:
Inheritance graph
[legend]
Collaboration diagram for Nektar::SolverUtils::DriverStandard:
Collaboration graph
[legend]

Static Public Member Functions

static DriverSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className = GetDriverFactory().RegisterCreatorFunction("Standard", DriverStandard::create)
 Name of the class. More...
 

Protected Member Functions

SOLVER_UTILS_EXPORT DriverStandard (const LibUtilities::SessionReaderSharedPtr pSession)
 Constructor. More...
 
virtual SOLVER_UTILS_EXPORT ~DriverStandard ()
 Destructor. More...
 
virtual SOLVER_UTILS_EXPORT void v_InitObject (ostream &out=cout)
 Second-stage initialisation. More...
 
virtual SOLVER_UTILS_EXPORT void v_Execute (ostream &out=cout)
 Virtual function for solve implementation. More...
 
- Protected Member Functions inherited from Nektar::SolverUtils::Driver
 Driver (const LibUtilities::SessionReaderSharedPtr pSession)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT
Array< OneD, NekDouble
v_GetRealEvl (void)
 
virtual SOLVER_UTILS_EXPORT
Array< OneD, NekDouble
v_GetImagEvl (void)
 

Static Protected Attributes

static std::string driverLookupId = LibUtilities::SessionReader::RegisterEnumValue("Driver","Standard",0)
 
- Static Protected Attributes inherited from Nektar::SolverUtils::Driver
static std::string evolutionOperatorLookupIds []
 
static std::string evolutionOperatorDef
 
static std::string driverDefault
 

Friends

class MemoryManager< DriverStandard >
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::SolverUtils::Driver
virtual ~Driver ()
 Destructor. More...
 
SOLVER_UTILS_EXPORT void InitObject (ostream &out=cout)
 Initialise Object. More...
 
SOLVER_UTILS_EXPORT void Execute (ostream &out=cout)
 Execute driver. More...
 
SOLVER_UTILS_EXPORT Array
< OneD,
EquationSystemSharedPtr
GetEqu ()
 
SOLVER_UTILS_EXPORT Array
< OneD, NekDouble
GetRealEvl (void)
 
SOLVER_UTILS_EXPORT Array
< OneD, NekDouble
GetImagEvl (void)
 
- Protected Attributes inherited from Nektar::SolverUtils::Driver
LibUtilities::CommSharedPtr m_comm
 Communication object. More...
 
LibUtilities::SessionReaderSharedPtr m_session
 Session reader object. More...
 
LibUtilities::SessionReaderSharedPtr session_LinNS
 I the Coupling between SFD and arnoldi. More...
 
Array< OneD,
EquationSystemSharedPtr
m_equ
 Equation system to solve. More...
 
int m_nequ
 number of equations More...
 
enum EvolutionOperatorType m_EvolutionOperator
 Evolution Operator. More...
 

Detailed Description

Base class for the development of solvers.

Definition at line 46 of file DriverStandard.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::DriverStandard::DriverStandard ( const LibUtilities::SessionReaderSharedPtr  pSession)
protected

Constructor.

Definition at line 50 of file DriverStandard.cpp.

51  : Driver(pSession)
52  {
53  }
Driver(const LibUtilities::SessionReaderSharedPtr pSession)
Initialises EquationSystem class members.
Definition: Driver.cpp:76
Nektar::SolverUtils::DriverStandard::~DriverStandard ( )
protectedvirtual

Destructor.

Definition at line 59 of file DriverStandard.cpp.

60  {
61  }

Member Function Documentation

static DriverSharedPtr Nektar::SolverUtils::DriverStandard::create ( const LibUtilities::SessionReaderSharedPtr pSession)
inlinestatic

Creates an instance of this class.

Definition at line 52 of file DriverStandard.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

52  {
54  p->InitObject();
55  return p;
56  }
boost::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:52
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::SolverUtils::DriverStandard::v_Execute ( ostream &  out = cout)
protectedvirtual

Virtual function for solve implementation.

Implements Nektar::SolverUtils::Driver.

Definition at line 73 of file DriverStandard.cpp.

References Nektar::SolverUtils::Driver::m_comm, and Nektar::SolverUtils::Driver::m_equ.

75  {
76  time_t starttime, endtime;
77  NekDouble CPUtime;
78 
79  m_equ[0]->PrintSummary(out);
80 
81  time(&starttime);
82 
83  m_equ[0]->DoInitialise();
84  m_equ[0]->DoSolve();
85 
86  time(&endtime);
87 
88  m_equ[0]->Output();
89 
90  if (m_comm->GetRank() == 0)
91  {
92  CPUtime = difftime(endtime, starttime);
93  cout << "-------------------------------------------" << endl;
94  cout << "Total Computation Time = " << CPUtime << "s" << endl;
95  cout << "-------------------------------------------" << endl;
96  }
97 
98  // Evaluate and output computation time and solution accuracy.
99  // The specific format of the error output is essential for the
100  // regression tests to work.
101  // Evaluate L2 Error
102  for(int i = 0; i < m_equ[0]->GetNvariables(); ++i)
103  {
104  Array<OneD, NekDouble> exactsoln(m_equ[0]->GetTotPoints(), 0.0);
105 
106  // Evaluate "ExactSolution" function, or zero array
107  m_equ[0]->EvaluateExactSolution(i, exactsoln,
108  m_equ[0]->GetFinalTime());
109 
110  NekDouble vL2Error = m_equ[0]->L2Error (i, exactsoln);
111  NekDouble vLinfError = m_equ[0]->LinfError(i, exactsoln);
112 
113  if (m_comm->GetRank() == 0)
114  {
115  out << "L 2 error (variable " << m_equ[0]->GetVariable(i)
116  << ") : " << vL2Error << endl;
117  out << "L inf error (variable " << m_equ[0]->GetVariable(i)
118  << ") : " << vLinfError << endl;
119  }
120  }
121  }
double NekDouble
Array< OneD, EquationSystemSharedPtr > m_equ
Equation system to solve.
Definition: Driver.h:94
LibUtilities::CommSharedPtr m_comm
Communication object.
Definition: Driver.h:85
void Nektar::SolverUtils::DriverStandard::v_InitObject ( ostream &  out = cout)
protectedvirtual

Second-stage initialisation.

Reimplemented from Nektar::SolverUtils::Driver.

Definition at line 67 of file DriverStandard.cpp.

References Nektar::SolverUtils::Driver::v_InitObject().

68  {
70  }
virtual SOLVER_UTILS_EXPORT void v_InitObject(ostream &out=cout)
Definition: Driver.cpp:90

Friends And Related Function Documentation

friend class MemoryManager< DriverStandard >
friend

Definition at line 49 of file DriverStandard.h.

Member Data Documentation

string Nektar::SolverUtils::DriverStandard::className = GetDriverFactory().RegisterCreatorFunction("Standard", DriverStandard::create)
static

Name of the class.

Definition at line 59 of file DriverStandard.h.

string Nektar::SolverUtils::DriverStandard::driverLookupId = LibUtilities::SessionReader::RegisterEnumValue("Driver","Standard",0)
staticprotected

Definition at line 74 of file DriverStandard.h.