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.
LibUtilities::SessionReaderSharedPtr session_LinNS
 I the Coupling between SFD and arnoldi.
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
static std::string driverDefault

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 81 of file Driver.cpp.

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

Initialises EquationSystem class members.

Definition at line 75 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 126 of file Driver.h.

References v_Execute().

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

Definition at line 131 of file Driver.h.

References m_equ.

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

Definition at line 141 of file Driver.h.

References v_GetImagEvl().

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

Definition at line 136 of file Driver.h.

References v_GetRealEvl().

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

Initialise Object.

Definition at line 121 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 197 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 191 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 89 of file Driver.cpp.

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

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_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");
vEquation, m_session);
break;
case eDirect:
m_session->SetTag("AdvectiveType","Linearised");
vEquation, m_session);
break;
case eAdjoint:
m_session->SetTag("AdvectiveType","Adjoint");
vEquation, m_session);
break;
//forward timestepping
m_session->SetTag("AdvectiveType","Linearised");
vEquation, m_session);
//backward timestepping
m_session->SetTag("AdvectiveType","Adjoint");
vEquation, m_session);
break;
m_session->SetTag("AdvectiveType","SkewSymmetric");
vEquation, m_session);
break;
{
// Coupling SFD method and Arnoldi algorithm
// For having 2 equation systems defined into 2 different
// session files (with the mesh into a file named 'session'.gz)
string meshfile;
string LinNSCondFile;
vector<string> LinNSFilename;
meshfile = m_session->GetSessionName() + ".gz";
LinNSCondFile = m_session->GetSessionName();
LinNSCondFile += "_LinNS.xml";
LinNSFilename.push_back(meshfile);
LinNSFilename.push_back(LinNSCondFile);
0, NULL, LinNSFilename, m_session->GetComm());
//For running stability analysis
session_LinNS->SetTag("AdvectiveType","Linearised");
vEquation, session_LinNS);
//For running the SFD method on the nonlinear problem
m_session->SetTag("AdvectiveType","Convective");
vEquation, m_session);
}
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
staticprotected
Initial value:

Definition at line 117 of file Driver.h.

std::string Nektar::SolverUtils::Driver::evolutionOperatorDef
staticprotected
Initial value:
"EvolutionOperator","Nonlinear")

Definition at line 116 of file Driver.h.

std::string Nektar::SolverUtils::Driver::evolutionOperatorLookupIds
staticprotected
Initial value:
{
"EvolutionOperator","Nonlinear" ,eNonlinear),
"EvolutionOperator","Direct" ,eDirect),
"EvolutionOperator","Adjoint" ,eAdjoint),
"EvolutionOperator","TransientGrowth",eTransientGrowth),
"EvolutionOperator","SkewSymmetric" ,eSkewSymmetric),
"EvolutionOperator","AdaptiveSFD" ,eAdaptiveSFD)
}

Definition at line 115 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
LibUtilities::SessionReaderSharedPtr Nektar::SolverUtils::Driver::session_LinNS
protected

I the Coupling between SFD and arnoldi.

Definition at line 91 of file Driver.h.

Referenced by v_InitObject().