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

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

#include <Driver.h>

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

Public Member Functions

virtual ~Driver ()
 Destructor.
SOLVER_UTILS_EXPORT void InitObject (ostream &out=cout)
 Initialise Object.
SOLVER_UTILS_EXPORT void Execute (ostream &out=cout)
 Execute driver.
SOLVER_UTILS_EXPORT Array
< OneD,
EquationSystemSharedPtr
GetEqu ()
SOLVER_UTILS_EXPORT Array
< OneD, NekDouble
GetRealEvl (void)
SOLVER_UTILS_EXPORT Array
< OneD, NekDouble
GetImagEvl (void)

Protected Member Functions

 Driver (const LibUtilities::SessionReaderSharedPtr pSession)
 Initialises EquationSystem class members.
virtual SOLVER_UTILS_EXPORT void v_InitObject (ostream &out=cout)
virtual SOLVER_UTILS_EXPORT void v_Execute (ostream &out=cout)=0
 Virtual function for solve implementation.
virtual SOLVER_UTILS_EXPORT
Array< OneD, NekDouble
v_GetRealEvl (void)
virtual SOLVER_UTILS_EXPORT
Array< OneD, NekDouble
v_GetImagEvl (void)

Protected Attributes

LibUtilities::CommSharedPtr m_comm
 Communication object.
LibUtilities::SessionReaderSharedPtr m_session
 Session reader object.
Array< OneD,
EquationSystemSharedPtr
m_equ
 Equation system to solve.
int m_nequ
 number of equations
enum EvolutionOperatorType m_EvolutionOperator
 Evolution Operator.

Static Protected Attributes

static std::string evolutionOperatorLookupIds []
static std::string evolutionOperatorDef = LibUtilities::SessionReader::RegisterDefaultSolverInfo("EvolutionOperator","Nonlinear")
static std::string driverDefault = LibUtilities::SessionReader::RegisterDefaultSolverInfo("Driver","Standard")

Detailed Description

Base class for the development of solvers.

Definition at line 65 of file Driver.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::Driver::~Driver ( )
virtual

Destructor.

Definition at line 70 of file Driver.cpp.

{
}
Nektar::SolverUtils::Driver::Driver ( const LibUtilities::SessionReaderSharedPtr  pSession)
protected

Initialises EquationSystem class members.

Definition at line 64 of file Driver.cpp.

: m_comm(pSession->GetComm()),
m_session(pSession)
{
}

Member Function Documentation

void Nektar::SolverUtils::Driver::Execute ( ostream &  out = cout)
inline

Execute driver.

Definition at line 123 of file Driver.h.

References v_Execute().

{
v_Execute(out);
}
Array< OneD, EquationSystemSharedPtr > Nektar::SolverUtils::Driver::GetEqu ( )
inline

Definition at line 128 of file Driver.h.

References m_equ.

{
return m_equ;
}
Array< OneD, NekDouble > Nektar::SolverUtils::Driver::GetImagEvl ( void  )
inline

Definition at line 138 of file Driver.h.

References v_GetImagEvl().

{
return v_GetImagEvl();
}
Array< OneD, NekDouble > Nektar::SolverUtils::Driver::GetRealEvl ( void  )
inline

Definition at line 133 of file Driver.h.

References v_GetRealEvl().

{
return v_GetRealEvl();
}
void Nektar::SolverUtils::Driver::InitObject ( ostream &  out = cout)
inline

Initialise Object.

Definition at line 118 of file Driver.h.

References v_InitObject().

{
}
virtual SOLVER_UTILS_EXPORT void Nektar::SolverUtils::Driver::v_Execute ( ostream &  out = cout)
protectedpure virtual
Array< OneD, NekDouble > Nektar::SolverUtils::Driver::v_GetImagEvl ( void  )
protectedvirtual

Reimplemented in Nektar::SolverUtils::DriverArnoldi.

Definition at line 150 of file Driver.cpp.

References ASSERTL0, and Nektar::NullNekDouble1DArray.

Referenced by GetImagEvl().

{
ASSERTL0(false,"This routine is not valid in this class");
}
Array< OneD, NekDouble > Nektar::SolverUtils::Driver::v_GetRealEvl ( void  )
protectedvirtual

Reimplemented in Nektar::SolverUtils::DriverArnoldi.

Definition at line 144 of file Driver.cpp.

References ASSERTL0, and Nektar::NullNekDouble1DArray.

Referenced by GetRealEvl().

{
ASSERTL0(false,"This routine is not valid in this class");
}
void Nektar::SolverUtils::Driver::v_InitObject ( ostream &  out = cout)
protectedvirtual
Todo:
At the moment this is Navier-Stokes specific - generalise?

Reimplemented in Nektar::SolverUtils::DriverSteadyState, Nektar::SolverUtils::DriverArnoldi, Nektar::SolverUtils::DriverArpack, Nektar::SolverUtils::DriverModifiedArnoldi, and Nektar::SolverUtils::DriverStandard.

Definition at line 79 of file Driver.cpp.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Nektar::SolverUtils::eAdjoint, Nektar::SolverUtils::eDirect, Nektar::SolverUtils::eNonlinear, Nektar::SolverUtils::eSkewSymmetric, Nektar::SolverUtils::eTransientGrowth, Nektar::SolverUtils::GetEquationSystemFactory(), m_equ, m_EvolutionOperator, m_nequ, and m_session.

Referenced by InitObject().

{
try
{
// Retrieve the equation system to solve.
ASSERTL0(m_session->DefinesSolverInfo("EqType"),
"EqType SolverInfo tag must be defined.");
std::string vEquation = m_session->GetSolverInfo("EqType");
if (m_session->DefinesSolverInfo("SolverType"))
{
vEquation = m_session->GetSolverInfo("SolverType");
}
// Check such a module exists for this equation.
ASSERTL0(GetEquationSystemFactory().ModuleExists(vEquation),
"EquationSystem '" + vEquation + "' is not defined.\n"
"Ensure equation name is correct and module is compiled.\n");
// Retrieve the type of evolution operator to use
/// @todo At the moment this is Navier-Stokes specific - generalise?
m_EvolutionOperator = m_session->GetSolverInfoAsEnum<EvolutionOperatorType>("EvolutionOperator");
m_equ = Array<OneD, EquationSystemSharedPtr>(m_nequ);
// Set the AdvectiveType tag and create EquationSystem objects.
{
case eNonlinear:
m_session->SetTag("AdvectiveType","Convective");
break;
case eDirect:
m_session->SetTag("AdvectiveType","Linearised");
break;
case eAdjoint:
m_session->SetTag("AdvectiveType","Adjoint");
break;
//forward timestepping
m_session->SetTag("AdvectiveType","Linearised");
//backward timestepping
m_session->SetTag("AdvectiveType","Adjoint");
break;
m_session->SetTag("AdvectiveType","SkewSymmetric");
break;
default:
ASSERTL0(false, "Unrecognised evolution operator.");
}
}
catch (int e)
{
ASSERTL0(e == -1, "No such class class defined.");
out << "An error occurred during driver initialisation." << endl;
}
}

Member Data Documentation

std::string Nektar::SolverUtils::Driver::driverDefault = LibUtilities::SessionReader::RegisterDefaultSolverInfo("Driver","Standard")
staticprotected

Definition at line 114 of file Driver.h.

std::string Nektar::SolverUtils::Driver::evolutionOperatorDef = LibUtilities::SessionReader::RegisterDefaultSolverInfo("EvolutionOperator","Nonlinear")
staticprotected

Definition at line 113 of file Driver.h.

std::string Nektar::SolverUtils::Driver::evolutionOperatorLookupIds
staticprotected
Initial value:
{
LibUtilities::SessionReader::RegisterEnumValue("EvolutionOperator","TransientGrowth",eTransientGrowth),
LibUtilities::SessionReader::RegisterEnumValue("EvolutionOperator","SkewSymmetric" ,eSkewSymmetric)
}

Definition at line 112 of file Driver.h.

LibUtilities::CommSharedPtr Nektar::SolverUtils::Driver::m_comm
protected
Array<OneD, EquationSystemSharedPtr> Nektar::SolverUtils::Driver::m_equ
protected
enum EvolutionOperatorType Nektar::SolverUtils::Driver::m_EvolutionOperator
protected
int Nektar::SolverUtils::Driver::m_nequ
protected
LibUtilities::SessionReaderSharedPtr Nektar::SolverUtils::Driver::m_session
protected