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...
 
SOLVER_UTILS_EXPORT ~DriverStandard () override=default
 Destructor. More...
 
SOLVER_UTILS_EXPORT void v_InitObject (std::ostream &out=std::cout) override
 Virtual function for initialisation implementation. More...
 
SOLVER_UTILS_EXPORT void v_Execute (std::ostream &out=std::cout) override
 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 void v_InitObject (std::ostream &out=std::cout)
 Virtual function for initialisation implementation. More...
 
virtual SOLVER_UTILS_EXPORT void v_Execute (std::ostream &out=std::cout)=0
 Virtual function for solve implementation. More...
 

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 ()=default
 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 ()
 
- 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
 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 43 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 52 of file DriverStandard.cpp.

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

◆ ~DriverStandard()

SOLVER_UTILS_EXPORT Nektar::SolverUtils::DriverStandard::~DriverStandard ( )
overrideprotecteddefault

Destructor.

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 49 of file DriverStandard.h.

52 {
55 p->InitObject();
56 return p;
57 }
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:52

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

◆ v_Execute()

void Nektar::SolverUtils::DriverStandard::v_Execute ( std::ostream &  out = std::cout)
overrideprotectedvirtual

Virtual function for solve implementation.

Implements Nektar::SolverUtils::Driver.

Definition at line 70 of file DriverStandard.cpp.

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

References Nektar::LibUtilities::Timer::Elapsed(), Nektar::SolverUtils::Driver::m_comm, Nektar::SolverUtils::Driver::m_equ, Nektar::LibUtilities::Timer::Start(), and Nektar::LibUtilities::Timer::Stop().

◆ v_InitObject()

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

Virtual function for initialisation implementation.

Reimplemented from Nektar::SolverUtils::Driver.

Definition at line 62 of file DriverStandard.cpp.

63{
65}
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout)
Virtual function for initialisation implementation.
Definition: Driver.cpp:84

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.
static DriverSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
DriverFactory & GetDriverFactory()
Definition: Driver.cpp:66

Name of the class.

Definition at line 60 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 78 of file DriverStandard.h.