Nektar++
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:
[legend]

Static Public Member Functions

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

Static Public Attributes

static std::string className
 Name of the class. More...
 

Protected Member Functions

SOLVER_UTILS_EXPORT DriverStandard (const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
 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, const SpatialDomains::MeshGraphSharedPtr pGraph)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDoublev_GetRealEvl (void)
 
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDoublev_GetImagEvl (void)
 

Static Protected Attributes

static std::string driverLookupId
 
- 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, EquationSystemSharedPtrGetEqu ()
 
SOLVER_UTILS_EXPORT Array< OneD, NekDoubleGetRealEvl (void)
 
SOLVER_UTILS_EXPORT Array< OneD, NekDoubleGetImagEvl (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...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 MeshGraph object. More...
 
Array< OneD, EquationSystemSharedPtrm_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 45 of file DriverStandard.h.

Constructor & Destructor Documentation

◆ DriverStandard()

Nektar::SolverUtils::DriverStandard::DriverStandard ( const LibUtilities::SessionReaderSharedPtr  pSession,
const SpatialDomains::MeshGraphSharedPtr  pGraph 
)
protected

Constructor.

Definition at line 53 of file DriverStandard.cpp.

56  : Driver(pSession, pGraph)
57 {
58 }
Driver(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Initialises EquationSystem class members.
Definition: Driver.cpp:73

◆ ~DriverStandard()

Nektar::SolverUtils::DriverStandard::~DriverStandard ( )
protectedvirtual

Destructor.

Definition at line 63 of file DriverStandard.cpp.

64 {
65 }

Member Function Documentation

◆ create()

static DriverSharedPtr Nektar::SolverUtils::DriverStandard::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const SpatialDomains::MeshGraphSharedPtr pGraph 
)
inlinestatic

Creates an instance of this class.

Definition at line 51 of file DriverStandard.h.

54  {
57  p->InitObject();
58  return p;
59  }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:51

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and CellMLToNektar.cellml_metadata::p.

◆ v_Execute()

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.

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, m_equ[0]->GetFinalTime());
110 
111  NekDouble vL2Error = m_equ[0]->L2Error(i, exactsoln);
112  NekDouble vLinfError = m_equ[0]->LinfError(i, exactsoln);
113 
114  if (m_comm->GetRank() == 0)
115  {
116  out << "L 2 error (variable " << m_equ[0]->GetVariable(i)
117  << ") : " << vL2Error << endl;
118  out << "L inf error (variable " << m_equ[0]->GetVariable(i)
119  << ") : " << vLinfError << endl;
120  }
121  }
122 }
LibUtilities::CommSharedPtr m_comm
Communication object.
Definition: Driver.h:85
Array< OneD, EquationSystemSharedPtr > m_equ
Equation system to solve.
Definition: Driver.h:97
double NekDouble

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

◆ v_InitObject()

void Nektar::SolverUtils::DriverStandard::v_InitObject ( std::ostream &  out = std::cout)
protectedvirtual

Second-stage initialisation.

Reimplemented from Nektar::SolverUtils::Driver.

Definition at line 70 of file DriverStandard.cpp.

71 {
73 }
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout)
Definition: Driver.cpp:87

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

Friends And Related Function Documentation

◆ MemoryManager< DriverStandard >

friend class MemoryManager< DriverStandard >
friend

Definition at line 1 of file DriverStandard.h.

Member Data Documentation

◆ className

string Nektar::SolverUtils::DriverStandard::className
static
Initial value:
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:198
static DriverSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
DriverFactory & GetDriverFactory()
Definition: Driver.cpp:64

Name of the class.

Definition at line 62 of file DriverStandard.h.

◆ driverLookupId

string Nektar::SolverUtils::DriverStandard::driverLookupId
staticprotected
Initial value:
=
static std::string RegisterEnumValue(std::string pEnum, std::string pString, int pEnumValue)
Registers an enumeration value.

Definition at line 80 of file DriverStandard.h.