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 (std::ostream &out=std::cout)
 Second-stage initialisation. More...
 
virtual SOLVER_UTILS_EXPORT void v_Execute (std::ostream &out=std::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 (std::ostream &out=std::cout)
 Initialise Object. More...
 
SOLVER_UTILS_EXPORT void Execute (std::ostream &out=std::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 52 of file DriverStandard.cpp.

53  : Driver(pSession)
54  {
55  }
Driver(const LibUtilities::SessionReaderSharedPtr pSession)
Initialises EquationSystem class members.
Definition: Driver.cpp:78
Nektar::SolverUtils::DriverStandard::~DriverStandard ( )
protectedvirtual

Destructor.

Definition at line 61 of file DriverStandard.cpp.

62  {
63  }

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 ( std::ostream &  out = std::cout)
protectedvirtual

Virtual function for solve implementation.

Implements Nektar::SolverUtils::Driver.

Definition at line 75 of file DriverStandard.cpp.

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

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

Second-stage initialisation.

Reimplemented from Nektar::SolverUtils::Driver.

Definition at line 69 of file DriverStandard.cpp.

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

70  {
72  }
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout)
Definition: Driver.cpp:92

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.