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

A base class for describing how to solve specific equations. More...

#include <EquationSystem.h>

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

Public Member Functions

virtual SOLVER_UTILS_EXPORT ~EquationSystem ()
 Destructor. More...
 
SOLVER_UTILS_EXPORT void SetUpTraceNormals (void)
 
SOLVER_UTILS_EXPORT void InitObject ()
 Initialises the members of this object. More...
 
SOLVER_UTILS_EXPORT void DoInitialise ()
 Perform any initialisation necessary before solving the problem. More...
 
SOLVER_UTILS_EXPORT void DoSolve ()
 Solve the problem. More...
 
SOLVER_UTILS_EXPORT void TransCoeffToPhys ()
 Transform from coefficient to physical space. More...
 
SOLVER_UTILS_EXPORT void TransPhysToCoeff ()
 Transform from physical to coefficient space. More...
 
SOLVER_UTILS_EXPORT void Output ()
 Perform output operations after solve. More...
 
SOLVER_UTILS_EXPORT NekDouble LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Linf error computation. More...
 
SOLVER_UTILS_EXPORT std::string GetSessionName ()
 Get Session name. More...
 
template<class T >
boost::shared_ptr< T > as ()
 
SOLVER_UTILS_EXPORT void ResetSessionName (std::string newname)
 Reset Session name. More...
 
SOLVER_UTILS_EXPORT
LibUtilities::SessionReaderSharedPtr 
GetSession ()
 Get Session name. More...
 
SOLVER_UTILS_EXPORT
MultiRegions::ExpListSharedPtr 
GetPressure ()
 Get pressure field if available. More...
 
SOLVER_UTILS_EXPORT void PrintSummary (std::ostream &out)
 Print a summary of parameters and solver characteristics. More...
 
SOLVER_UTILS_EXPORT void SetLambda (NekDouble lambda)
 Set parameter m_lambda. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
 Evaluates a function as specified in the session file. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (std::vector< std::string > pFieldNames, Array< OneD, Array< OneD, NekDouble > > &pFields, const std::string &pName, const NekDouble &pTime=0.0, const int domain=0)
 Populate given fields with the function from session. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (std::vector< std::string > pFieldNames, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const std::string &pName, const NekDouble &pTime=0.0, const int domain=0)
 Populate given fields with the function from session. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (std::string pFieldName, Array< OneD, NekDouble > &pArray, const std::string &pFunctionName, const NekDouble &pTime=0.0, const int domain=0)
 
SOLVER_UTILS_EXPORT std::string DescribeFunction (std::string pFieldName, const std::string &pFunctionName, const int domain)
 Provide a description of a function for a given field name. More...
 
SOLVER_UTILS_EXPORT void InitialiseBaseFlow (Array< OneD, Array< OneD, NekDouble > > &base)
 Perform initialisation of the base flow. More...
 
SOLVER_UTILS_EXPORT void SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 Initialise the data in the dependent fields. More...
 
SOLVER_UTILS_EXPORT void EvaluateExactSolution (int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 Evaluates an exact solution. More...
 
SOLVER_UTILS_EXPORT NekDouble L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised=false)
 Compute the L2 error between fields and a given exact solution. More...
 
SOLVER_UTILS_EXPORT NekDouble L2Error (unsigned int field, bool Normalised=false)
 Compute the L2 error of the fields. More...
 
SOLVER_UTILS_EXPORT Array
< OneD, NekDouble
ErrorExtraPoints (unsigned int field)
 Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf]. More...
 
SOLVER_UTILS_EXPORT void WeakAdvectionGreensDivergenceForm (const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
 Compute the inner product $ (\nabla \phi \cdot F) $. More...
 
SOLVER_UTILS_EXPORT void WeakAdvectionDivergenceForm (const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
 Compute the inner product $ (\phi, \nabla \cdot F) $. More...
 
SOLVER_UTILS_EXPORT void WeakAdvectionNonConservativeForm (const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, bool UseContCoeffs=false)
 Compute the inner product $ (\phi, V\cdot \nabla u) $. More...
 
f SOLVER_UTILS_EXPORT void AdvectionNonConservativeForm (const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wk=NullNekDouble1DArray)
 Compute the non-conservative advection. More...
 
SOLVER_UTILS_EXPORT void WeakDGAdvection (const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false, int nvariables=0)
 Calculate the weak discontinuous Galerkin advection. More...
 
SOLVER_UTILS_EXPORT void WeakDGDiffusion (const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false)
 Calculate weak DG Diffusion in the LDG form. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_Output (const int n)
 Write checkpoint file of m_fields. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_Output (const int n, MultiRegions::ExpListSharedPtr &field, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 Write checkpoint file of custom data fields. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow (const int n)
 Write base flow file of m_fields. More...
 
SOLVER_UTILS_EXPORT void WriteFld (const std::string &outname)
 Write field data to the given filename. More...
 
SOLVER_UTILS_EXPORT void WriteFld (const std::string &outname, MultiRegions::ExpListSharedPtr &field, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 Write input fields to the given filename. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
 Input field data from the given file. More...
 
SOLVER_UTILS_EXPORT void ImportFldToMultiDomains (const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const int ndomains)
 Input field data from the given file to multiple domains. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, std::vector< std::string > &fieldStr, Array< OneD, Array< OneD, NekDouble > > &coeffs)
 Output a field. Input field data into array from the given file. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, MultiRegions::ExpListSharedPtr &pField, std::string &pFieldName)
 Output a field. Input field data into ExpList from the given file. More...
 
SOLVER_UTILS_EXPORT void ScanForHistoryPoints ()
 Builds map of which element holds each history point. More...
 
SOLVER_UTILS_EXPORT void WriteHistoryData (std::ostream &out)
 Probe each history point and write to file. More...
 
SOLVER_UTILS_EXPORT void SessionSummary (SummaryList &vSummary)
 Write out a session summary. More...
 
SOLVER_UTILS_EXPORT Array
< OneD,
MultiRegions::ExpListSharedPtr > & 
UpdateFields ()
 
SOLVER_UTILS_EXPORT
LibUtilities::FieldMetaDataMap
UpdateFieldMetaDataMap ()
 Get hold of FieldInfoMap so it can be updated. More...
 
SOLVER_UTILS_EXPORT NekDouble GetFinalTime ()
 Return final time. More...
 
SOLVER_UTILS_EXPORT int GetNcoeffs ()
 
SOLVER_UTILS_EXPORT int GetNcoeffs (const int eid)
 
SOLVER_UTILS_EXPORT int GetNumExpModes ()
 
SOLVER_UTILS_EXPORT const
Array< OneD, int > 
GetNumExpModesPerExp ()
 
SOLVER_UTILS_EXPORT int GetNvariables ()
 
SOLVER_UTILS_EXPORT const
std::string 
GetVariable (unsigned int i)
 
SOLVER_UTILS_EXPORT int GetTraceTotPoints ()
 
SOLVER_UTILS_EXPORT int GetTraceNpoints ()
 
SOLVER_UTILS_EXPORT int GetExpSize ()
 
SOLVER_UTILS_EXPORT int GetPhys_Offset (int n)
 
SOLVER_UTILS_EXPORT int GetCoeff_Offset (int n)
 
SOLVER_UTILS_EXPORT int GetTotPoints ()
 
SOLVER_UTILS_EXPORT int GetTotPoints (int n)
 
SOLVER_UTILS_EXPORT int GetNpoints ()
 
SOLVER_UTILS_EXPORT int GetNumElmVelocity ()
 
SOLVER_UTILS_EXPORT int GetSteps ()
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep ()
 
SOLVER_UTILS_EXPORT void CopyFromPhysField (const int i, Array< OneD, NekDouble > &output)
 
SOLVER_UTILS_EXPORT void CopyToPhysField (const int i, Array< OneD, NekDouble > &output)
 
SOLVER_UTILS_EXPORT void SetSteps (const int steps)
 
SOLVER_UTILS_EXPORT void ZeroPhysFields ()
 
SOLVER_UTILS_EXPORT void FwdTransFields ()
 
SOLVER_UTILS_EXPORT void GetFluxVector (const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
 
SOLVER_UTILS_EXPORT void GetFluxVector (const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &fluxX, Array< OneD, Array< OneD, NekDouble > > &fluxY)
 
SOLVER_UTILS_EXPORT void GetFluxVector (const int i, const int j, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
 
SOLVER_UTILS_EXPORT void NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
 
SOLVER_UTILS_EXPORT void NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxX, Array< OneD, Array< OneD, NekDouble > > &numfluxY)
 
SOLVER_UTILS_EXPORT void NumFluxforScalar (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
 
SOLVER_UTILS_EXPORT void NumFluxforVector (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
 
SOLVER_UTILS_EXPORT void SetModifiedBasis (const bool modbasis)
 
SOLVER_UTILS_EXPORT int NoCaseStringCompare (const string &s1, const string &s2)
 Perform a case-insensitive string comparison. More...
 
SOLVER_UTILS_EXPORT int GetCheckpointNumber ()
 
SOLVER_UTILS_EXPORT void SetCheckpointNumber (int num)
 
SOLVER_UTILS_EXPORT int GetCheckpointSteps ()
 
SOLVER_UTILS_EXPORT void SetCheckpointSteps (int num)
 
SOLVER_UTILS_EXPORT void SetTime (const NekDouble time)
 
SOLVER_UTILS_EXPORT void SetInitialStep (const int step)
 
SOLVER_UTILS_EXPORT void SetBoundaryConditions (NekDouble time)
 Evaluates the boundary conditions at the given time. More...
 
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp ()
 Virtual function to identify if operator is negated in DoSolve. More...
 

Protected Types

enum  HomogeneousType { eHomogeneous1D, eHomogeneous2D, eHomogeneous3D, eNotHomogeneous }
 Parameter for homogeneous expansions. More...
 

Protected Member Functions

SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession)
 Initialises EquationSystem class members. More...
 
int nocase_cmp (const string &s1, const string &s2)
 
virtual SOLVER_UTILS_EXPORT void v_InitObject ()
 Initialisation object for EquationSystem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise ()
 Virtual function for initialisation implementation. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoSolve ()
 Virtual function for solve implementation. More...
 
virtual SOLVER_UTILS_EXPORT
NekDouble 
v_LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Virtual function for the L_inf error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT
NekDouble 
v_L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the L_2 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys ()
 Virtual function for transformation to physical space. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff ()
 Virtual function for transformation to coefficient space. More...
 
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &l)
 Virtual function for generating summary information. More...
 
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution (unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 
SOLVER_UTILS_EXPORT void SetUpBaseFields (SpatialDomains::MeshGraphSharedPtr &mesh)
 
SOLVER_UTILS_EXPORT void ImportFldBase (std::string pInfile, SpatialDomains::MeshGraphSharedPtr pGraph)
 
virtual SOLVER_UTILS_EXPORT void v_Output (void)
 
virtual SOLVER_UTILS_EXPORT
MultiRegions::ExpListSharedPtr 
v_GetPressure (void)
 
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 

Protected Attributes

LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader. More...
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output. More...
 
map< std::string, Array< OneD,
Array< OneD, float > > > 
m_interpWeights
 Map of the interpolation weights for a specific filename. More...
 
map< std::string, Array< OneD,
Array< OneD, unsigned int > > > 
m_interpInds
 Map of the interpolation indices for a specific filename. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_fields
 Array holding all dependent variables. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_base
 Base fields. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_derivedfields
 Array holding all dependent variables. More...
 
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
 Pointer to boundary conditions object. More...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Pointer to graph defining mesh. More...
 
std::string m_sessionName
 Name of the session. More...
 
NekDouble m_time
 Current time of simulation. More...
 
int m_initialStep
 Number of the step where the simulation should begin. More...
 
NekDouble m_fintime
 Finish time of the simulation. More...
 
NekDouble m_timestep
 Time step size. More...
 
NekDouble m_lambda
 Lambda constant in real system if one required. More...
 
std::set< std::string > m_loadedFields
 
NekDouble m_checktime
 Time between checkpoints. More...
 
int m_nchk
 Number of checkpoints written so far. More...
 
int m_steps
 Number of steps to take. More...
 
int m_checksteps
 Number of steps between checkpoints. More...
 
int m_spacedim
 Spatial dimension (>= expansion dim). More...
 
int m_expdim
 Expansion dimension. More...
 
bool m_singleMode
 Flag to determine if single homogeneous mode is used. More...
 
bool m_halfMode
 Flag to determine if half homogeneous mode is used. More...
 
bool m_multipleModes
 Flag to determine if use multiple homogenenous modes are used. More...
 
bool m_useFFT
 Flag to determine if FFT is used for homogeneous transform. More...
 
bool m_homogen_dealiasing
 Flag to determine if dealiasing is used for homogeneous simulations. More...
 
bool m_specHP_dealiasing
 Flag to determine if dealisising is usde for the Spectral/hp element discretisation. More...
 
enum MultiRegions::ProjectionType m_projectionType
 Type of projection; e.g continuous or discontinuous. More...
 
Array< OneD, Array< OneD,
NekDouble > > 
m_traceNormals
 Array holding trace normals for DG simulations in the forwards direction. More...
 
Array< OneD, Array< OneD,
Array< OneD, NekDouble > > > 
m_gradtan
 1 x nvariable x nq More...
 
Array< OneD, Array< OneD,
Array< OneD, NekDouble > > > 
m_tanbasis
 2 x m_spacedim x nq More...
 
Array< OneD, bool > m_checkIfSystemSingular
 Flag to indicate if the fields should be checked for singularity. More...
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 Map to identify relevant solver info to dump in output fields. More...
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error. More...
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous) More...
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous) More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
int m_HomoDirec
 number of homogenous directions More...
 
int m_NumMode
 Mode to use in case of single mode analysis. More...
 

Private Member Functions

virtual SOLVER_UTILS_EXPORT
Array< OneD, bool > 
v_GetSystemSingularChecks ()
 
virtual SOLVER_UTILS_EXPORT void v_GetFluxVector (const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
 
virtual SOLVER_UTILS_EXPORT void v_GetFluxVector (const int i, const int j, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
 
virtual SOLVER_UTILS_EXPORT void v_GetFluxVector (const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &fluxX, Array< OneD, Array< OneD, NekDouble > > &fluxY)
 
virtual SOLVER_UTILS_EXPORT void v_NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
 
virtual SOLVER_UTILS_EXPORT void v_NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxX, Array< OneD, Array< OneD, NekDouble > > &numfluxY)
 
virtual SOLVER_UTILS_EXPORT void v_NumFluxforScalar (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
 
virtual SOLVER_UTILS_EXPORT void v_NumFluxforVector (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
 
SOLVER_UTILS_EXPORT void PrintProgressbar (const int position, const int goal) const
 

Detailed Description

A base class for describing how to solve specific equations.

This class is a base class for all solver implementations. It provides the underlying generic functionality and interface for solving equations.

To solve a steady-state equation, create a derived class from this class and reimplement the virtual functions to provide custom implementation for the problem.

To solve unsteady problems, derive from the UnsteadySystem class instead which provides general time integration.

Definition at line 69 of file EquationSystem.h.

Member Enumeration Documentation

Parameter for homogeneous expansions.

Enumerator
eHomogeneous1D 
eHomogeneous2D 
eHomogeneous3D 
eNotHomogeneous 

Definition at line 530 of file EquationSystem.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::EquationSystem::~EquationSystem ( )
virtual

Destructor.

Destructor for class EquationSystem.

Definition at line 676 of file EquationSystem.cpp.

677  {
680  LibUtilities::NekManager<LocalRegions::MatrixKey,
682  }
NekMatrix< NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag >, BlockMatrixTag > DNekScalBlkMat
Definition: NekTypeDefs.hpp:66
Used to lookup the create function in NekManager.
Definition: MatrixKey.h:68
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
Nektar::SolverUtils::EquationSystem::EquationSystem ( const LibUtilities::SessionReaderSharedPtr pSession)
protected

Initialises EquationSystem class members.

This constructor is protected as the objects of this class are never instantiated directly.

Parameters
pSessionThe session reader holding problem parameters.

Definition at line 97 of file EquationSystem.cpp.

References m_fieldMetaDataMap, and m_session.

99  : m_comm (pSession->GetComm()),
100  m_session (pSession),
101  m_lambda (0),
103  {
104  // set up session names in fieldMetaDataMap
105  const vector<std::string> filenames = m_session->GetFilenames();
106 
107  for(int i = 0; i < filenames.size(); ++i)
108  {
109  string sessionname = "SessionName";
110  sessionname += boost::lexical_cast<std::string>(i);
111  m_fieldMetaDataMap[sessionname] = filenames[i];
112  }
113 
114  }
NekDouble m_lambda
Lambda constant in real system if one required.
LibUtilities::CommSharedPtr m_comm
Communicator.
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
static FieldMetaDataMap NullFieldMetaDataMap
Definition: FieldIO.h:54

Member Function Documentation

void Nektar::SolverUtils::EquationSystem::AdvectionNonConservativeForm ( const Array< OneD, Array< OneD, NekDouble > > &  V,
const Array< OneD, const NekDouble > &  u,
Array< OneD, NekDouble > &  outarray,
Array< OneD, NekDouble > &  wk = NullNekDouble1DArray 
)

Compute the non-conservative advection.

Calculate the inner product $ V\cdot \nabla u $

Parameters
VFields.
uFields.
outarrayStorage for result.
wkWorkspace.

Definition at line 1629 of file EquationSystem.cpp.

References ASSERTL0, m_fields, Vmath::Vmul(), and Vmath::Vvtvp().

Referenced by Nektar::CFLtester::DoOdeRhs(), Nektar::EigenValuesAdvection::v_DoSolve(), and WeakAdvectionNonConservativeForm().

1634  {
1635  // Use dimension of Velocity vector to dictate dimension of operation
1636  int ndim = V.num_elements();
1637  //int ndim = m_expdim;
1638 
1639  // ToDo: here we should add a check that V has right dimension
1640 
1641  int nPointsTot = m_fields[0]->GetNpoints();
1642  Array<OneD, NekDouble> grad0,grad1,grad2;
1643 
1644  // Check to see if wk space is defined
1645  if (wk.num_elements())
1646  {
1647  grad0 = wk;
1648  }
1649  else
1650  {
1651  grad0 = Array<OneD, NekDouble> (nPointsTot);
1652  }
1653 
1654  // Evaluate V\cdot Grad(u)
1655  switch(ndim)
1656  {
1657  case 1:
1658  m_fields[0]->PhysDeriv(u,grad0);
1659  Vmath::Vmul(nPointsTot, grad0, 1, V[0], 1, outarray,1);
1660  break;
1661  case 2:
1662  grad1 = Array<OneD, NekDouble> (nPointsTot);
1663  m_fields[0]->PhysDeriv(u, grad0, grad1);
1664  Vmath::Vmul (nPointsTot, grad0, 1, V[0], 1, outarray, 1);
1665  Vmath::Vvtvp(nPointsTot, grad1, 1, V[1], 1,
1666  outarray, 1, outarray, 1);
1667  break;
1668  case 3:
1669  grad1 = Array<OneD, NekDouble> (nPointsTot);
1670  grad2 = Array<OneD, NekDouble> (nPointsTot);
1671  m_fields[0]->PhysDeriv(u,grad0,grad1,grad2);
1672  Vmath::Vmul (nPointsTot, grad0, 1, V[0], 1, outarray, 1);
1673  Vmath::Vvtvp(nPointsTot, grad1, 1, V[1], 1,
1674  outarray, 1, outarray, 1);
1675  Vmath::Vvtvp(nPointsTot, grad2, 1, V[2], 1,
1676  outarray, 1, outarray, 1);
1677  break;
1678  default:
1679  ASSERTL0(false,"dimension unknown");
1680  }
1681  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:428
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
template<class T >
boost::shared_ptr<T> Nektar::SolverUtils::EquationSystem::as ( )
inline

Definition at line 106 of file EquationSystem.h.

References ASSERTL1.

107  {
108 #if defined __INTEL_COMPILER && BOOST_VERSION > 105200
109  typedef typename boost::shared_ptr<T>::element_type E;
110  E * p = dynamic_cast< E* >( shared_from_this().get() );
111  ASSERTL1(p, "Cannot perform cast");
112  return boost::shared_ptr<T>( shared_from_this(), p );
113 #else
114  return boost::dynamic_pointer_cast<T>( shared_from_this() );
115 #endif
116  }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Nektar::SolverUtils::EquationSystem::Checkpoint_BaseFlow ( const int  n)

Write base flow file of m_fields.

Write the n-th base flow into a .chk file

Parameters
nThe index of the base flow file.

Definition at line 1997 of file EquationSystem.cpp.

References m_sessionName, and WriteFld().

1998  {
1999  std::string outname = m_sessionName + "_BaseFlow_" +
2000  boost::lexical_cast<std::string>(n);
2001 
2002  WriteFld(outname + ".chk");
2003  }
std::string m_sessionName
Name of the session.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
void Nektar::SolverUtils::EquationSystem::Checkpoint_Output ( const int  n)

Write checkpoint file of m_fields.

Write the n-th checkpoint file.

Parameters
nThe index of the checkpoint file.

Definition at line 1969 of file EquationSystem.cpp.

References m_sessionName, and WriteFld().

Referenced by Nektar::SolverUtils::UnsteadySystem::v_DoSolve(), Nektar::CoupledLinearNS::v_DoSolve(), Nektar::NavierStokesCFE::v_SetInitialConditions(), Nektar::EulerCFE::v_SetInitialConditions(), Nektar::EulerADCFE::v_SetInitialConditions(), Nektar::NonlinearPeregrine::v_SetInitialConditions(), and v_SetInitialConditions().

1970  {
1971  std::string outname = m_sessionName + "_" +
1972  boost::lexical_cast<std::string>(n);
1973 
1974  WriteFld(outname + ".chk");
1975  }
std::string m_sessionName
Name of the session.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
void Nektar::SolverUtils::EquationSystem::Checkpoint_Output ( const int  n,
MultiRegions::ExpListSharedPtr field,
std::vector< Array< OneD, NekDouble > > &  fieldcoeffs,
std::vector< std::string > &  variables 
)

Write checkpoint file of custom data fields.

Write the n-th checkpoint file.

Parameters
nThe index of the checkpoint file.

Definition at line 1981 of file EquationSystem.cpp.

References m_sessionName, and WriteFld().

1986  {
1987  char chkout[16] = "";
1988  sprintf(chkout, "%d", n);
1989  std::string outname = m_sessionName + "_" + chkout + ".chk";
1990  WriteFld(outname, field, fieldcoeffs, variables);
1991  }
std::string m_sessionName
Name of the session.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
void Nektar::SolverUtils::EquationSystem::CopyFromPhysField ( const int  i,
Array< OneD, NekDouble > &  output 
)
inline

Definition at line 903 of file EquationSystem.h.

References m_fields, and Vmath::Vcopy().

905  {
906  Vmath::Vcopy(output.num_elements(), m_fields[i]->GetPhys(), 1, output, 1 );
907  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Nektar::SolverUtils::EquationSystem::CopyToPhysField ( const int  i,
Array< OneD, NekDouble > &  output 
)
inline

Definition at line 909 of file EquationSystem.h.

References m_fields, and Vmath::Vcopy().

911  {
912  Vmath::Vcopy(output.num_elements(), output, 1, m_fields[i]->UpdatePhys(), 1 );
913  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
std::string Nektar::SolverUtils::EquationSystem::DescribeFunction ( std::string  pFieldName,
const std::string &  pFunctionName,
const int  domain 
)

Provide a description of a function for a given field name.

Parameters
pFieldNameField name.
pFunctionNameFunction name.

Definition at line 948 of file EquationSystem.cpp.

References ASSERTL0, Nektar::LibUtilities::eFunctionTypeExpression, Nektar::LibUtilities::eFunctionTypeFile, and m_session.

Referenced by v_SetInitialConditions().

952  {
953  ASSERTL0(m_session->DefinesFunction(pFunctionName),
954  "Function '" + pFunctionName + "' does not exist.");
955 
956  std::string retVal;
958 
959  vType = m_session->GetFunctionType(pFunctionName, pFieldName);
961  {
963  = m_session->GetFunction(pFunctionName, pFieldName,domain);
964  retVal = ffunc->GetExpression();
965  }
966  else if (vType == LibUtilities::eFunctionTypeFile)
967  {
968  std::string filename
969  = m_session->GetFunctionFilename(pFunctionName, pFieldName,domain);
970  retVal = "from file " + filename;
971  }
972 
973  return retVal;
974  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
boost::shared_ptr< Equation > EquationSharedPtr
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
void Nektar::SolverUtils::EquationSystem::DoInitialise ( )
inline

Perform any initialisation necessary before solving the problem.

This allows initialisation of the solver which cannot be completed during object construction (such as setting of initial conditions).

Public interface routine to virtual function implementation.

Definition at line 683 of file EquationSystem.h.

References v_DoInitialise().

684  {
685  v_DoInitialise();
686  }
virtual SOLVER_UTILS_EXPORT void v_DoInitialise()
Virtual function for initialisation implementation.
void Nektar::SolverUtils::EquationSystem::DoSolve ( void  )
inline

Solve the problem.

Performs the actual solve.

Public interface routine to virtual function implementation.

Definition at line 715 of file EquationSystem.h.

References v_DoSolve().

716  {
717  v_DoSolve();
718  }
virtual SOLVER_UTILS_EXPORT void v_DoSolve()
Virtual function for solve implementation.
Array< OneD, NekDouble > Nektar::SolverUtils::EquationSystem::ErrorExtraPoints ( unsigned int  field)

Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf].

Compute the error in the L2-norm, L-inf for a larger number of quadrature points.

Parameters
fieldThe field to compare.
Returns
Error in the L2-norm and L-inf norm.

Definition at line 1108 of file EquationSystem.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eGaussRadauMAlpha1Beta0, Nektar::LibUtilities::eModified_A, Nektar::LibUtilities::eModified_B, GetNumExpModes(), m_fields, m_graph, m_NumQuadPointsError, m_session, and m_time.

Referenced by v_L2Error(), and v_LinfError().

1110  {
1111  int NumModes = GetNumExpModes();
1112  Array<OneD,NekDouble> L2INF(2);
1113 
1114  const LibUtilities::PointsKey PkeyT1(
1116  const LibUtilities::PointsKey PkeyT2(
1118  const LibUtilities::PointsKey PkeyQ1(
1120  const LibUtilities::PointsKey PkeyQ2(
1122  const LibUtilities::BasisKey BkeyT1(
1123  LibUtilities::eModified_A,NumModes, PkeyT1);
1124  const LibUtilities::BasisKey BkeyT2(
1125  LibUtilities::eModified_B, NumModes, PkeyT2);
1126  const LibUtilities::BasisKey BkeyQ1(
1127  LibUtilities::eModified_A, NumModes, PkeyQ1);
1128  const LibUtilities::BasisKey BkeyQ2(
1129  LibUtilities::eModified_A, NumModes, PkeyQ2);
1130 
1133  m_session, BkeyT1, BkeyT2, BkeyQ1, BkeyQ2, m_graph);
1134 
1135  int ErrorCoordim = ErrorExp->GetCoordim(0);
1136  int ErrorNq = ErrorExp->GetTotPoints();
1137 
1138  Array<OneD,NekDouble> ErrorXc0(ErrorNq, 0.0);
1139  Array<OneD,NekDouble> ErrorXc1(ErrorNq, 0.0);
1140  Array<OneD,NekDouble> ErrorXc2(ErrorNq, 0.0);
1141 
1142  switch(ErrorCoordim)
1143  {
1144  case 1:
1145  ErrorExp->GetCoords(ErrorXc0);
1146  break;
1147  case 2:
1148  ErrorExp->GetCoords(ErrorXc0, ErrorXc1);
1149  break;
1150  case 3:
1151  ErrorExp->GetCoords(ErrorXc0, ErrorXc1, ErrorXc2);
1152  break;
1153  }
1155  m_session->GetFunction("ExactSolution", field);
1156 
1157  // Evaluate the exact solution
1158  Array<OneD,NekDouble> ErrorSol(ErrorNq);
1159 
1160  exSol->Evaluate(ErrorXc0,ErrorXc1,ErrorXc2,m_time,ErrorSol);
1161 
1162  // Calcualte spectral/hp approximation on the quadrature points
1163  // of this new expansion basis
1164  ErrorExp->BwdTrans_IterPerExp(m_fields[field]->GetCoeffs(),
1165  ErrorExp->UpdatePhys());
1166 
1167  L2INF[0] = ErrorExp->L2 (ErrorExp->GetPhys(), ErrorSol);
1168  L2INF[1] = ErrorExp->Linf(ErrorExp->GetPhys(), ErrorSol);
1169 
1170  return L2INF;
1171  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
NekDouble m_time
Current time of simulation.
Principle Modified Functions .
Definition: BasisType.h:49
SOLVER_UTILS_EXPORT int GetNumExpModes()
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:57
Principle Modified Functions .
Definition: BasisType.h:50
Defines a specification for a set of points.
Definition: Points.h:58
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
Definition: ExpList2D.h:49
boost::shared_ptr< Equation > EquationSharedPtr
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
Describes the specification for a Basis.
Definition: Basis.h:50
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:50
void Nektar::SolverUtils::EquationSystem::EvaluateExactSolution ( int  field,
Array< OneD, NekDouble > &  outfield,
const NekDouble  time 
)
inline

Evaluates an exact solution.

Definition at line 794 of file EquationSystem.h.

References v_EvaluateExactSolution().

797  {
798  v_EvaluateExactSolution(field, outfield, time);
799  }
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
void Nektar::SolverUtils::EquationSystem::EvaluateFunction ( Array< OneD, Array< OneD, NekDouble > > &  pArray,
std::string  pFunctionName,
const NekDouble  pTime = 0.0,
const int  domain = 0 
)

Evaluates a function as specified in the session file.

Evaluates a physical function at each quadrature point in the domain.

Parameters
pArrayThe array into which to write the values.
pEqnThe equation to evaluate.

Definition at line 690 of file EquationSystem.cpp.

References ASSERTL0, and m_session.

Referenced by Nektar::CoupledLinearNS::DefineForcingTerm(), Nektar::ShallowWaterSystem::EvaluateCoriolis(), EvaluateFunction(), Nektar::ShallowWaterSystem::EvaluateWaterDepth(), InitialiseBaseFlow(), Nektar::APE::UpdateBasefield(), Nektar::APE::UpdateSourceTerms(), Nektar::SteadyAdvectionDiffusion::v_DoInitialise(), Nektar::CoupledLinearNS::v_DoInitialise(), Nektar::LinearElasticSystem::v_DoSolve(), v_EvaluateExactSolution(), Nektar::Poisson::v_InitObject(), Nektar::EigenValuesAdvection::v_InitObject(), Nektar::BidomainRoth::v_InitObject(), Nektar::Monodomain::v_InitObject(), Nektar::UnsteadyAdvection::v_InitObject(), Nektar::CFLtester::v_InitObject(), Nektar::UnsteadyAdvectionDiffusion::v_InitObject(), Nektar::PulseWaveSystem::v_InitObject(), Nektar::PulseWaveSystem::v_L2Error(), v_L2Error(), Nektar::PulseWaveSystem::v_LinfError(), v_LinfError(), and v_SetInitialConditions().

695  {
696  ASSERTL0(m_session->DefinesFunction(pFunctionName),
697  "Function '" + pFunctionName + "' does not exist.");
698 
699  std::vector<std::string> vFieldNames = m_session->GetVariables();
700 
701  for(int i = 0 ; i < vFieldNames.size(); i++)
702  {
703  EvaluateFunction(vFieldNames[i], pArray[i], pFunctionName,
704  pTime, domain);
705  }
706  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
void Nektar::SolverUtils::EquationSystem::EvaluateFunction ( std::vector< std::string >  pFieldNames,
Array< OneD, Array< OneD, NekDouble > > &  pFields,
const std::string &  pFunctionName,
const NekDouble pTime = 0.0,
const int  domain = 0 
)

Populate given fields with the function from session.

Populates a forcing function for each of the dependent variables using the expression provided by the BoundaryConditions object.

Parameters
forceArray of fields to assign forcing.

Definition at line 713 of file EquationSystem.cpp.

References ASSERTL0, ASSERTL1, EvaluateFunction(), and m_session.

719  {
720  ASSERTL1(pFieldNames.size() == pFields.num_elements(),
721  "Function '" + pFunctionName
722  + "' variable list size mismatch with array storage.");
723  ASSERTL0(m_session->DefinesFunction(pFunctionName),
724  "Function '" + pFunctionName + "' does not exist.");
725 
726  for(int i = 0; i < pFieldNames.size(); i++)
727  {
728  EvaluateFunction(pFieldNames[i], pFields[i], pFunctionName, pTime, domain);
729  }
730  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Nektar::SolverUtils::EquationSystem::EvaluateFunction ( std::vector< std::string >  pFieldNames,
Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields,
const std::string &  pFunctionName,
const NekDouble pTime = 0.0,
const int  domain = 0 
)

Populate given fields with the function from session.

Populates a function for each of the dependent variables using the expression or filenames provided by the SessionReader object.

Parameters
forceArray of fields to assign forcing.

Definition at line 737 of file EquationSystem.cpp.

References ASSERTL0, EvaluateFunction(), and m_session.

743  {
744  ASSERTL0(m_session->DefinesFunction(pFunctionName),
745  "Function '" + pFunctionName + "' does not exist.");
746  ASSERTL0(pFieldNames.size() == pFields.num_elements(),
747  "Field list / name list size mismatch.");
748 
749  for(int i = 0; i < pFieldNames.size(); i++)
750  {
751  EvaluateFunction(pFieldNames[i], pFields[i]->UpdatePhys(),
752  pFunctionName, pTime, domain);
753  pFields[i]->FwdTrans_IterPerExp(pFields[i]->GetPhys(),
754  pFields[i]->UpdateCoeffs());
755  }
756 
757  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
void Nektar::SolverUtils::EquationSystem::EvaluateFunction ( std::string  pFieldName,
Array< OneD, NekDouble > &  pArray,
const std::string &  pFunctionName,
const NekDouble pTime = 0.0,
const int  domain = 0 
)

Definition at line 760 of file EquationSystem.cpp.

References ASSERTL0, Nektar::LibUtilities::eFunctionTypeExpression, Nektar::LibUtilities::eFunctionTypeFile, Nektar::LibUtilities::eFunctionTypeTransientFile, GetNcoeffs(), Nektar::LibUtilities::PtsIO::Import(), m_fields, m_fld, m_interpInds, m_interpWeights, m_loadedFields, m_session, m_time, Nektar::LibUtilities::NullFieldMetaDataMap, PrintProgressbar(), and Vmath::Zero().

766  {
767  ASSERTL0(m_session->DefinesFunction(pFunctionName),
768  "Function '" + pFunctionName + "' does not exist.");
769 
770  unsigned int nq = m_fields[0]->GetNpoints();
771  if (pArray.num_elements() < nq)
772  {
773  pArray = Array<OneD, NekDouble>(nq);
774  }
775 
777  vType = m_session->GetFunctionType(pFunctionName, pFieldName,domain);
779  {
780  Array<OneD,NekDouble> x0(nq);
781  Array<OneD,NekDouble> x1(nq);
782  Array<OneD,NekDouble> x2(nq);
783 
784  // Get the coordinates (assuming all fields have the same
785  // discretisation)
786  m_fields[0]->GetCoords(x0,x1,x2);
788  = m_session->GetFunction(pFunctionName, pFieldName,domain);
789 
790  ffunc->Evaluate(x0,x1,x2,pTime,pArray);
791  }
792  else if (vType == LibUtilities::eFunctionTypeFile ||
794  {
795  // check if we already read this pFunctionName + pFieldName
796  // combination and stop processing if we are dealing with
797  // a non-timedependent file
798  std::string loadedKey = pFunctionName + pFieldName;
799  if (m_loadedFields.count(loadedKey) != 0 && vType == LibUtilities::eFunctionTypeFile)
800  {
801  return;
802  }
803  m_loadedFields.insert(loadedKey);
804 
805  std::string filename = m_session->GetFunctionFilename(
806  pFunctionName, pFieldName, domain);
807  std::string fileVar = m_session->GetFunctionFilenameVariable(
808  pFunctionName, pFieldName, domain);
809 
810  if (fileVar.length() == 0)
811  {
812  fileVar = pFieldName;
813  }
814 
815  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
816  std::vector<std::vector<NekDouble> > FieldData;
818  Vmath::Zero(vCoeffs.num_elements(),vCoeffs,1);
819 
820  int numexp = m_fields[0]->GetExpSize();
821  Array<OneD,int> ElementGIDs(numexp);
822 
823  // Define list of global element ids
824  for(int i = 0; i < numexp; ++i)
825  {
826  ElementGIDs[i] = m_fields[0]->GetExp(i)->GetGeom()->GetGlobalID();
827  }
828 
829  // In case of eFunctionTypeTransientFile, generate filename from
830  // format string
832  {
833  try
834  {
835 #ifdef _WIN32
836  // We need this to make sure boost::format has always
837  // two digits in the exponents of Scientific notation.
838  unsigned int old_exponent_format;
839  old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
840  filename = boost::str(boost::format(filename) % m_time);
841  _set_output_format(old_exponent_format);
842 #else
843  filename = boost::str(boost::format(filename) % m_time);
844 #endif
845  }
846  catch (...)
847  {
848  ASSERTL0(false, "Invalid Filename in function \""
849  + pFunctionName + "\", variable \"" + fileVar + "\"")
850  }
851  }
852 
853  if (boost::filesystem::path(filename).extension() != ".pts")
854  {
855  m_fld->Import(filename, FieldDef, FieldData,
857  ElementGIDs);
858 
859  int idx = -1;
860 
861  // Loop over all the expansions
862  for (int i = 0; i < FieldDef.size(); ++i)
863  {
864  // Find the index of the required field in the
865  // expansion segment
866  for (int j = 0; j < FieldDef[i]->m_fields.size(); ++j)
867  {
868  if (FieldDef[i]->m_fields[j] == fileVar)
869  {
870  idx = j;
871  }
872  }
873 
874  if (idx >= 0)
875  {
876  m_fields[0]->ExtractDataToCoeffs(
877  FieldDef[i], FieldData[i],
878  FieldDef[i]->m_fields[idx], vCoeffs);
879  }
880  else
881  {
882  cout << "Field " + fileVar + " not found." << endl;
883  }
884  }
885 
886  m_fields[0]->BwdTrans_IterPerExp(vCoeffs, pArray);
887  }
888  else
889  {
891  LibUtilities::PtsIO ptsIO(m_session->GetComm());
892  ptsIO.Import(filename, ptsField);
893 
895  coords[0] = Array<OneD, NekDouble>(nq);
896  coords[1] = Array<OneD, NekDouble>(nq);
897  coords[2] = Array<OneD, NekDouble>(nq);
898  m_fields[0]->GetCoords(coords[0], coords[1], coords[2]);
899 
900  // check if we already computed this funcKey combination
901  std::string weightsKey = m_session->GetFunctionFilename(pFunctionName, pFieldName, domain);
902  if (m_interpWeights.count(weightsKey) != 0)
903  {
904  // found, re-use
905  ptsField->SetWeights(m_interpWeights[weightsKey], m_interpInds[weightsKey]);
906  }
907  else
908  {
909  if (m_session->GetComm()->GetRank() == 0)
910  {
911  ptsField->setProgressCallback(&EquationSystem::PrintProgressbar, this);
912  cout << "Interpolating: ";
913  }
914  ptsField->CalcWeights(coords);
915  if (m_session->GetComm()->GetRank() == 0)
916  {
917  cout << endl;
918  }
919  ptsField->GetWeights(m_interpWeights[weightsKey], m_interpInds[weightsKey]);
920  }
921 
923  ptsField->Interpolate(intFields);
924 
925  int fieldInd;
926  vector<string> fieldNames = ptsField->GetFieldNames();
927  for (fieldInd = 0; fieldInd < fieldNames.size(); ++fieldInd)
928  {
929  if (ptsField->GetFieldName(fieldInd) == pFieldName)
930  {
931  break;
932  }
933  }
934  ASSERTL0(fieldInd != fieldNames.size(), "field not found");
935 
936  pArray = intFields[fieldInd];
937  }
938  }
939  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
NekDouble m_time
Current time of simulation.
map< std::string, Array< OneD, Array< OneD, unsigned int > > > m_interpInds
Map of the interpolation indices for a specific filename.
SOLVER_UTILS_EXPORT void PrintProgressbar(const int position, const int goal) const
boost::shared_ptr< PtsField > PtsFieldSharedPtr
Definition: PtsField.h:263
std::set< std::string > m_loadedFields
void Import(const string &inFile, PtsFieldSharedPtr &ptsField, FieldMetaDataMap &fieldmetadatamap=NullFieldMetaDataMap)
Import a pts field from file.
Definition: PtsIO.cpp:117
boost::shared_ptr< Equation > EquationSharedPtr
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetNcoeffs()
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
static FieldMetaDataMap NullFieldMetaDataMap
Definition: FieldIO.h:54
map< std::string, Array< OneD, Array< OneD, float > > > m_interpWeights
Map of the interpolation weights for a specific filename.
void Nektar::SolverUtils::EquationSystem::FwdTransFields ( void  )

FwdTrans the m_fields members

Definition at line 1535 of file EquationSystem.cpp.

References m_fields.

1536  {
1537  for (int i = 0; i < m_fields.num_elements(); i++)
1538  {
1539  m_fields[i]->FwdTrans(m_fields[i]->GetPhys(),
1540  m_fields[i]->UpdateCoeffs());
1541  m_fields[i]->SetPhysState(false);
1542  }
1543  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int Nektar::SolverUtils::EquationSystem::GetCheckpointNumber ( )
inline

Definition at line 410 of file EquationSystem.h.

References m_nchk.

411  {
412  return m_nchk;
413  }
int m_nchk
Number of checkpoints written so far.
SOLVER_UTILS_EXPORT int Nektar::SolverUtils::EquationSystem::GetCheckpointSteps ( )
inline

Definition at line 420 of file EquationSystem.h.

References m_checksteps.

421  {
422  return m_checksteps;
423  }
int m_checksteps
Number of steps between checkpoints.
int Nektar::SolverUtils::EquationSystem::GetCoeff_Offset ( int  n)
inline

Definition at line 863 of file EquationSystem.h.

References m_fields.

864  {
865  return m_fields[0]->GetCoeff_Offset(n);
866  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
int Nektar::SolverUtils::EquationSystem::GetExpSize ( void  )
inline
NekDouble Nektar::SolverUtils::EquationSystem::GetFinalTime ( )
inline

Return final time.

Definition at line 807 of file EquationSystem.h.

References m_time.

808  {
809  return m_time;
810  }
NekDouble m_time
Current time of simulation.
void Nektar::SolverUtils::EquationSystem::GetFluxVector ( const int  i,
Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  flux 
)
inline

Definition at line 915 of file EquationSystem.h.

References v_GetFluxVector().

Referenced by WeakDGAdvection(), and WeakDGDiffusion().

918  {
919  v_GetFluxVector(i,physfield, flux);
920  }
virtual SOLVER_UTILS_EXPORT void v_GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
void Nektar::SolverUtils::EquationSystem::GetFluxVector ( const int  i,
Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  fluxX,
Array< OneD, Array< OneD, NekDouble > > &  fluxY 
)
inline

Definition at line 922 of file EquationSystem.h.

References v_GetFluxVector().

926  {
927  v_GetFluxVector(i,physfield, fluxX, fluxY);
928  }
virtual SOLVER_UTILS_EXPORT void v_GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
void Nektar::SolverUtils::EquationSystem::GetFluxVector ( const int  i,
const int  j,
Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  flux 
)
inline

Definition at line 930 of file EquationSystem.h.

References v_GetFluxVector().

933  {
934  v_GetFluxVector(i,j,physfield,flux);
935  }
virtual SOLVER_UTILS_EXPORT void v_GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
int Nektar::SolverUtils::EquationSystem::GetNcoeffs ( void  )
inline
int Nektar::SolverUtils::EquationSystem::GetNcoeffs ( const int  eid)
inline

Definition at line 817 of file EquationSystem.h.

References m_fields.

818  {
819  return m_fields[0]->GetNcoeffs(eid);
820  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
int Nektar::SolverUtils::EquationSystem::GetNpoints ( void  )
inline

Definition at line 878 of file EquationSystem.h.

References m_fields.

Referenced by Nektar::ImageWarpingSystem::DoOdeProjection(), Nektar::NonlinearSWE::DoOdeProjection(), Nektar::LinearSWE::DoOdeProjection(), Nektar::UnsteadyInviscidBurger::DoOdeProjection(), Nektar::UnsteadyDiffusion::DoOdeProjection(), Nektar::NavierStokesCFE::DoOdeProjection(), Nektar::EulerCFE::DoOdeProjection(), Nektar::EulerADCFE::DoOdeProjection(), Nektar::UnsteadyAdvection::DoOdeProjection(), Nektar::NonlinearPeregrine::DoOdeProjection(), Nektar::UnsteadyAdvectionDiffusion::DoOdeProjection(), Nektar::CFLtester::DoOdeProjection(), Nektar::UnsteadyViscousBurgers::DoOdeProjection(), Nektar::ImageWarpingSystem::DoOdeRhs(), Nektar::UnsteadyInviscidBurger::DoOdeRhs(), Nektar::NavierStokesCFE::DoOdeRhs(), Nektar::EulerCFE::DoOdeRhs(), Nektar::UnsteadyAdvection::DoOdeRhs(), Nektar::EulerADCFE::DoOdeRhs(), Nektar::UnsteadyAdvectionDiffusion::DoOdeRhs(), Nektar::CFLtester::DoOdeRhs(), Nektar::UnsteadyViscousBurgers::DoOdeRhs(), Nektar::UnsteadyInviscidBurger::GetFluxVector(), Nektar::UnsteadyDiffusion::GetFluxVector(), Nektar::UnsteadyAdvectionDiffusion::GetFluxVectorDiff(), Nektar::UnsteadyViscousBurgers::GetFluxVectorDiff(), Nektar::UnsteadyInviscidBurger::GetNormalVelocity(), Nektar::SolverUtils::UnsteadySystem::v_AppendOutput1D(), Nektar::EigenValuesAdvection::v_DoSolve(), Nektar::LinearElasticSystem::v_DoSolve(), Nektar::EigenValuesAdvection::v_GetFluxVector(), Nektar::ImageWarpingSystem::v_GetFluxVector(), Nektar::CFLtester::v_GetFluxVector(), Nektar::IncNavierStokes::v_GetFluxVector(), Nektar::PulseWaveSystem::v_L2Error(), v_L2Error(), Nektar::PulseWaveSystem::v_LinfError(), v_LinfError(), WeakDGAdvection(), WeakDGDiffusion(), and ZeroPhysFields().

879  {
880  return m_fields[0]->GetNpoints();
881  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
int Nektar::SolverUtils::EquationSystem::GetNumElmVelocity ( void  )
inline

Definition at line 883 of file EquationSystem.h.

References m_fields.

884  {
885  return (m_fields.num_elements() - 1);
886  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
int Nektar::SolverUtils::EquationSystem::GetNumExpModes ( void  )
inline

Definition at line 822 of file EquationSystem.h.

References m_graph.

Referenced by ErrorExtraPoints().

823  {
824  return m_graph->GetExpansions().begin()->second->m_basisKeyVector[0]
825  .GetNumModes();
826  }
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
const Array< OneD, int > Nektar::SolverUtils::EquationSystem::GetNumExpModesPerExp ( void  )
inline

Definition at line 828 of file EquationSystem.h.

References m_fields.

Referenced by Nektar::EulerADCFE::DoOdeRhs(), and Nektar::IncNavierStokes::GetElmtCFLVals().

829  {
830  return m_fields[0]->EvalBasisNumModesMaxPerExp();
831  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
int Nektar::SolverUtils::EquationSystem::GetNvariables ( void  )
inline

Definition at line 833 of file EquationSystem.h.

References m_session.

Referenced by ImportFldToMultiDomains().

834  {
835  return m_session->GetVariables().size();
836  }
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
int Nektar::SolverUtils::EquationSystem::GetPhys_Offset ( int  n)
inline
MultiRegions::ExpListSharedPtr Nektar::SolverUtils::EquationSystem::GetPressure ( void  )
inline

Get pressure field if available.

Get Pressure field if available

Definition at line 750 of file EquationSystem.h.

References v_GetPressure().

Referenced by Nektar::NavierStokesCFE::DoOdeRhs(), Nektar::EulerADCFE::DoOdeRhs(), Nektar::CompressibleFlowSystem::GetFluxVector(), Nektar::CompressibleFlowSystem::GetFluxVectorDeAlias(), Nektar::CompressibleFlowSystem::GetViscousFluxVectorDeAlias(), and Nektar::CompressibleFlowSystem::v_InitObject().

751  {
752  return v_GetPressure();
753  }
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure(void)
SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr Nektar::SolverUtils::EquationSystem::GetSession ( )
inline

Get Session name.

Definition at line 125 of file EquationSystem.h.

References m_session.

126  {
127  return m_session;
128  }
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT std::string Nektar::SolverUtils::EquationSystem::GetSessionName ( )
inline

Get Session name.

Definition at line 100 of file EquationSystem.h.

References m_sessionName.

101  {
102  return m_sessionName;
103  }
std::string m_sessionName
Name of the session.
int Nektar::SolverUtils::EquationSystem::GetSteps ( void  )
inline

Definition at line 888 of file EquationSystem.h.

References m_steps.

889  {
890  return m_steps;
891  }
int m_steps
Number of steps to take.
NekDouble Nektar::SolverUtils::EquationSystem::GetTimeStep ( void  )
inline

Definition at line 893 of file EquationSystem.h.

References m_timestep.

Referenced by Nektar::SolverUtils::UnsteadySystem::v_DoSolve().

894  {
895  return m_timestep;
896  }
NekDouble m_timestep
Time step size.
int Nektar::SolverUtils::EquationSystem::GetTotPoints ( void  )
inline

Definition at line 868 of file EquationSystem.h.

References m_fields.

Referenced by Nektar::NonlinearSWE::AddCoriolis(), Nektar::LinearSWE::AddCoriolis(), Nektar::NonlinearPeregrine::AddCoriolis(), Nektar::APE::AddSource(), Nektar::NonlinearSWE::AddVariableDepth(), Nektar::NonlinearPeregrine::AddVariableDepth(), Nektar::NonlinearSWE::ConservativeToPrimitive(), Nektar::LinearSWE::ConservativeToPrimitive(), Nektar::NonlinearPeregrine::ConservativeToPrimitive(), Nektar::NonlinearSWE::DoOdeRhs(), Nektar::LinearSWE::DoOdeRhs(), Nektar::APE::DoOdeRhs(), Nektar::NonlinearPeregrine::DoOdeRhs(), Nektar::EulerCFE::GetExactIsentropicVortex(), Nektar::EulerCFE::GetExactRinglebFlow(), Nektar::CFLtester::GetStdVelocity(), Nektar::NonlinearPeregrine::LaitoneSolitaryWave(), Nektar::NonlinearSWE::PrimitiveToConservative(), Nektar::LinearSWE::PrimitiveToConservative(), Nektar::NonlinearPeregrine::PrimitiveToConservative(), Nektar::EulerCFE::SetInitialIsentropicVortex(), Nektar::CoupledLinearNS::SetUpCoupledMatrix(), Nektar::NonlinearSWE::v_ConservativeToPrimitive(), Nektar::LinearSWE::v_ConservativeToPrimitive(), Nektar::NonlinearPeregrine::v_ConservativeToPrimitive(), Nektar::APE::v_InitObject(), Nektar::ShallowWaterSystem::v_InitObject(), Nektar::NonlinearSWE::v_PrimitiveToConservative(), Nektar::LinearSWE::v_PrimitiveToConservative(), Nektar::NonlinearPeregrine::v_PrimitiveToConservative(), and Nektar::NonlinearPeregrine::WCESolve().

869  {
870  return m_fields[0]->GetNpoints();
871  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
int Nektar::SolverUtils::EquationSystem::GetTotPoints ( int  n)
inline

Definition at line 873 of file EquationSystem.h.

References m_fields.

874  {
875  return m_fields[0]->GetTotPoints(n);
876  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
int Nektar::SolverUtils::EquationSystem::GetTraceNpoints ( void  )
inline
int Nektar::SolverUtils::EquationSystem::GetTraceTotPoints ( void  )
inline
const std::string Nektar::SolverUtils::EquationSystem::GetVariable ( unsigned int  i)
inline

Definition at line 838 of file EquationSystem.h.

References m_session.

839  {
840  return m_session->GetVariable(i);
841  }
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
void Nektar::SolverUtils::EquationSystem::ImportFld ( const std::string &  infile,
Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields 
)

Input field data from the given file.

Import field from infile and load into m_fields. This routine will also perform a BwdTrans to ensure data is in both the physical and coefficient storage.

Parameters
infileFilename to read.

Definition at line 2093 of file EquationSystem.cpp.

References ASSERTL1, GetNcoeffs(), m_fields, m_fld, m_session, and Vmath::Zero().

2096  {
2097  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2098  std::vector<std::vector<NekDouble> > FieldData;
2099 
2100  m_fld->Import(infile,FieldDef,FieldData);
2101 
2102  // Copy FieldData into m_fields
2103  for(int j = 0; j < pFields.num_elements(); ++j)
2104  {
2105  Vmath::Zero(pFields[j]->GetNcoeffs(),
2106  pFields[j]->UpdateCoeffs(),1);
2107 
2108  for(int i = 0; i < FieldDef.size(); ++i)
2109  {
2110  ASSERTL1(FieldDef[i]->m_fields[j] ==
2111  m_session->GetVariable(j),
2112  std::string("Order of ") + infile
2113  + std::string(" data and that defined in "
2114  "m_boundaryconditions differs"));
2115 
2116  pFields[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
2117  FieldDef[i]->m_fields[j],
2118  pFields[j]->UpdateCoeffs());
2119  }
2120  pFields[j]->BwdTrans(pFields[j]->GetCoeffs(),
2121  pFields[j]->UpdatePhys());
2122  }
2123  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetNcoeffs()
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Nektar::SolverUtils::EquationSystem::ImportFld ( const std::string &  infile,
std::vector< std::string > &  fieldStr,
Array< OneD, Array< OneD, NekDouble > > &  coeffs 
)

Output a field. Input field data into array from the given file.

Import field from infile and load into the array coeffs.

Parameters
infileFilename to read.
fieldStran array of string identifying fields to be imported
coeffsand array of array of coefficients to store imported data

Definition at line 2216 of file EquationSystem.cpp.

References ASSERTL0, m_fields, m_fld, and Vmath::Zero().

2220  {
2221 
2222  ASSERTL0(fieldStr.size() <= coeffs.num_elements(),
2223  "length of fieldstr should be the same as pFields");
2224 
2225  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2226  std::vector<std::vector<NekDouble> > FieldData;
2227 
2228  m_fld->Import(infile,FieldDef,FieldData);
2229 
2230  // Copy FieldData into m_fields
2231  for(int j = 0; j < fieldStr.size(); ++j)
2232  {
2233  Vmath::Zero(coeffs[j].num_elements(),coeffs[j],1);
2234  for(int i = 0; i < FieldDef.size(); ++i)
2235  {
2236  m_fields[0]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
2237  fieldStr[j], coeffs[j]);
2238  }
2239  }
2240  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
void Nektar::SolverUtils::EquationSystem::ImportFld ( const std::string &  infile,
MultiRegions::ExpListSharedPtr pField,
std::string &  pFieldName 
)

Output a field. Input field data into ExpList from the given file.

Import field from infile and load into pField. This routine will also perform a BwdTrans to ensure data is in both the physical and coefficient storage.

Definition at line 2177 of file EquationSystem.cpp.

References ASSERTL1, m_fields, m_fld, and Vmath::Zero().

2181  {
2182  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2183  std::vector<std::vector<NekDouble> > FieldData;
2184 
2185  m_fld->Import(infile,FieldDef,FieldData);
2186  int idx = -1;
2187 
2188  Vmath::Zero(pField->GetNcoeffs(),pField->UpdateCoeffs(),1);
2189 
2190  for(int i = 0; i < FieldDef.size(); ++i)
2191  {
2192  // find the index of the required field in the file.
2193  for(int j = 0; j < FieldData.size(); ++j)
2194  {
2195  if (FieldDef[i]->m_fields[j] == pFieldName)
2196  {
2197  idx = j;
2198  }
2199  }
2200  ASSERTL1(idx >= 0, "Field " + pFieldName + " not found.");
2201 
2202  pField->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
2203  FieldDef[i]->m_fields[idx],
2204  pField->UpdateCoeffs());
2205  }
2206  pField->BwdTrans(pField->GetCoeffs(), pField->UpdatePhys());
2207  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Nektar::SolverUtils::EquationSystem::ImportFldBase ( std::string  pInfile,
SpatialDomains::MeshGraphSharedPtr  pGraph 
)
protected

Definition at line 1436 of file EquationSystem.cpp.

References ASSERTL0, m_base, m_fields, m_fld, and m_session.

1439  {
1440  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
1441  std::vector<std::vector<NekDouble> > FieldData;
1442 
1443  //Get Homogeneous
1444  m_fld->Import(pInfile,FieldDef,FieldData);
1445 
1446  int nvar = m_session->GetVariables().size();
1447  if (m_session->DefinesSolverInfo("HOMOGENEOUS"))
1448  {
1449  std::string HomoStr = m_session->GetSolverInfo("HOMOGENEOUS");
1450  }
1451  // copy FieldData into m_fields
1452  for (int j = 0; j < nvar; ++j)
1453  {
1454  for(int i = 0; i < FieldDef.size(); ++i)
1455  {
1456  bool flag = FieldDef[i]->m_fields[j] ==
1457  m_session->GetVariable(j);
1458  ASSERTL0(flag, (std::string("Order of ") + pInfile
1459  + std::string(" data and that defined in "
1460  "the session differs")).c_str());
1461 
1462  m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
1463  FieldDef[i]->m_fields[j],
1464  m_base[j]->UpdateCoeffs());
1465  }
1466  }
1467  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
Array< OneD, MultiRegions::ExpListSharedPtr > m_base
Base fields.
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
void Nektar::SolverUtils::EquationSystem::ImportFldToMultiDomains ( const std::string &  infile,
Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields,
const int  ndomains 
)

Input field data from the given file to multiple domains.

Import field from infile and load into m_fields. This routine will also perform a BwdTrans to ensure data is in both the physical and coefficient storage.

Parameters
infileFilename to read. If optionan ndomains is specified it assumes we loop over nodmains for each nvariables.

Definition at line 2134 of file EquationSystem.cpp.

References ASSERTL0, ASSERTL1, GetNcoeffs(), GetNvariables(), Nektar::LibUtilities::Import(), m_fields, m_session, and Vmath::Zero().

2138  {
2139  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2140  std::vector<std::vector<NekDouble> > FieldData;
2141 
2142  LibUtilities::Import(infile,FieldDef,FieldData);
2143 
2144  int nvariables = GetNvariables();
2145 
2146  ASSERTL0(ndomains*nvariables == pFields.num_elements(),"Number of fields does not match the number of variables and domains");
2147 
2148  // Copy FieldData into m_fields
2149  for(int j = 0; j < ndomains; ++j)
2150  {
2151  for(int i = 0; i < nvariables; ++i)
2152  {
2153  Vmath::Zero(pFields[j*nvariables+i]->GetNcoeffs(),pFields[j*nvariables+i]->UpdateCoeffs(),1);
2154 
2155  for(int n = 0; n < FieldDef.size(); ++n)
2156  {
2157  ASSERTL1(FieldDef[n]->m_fields[i] == m_session->GetVariable(i),
2158  std::string("Order of ") + infile
2159  + std::string(" data and that defined in "
2160  "m_boundaryconditions differs"));
2161 
2162  pFields[j*nvariables+i]->ExtractDataToCoeffs(FieldDef[n], FieldData[n],
2163  FieldDef[n]->m_fields[i],
2164  pFields[j*nvariables+i]->UpdateCoeffs());
2165  }
2166  pFields[j*nvariables+i]->BwdTrans(pFields[j*nvariables+i]->GetCoeffs(),
2167  pFields[j*nvariables+i]->UpdatePhys());
2168  }
2169  }
2170  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
SOLVER_UTILS_EXPORT int GetNvariables()
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > ElementiDs)
Imports an FLD file.
Definition: FieldIO.cpp:115
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetNcoeffs()
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Nektar::SolverUtils::EquationSystem::InitialiseBaseFlow ( Array< OneD, Array< OneD, NekDouble > > &  base)

Perform initialisation of the base flow.

Definition at line 1256 of file EquationSystem.cpp.

References EvaluateFunction(), m_graph, m_spacedim, and SetUpBaseFields().

1258  {
1260  std::vector<std::string> vel;
1261  vel.push_back("Vx");
1262  vel.push_back("Vy");
1263  vel.push_back("Vz");
1264  vel.resize(m_spacedim);
1266  EvaluateFunction(vel, base, "BaseFlow");
1267  }
SOLVER_UTILS_EXPORT void SetUpBaseFields(SpatialDomains::MeshGraphSharedPtr &mesh)
int m_spacedim
Spatial dimension (>= expansion dim).
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
void Nektar::SolverUtils::EquationSystem::InitObject ( )
inline

Initialises the members of this object.

This is the second part of the two-phase initialisation process. Calls to virtual functions will correctly resolve to the derived class during this phase of the construction.

Definition at line 671 of file EquationSystem.h.

References v_InitObject().

672  {
673  v_InitObject();
674  }
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Initialisation object for EquationSystem.
NekDouble Nektar::SolverUtils::EquationSystem::L2Error ( unsigned int  field,
const Array< OneD, NekDouble > &  exactsoln,
bool  Normalised = false 
)
inline

Compute the L2 error between fields and a given exact solution.

L_2 Error computation Public interface routine to virtual function implementation.

Definition at line 742 of file EquationSystem.h.

References v_L2Error().

Referenced by L2Error().

743  {
744  return v_L2Error(field, exactsoln, Normalised);
745  }
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
Virtual function for the L_2 error computation between fields and a given exact solution.
SOLVER_UTILS_EXPORT NekDouble Nektar::SolverUtils::EquationSystem::L2Error ( unsigned int  field,
bool  Normalised = false 
)
inline

Compute the L2 error of the fields.

Definition at line 200 of file EquationSystem.h.

References L2Error(), and Nektar::NullNekDouble1DArray.

203  {
204  return L2Error(field,NullNekDouble1DArray,Normalised);
205  }
static Array< OneD, NekDouble > NullNekDouble1DArray
SOLVER_UTILS_EXPORT NekDouble L2Error(unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised=false)
Compute the L2 error between fields and a given exact solution.
NekDouble Nektar::SolverUtils::EquationSystem::LinfError ( unsigned int  field,
const Array< OneD, NekDouble > &  exactsoln = NullNekDouble1DArray 
)
inline

Linf error computation.

L_inf Error computation Public interface routine to virtual function implementation.

Definition at line 733 of file EquationSystem.h.

References v_LinfError().

734  {
735  return v_LinfError(field, exactsoln);
736  }
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
Virtual function for the L_inf error computation between fields and a given exact solution...
int Nektar::SolverUtils::EquationSystem::nocase_cmp ( const string &  s1,
const string &  s2 
)
inlineprotected

Definition at line 559 of file EquationSystem.h.

References NoCaseStringCompare().

560  {
561  return NoCaseStringCompare(s1,s2);
562  }
SOLVER_UTILS_EXPORT int NoCaseStringCompare(const string &s1, const string &s2)
Perform a case-insensitive string comparison.
int Nektar::SolverUtils::EquationSystem::NoCaseStringCompare ( const string &  s1,
const string &  s2 
)

Perform a case-insensitive string comparison.

Performs a case-insensitive string comparison (from web).

Parameters
s1First string to compare.
s2Second string to compare.
Returns
0 if the strings match.

Definition at line 2332 of file EquationSystem.cpp.

Referenced by nocase_cmp(), and Nektar::NavierStokesCFE::v_InitObject().

2335  {
2336  //if (s1.size() < s2.size()) return -1;
2337  //if (s1.size() > s2.size()) return 1;
2338 
2339  string::const_iterator it1=s1.begin();
2340  string::const_iterator it2=s2.begin();
2341 
2342  // Stop when either string's end has been reached
2343  while ( (it1!=s1.end()) && (it2!=s2.end()) )
2344  {
2345  if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
2346  {
2347  // Return -1 to indicate smaller than, 1 otherwise
2348  return (::toupper(*it1) < ::toupper(*it2)) ? -1 : 1;
2349  }
2350 
2351  // Proceed to the next character in each string
2352  ++it1;
2353  ++it2;
2354  }
2355 
2356  size_t size1=s1.size();
2357  size_t size2=s2.size();// cache lengths
2358 
2359  // Return -1, 0 or 1 according to strings' lengths
2360  if (size1==size2)
2361  {
2362  return 0;
2363  }
2364 
2365  return (size1 < size2) ? -1 : 1;
2366  }
void Nektar::SolverUtils::EquationSystem::NumericalFlux ( Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  numflux 
)
inline

Definition at line 937 of file EquationSystem.h.

References v_NumericalFlux().

Referenced by WeakDGAdvection().

939  {
940  v_NumericalFlux(physfield, numflux);
941  }
virtual SOLVER_UTILS_EXPORT void v_NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
void Nektar::SolverUtils::EquationSystem::NumericalFlux ( Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  numfluxX,
Array< OneD, Array< OneD, NekDouble > > &  numfluxY 
)
inline

Definition at line 943 of file EquationSystem.h.

References v_NumericalFlux().

946  {
947  v_NumericalFlux(physfield, numfluxX, numfluxY);
948  }
virtual SOLVER_UTILS_EXPORT void v_NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
void Nektar::SolverUtils::EquationSystem::NumFluxforScalar ( const Array< OneD, Array< OneD, NekDouble > > &  ufield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  uflux 
)
inline

Definition at line 950 of file EquationSystem.h.

References v_NumFluxforScalar().

Referenced by WeakDGDiffusion().

953  {
954  v_NumFluxforScalar(ufield, uflux);
955  }
virtual SOLVER_UTILS_EXPORT void v_NumFluxforScalar(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
void Nektar::SolverUtils::EquationSystem::NumFluxforVector ( const Array< OneD, Array< OneD, NekDouble > > &  ufield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  qfield,
Array< OneD, Array< OneD, NekDouble > > &  qflux 
)
inline

Definition at line 957 of file EquationSystem.h.

References v_NumFluxforVector().

Referenced by WeakDGDiffusion().

961  {
962  v_NumFluxforVector(ufield, qfield, qflux);
963  }
virtual SOLVER_UTILS_EXPORT void v_NumFluxforVector(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
void Nektar::SolverUtils::EquationSystem::Output ( void  )
inline

Perform output operations after solve.

Perform output operations after solve.

Definition at line 724 of file EquationSystem.h.

References v_Output().

725  {
726  v_Output();
727  }
virtual SOLVER_UTILS_EXPORT void v_Output(void)
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::PrintProgressbar ( const int  position,
const int  goal 
) const
inlineprivate

Definition at line 658 of file EquationSystem.h.

References Nektar::LibUtilities::PrintProgressbar().

Referenced by EvaluateFunction().

660  {
661  LibUtilities::PrintProgressbar(position, goal, "Interpolating");
662  }
void PrintProgressbar(const int position, const int goal, const string message)
Prints a progressbar.
Definition: Progressbar.hpp:70
void Nektar::SolverUtils::EquationSystem::PrintSummary ( std::ostream &  out)
inline

Print a summary of parameters and solver characteristics.

Prints a summary of variables and problem parameters.

Public interface routine to virtual function implementation.

Parameters
outThe ostream object to write to.

Definition at line 762 of file EquationSystem.h.

References m_session, and v_GenerateSummary().

763  {
764  if (m_session->GetComm()->GetRank() == 0)
765  {
766  std::vector<std::pair<std::string, std::string> > vSummary;
767  v_GenerateSummary(vSummary);
768 
769  out << "=======================================================================" << endl;
770  SummaryList::const_iterator x;
771  for (x = vSummary.begin(); x != vSummary.end(); ++x)
772  {
773  out << "\t";
774  out.width(20);
775  out << x->first << ": " << x->second << endl;
776  }
777  out << "=======================================================================" << endl;
778  }
779  }
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &l)
Virtual function for generating summary information.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::ResetSessionName ( std::string  newname)
inline

Reset Session name.

Definition at line 119 of file EquationSystem.h.

References m_sessionName.

120  {
121  m_sessionName = newname;
122  }
std::string m_sessionName
Name of the session.
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::ScanForHistoryPoints ( )

Builds map of which element holds each history point.

void Nektar::SolverUtils::EquationSystem::SessionSummary ( SummaryList s)

Write out a session summary.

Write out a summary of the session data.

Parameters
outOutput stream to write data to.

Definition at line 2246 of file EquationSystem.cpp.

References Nektar::SolverUtils::AddSummaryItem(), Nektar::MultiRegions::eDiscontinuous, Nektar::MultiRegions::eGalerkin, eHomogeneous1D, eHomogeneous2D, Nektar::MultiRegions::eMixed_CG_Discontinuous, Nektar::SolverUtils::GetAdvectionFactory(), Nektar::SolverUtils::GetDiffusionFactory(), m_expdim, m_fields, m_halfMode, m_HomogeneousType, m_multipleModes, m_npointsY, m_npointsZ, m_NumMode, m_projectionType, m_session, m_sessionName, m_singleMode, m_spacedim, and m_useFFT.

Referenced by v_GenerateSummary().

2247  {
2248  AddSummaryItem(s, "EquationType", m_session->GetSolverInfo("EQTYPE"));
2249  AddSummaryItem(s, "Session Name", m_sessionName);
2250  AddSummaryItem(s, "Spatial Dim.", m_spacedim);
2251  AddSummaryItem(s, "Max SEM Exp. Order", m_fields[0]->EvalBasisNumModesMax());
2253  {
2254  AddSummaryItem(s, "Quasi-3D", "Homogeneous in z-direction");
2255  AddSummaryItem(s, "Expansion Dim.", m_expdim + 1);
2256  AddSummaryItem(s, "Num. Hom. Modes (z)", m_npointsZ);
2257  AddSummaryItem(s, "Hom. length (LZ)", "m_LhomZ");
2258  AddSummaryItem(s, "FFT Type", m_useFFT ? "FFTW" : "MVM");
2259  if (m_halfMode)
2260  {
2261  AddSummaryItem(s, "ModeType", "Half Mode");
2262  }
2263  else if (m_singleMode)
2264  {
2265  AddSummaryItem(s, "ModeType", "Single Mode");
2266  }
2267  else if (m_multipleModes)
2268  {
2269  AddSummaryItem(s, "ModeType", "Multiple Modes");
2270  AddSummaryItem(s, "Selected Mode",
2271  boost::lexical_cast<string>(m_NumMode));
2272  }
2273  }
2274  else if(m_HomogeneousType == eHomogeneous2D)
2275  {
2276  AddSummaryItem(s, "Quasi-3D", "Homogeneous in yz-plane");
2277  AddSummaryItem(s, "Expansion Dim.", m_expdim + 2);
2278  AddSummaryItem(s, "Num. Hom. Modes (y)", m_npointsY);
2279  AddSummaryItem(s, "Num. Hom. Modes (z)", m_npointsZ);
2280  AddSummaryItem(s, "Hom. length (LY)", "m_LhomY");
2281  AddSummaryItem(s, "Hom. length (LZ)", "m_LhomZ");
2282  AddSummaryItem(s, "FFT Type", m_useFFT ? "FFTW" : "MVM");
2283  }
2284  else
2285  {
2286  AddSummaryItem(s, "Expansion Dim.", m_expdim);
2287  }
2288 
2289  if (m_session->DefinesSolverInfo("UpwindType"))
2290  {
2291  AddSummaryItem(s, "Riemann Solver",
2292  m_session->GetSolverInfo("UpwindType"));
2293  }
2294 
2295  if (m_session->DefinesSolverInfo("AdvectionType"))
2296  {
2297  std::string AdvectionType;
2298  AdvectionType = m_session->GetSolverInfo("AdvectionType");
2299  AddSummaryItem(s, "Advection Type", GetAdvectionFactory().
2300  GetClassDescription(AdvectionType));
2301  }
2302 
2304  {
2305  AddSummaryItem(s, "Projection Type", "Continuous Galerkin");
2306  }
2308  {
2309  AddSummaryItem(s, "Projection Type", "Discontinuous Galerkin");
2310  }
2312  {
2313  AddSummaryItem(s, "Projection Type",
2314  "Mixed Continuous Galerkin and Discontinuous");
2315  }
2316 
2317  if (m_session->DefinesSolverInfo("DiffusionType"))
2318  {
2319  std::string DiffusionType;
2320  DiffusionType = m_session->GetSolverInfo("DiffusionType");
2321  AddSummaryItem(s, "Diffusion Type", GetDiffusionFactory().
2322  GetClassDescription(DiffusionType));
2323  }
2324  }
bool m_singleMode
Flag to determine if single homogeneous mode is used.
bool m_halfMode
Flag to determine if half homogeneous mode is used.
int m_expdim
Expansion dimension.
DiffusionFactory & GetDiffusionFactory()
Definition: Diffusion.cpp:42
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
bool m_useFFT
Flag to determine if FFT is used for homogeneous transform.
int m_npointsZ
number of points in Z direction (if homogeneous)
std::string m_sessionName
Name of the session.
int m_NumMode
Mode to use in case of single mode analysis.
bool m_multipleModes
Flag to determine if use multiple homogenenous modes are used.
int m_npointsY
number of points in Y direction (if homogeneous)
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:50
int m_spacedim
Spatial dimension (>= expansion dim).
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:46
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
enum HomogeneousType m_HomogeneousType
void Nektar::SolverUtils::EquationSystem::SetBoundaryConditions ( NekDouble  time)

Evaluates the boundary conditions at the given time.

If boundary conditions are time-dependent, they will be evaluated at the time specified.

Parameters
timeThe time at which to evaluate the BCs

Definition at line 981 of file EquationSystem.cpp.

References m_fields, and m_session.

Referenced by Nektar::UnsteadyAdvectionDiffusion::DoImplicitSolve(), Nektar::UnsteadyViscousBurgers::DoImplicitSolve(), Nektar::ImageWarpingSystem::DoOdeProjection(), Nektar::UnsteadyInviscidBurger::DoOdeProjection(), Nektar::UnsteadyDiffusion::DoOdeProjection(), Nektar::UnsteadyAdvection::DoOdeProjection(), Nektar::UnsteadyAdvectionDiffusion::DoOdeProjection(), Nektar::CFLtester::DoOdeProjection(), Nektar::UnsteadyViscousBurgers::DoOdeProjection(), Nektar::PulseWavePropagation::SetPulseWaveBoundaryConditions(), and Nektar::SolverUtils::UnsteadySystem::v_DoInitialise().

982  {
983  std::string varName;
984  int nvariables = m_fields.num_elements();
985  for (int i = 0; i < nvariables; ++i)
986  {
987  varName = m_session->GetVariable(i);
988  m_fields[i]->EvaluateBoundaryConditions(time, varName);
989  }
990  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::SetCheckpointNumber ( int  num)
inline

Definition at line 415 of file EquationSystem.h.

References m_nchk.

416  {
417  m_nchk = num;
418  }
int m_nchk
Number of checkpoints written so far.
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::SetCheckpointSteps ( int  num)
inline

Definition at line 425 of file EquationSystem.h.

References m_checksteps.

426  {
427  m_checksteps = num;
428  }
int m_checksteps
Number of steps between checkpoints.
void Nektar::SolverUtils::EquationSystem::SetInitialConditions ( NekDouble  initialtime = 0.0,
bool  dumpInitialConditions = true,
const int  domain = 0 
)
inline

Initialise the data in the dependent fields.

Definition at line 786 of file EquationSystem.h.

References v_SetInitialConditions().

Referenced by main(), Nektar::SolverUtils::UnsteadySystem::v_DoInitialise(), Nektar::PulseWaveSystem::v_DoInitialise(), and Nektar::CoupledLinearNS::v_DoInitialise().

789  {
790  v_SetInitialConditions(initialtime,dumpInitialConditions,domain);
791  }
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::SetInitialStep ( const int  step)
inline

Definition at line 436 of file EquationSystem.h.

References m_initialStep.

438  {
439  m_initialStep = step;
440  }
int m_initialStep
Number of the step where the simulation should begin.
void Nektar::SolverUtils::EquationSystem::SetLambda ( NekDouble  lambda)
inline

Set parameter m_lambda.

Definition at line 781 of file EquationSystem.h.

References m_lambda.

782  {
783  m_lambda = lambda;
784  }
NekDouble m_lambda
Lambda constant in real system if one required.
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::SetModifiedBasis ( const bool  modbasis)
inline
void Nektar::SolverUtils::EquationSystem::SetSteps ( const int  steps)
inline

Definition at line 898 of file EquationSystem.h.

References m_steps.

899  {
900  m_steps = steps;
901  }
int m_steps
Number of steps to take.
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::SetTime ( const NekDouble  time)
inline

Definition at line 430 of file EquationSystem.h.

References m_time.

432  {
433  m_time = time;
434  }
NekDouble m_time
Current time of simulation.
void Nektar::SolverUtils::EquationSystem::SetUpBaseFields ( SpatialDomains::MeshGraphSharedPtr mesh)
protected

Definition at line 1269 of file EquationSystem.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::LibUtilities::eFourier, Nektar::LibUtilities::eFourierEvenlySpaced, Nektar::LibUtilities::eFourierHalfModeRe, Nektar::LibUtilities::eFourierSingleModeSpaced, Nektar::MultiRegions::eGalerkin, eHomogeneous1D, Nektar::MultiRegions::eMixed_CG_Discontinuous, m_base, m_expdim, m_graph, m_halfMode, m_homogen_dealiasing, m_HomogeneousType, m_LhomZ, m_npointsZ, m_projectionType, m_session, m_singleMode, and m_useFFT.

Referenced by InitialiseBaseFlow().

1271  {
1272  int i;
1273 
1274  // The number of variables can be different from the dimension
1275  // of the base flow
1276  int nvariables = m_session->GetVariables().size();
1280  {
1281  switch (m_expdim)
1282  {
1283  case 1:
1284  {
1285  for(i = 0; i < m_base.num_elements(); i++)
1286  {
1289  m_session->GetVariable(0));
1290  }
1291  }
1292  break;
1293  case 2:
1294  {
1296  {
1297  if (m_singleMode)
1298  {
1299  const LibUtilities::PointsKey PkeyZ(m_npointsZ,
1301  const LibUtilities::BasisKey BkeyZ(
1303  m_npointsZ,PkeyZ);
1304 
1305  for (i = 0 ; i < m_base.num_elements(); i++)
1306  {
1309  ::AllocateSharedPtr(
1310  m_session, BkeyZ, m_LhomZ,
1312  m_graph,
1313  m_session->GetVariable(i));
1314  m_base[i]->SetWaveSpace(true);
1315  }
1316  }
1317  else if (m_halfMode)
1318  {
1319  //1 plane field (half mode expansion)
1320  const LibUtilities::PointsKey PkeyZ(m_npointsZ,
1322  const LibUtilities::BasisKey BkeyZ(
1324  m_npointsZ,PkeyZ);
1325 
1326  for (i = 0 ; i < m_base.num_elements(); i++)
1327  {
1330  ::AllocateSharedPtr(
1331  m_session, BkeyZ, m_LhomZ,
1333  m_graph,
1334  m_session->GetVariable(i));
1335  m_base[i]->SetWaveSpace(true);
1336  }
1337  }
1338  else
1339  {
1340  const LibUtilities::PointsKey PkeyZ(m_npointsZ,
1342  const LibUtilities::BasisKey BkeyZ(
1344  PkeyZ);
1345 
1346  for (i = 0 ; i < m_base.num_elements(); i++)
1347  {
1350  ::AllocateSharedPtr(
1351  m_session, BkeyZ, m_LhomZ,
1353  m_graph,
1354  m_session->GetVariable(i));
1355  m_base[i]->SetWaveSpace(false);
1356  }
1357  }
1358  }
1359  else
1360  {
1361  i = 0;
1365  m_session->GetVariable(i));
1366  m_base[0]=firstbase;
1367 
1368  for (i = 1 ; i < m_base.num_elements(); i++)
1369  {
1370  m_base[i] = MemoryManager<MultiRegions::
1371  ContField2D>::AllocateSharedPtr(
1372  *firstbase,mesh,
1373  m_session->GetVariable(i));
1374  }
1375  }
1376  }
1377  break;
1378  case 3:
1379  {
1383  m_session->GetVariable(0));
1384  m_base[0] = firstbase;
1385  for (i = 1 ; i < m_base.num_elements(); i++)
1386  {
1388  ::AllocateSharedPtr(*firstbase, m_graph,
1389  m_session->GetVariable(0));
1390  }
1391  }
1392  break;
1393  default:
1394  ASSERTL0(false,"Expansion dimension not recognised");
1395  break;
1396  }
1397  }
1398  else
1399  {
1400  switch(m_expdim)
1401  {
1402  case 1:
1403  {
1404  // need to use zero for variable as may be more base
1405  // flows than variables
1406  for(i = 0 ; i < m_base.num_elements(); i++)
1407  {
1408  m_base[i] = MemoryManager<MultiRegions
1410  ::AllocateSharedPtr(m_session, m_graph,
1411  m_session->GetVariable(0));
1412  }
1413  break;
1414  }
1415  case 2:
1416  {
1417  for(i = 0 ; i < m_base.num_elements(); i++)
1418  {
1419  m_base[i] = MemoryManager<MultiRegions::
1420  DisContField2D>::AllocateSharedPtr(
1422  m_session->GetVariable(0));
1423  }
1424  break;
1425  }
1426  case 3:
1427  ASSERTL0(false, "3 D not set up");
1428  default:
1429  ASSERTL0(false, "Expansion dimension not recognised");
1430  break;
1431  }
1432  }
1433  }
bool m_singleMode
Flag to determine if single homogeneous mode is used.
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
bool m_halfMode
Flag to determine if half homogeneous mode is used.
NekDouble m_LhomZ
physical length in Z direction (if homogeneous)
int m_expdim
Expansion dimension.
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
bool m_useFFT
Flag to determine if FFT is used for homogeneous transform.
boost::shared_ptr< ContField2D > ContField2DSharedPtr
Definition: ContField2D.h:293
Fourier Expansion .
Definition: BasisType.h:52
int m_npointsZ
number of points in Z direction (if homogeneous)
1D Evenly-spaced points using Fourier Fit
Definition: PointsType.h:64
Fourier Modified expansions with just the real part of the first mode .
Definition: BasisType.h:59
This class is the abstraction of a global continuous two- dimensional spectral/hp element expansion w...
Definition: ContField2D.h:56
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
Defines a specification for a set of points.
Definition: Points.h:58
bool m_homogen_dealiasing
Flag to determine if dealiasing is used for homogeneous simulations.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
Array< OneD, MultiRegions::ExpListSharedPtr > m_base
Base fields.
1D Non Evenly-spaced points for Single Mode analysis
Definition: PointsType.h:65
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
boost::shared_ptr< ContField3D > ContField3DSharedPtr
Definition: ContField3D.h:191
Describes the specification for a Basis.
Definition: Basis.h:50
enum HomogeneousType m_HomogeneousType
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::SetUpTraceNormals ( void  )
void Nektar::SolverUtils::EquationSystem::TransCoeffToPhys ( void  )
inline

Transform from coefficient to physical space.

Performs the transformation from coefficient to physical space.

Public interface routine to virtual function implementation.

Definition at line 694 of file EquationSystem.h.

References v_TransCoeffToPhys().

695  {
697  }
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys()
Virtual function for transformation to physical space.
void Nektar::SolverUtils::EquationSystem::TransPhysToCoeff ( void  )
inline

Transform from physical to coefficient space.

Performs the transformation from physical to coefficient space.

Public interface routine to virtual function implementation.

Definition at line 704 of file EquationSystem.h.

References v_TransPhysToCoeff().

705  {
707  }
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff()
Virtual function for transformation to coefficient space.
SOLVER_UTILS_EXPORT LibUtilities::FieldMetaDataMap& Nektar::SolverUtils::EquationSystem::UpdateFieldMetaDataMap ( )
inline

Get hold of FieldInfoMap so it can be updated.

Array< OneD, MultiRegions::ExpListSharedPtr > & Nektar::SolverUtils::EquationSystem::UpdateFields ( void  )
inline

Definition at line 801 of file EquationSystem.h.

References m_fields.

802  {
803  return m_fields;
804  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Nektar::SolverUtils::EquationSystem::v_DoInitialise ( void  )
protectedvirtual

Virtual function for initialisation implementation.

By default, nothing needs initialising at the EquationSystem level.

Reimplemented in Nektar::CoupledLinearNS, Nektar::PulseWaveSystem, Nektar::VelocityCorrectionScheme, Nektar::SolverUtils::UnsteadySystem, Nektar::VCSMapping, Nektar::SteadyAdvectionDiffusion, and Nektar::EigenValuesAdvection.

Definition at line 1250 of file EquationSystem.cpp.

Referenced by DoInitialise().

1251  {
1252 
1253  }
void Nektar::SolverUtils::EquationSystem::v_DoSolve ( void  )
protectedvirtual
void Nektar::SolverUtils::EquationSystem::v_EvaluateExactSolution ( unsigned int  field,
Array< OneD, NekDouble > &  outfield,
const NekDouble  time 
)
protectedvirtual

Reimplemented in Nektar::EulerCFE.

Definition at line 1231 of file EquationSystem.cpp.

References ASSERTL0, EvaluateFunction(), m_fields, m_session, and Vmath::Zero().

Referenced by EvaluateExactSolution().

1235  {
1236  ASSERTL0 (outfield.num_elements() == m_fields[field]->GetNpoints(),
1237  "ExactSolution array size mismatch.");
1238  Vmath::Zero(outfield.num_elements(), outfield, 1);
1239  if (m_session->DefinesFunction("ExactSolution"))
1240  {
1241  EvaluateFunction(m_session->GetVariable(field), outfield,
1242  "ExactSolution", time);
1243  }
1244  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
void Nektar::SolverUtils::EquationSystem::v_ExtraFldOutput ( std::vector< Array< OneD, NekDouble > > &  fieldcoeffs,
std::vector< std::string > &  variables 
)
protectedvirtual

Reimplemented in Nektar::CompressibleFlowSystem, Nektar::LinearElasticSystem, and Nektar::APE.

Definition at line 2442 of file EquationSystem.cpp.

Referenced by WriteFld().

2445  {
2446  }
void Nektar::SolverUtils::EquationSystem::v_GenerateSummary ( SummaryList l)
protectedvirtual
void Nektar::SolverUtils::EquationSystem::v_GetFluxVector ( const int  i,
Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  flux 
)
privatevirtual

Reimplemented in Nektar::IncNavierStokes, Nektar::CFLtester, Nektar::PulseWavePropagation, Nektar::ImageWarpingSystem, and Nektar::EigenValuesAdvection.

Definition at line 2373 of file EquationSystem.cpp.

References ASSERTL0.

Referenced by GetFluxVector().

2377  {
2378  ASSERTL0(false, "v_GetFluxVector: This function is not valid "
2379  "for the Base class");
2380  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void Nektar::SolverUtils::EquationSystem::v_GetFluxVector ( const int  i,
const int  j,
Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  flux 
)
privatevirtual

Definition at line 2382 of file EquationSystem.cpp.

References ASSERTL0.

2386  {
2387  ASSERTL0(false, "v_GetqFluxVector: This function is not valid "
2388  "for the Base class");
2389  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void Nektar::SolverUtils::EquationSystem::v_GetFluxVector ( const int  i,
Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  fluxX,
Array< OneD, Array< OneD, NekDouble > > &  fluxY 
)
privatevirtual

Definition at line 2391 of file EquationSystem.cpp.

References ASSERTL0.

2396  {
2397  ASSERTL0(false, "v_GetFluxVector: This function is not valid "
2398  "for the Base class");
2399  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
MultiRegions::ExpListSharedPtr Nektar::SolverUtils::EquationSystem::v_GetPressure ( void  )
protectedvirtual

Reimplemented in Nektar::IncNavierStokes.

Definition at line 2435 of file EquationSystem.cpp.

References ASSERTL0.

Referenced by GetPressure().

2436  {
2437  ASSERTL0(false, "This function is not valid for the Base class");
2439  return null;
2440  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Array< OneD, bool > Nektar::SolverUtils::EquationSystem::v_GetSystemSingularChecks ( )
privatevirtual

Reimplemented in Nektar::VelocityCorrectionScheme, Nektar::Laplace, Nektar::Helmholtz, and Nektar::Poisson.

Definition at line 2368 of file EquationSystem.cpp.

References m_session.

Referenced by v_InitObject().

2369  {
2370  return Array<OneD, bool>(m_session->GetVariables().size(), false);
2371  }
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
void Nektar::SolverUtils::EquationSystem::v_InitObject ( )
protectedvirtual

Initialisation object for EquationSystem.

Continuous field

Setting up the normals

Setting up the normals

Reimplemented in Nektar::CoupledLinearNS, Nektar::CompressibleFlowSystem, Nektar::PulseWaveSystem, Nektar::UnsteadyViscousBurgers, Nektar::UnsteadyAdvectionDiffusion, Nektar::LinearElasticSystem, Nektar::IncNavierStokes, Nektar::CFLtester, Nektar::UnsteadyAdvection, Nektar::UnsteadyInviscidBurger, Nektar::SolverUtils::UnsteadySystem, Nektar::ShallowWaterSystem, Nektar::NonlinearPeregrine, Nektar::APE, Nektar::EulerADCFE, Nektar::NavierStokesCFE, Nektar::EulerCFE, Nektar::IterativeElasticSystem, Nektar::PulseWavePropagation, Nektar::ImageWarpingSystem, Nektar::UnsteadyDiffusion, Nektar::Monodomain, Nektar::Bidomain, Nektar::BidomainRoth, Nektar::LinearSWE, Nektar::NonlinearSWE, Nektar::VCSMapping, Nektar::PulseWaveSystemOutput, Nektar::Laplace, Nektar::SteadyAdvectionDiffusion, Nektar::EigenValuesAdvection, Nektar::Helmholtz, Nektar::VelocityCorrectionScheme, Nektar::SteadyAdvectionDiffusionReaction, Nektar::Poisson, and Nektar::SolverUtils::AdvectionSystem.

Definition at line 119 of file EquationSystem.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::MultiRegions::eDiscontinuous, Nektar::LibUtilities::eFourier, Nektar::LibUtilities::eFourierEvenlySpaced, Nektar::LibUtilities::eFourierHalfModeIm, Nektar::LibUtilities::eFourierHalfModeRe, Nektar::LibUtilities::eFourierSingleMode, Nektar::LibUtilities::eFourierSingleModeSpaced, Nektar::MultiRegions::eGalerkin, eHomogeneous1D, eHomogeneous2D, eHomogeneous3D, Nektar::MultiRegions::eMixed_CG_Discontinuous, eNotHomogeneous, GetTraceNpoints(), m_boundaryConditions, m_checkIfSystemSingular, m_checksteps, m_checktime, m_expdim, m_fields, m_fintime, m_fld, m_graph, m_halfMode, m_HomoDirec, m_homogen_dealiasing, m_HomogeneousType, m_LhomY, m_LhomZ, m_multipleModes, m_nchk, m_npointsY, m_npointsZ, m_NumQuadPointsError, m_projectionType, m_session, m_sessionName, m_singleMode, m_spacedim, m_specHP_dealiasing, m_steps, m_time, m_timestep, m_traceNormals, m_useFFT, Nektar::SpatialDomains::MeshGraph::Read(), v_GetSystemSingularChecks(), and ZeroPhysFields().

Referenced by InitObject(), and Nektar::SolverUtils::UnsteadySystem::v_InitObject().

120  {
121  // Save the basename of input file name for output details
122  m_sessionName = m_session->GetSessionName();
123 
124  // Instantiate a field reader/writer
127  m_session->GetComm(),
128  m_session->DefinesCmdLineArgument("shared-filesystem"));
129 
130  // Read the geometry and the expansion information
132 
133  // Also read and store the boundary conditions
136  AllocateSharedPtr(m_session, m_graph);
137 
138  // Set space dimension for use in class
139  m_spacedim = m_graph->GetSpaceDimension();
140 
141  // Setting parameteres for homogenous problems
142  m_HomoDirec = 0;
143  m_useFFT = false;
144  m_homogen_dealiasing = false;
145  m_singleMode = false;
146  m_halfMode = false;
147  m_multipleModes = false;
149 
150  if (m_session->DefinesSolverInfo("HOMOGENEOUS"))
151  {
152  std::string HomoStr = m_session->GetSolverInfo("HOMOGENEOUS");
153  m_spacedim = 3;
154 
155  if ((HomoStr == "HOMOGENEOUS1D") || (HomoStr == "Homogeneous1D")
156  || (HomoStr == "1D") || (HomoStr == "Homo1D"))
157  {
159  m_session->LoadParameter("LZ", m_LhomZ);
160  m_HomoDirec = 1;
161 
162  if(m_session->DefinesSolverInfo("ModeType"))
163  {
164  m_session->MatchSolverInfo("ModeType", "SingleMode",
165  m_singleMode, false);
166  m_session->MatchSolverInfo("ModeType", "HalfMode",
167  m_halfMode, false);
168  m_session->MatchSolverInfo("ModeType", "MultipleModes",
169  m_multipleModes, false);
170  }
171 
172  // Stability Analysis flags
173  if (m_session->DefinesSolverInfo("ModeType"))
174  {
175  if(m_singleMode)
176  {
177  m_npointsZ = 2;
178  }
179  else if(m_halfMode)
180  {
181  m_npointsZ = 1;
182  }
183  else if(m_multipleModes)
184  {
185  m_npointsZ = m_session->GetParameter("HomModesZ");
186  }
187  else
188  {
189  ASSERTL0(false, "SolverInfo ModeType not valid");
190  }
191  }
192  else
193  {
194  m_npointsZ = m_session->GetParameter("HomModesZ");
195  }
196  }
197 
198  if ((HomoStr == "HOMOGENEOUS2D") || (HomoStr == "Homogeneous2D")
199  || (HomoStr == "2D") || (HomoStr == "Homo2D"))
200  {
202  m_session->LoadParameter("HomModesY", m_npointsY);
203  m_session->LoadParameter("LY", m_LhomY);
204  m_session->LoadParameter("HomModesZ", m_npointsZ);
205  m_session->LoadParameter("LZ", m_LhomZ);
206  m_HomoDirec = 2;
207  }
208 
209  if ((HomoStr == "HOMOGENEOUS3D") || (HomoStr == "Homogeneous3D")
210  || (HomoStr == "3D") || (HomoStr == "Homo3D"))
211  {
213  m_session->LoadParameter("HomModesY", m_npointsY);
214  m_session->LoadParameter("LY", m_LhomY);
215  m_session->LoadParameter("HomModesZ", m_npointsZ);
216  m_session->LoadParameter("LZ", m_LhomZ);
217  m_HomoDirec = 2;
218  }
219 
220  m_session->MatchSolverInfo("USEFFT", "FFTW", m_useFFT, false);
221 
222  m_session->MatchSolverInfo("DEALIASING", "True",
223  m_homogen_dealiasing, false);
224  if(m_homogen_dealiasing == false)
225  {
226  m_session->MatchSolverInfo("DEALIASING", "On",
227  m_homogen_dealiasing, false);
228  }
229  }
230  else
231  {
232  // set to default value so can use to identify 2d or 3D
233  // (homogeneous) expansions
234  m_npointsZ = 1;
235  }
236 
237  m_session->MatchSolverInfo("SPECTRALHPDEALIASING", "True",
238  m_specHP_dealiasing, false);
239  if (m_specHP_dealiasing == false)
240  {
241  m_session->MatchSolverInfo("SPECTRALHPDEALIASING", "On",
242  m_specHP_dealiasing, false);
243  }
244 
245  // Options to determine type of projection from file or directly
246  // from constructor
247  if (m_session->DefinesSolverInfo("PROJECTION"))
248  {
249  std::string ProjectStr = m_session->GetSolverInfo("PROJECTION");
250 
251  if ((ProjectStr == "Continuous") || (ProjectStr == "Galerkin") ||
252  (ProjectStr == "CONTINUOUS") || (ProjectStr == "GALERKIN"))
253  {
255  }
256  else if ((ProjectStr == "MixedCGDG") ||
257  (ProjectStr == "Mixed_CG_Discontinuous"))
258  {
260  }
261  else if(ProjectStr == "DisContinuous")
262  {
264  }
265  else
266  {
267  ASSERTL0(false,"PROJECTION value not recognised");
268  }
269  }
270  else
271  {
272  cerr << "Projection type not specified in SOLVERINFO,"
273  "defaulting to continuous Galerkin" << endl;
275  }
276 
277  // Enforce singularity check for some problems
279 
280  int i;
281  int nvariables = m_session->GetVariables().size();
282  bool DeclareCoeffPhysArrays = true;
283 
284 
286  m_spacedim = m_graph->GetSpaceDimension()+m_HomoDirec;
287  m_expdim = m_graph->GetMeshDimension();
288 
289  /// Continuous field
292  {
293  switch(m_expdim)
294  {
295  case 1:
296  {
299  {
300  const LibUtilities::PointsKey PkeyY
302  const LibUtilities::BasisKey BkeyY
304  const LibUtilities::PointsKey PkeyZ
307  BkeyZ(LibUtilities::eFourier, m_npointsZ, PkeyZ);
308 
309  for (i = 0; i < m_fields.num_elements(); i++)
310  {
313  ::AllocateSharedPtr(
314  m_session, BkeyY, BkeyZ, m_LhomY,
315  m_LhomZ, m_useFFT,
316  m_homogen_dealiasing, m_graph,
317  m_session->GetVariable(i));
318  }
319  }
320  else
321  {
322  for (i = 0; i < m_fields.num_elements(); i++)
323  {
326  AllocateSharedPtr(
327  m_session, m_graph,
328  m_session->GetVariable(i));
329  }
330  }
331  break;
332  }
333  case 2:
334  {
336  {
337  // Fourier single mode stability analysis
338  if (m_singleMode)
339  {
340  const LibUtilities::PointsKey PkeyZ(
341  m_npointsZ,
343 
344  const LibUtilities::BasisKey BkeyZ(
346  m_npointsZ,
347  PkeyZ);
348 
349  for(i = 0; i < m_fields.num_elements(); i++)
350  {
353  ::AllocateSharedPtr(
354  m_session, BkeyZ, m_LhomZ,
356  m_graph,
357  m_session->GetVariable(i),
359  }
360  }
361  // Half mode stability analysis
362  else if(m_halfMode)
363  {
364  const LibUtilities::PointsKey PkeyZ(
365  m_npointsZ,
367 
368  const LibUtilities::BasisKey BkeyZR(
370  m_npointsZ, PkeyZ);
371 
372  const LibUtilities::BasisKey BkeyZI(
374  m_npointsZ, PkeyZ);
375 
376 
377  for (i = 0; i < m_fields.num_elements(); i++)
378  {
379  if(m_session->GetVariable(i).compare("w")
380  == 0)
381  {
384  ::AllocateSharedPtr(
385  m_session, BkeyZI, m_LhomZ,
386  m_useFFT,
388  m_graph,
389  m_session->GetVariable(i),
391  }
392  else
393  {
396  ::AllocateSharedPtr(
397  m_session, BkeyZR, m_LhomZ,
399  m_graph,
400  m_session->GetVariable(i),
402  }
403 
404 
405  }
406  }
407  // Normal homogeneous 1D
408  else
409  {
410  const LibUtilities::PointsKey PkeyZ(
411  m_npointsZ,
413  const LibUtilities::BasisKey BkeyZ(
415 
416  for (i = 0; i < m_fields.num_elements(); i++)
417  {
420  ::AllocateSharedPtr(
421  m_session, BkeyZ, m_LhomZ,
423  m_graph,
424  m_session->GetVariable(i),
426  }
427  }
428  }
429  else
430  {
431  i = 0;
433  firstfield = MemoryManager<MultiRegions::
434  ContField2D>::AllocateSharedPtr(
435  m_session, m_graph,
436  m_session->GetVariable(i),
437  DeclareCoeffPhysArrays,
439  m_fields[0] = firstfield;
440  for (i = 1; i < m_fields.num_elements(); i++)
441  {
442  if (m_graph->
443  SameExpansions(m_session->GetVariable(0),
444  m_session->GetVariable(i)))
445  {
446  m_fields[i] = MemoryManager<MultiRegions::
447  ContField2D>::AllocateSharedPtr(
448  *firstfield, m_graph,
449  m_session->GetVariable(i),
450  DeclareCoeffPhysArrays,
452  }
453  else
454  {
455  m_fields[i] = MemoryManager<MultiRegions
456  ::ContField2D>::AllocateSharedPtr(
457  m_session, m_graph,
458  m_session->GetVariable(i),
459  DeclareCoeffPhysArrays,
461  }
462  }
463 
464  if (m_projectionType ==
466  {
467  /// Setting up the normals
470  (m_spacedim);
471 
472  for (i = 0; i < m_spacedim; ++i)
473  {
475  (GetTraceNpoints());
476  }
477 
478  m_fields[0]->GetTrace()->
479  GetNormals(m_traceNormals);
480  }
481 
482  }
483 
484  break;
485  }
486  case 3:
487  {
488  i = 0;
492  m_session->GetVariable(i),
494 
495  m_fields[0] = firstfield;
496  for (i = 1; i < m_fields.num_elements(); i++)
497  {
498  if(m_graph->SameExpansions(
499  m_session->GetVariable(0),
500  m_session->GetVariable(i)))
501  {
502  m_fields[i] = MemoryManager<MultiRegions
503  ::ContField3D>::AllocateSharedPtr(
504  *firstfield, m_graph,
505  m_session->GetVariable(i),
507  }
508  else
509  {
510  m_fields[i] = MemoryManager<MultiRegions
511  ::ContField3D>::AllocateSharedPtr(
512  m_session, m_graph,
513  m_session->GetVariable(i),
515  }
516  }
517 
518  if (m_projectionType ==
520  {
521  /// Setting up the normals
524  (m_spacedim);
525  for(i = 0; i < m_spacedim; ++i)
526  {
527  m_traceNormals[i] =
529  }
530 
531  m_fields[0]->GetTrace()->GetNormals(m_traceNormals);
532  // Call the trace on all fields to ensure DG setup.
533  for(i = 1; i < m_fields.num_elements(); ++i)
534  {
535  m_fields[i]->GetTrace();
536  }
537  }
538  break;
539  }
540  default:
541  ASSERTL0(false,"Expansion dimension not recognised");
542  break;
543  }
544  }
545  // Discontinuous field
546  else
547  {
548  switch(m_expdim)
549  {
550  case 1:
551  {
554  {
555  const LibUtilities::PointsKey PkeyY(
557  const LibUtilities::BasisKey BkeyY(
559  const LibUtilities::PointsKey PkeyZ(
561  const LibUtilities::BasisKey BkeyZ(
563 
564  for (i = 0; i < m_fields.num_elements(); i++)
565  {
566  m_fields[i] = MemoryManager<MultiRegions
568  ::AllocateSharedPtr(
569  m_session, BkeyY, BkeyZ, m_LhomY,
570  m_LhomZ, m_useFFT,
571  m_homogen_dealiasing, m_graph,
572  m_session->GetVariable(i));
573  }
574  }
575  else
576  {
577  for (i = 0; i < m_fields.num_elements(); i++)
578  {
579  m_fields[i] = MemoryManager<MultiRegions::
580  DisContField1D>::AllocateSharedPtr(
581  m_session, m_graph,
582  m_session->GetVariable(i));
583  }
584  }
585 
586  break;
587  }
588  case 2:
589  {
591  {
592  const LibUtilities::PointsKey PkeyZ(
594  const LibUtilities::BasisKey BkeyZ(
596 
597  for (i = 0; i < m_fields.num_elements(); i++)
598  {
599  m_fields[i] = MemoryManager<MultiRegions
601  ::AllocateSharedPtr(
602  m_session, BkeyZ, m_LhomZ, m_useFFT,
603  m_homogen_dealiasing, m_graph,
604  m_session->GetVariable(i));
605  }
606  }
607  else
608  {
609  for (i = 0; i < m_fields.num_elements(); i++)
610  {
611  m_fields[i] = MemoryManager<MultiRegions::
612  DisContField2D>::AllocateSharedPtr(
613  m_session, m_graph,
614  m_session->GetVariable(i));
615  }
616  }
617 
618  break;
619  }
620  case 3:
621  {
623  {
624  ASSERTL0(false,
625  "3D fully periodic problems not implemented yet");
626  }
627  else
628  {
629  for (i = 0; i < m_fields.num_elements(); i++)
630  {
631  m_fields[i] = MemoryManager<MultiRegions::
632  DisContField3D>::AllocateSharedPtr(
633  m_session, m_graph,
634  m_session->GetVariable(i));
635  }
636  }
637  break;
638  }
639  default:
640  ASSERTL0(false, "Expansion dimension not recognised");
641  break;
642  }
643 
644  // Setting up the normals
647 
648  for (i = 0; i < m_spacedim; ++i)
649  {
650  m_traceNormals[i] =
652  }
653 
654  m_fields[0]->GetTrace()->GetNormals(m_traceNormals);
655  }
656 
657  // Set Default Parameter
658  m_session->LoadParameter("Time", m_time, 0.0);
659  m_session->LoadParameter("TimeStep", m_timestep, 0.01);
660  m_session->LoadParameter("NumSteps", m_steps, 0);
661  m_session->LoadParameter("IO_CheckSteps", m_checksteps, 0);
662  m_session->LoadParameter("IO_CheckTime", m_checktime, 0.0);
663  m_session->LoadParameter("FinTime", m_fintime, 0);
664  m_session->LoadParameter("NumQuadPointsError",
666 
667  m_nchk = 1;
668 
669  // Zero all physical fields initially
670  ZeroPhysFields();
671  }
bool m_singleMode
Flag to determine if single homogeneous mode is used.
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
static boost::shared_ptr< MeshGraph > Read(const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
Definition: MeshGraph.cpp:119
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
NekDouble m_time
Current time of simulation.
NekDouble m_timestep
Time step size.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
bool m_halfMode
Flag to determine if half homogeneous mode is used.
NekDouble m_LhomZ
physical length in Z direction (if homogeneous)
Array< OneD, bool > m_checkIfSystemSingular
Flag to indicate if the fields should be checked for singularity.
int m_expdim
Expansion dimension.
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
NekDouble m_checktime
Time between checkpoints.
bool m_useFFT
Flag to determine if FFT is used for homogeneous transform.
NekDouble m_LhomY
physical length in Y direction (if homogeneous)
boost::shared_ptr< ContField2D > ContField2DSharedPtr
Definition: ContField2D.h:293
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
Fourier Expansion .
Definition: BasisType.h:52
int m_npointsZ
number of points in Z direction (if homogeneous)
std::string m_sessionName
Name of the session.
int m_nchk
Number of checkpoints written so far.
int m_checksteps
Number of steps between checkpoints.
NekDouble m_fintime
Finish time of the simulation.
int m_steps
Number of steps to take.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
int m_HomoDirec
number of homogenous directions
1D Evenly-spaced points using Fourier Fit
Definition: PointsType.h:64
bool m_multipleModes
Flag to determine if use multiple homogenenous modes are used.
Fourier Modified expansions with just the real part of the first mode .
Definition: BasisType.h:59
virtual SOLVER_UTILS_EXPORT Array< OneD, bool > v_GetSystemSingularChecks()
This class is the abstraction of a global continuous two- dimensional spectral/hp element expansion w...
Definition: ContField2D.h:56
int m_npointsY
number of points in Y direction (if homogeneous)
Abstraction of a global continuous one-dimensional spectral/hp element expansion which approximates t...
Definition: ContField1D.h:56
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
Pointer to boundary conditions object.
int m_spacedim
Spatial dimension (>= expansion dim).
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
Defines a specification for a set of points.
Definition: Points.h:58
bool m_homogen_dealiasing
Flag to determine if dealiasing is used for homogeneous simulations.
Fourier Modified expansions with just the imaginary part of the first mode .
Definition: BasisType.h:60
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
Fourier ModifiedExpansion with just the first mode .
Definition: BasisType.h:58
SOLVER_UTILS_EXPORT int GetTraceNpoints()
1D Non Evenly-spaced points for Single Mode analysis
Definition: PointsType.h:65
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
SOLVER_UTILS_EXPORT void ZeroPhysFields()
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
boost::shared_ptr< ContField3D > ContField3DSharedPtr
Definition: ContField3D.h:191
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
Describes the specification for a Basis.
Definition: Basis.h:50
enum HomogeneousType m_HomogeneousType
NekDouble Nektar::SolverUtils::EquationSystem::v_L2Error ( unsigned int  field,
const Array< OneD, NekDouble > &  exactsoln = NullNekDouble1DArray,
bool  Normalised = false 
)
protectedvirtual

Virtual function for the L_2 error computation between fields and a given exact solution.

Compute the error in the L2-norm.

Parameters
fieldThe field to compare.
exactsolnThe exact solution to compare with.
NormalisedNormalise L2-error.
Returns
Error in the L2-norm.

Reimplemented in Nektar::PulseWaveSystem.

Definition at line 999 of file EquationSystem.cpp.

References ErrorExtraPoints(), EvaluateFunction(), GetNpoints(), m_comm, m_fields, m_NumQuadPointsError, m_session, m_time, and Nektar::LibUtilities::ReduceSum.

Referenced by L2Error().

1003  {
1004  NekDouble L2error = -1.0;
1005 
1006  if (m_NumQuadPointsError == 0)
1007  {
1008  if (m_fields[field]->GetPhysState() == false)
1009  {
1010  m_fields[field]->BwdTrans(m_fields[field]->GetCoeffs(),
1011  m_fields[field]->UpdatePhys());
1012  }
1013 
1014  if (exactsoln.num_elements())
1015  {
1016  L2error = m_fields[field]->L2(m_fields[field]->GetPhys(), exactsoln);
1017  }
1018  else if (m_session->DefinesFunction("ExactSolution"))
1019  {
1021  exactsoln(m_fields[field]->GetNpoints());
1022 
1023  EvaluateFunction(m_session->GetVariable(field), exactsoln,
1024  "ExactSolution", m_time);
1025 
1026  L2error = m_fields[field]->L2(m_fields[field]->GetPhys(), exactsoln);
1027  }
1028  else
1029  {
1030  L2error = m_fields[field]->L2(m_fields[field]->GetPhys());
1031  }
1032 
1033  if (Normalised == true)
1034  {
1036  1.0);
1037 
1038  NekDouble Vol = m_fields[field]->PhysIntegral(one);
1039  m_comm->AllReduce(Vol, LibUtilities::ReduceSum);
1040 
1041  L2error = sqrt(L2error*L2error/Vol);
1042  }
1043  }
1044  else
1045  {
1046  Array<OneD,NekDouble> L2INF(2);
1047  L2INF = ErrorExtraPoints(field);
1048  L2error = L2INF[0];
1049  }
1050  return L2error;
1051  }
NekDouble m_time
Current time of simulation.
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > ErrorExtraPoints(unsigned int field)
Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf].
LibUtilities::CommSharedPtr m_comm
Communicator.
double NekDouble
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
NekDouble Nektar::SolverUtils::EquationSystem::v_LinfError ( unsigned int  field,
const Array< OneD, NekDouble > &  exactsoln = NullNekDouble1DArray 
)
protectedvirtual

Virtual function for the L_inf error computation between fields and a given exact solution.

Compute the error in the L_inf-norm

Parameters
fieldThe field to compare.
exactsolnThe exact solution to compare with.
Returns
Error in the L_inft-norm.

Reimplemented in Nektar::PulseWaveSystem.

Definition at line 1059 of file EquationSystem.cpp.

References ErrorExtraPoints(), EvaluateFunction(), GetNpoints(), m_fields, m_NumQuadPointsError, m_session, and m_time.

Referenced by LinfError().

1062  {
1063  NekDouble Linferror = -1.0;
1064 
1065  if (m_NumQuadPointsError == 0)
1066  {
1067  if (m_fields[field]->GetPhysState() == false)
1068  {
1069  m_fields[field]->BwdTrans(m_fields[field]->GetCoeffs(),
1070  m_fields[field]->UpdatePhys());
1071  }
1072 
1073  if (exactsoln.num_elements())
1074  {
1075  Linferror = m_fields[field]->Linf(m_fields[field]->GetPhys(), exactsoln);
1076  }
1077  else if (m_session->DefinesFunction("ExactSolution"))
1078  {
1080  exactsoln(m_fields[field]->GetNpoints());
1081 
1082  EvaluateFunction(m_session->GetVariable(field), exactsoln,
1083  "ExactSolution", m_time);
1084 
1085  Linferror = m_fields[field]->Linf(m_fields[field]->GetPhys(), exactsoln);
1086  }
1087  else
1088  {
1089  Linferror = m_fields[field]->Linf(m_fields[field]->GetPhys());
1090  }
1091  }
1092  else
1093  {
1094  Array<OneD,NekDouble> L2INF(2);
1095  L2INF = ErrorExtraPoints(field);
1096  Linferror = L2INF[1];
1097  }
1098 
1099  return Linferror;
1100  }
NekDouble m_time
Current time of simulation.
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > ErrorExtraPoints(unsigned int field)
Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf].
double NekDouble
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
bool Nektar::SolverUtils::EquationSystem::v_NegatedOp ( void  )
virtual

Virtual function to identify if operator is negated in DoSolve.

Virtual function to define if operator in DoSolve is negated with regard to the strong form. This is currently only used in Arnoldi solves. Default is false.

Reimplemented in Nektar::CoupledLinearNS.

Definition at line 1482 of file EquationSystem.cpp.

1483  {
1484  return false;
1485  }
void Nektar::SolverUtils::EquationSystem::v_NumericalFlux ( Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  numflux 
)
privatevirtual

Reimplemented in Nektar::IncNavierStokes, Nektar::CFLtester, Nektar::SolverUtils::UnsteadySystem, Nektar::PulseWavePropagation, Nektar::ImageWarpingSystem, and Nektar::EigenValuesAdvection.

Definition at line 2401 of file EquationSystem.cpp.

References ASSERTL0.

Referenced by NumericalFlux().

2404  {
2405  ASSERTL0(false, "v_NumericalFlux: This function is not valid "
2406  "for the Base class");
2407  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void Nektar::SolverUtils::EquationSystem::v_NumericalFlux ( Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  numfluxX,
Array< OneD, Array< OneD, NekDouble > > &  numfluxY 
)
privatevirtual

Reimplemented in Nektar::SolverUtils::UnsteadySystem.

Definition at line 2409 of file EquationSystem.cpp.

References ASSERTL0.

2413  {
2414  ASSERTL0(false, "v_NumericalFlux: This function is not valid "
2415  "for the Base class");
2416  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void Nektar::SolverUtils::EquationSystem::v_NumFluxforScalar ( const Array< OneD, Array< OneD, NekDouble > > &  ufield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  uflux 
)
privatevirtual

Reimplemented in Nektar::SolverUtils::UnsteadySystem.

Definition at line 2418 of file EquationSystem.cpp.

References ASSERTL0.

Referenced by NumFluxforScalar().

2421  {
2422  ASSERTL0(false, "v_NumFluxforScalar: This function is not valid "
2423  "for the Base class");
2424  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void Nektar::SolverUtils::EquationSystem::v_NumFluxforVector ( const Array< OneD, Array< OneD, NekDouble > > &  ufield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  qfield,
Array< OneD, Array< OneD, NekDouble > > &  qflux 
)
privatevirtual

Reimplemented in Nektar::SolverUtils::UnsteadySystem.

Definition at line 2426 of file EquationSystem.cpp.

References ASSERTL0.

Referenced by NumFluxforVector().

2430  {
2431  ASSERTL0(false, "v_NumFluxforVector: This function is not valid "
2432  "for the Base class");
2433  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void Nektar::SolverUtils::EquationSystem::v_Output ( void  )
protectedvirtual

Write the field data to file. The file is named according to the session name with the extension .fld appended.

Reimplemented in Nektar::CoupledLinearNS, and Nektar::PulseWaveSystem.

Definition at line 1515 of file EquationSystem.cpp.

References m_sessionName, and WriteFld().

Referenced by Output().

1516  {
1517  WriteFld(m_sessionName + ".fld");
1518  }
std::string m_sessionName
Name of the session.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
void Nektar::SolverUtils::EquationSystem::v_SetInitialConditions ( NekDouble  initialtime = 0.0,
bool  dumpInitialConditions = true,
const int  domain = 0 
)
protectedvirtual

Set the physical fields based on a restart file, or a function describing the initial condition given in the session.

Parameters
initialtimeTime at which to evaluate the function.
dumpInitialConditionsWrite the initial condition to file?

Reimplemented in Nektar::CompressibleFlowSystem, Nektar::NonlinearPeregrine, Nektar::EulerADCFE, Nektar::EulerCFE, Nektar::NavierStokesCFE, Nektar::Monodomain, Nektar::Bidomain, and Nektar::BidomainRoth.

Definition at line 1180 of file EquationSystem.cpp.

References Checkpoint_Output(), DescribeFunction(), EvaluateFunction(), GetNcoeffs(), m_checksteps, m_fields, m_session, m_time, and Vmath::Zero().

Referenced by SetInitialConditions().

1183  {
1184  if (m_session->GetComm()->GetRank() == 0)
1185  {
1186  cout << "Initial Conditions:" << endl;
1187  }
1188 
1189  if (m_session->DefinesFunction("InitialConditions"))
1190  {
1191  EvaluateFunction(m_session->GetVariables(), m_fields,
1192  "InitialConditions", m_time, domain);
1193 
1194  if (m_session->GetComm()->GetRank() == 0)
1195  {
1196 
1197  for (int i = 0; i < m_fields.num_elements(); ++i)
1198  {
1199  std::string varName = m_session->GetVariable(i);
1200  cout << " - Field " << varName << ": "
1201  << DescribeFunction(varName, "InitialConditions",domain)
1202  << endl;
1203  }
1204  }
1205  }
1206  else
1207  {
1208  int nq = m_fields[0]->GetNpoints();
1209  for (int i = 0; i < m_fields.num_elements(); i++)
1210  {
1211  Vmath::Zero(nq, m_fields[i]->UpdatePhys(), 1);
1212  m_fields[i]->SetPhysState(true);
1214  m_fields[i]->UpdateCoeffs(), 1);
1215  if (m_session->GetComm()->GetRank() == 0)
1216  {
1217  cout << " - Field " << m_session->GetVariable(i)
1218  << ": 0 (default)" << endl;
1219  }
1220  }
1221 
1222  }
1223 
1224  if (dumpInitialConditions && m_checksteps)
1225  {
1226  Checkpoint_Output(0);
1227  }
1228  }
SOLVER_UTILS_EXPORT std::string DescribeFunction(std::string pFieldName, const std::string &pFunctionName, const int domain)
Provide a description of a function for a given field name.
NekDouble m_time
Current time of simulation.
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
int m_checksteps
Number of steps between checkpoints.
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetNcoeffs()
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
void Nektar::SolverUtils::EquationSystem::v_TransCoeffToPhys ( void  )
protectedvirtual

Virtual function for transformation to physical space.

Reimplemented in Nektar::IncNavierStokes, Nektar::CoupledLinearNS, and Nektar::VelocityCorrectionScheme.

Definition at line 1490 of file EquationSystem.cpp.

Referenced by TransCoeffToPhys().

1491  {
1492 
1493  }
void Nektar::SolverUtils::EquationSystem::v_TransPhysToCoeff ( void  )
protectedvirtual

Virtual function for transformation to coefficient space.

Reimplemented in Nektar::IncNavierStokes, Nektar::CoupledLinearNS, and Nektar::VelocityCorrectionScheme.

Definition at line 1498 of file EquationSystem.cpp.

Referenced by TransPhysToCoeff().

1499  {
1500 
1501  }
void Nektar::SolverUtils::EquationSystem::WeakAdvectionDivergenceForm ( const Array< OneD, Array< OneD, NekDouble > > &  F,
Array< OneD, NekDouble > &  outarray 
)

Compute the inner product $ (\phi, \nabla \cdot F) $.

Calculate Inner product of the divergence advection form $(\phi, \nabla \cdot F)$, where for example $ F = uV $.

Parameters
FFields.
outarrayStorage for result.

Definition at line 1568 of file EquationSystem.cpp.

References Nektar::MultiRegions::DirCartesianMap, m_fields, and Vmath::Vadd().

1571  {
1572  // Use dimension of Velocity vector to dictate dimension of operation
1573  int ndim = F.num_elements();
1574  int nPointsTot = m_fields[0]->GetNpoints();
1575  Array<OneD, NekDouble> tmp(nPointsTot);
1576  Array<OneD, NekDouble> div(nPointsTot, 0.0);
1577 
1578  // Evaluate the divergence
1579  for (int i = 0; i < ndim; ++i)
1580  {
1581  //m_fields[0]->PhysDeriv(i,F[i],tmp);
1582  m_fields[0]->PhysDeriv(MultiRegions::DirCartesianMap[i],F[i],tmp);
1583  Vmath::Vadd(nPointsTot, tmp, 1, div, 1, div, 1);
1584  }
1585 
1586  m_fields[0]->IProductWRTBase(div, outarray);
1587  }
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:86
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:285
void Nektar::SolverUtils::EquationSystem::WeakAdvectionGreensDivergenceForm ( const Array< OneD, Array< OneD, NekDouble > > &  F,
Array< OneD, NekDouble > &  outarray 
)

Compute the inner product $ (\nabla \phi \cdot F) $.

Computes the weak Green form of advection terms (without boundary integral), i.e. $ (\nabla \phi \cdot F) $ where for example $ F=uV $.

Parameters
FFields.
outarrayStorage for result.
Note
Assuming all fields are of the same expansion and order so that we can use the parameters of m_fields[0].

Definition at line 1555 of file EquationSystem.cpp.

References m_fields.

Referenced by WeakDGAdvection(), and WeakDGDiffusion().

1558  {
1559  m_fields[0]->IProductWRTDerivBase(F,outarray);
1560  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Nektar::SolverUtils::EquationSystem::WeakAdvectionNonConservativeForm ( const Array< OneD, Array< OneD, NekDouble > > &  V,
const Array< OneD, const NekDouble > &  u,
Array< OneD, NekDouble > &  outarray,
bool  UseContCoeffs = false 
)

Compute the inner product $ (\phi, V\cdot \nabla u) $.

Calculate Inner product of the divergence advection form $ (\phi, V\cdot \nabla u) $

Parameters
VFields.
uFields.
outarrayStorage for result.

Definition at line 1596 of file EquationSystem.cpp.

References AdvectionNonConservativeForm(), Nektar::MultiRegions::eGlobal, and m_fields.

1601  {
1602  // use dimension of Velocity vector to dictate dimension of operation
1603  int ndim = V.num_elements();
1604 
1605  int nPointsTot = m_fields[0]->GetNpoints();
1606  Array<OneD, NekDouble> tmp(nPointsTot);
1607  Array<OneD, NekDouble> wk(ndim * nPointsTot, 0.0);
1608 
1609  AdvectionNonConservativeForm(V, u, tmp, wk);
1610 
1611  if (UseContCoeffs)
1612  {
1613  m_fields[0]->IProductWRTBase(tmp, outarray,
1615  }
1616  else
1617  {
1618  m_fields[0]->IProductWRTBase_IterPerExp(tmp, outarray);
1619  }
1620  }
f SOLVER_UTILS_EXPORT void AdvectionNonConservativeForm(const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wk=NullNekDouble1DArray)
Compute the non-conservative advection.
Global coefficients.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Nektar::SolverUtils::EquationSystem::WeakDGAdvection ( const Array< OneD, Array< OneD, NekDouble > > &  InField,
Array< OneD, Array< OneD, NekDouble > > &  OutField,
bool  NumericalFluxIncludesNormal = true,
bool  InFieldIsInPhysSpace = false,
int  nvariables = 0 
)

Calculate the weak discontinuous Galerkin advection.

Calculate weak DG advection in the form $ \langle\phi, \hat{F}\cdot n\rangle - (\nabla \phi \cdot F) $.

Parameters
InFieldFields.
OutFieldStorage for result.
NumericalFluxIncludesNormalDefault: true.
InFieldIsPhysSpaceDefault: false.
nvariablesNumber of fields.

Definition at line 1693 of file EquationSystem.cpp.

References GetFluxVector(), GetNcoeffs(), GetNpoints(), GetTraceNpoints(), m_expdim, m_fields, Vmath::Neg(), NumericalFlux(), and WeakAdvectionGreensDivergenceForm().

Referenced by Nektar::ImageWarpingSystem::DoOdeRhs(), Nektar::PulseWavePropagation::DoOdeRhs(), Nektar::CFLtester::DoOdeRhs(), and Nektar::EigenValuesAdvection::v_DoSolve().

1699  {
1700  int i;
1701  int nVelDim = m_expdim;
1702  int nPointsTot = GetNpoints();
1703  int ncoeffs = GetNcoeffs();
1704  int nTracePointsTot = GetTraceNpoints();
1705 
1706  if (!nvariables)
1707  {
1708  nvariables = m_fields.num_elements();
1709  }
1710 
1711  Array<OneD, Array<OneD, NekDouble> > fluxvector(nVelDim);
1712  Array<OneD, Array<OneD, NekDouble> > physfield (nvariables);
1713 
1714  for(i = 0; i < nVelDim; ++i)
1715  {
1716  fluxvector[i] = Array<OneD, NekDouble>(nPointsTot);
1717  }
1718 
1719  // Get the variables in physical space
1720  // already in physical space
1721  if (InFieldIsInPhysSpace == true)
1722  {
1723  for (i = 0; i < nvariables; ++i)
1724  {
1725  physfield[i] = InField[i];
1726  }
1727  }
1728  // otherwise do a backward transformation
1729  else
1730  {
1731  for(i = 0; i < nvariables; ++i)
1732  {
1733  // Could make this point to m_fields[i]->UpdatePhys();
1734  physfield[i] = Array<OneD, NekDouble>(nPointsTot);
1735  m_fields[i]->BwdTrans(InField[i],physfield[i]);
1736  }
1737  }
1738 
1739  // Get the advection part (without numerical flux)
1740  for (i = 0; i < nvariables; ++i)
1741  {
1742  // Get the ith component of the flux vector in (physical space)
1743  GetFluxVector(i, physfield, fluxvector);
1744 
1745  // Calculate the i^th value of (\grad_i \phi, F)
1746  WeakAdvectionGreensDivergenceForm(fluxvector,OutField[i]);
1747  }
1748 
1749  // Get the numerical flux and add to the modal coeffs
1750  // if the NumericalFluxs function already includes the
1751  // normal in the output
1752  if (NumericalFluxIncludesNormal == true)
1753  {
1754  Array<OneD, Array<OneD, NekDouble> > numflux (nvariables);
1755 
1756  for (i = 0; i < nvariables; ++i)
1757  {
1758  numflux[i] = Array<OneD, NekDouble>(nTracePointsTot);
1759  }
1760 
1761  // Evaluate numerical flux in physical space which may in
1762  // general couple all component of vectors
1763  NumericalFlux(physfield, numflux);
1764 
1765  // Evaulate <\phi, \hat{F}\cdot n> - OutField[i]
1766  for (i = 0; i < nvariables; ++i)
1767  {
1768  Vmath::Neg(ncoeffs,OutField[i],1);
1769  m_fields[i]->AddTraceIntegral(numflux[i],OutField[i]);
1770  m_fields[i]->SetPhysState(false);
1771  }
1772  }
1773  // if the NumericalFlux function does not include the
1774  // normal in the output
1775  else
1776  {
1777  Array<OneD, Array<OneD, NekDouble> > numfluxX (nvariables);
1778  Array<OneD, Array<OneD, NekDouble> > numfluxY (nvariables);
1779 
1780  for (i = 0; i < nvariables; ++i)
1781  {
1782  numfluxX[i] = Array<OneD, NekDouble>(nTracePointsTot);
1783  numfluxY[i] = Array<OneD, NekDouble>(nTracePointsTot);
1784  }
1785 
1786  // Evaluate numerical flux in physical space which may in
1787  // general couple all component of vectors
1788  NumericalFlux(physfield, numfluxX, numfluxY);
1789 
1790  // Evaulate <\phi, \hat{F}\cdot n> - OutField[i]
1791  for(i = 0; i < nvariables; ++i)
1792  {
1793  Vmath::Neg(ncoeffs,OutField[i],1);
1794  m_fields[i]->AddTraceIntegral(numfluxX[i], numfluxY[i],
1795  OutField[i]);
1796  m_fields[i]->SetPhysState(false);
1797  }
1798  }
1799  }
int m_expdim
Expansion dimension.
SOLVER_UTILS_EXPORT void WeakAdvectionGreensDivergenceForm(const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
Compute the inner product .
SOLVER_UTILS_EXPORT void NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:382
SOLVER_UTILS_EXPORT void GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetTraceNpoints()
SOLVER_UTILS_EXPORT int GetNcoeffs()
void Nektar::SolverUtils::EquationSystem::WeakDGDiffusion ( const Array< OneD, Array< OneD, NekDouble > > &  InField,
Array< OneD, Array< OneD, NekDouble > > &  OutField,
bool  NumericalFluxIncludesNormal = true,
bool  InFieldIsInPhysSpace = false 
)

Calculate weak DG Diffusion in the LDG form.

Calculate weak DG Diffusion in the LDG form $ \langle\psi, \hat{u}\cdot n\rangle - \langle\nabla\psi \cdot u\rangle \langle\phi, \hat{q}\cdot n\rangle - (\nabla \phi \cdot q) \rangle $

Definition at line 1807 of file EquationSystem.cpp.

References GetFluxVector(), GetNcoeffs(), GetNpoints(), GetTraceNpoints(), m_fields, m_spacedim, m_tanbasis, Vmath::Neg(), NumFluxforScalar(), NumFluxforVector(), Vmath::Vadd(), Vmath::Vcopy(), Vmath::Vmul(), and WeakAdvectionGreensDivergenceForm().

1812  {
1813  int i, j, k;
1814  int nPointsTot = GetNpoints();
1815  int ncoeffs = GetNcoeffs();
1816  int nTracePointsTot = GetTraceNpoints();
1817  int nvariables = m_fields.num_elements();
1818  int nqvar = 2;
1819 
1820  Array<OneD, NekDouble> qcoeffs (ncoeffs);
1821  Array<OneD, NekDouble> temp (ncoeffs);
1822 
1824  Array<OneD, Array<OneD, NekDouble> > ufield (nvariables);
1825 
1828 
1829  for (j = 0; j < nqvar; ++j)
1830  {
1831  qfield[j] = Array<OneD, Array<OneD, NekDouble> >(nqvar);
1832  flux[j] = Array<OneD, Array<OneD, NekDouble> >(nqvar);
1833 
1834  for (i = 0; i< nvariables; ++i)
1835  {
1836  ufield[i] = Array<OneD, NekDouble>(nPointsTot, 0.0);
1837  qfield[j][i] = Array<OneD, NekDouble>(nPointsTot, 0.0);
1838  flux[j][i] = Array<OneD, NekDouble>(nTracePointsTot, 0.0);
1839  }
1840  }
1841 
1842  for (k = 0; k < m_spacedim; ++k)
1843  {
1844  fluxvector[k] = Array<OneD, NekDouble>(nPointsTot, 0.0);
1845  }
1846 
1847  // Get the variables in physical space already in physical space
1848  if (InFieldIsInPhysSpace == true)
1849  {
1850  for (i = 0; i < nvariables; ++i)
1851  {
1852  ufield[i] = InField[i];
1853  }
1854  }
1855  // Otherwise do a backward transformation
1856  else
1857  {
1858  for (i = 0; i < nvariables; ++i)
1859  {
1860  // Could make this point to m_fields[i]->UpdatePhys();
1861  ufield[i] = Array<OneD, NekDouble>(nPointsTot);
1862  m_fields[i]->BwdTrans(InField[i],ufield[i]);
1863  }
1864  }
1865 
1866  // ##########################################################
1867  // Compute q_{\eta} and q_{\xi} from su
1868  // Obtain Numerical Fluxes
1869  // ##########################################################
1870  NumFluxforScalar(ufield, flux);
1871 
1872  for (j = 0; j < nqvar; ++j)
1873  {
1874  for (i = 0; i < nvariables; ++i)
1875  {
1876  // Get the ith component of the flux vector in
1877  // (physical space) fluxvector = m_tanbasis * u,
1878  // where m_tanbasis = 2 by m_spacedim by nPointsTot
1879  if (m_tanbasis.num_elements())
1880  {
1881  for (k = 0; k < m_spacedim; ++k)
1882  {
1883  Vmath::Vmul(nPointsTot, m_tanbasis[j][k], 1,
1884  ufield[i], 1, fluxvector[k], 1);
1885  }
1886  }
1887  else
1888  {
1889  GetFluxVector(i, j, ufield, fluxvector);
1890  }
1891 
1892  // Calculate the i^th value of (\grad_i \phi, F)
1893  WeakAdvectionGreensDivergenceForm(fluxvector, qcoeffs);
1894 
1895  Vmath::Neg(ncoeffs,qcoeffs,1);
1896  m_fields[i]->AddTraceIntegral(flux[j][i], qcoeffs);
1897  m_fields[i]->SetPhysState(false);
1898 
1899  // Add weighted mass matrix = M ( \nabla \cdot Tanbasis )
1900 // if(m_gradtan.num_elements())
1901 // {
1902 // MultiRegions::GlobalMatrixKey key(StdRegions::eMass,
1903 // m_gradtan[j]);
1904 // m_fields[i]->MultiRegions::ExpList::GeneralMatrixOp(key,
1905 // InField[i], temp);
1906 // Vmath::Svtvp(ncoeffs, -1.0, temp, 1, qcoeffs, 1,
1907 // qcoeffs, 1);
1908 // }
1909 
1910  //Multiply by the inverse of mass matrix
1911  m_fields[i]->MultiplyByElmtInvMass(qcoeffs, qcoeffs);
1912 
1913  // Back to physical space
1914  m_fields[i]->BwdTrans(qcoeffs, qfield[j][i]);
1915  }
1916  }
1917 
1918 
1919  // ##########################################################
1920  // Compute u from q_{\eta} and q_{\xi}
1921  // ##########################################################
1922 
1923  // Obtain Numerical Fluxes
1924  NumFluxforVector(ufield, qfield, flux[0]);
1925 
1926  for (i = 0; i < nvariables; ++i)
1927  {
1928  // L = L(tan_eta) q_eta + L(tan_xi) q_xi
1929  OutField[i] = Array<OneD, NekDouble>(ncoeffs, 0.0);
1930  temp = Array<OneD, NekDouble>(ncoeffs, 0.0);
1931 
1932  if (m_tanbasis.num_elements())
1933  {
1934  for (j = 0; j < nqvar; ++j)
1935  {
1936  for (k = 0; k < m_spacedim; ++k)
1937  {
1938  Vmath::Vmul(nPointsTot, m_tanbasis[j][k], 1,
1939  qfield[j][i], 1, fluxvector[k], 1);
1940  }
1941 
1942  WeakAdvectionGreensDivergenceForm(fluxvector, temp);
1943  Vmath::Vadd(ncoeffs, temp, 1, OutField[i], 1,
1944  OutField[i], 1);
1945  }
1946  }
1947  else
1948  {
1949  for (k = 0; k < m_spacedim; ++k)
1950  {
1951  Vmath::Vcopy(nPointsTot, qfield[k][i], 1,
1952  fluxvector[k], 1);
1953  }
1954 
1955  WeakAdvectionGreensDivergenceForm(fluxvector, OutField[i]);
1956  }
1957 
1958  // Evaulate <\phi, \hat{F}\cdot n> - OutField[i]
1959  Vmath::Neg(ncoeffs,OutField[i],1);
1960  m_fields[i]->AddTraceIntegral(flux[0][i], OutField[i]);
1961  m_fields[i]->SetPhysState(false);
1962  }
1963  }
SOLVER_UTILS_EXPORT void NumFluxforScalar(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
SOLVER_UTILS_EXPORT void WeakAdvectionGreensDivergenceForm(const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
Compute the inner product .
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tanbasis
2 x m_spacedim x nq
int m_spacedim
Spatial dimension (>= expansion dim).
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:382
SOLVER_UTILS_EXPORT void GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetTraceNpoints()
SOLVER_UTILS_EXPORT int GetNcoeffs()
SOLVER_UTILS_EXPORT void NumFluxforVector(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:285
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::SolverUtils::EquationSystem::WriteFld ( const std::string &  outname)

Write field data to the given filename.

Writes the field data to a file with the given filename.

Parameters
outnameFilename to write to.

Definition at line 2009 of file EquationSystem.cpp.

References GetNcoeffs(), m_boundaryConditions, m_fields, and v_ExtraFldOutput().

Referenced by Checkpoint_BaseFlow(), Checkpoint_Output(), Nektar::EulerCFE::SetInitialRinglebFlow(), Nektar::BidomainRoth::v_InitObject(), Nektar::Monodomain::v_InitObject(), Nektar::CoupledLinearNS::v_Output(), and v_Output().

2010  {
2011  std::vector<Array<OneD, NekDouble> > fieldcoeffs(
2012  m_fields.num_elements());
2013  std::vector<std::string> variables(m_fields.num_elements());
2014 
2015  for (int i = 0; i < m_fields.num_elements(); ++i)
2016  {
2017  if (m_fields[i]->GetNcoeffs() == m_fields[0]->GetNcoeffs())
2018  {
2019  fieldcoeffs[i] = m_fields[i]->UpdateCoeffs();
2020  }
2021  else
2022  {
2023  fieldcoeffs[i] = Array<OneD,NekDouble>(m_fields[0]->
2024  GetNcoeffs());
2025  m_fields[0]->ExtractCoeffsToCoeffs(m_fields[i],
2026  m_fields[i]->GetCoeffs(),
2027  fieldcoeffs[i]);
2028  }
2029  variables[i] = m_boundaryConditions->GetVariable(i);
2030  }
2031 
2032  v_ExtraFldOutput(fieldcoeffs, variables);
2033 
2034  WriteFld(outname, m_fields[0], fieldcoeffs, variables);
2035  }
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
Pointer to boundary conditions object.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetNcoeffs()
void Nektar::SolverUtils::EquationSystem::WriteFld ( const std::string &  outname,
MultiRegions::ExpListSharedPtr field,
std::vector< Array< OneD, NekDouble > > &  fieldcoeffs,
std::vector< std::string > &  variables 
)

Write input fields to the given filename.

Writes the field data to a file with the given filename.

Parameters
outnameFilename to write to.
fieldExpList on which data is based.
fieldcoeffsAn array of array of expansion coefficients.
variablesAn array of variable names.

Definition at line 2046 of file EquationSystem.cpp.

References Nektar::GlobalMapping::Mapping::Load(), m_fieldMetaDataMap, m_fld, m_session, m_time, and Nektar::GlobalMapping::MappingSharedPtr.

2051  {
2052  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
2053  = field->GetFieldDefinitions();
2054  std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
2055 
2056  // Copy Data into FieldData and set variable
2057  for(int j = 0; j < fieldcoeffs.size(); ++j)
2058  {
2059  for(int i = 0; i < FieldDef.size(); ++i)
2060  {
2061  // Could do a search here to find correct variable
2062  FieldDef[i]->m_fields.push_back(variables[j]);
2063  field->AppendFieldData(FieldDef[i], FieldData[i],
2064  fieldcoeffs[j]);
2065  }
2066  }
2067 
2068  // Update time in field info if required
2069  if(m_fieldMetaDataMap.find("Time") != m_fieldMetaDataMap.end())
2070  {
2071  m_fieldMetaDataMap["Time"] = boost::lexical_cast<std::string>(m_time);
2072  }
2073 
2074  // If necessary, add mapping information to metadata
2075  // and output mapping coordinates
2077  fields[0] = field;
2081  mapping->Output( fieldMetaDataMap, outname);
2082 
2083  m_fld->Write(outname, FieldDef, FieldData, fieldMetaDataMap);
2084  }
NekDouble m_time
Current time of simulation.
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:53
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
GLOBAL_MAPPING_EXPORT typedef boost::shared_ptr< Mapping > MappingSharedPtr
A shared pointer to a Mapping object.
Definition: Mapping.h:51
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
static GLOBAL_MAPPING_EXPORT MappingSharedPtr Load(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Return a pointer to the mapping, creating it on first call.
Definition: Mapping.cpp:264
SOLVER_UTILS_EXPORT void Nektar::SolverUtils::EquationSystem::WriteHistoryData ( std::ostream &  out)

Probe each history point and write to file.

void Nektar::SolverUtils::EquationSystem::ZeroPhysFields ( void  )

Zero the physical fields.

Definition at line 1523 of file EquationSystem.cpp.

References GetNpoints(), m_fields, and Vmath::Zero().

Referenced by Nektar::PulseWaveSystem::v_InitObject(), and v_InitObject().

1524  {
1525  for (int i = 0; i < m_fields.num_elements(); i++)
1526  {
1528  m_fields[i]->UpdatePhys(),1);
1529  }
1530  }
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359

Member Data Documentation

Array<OneD, MultiRegions::ExpListSharedPtr> Nektar::SolverUtils::EquationSystem::m_base
protected

Base fields.

Definition at line 462 of file EquationSystem.h.

Referenced by ImportFldBase(), and SetUpBaseFields().

SpatialDomains::BoundaryConditionsSharedPtr Nektar::SolverUtils::EquationSystem::m_boundaryConditions
protected
Array<OneD, bool> Nektar::SolverUtils::EquationSystem::m_checkIfSystemSingular
protected

Flag to indicate if the fields should be checked for singularity.

Definition at line 522 of file EquationSystem.h.

Referenced by v_InitObject().

int Nektar::SolverUtils::EquationSystem::m_checksteps
protected
NekDouble Nektar::SolverUtils::EquationSystem::m_checktime
protected

Time between checkpoints.

Definition at line 484 of file EquationSystem.h.

Referenced by Nektar::SolverUtils::UnsteadySystem::v_DoSolve(), and v_InitObject().

LibUtilities::CommSharedPtr Nektar::SolverUtils::EquationSystem::m_comm
protected
Array<OneD, MultiRegions::ExpListSharedPtr> Nektar::SolverUtils::EquationSystem::m_derivedfields
protected

Array holding all dependent variables.

Definition at line 464 of file EquationSystem.h.

int Nektar::SolverUtils::EquationSystem::m_expdim
protected
LibUtilities::FieldMetaDataMap Nektar::SolverUtils::EquationSystem::m_fieldMetaDataMap
protected
Array<OneD, MultiRegions::ExpListSharedPtr> Nektar::SolverUtils::EquationSystem::m_fields
protected

Array holding all dependent variables.

Definition at line 460 of file EquationSystem.h.

Referenced by Nektar::UnsteadyAdvectionDiffusion::AddAdvectionPenaltyFlux(), Nektar::NonlinearSWE::AddCoriolis(), Nektar::LinearSWE::AddCoriolis(), Nektar::NonlinearPeregrine::AddCoriolis(), Nektar::NonlinearSWE::AddVariableDepth(), Nektar::NonlinearPeregrine::AddVariableDepth(), AdvectionNonConservativeForm(), Nektar::VCSMapping::ApplyIncNSMappingForcing(), Nektar::LinearElasticSystem::BuildMatrixSystem(), Nektar::IncNavierStokes::CalcSteadyState(), Nektar::SolverUtils::UnsteadySystem::CheckForRestartTime(), Nektar::CoupledLinearNS::Continuation(), Nektar::ShallowWaterSystem::CopyBoundaryTrace(), CopyFromPhysField(), CopyToPhysField(), Nektar::CoupledLinearNS::DefineForcingTerm(), Nektar::Bidomain::DoImplicitSolve(), Nektar::BidomainRoth::DoImplicitSolve(), Nektar::Monodomain::DoImplicitSolve(), Nektar::UnsteadyDiffusion::DoImplicitSolve(), Nektar::UnsteadyAdvectionDiffusion::DoImplicitSolve(), Nektar::UnsteadyViscousBurgers::DoImplicitSolve(), Nektar::NonlinearSWE::DoOdeProjection(), Nektar::LinearSWE::DoOdeProjection(), Nektar::UnsteadyInviscidBurger::DoOdeProjection(), Nektar::UnsteadyDiffusion::DoOdeProjection(), Nektar::APE::DoOdeProjection(), Nektar::UnsteadyAdvection::DoOdeProjection(), Nektar::NonlinearPeregrine::DoOdeProjection(), Nektar::UnsteadyAdvectionDiffusion::DoOdeProjection(), Nektar::CFLtester::DoOdeProjection(), Nektar::PulseWavePropagation::DoOdeRhs(), Nektar::ImageWarpingSystem::DoOdeRhs(), Nektar::NonlinearSWE::DoOdeRhs(), Nektar::UnsteadyInviscidBurger::DoOdeRhs(), Nektar::LinearSWE::DoOdeRhs(), Nektar::Bidomain::DoOdeRhs(), Nektar::UnsteadyDiffusion::DoOdeRhs(), Nektar::BidomainRoth::DoOdeRhs(), Nektar::NavierStokesCFE::DoOdeRhs(), Nektar::APE::DoOdeRhs(), Nektar::EulerCFE::DoOdeRhs(), Nektar::UnsteadyAdvection::DoOdeRhs(), Nektar::EulerADCFE::DoOdeRhs(), Nektar::NonlinearPeregrine::DoOdeRhs(), Nektar::UnsteadyAdvectionDiffusion::DoOdeRhs(), Nektar::CFLtester::DoOdeRhs(), Nektar::UnsteadyViscousBurgers::DoOdeRhs(), ErrorExtraPoints(), Nektar::CoupledLinearNS::EvaluateAdvection(), Nektar::IncNavierStokes::EvaluateAdvectionTerms(), EvaluateFunction(), Nektar::CoupledLinearNS::EvaluateNewtonRHS(), Nektar::CompressibleFlowSystem::ExtrapOrder0BC(), FwdTransFields(), Nektar::APE::GetBasefield(), Nektar::IncNavierStokes::GetCFLEstimate(), GetCoeff_Offset(), Nektar::IncNavierStokes::GetElmtCFLVals(), Nektar::EulerCFE::GetExactIsentropicVortex(), Nektar::EulerCFE::GetExactRinglebFlow(), GetExpSize(), Nektar::NonlinearSWE::GetFluxVector(), Nektar::LinearSWE::GetFluxVector(), Nektar::NonlinearPeregrine::GetFluxVector(), Nektar::CompressibleFlowSystem::GetFluxVector(), Nektar::UnsteadyAdvectionDiffusion::GetFluxVectorAdv(), Nektar::UnsteadyViscousBurgers::GetFluxVectorAdv(), Nektar::UnsteadyAdvection::GetFluxVectorDeAlias(), Nektar::CompressibleFlowSystem::GetFluxVectorDeAlias(), Nektar::UnsteadyAdvectionDiffusion::GetMaxStdVelocity(), GetNcoeffs(), Nektar::UnsteadyAdvectionDiffusion::GetNormalVel(), Nektar::UnsteadyInviscidBurger::GetNormalVelocity(), Nektar::UnsteadyAdvection::GetNormalVelocity(), Nektar::UnsteadyViscousBurgers::GetNormalVelocity(), GetNpoints(), GetNumElmVelocity(), GetNumExpModesPerExp(), GetPhys_Offset(), Nektar::CFLtester::GetStdVelocity(), Nektar::UnsteadyAdvectionDiffusion::GetSubstepTimeStep(), GetTotPoints(), GetTraceNpoints(), Nektar::CompressibleFlowSystem::GetViscousFluxVector(), Nektar::CompressibleFlowSystem::GetViscousFluxVectorDeAlias(), ImportFld(), ImportFldBase(), ImportFldToMultiDomains(), Nektar::NonlinearPeregrine::LaitoneSolitaryWave(), Nektar::VCSMapping::MappingAccelerationCorrection(), Nektar::VCSMapping::MappingAdvectionCorrection(), Nektar::VCSMapping::MappingPressureCorrection(), Nektar::NonlinearPeregrine::NumericalFluxConsVariables(), Nektar::NonlinearPeregrine::NumericalFluxForcing(), Nektar::CompressibleFlowSystem::PressureInflowFileBC(), Nektar::CompressibleFlowSystem::PressureOutflowBC(), Nektar::CompressibleFlowSystem::PressureOutflowFileBC(), Nektar::CompressibleFlowSystem::PressureOutflowNonReflectiveBC(), Nektar::CompressibleFlowSystem::RiemannInvariantBC(), SessionSummary(), Nektar::NavierStokesCFE::SetBoundaryConditions(), Nektar::NonlinearSWE::SetBoundaryConditions(), Nektar::EulerADCFE::SetBoundaryConditions(), Nektar::EulerCFE::SetBoundaryConditions(), Nektar::LinearSWE::SetBoundaryConditions(), Nektar::APE::SetBoundaryConditions(), Nektar::NonlinearPeregrine::SetBoundaryConditions(), Nektar::IncNavierStokes::SetBoundaryConditions(), SetBoundaryConditions(), Nektar::NonlinearPeregrine::SetBoundaryConditionsContVariables(), Nektar::NonlinearPeregrine::SetBoundaryConditionsForcing(), Nektar::EulerCFE::SetBoundaryIsentropicVortex(), Nektar::EulerCFE::SetBoundaryRinglebFlow(), Nektar::CompressibleFlowSystem::SetCommonBC(), Nektar::EulerCFE::SetInitialIsentropicVortex(), Nektar::EulerCFE::SetInitialRinglebFlow(), Nektar::IncNavierStokes::SetRadiationBoundaryForcing(), Nektar::CoupledLinearNS::SetUpCoupledMatrix(), Nektar::IncNavierStokes::SetZeroNormalVelocity(), Nektar::CoupledLinearNS::Solve(), Nektar::CoupledLinearNS::SolveLinearNS(), Nektar::CoupledLinearNS::SolveSteadyNavierStokes(), Nektar::VelocityCorrectionScheme::SolveUnsteadyStokesSystem(), Nektar::CoupledLinearNS::SolveUnsteadyStokesSystem(), Nektar::UnsteadyAdvectionDiffusion::SubStepAdvance(), Nektar::UnsteadyAdvectionDiffusion::SubStepAdvection(), Nektar::SolverUtils::UnsteadySystem::SVVVarDiffCoeff(), Nektar::CompressibleFlowSystem::SymmetryBC(), UpdateFields(), Nektar::APE::UpdateSourceTerms(), Nektar::SolverUtils::UnsteadySystem::v_AppendOutput1D(), Nektar::NonlinearSWE::v_ConservativeToPrimitive(), Nektar::LinearSWE::v_ConservativeToPrimitive(), Nektar::NonlinearPeregrine::v_ConservativeToPrimitive(), Nektar::SteadyAdvectionDiffusion::v_DoInitialise(), Nektar::VCSMapping::v_DoInitialise(), Nektar::VelocityCorrectionScheme::v_DoInitialise(), Nektar::PulseWaveSystem::v_DoInitialise(), Nektar::CoupledLinearNS::v_DoInitialise(), Nektar::EigenValuesAdvection::v_DoSolve(), Nektar::Laplace::v_DoSolve(), Nektar::SteadyAdvectionDiffusion::v_DoSolve(), Nektar::IterativeElasticSystem::v_DoSolve(), Nektar::SolverUtils::UnsteadySystem::v_DoSolve(), Nektar::LinearElasticSystem::v_DoSolve(), Nektar::PulseWaveSystem::v_DoSolve(), Nektar::VCSMapping::v_EvaluateAdvection_SetPressureBCs(), Nektar::VelocityCorrectionScheme::v_EvaluateAdvection_SetPressureBCs(), v_EvaluateExactSolution(), Nektar::APE::v_ExtraFldOutput(), Nektar::LinearElasticSystem::v_ExtraFldOutput(), Nektar::Poisson::v_GenerateSummary(), Nektar::IncNavierStokes::v_GetFluxVector(), Nektar::CFLtester::v_GetTimeStep(), Nektar::Poisson::v_InitObject(), Nektar::VelocityCorrectionScheme::v_InitObject(), Nektar::VCSMapping::v_InitObject(), Nektar::NonlinearSWE::v_InitObject(), Nektar::LinearSWE::v_InitObject(), Nektar::Bidomain::v_InitObject(), Nektar::BidomainRoth::v_InitObject(), Nektar::Monodomain::v_InitObject(), Nektar::UnsteadyDiffusion::v_InitObject(), Nektar::ImageWarpingSystem::v_InitObject(), Nektar::IterativeElasticSystem::v_InitObject(), Nektar::APE::v_InitObject(), Nektar::EulerADCFE::v_InitObject(), Nektar::NonlinearPeregrine::v_InitObject(), Nektar::ShallowWaterSystem::v_InitObject(), Nektar::UnsteadyInviscidBurger::v_InitObject(), Nektar::UnsteadyAdvection::v_InitObject(), Nektar::IncNavierStokes::v_InitObject(), Nektar::LinearElasticSystem::v_InitObject(), Nektar::UnsteadyAdvectionDiffusion::v_InitObject(), Nektar::UnsteadyViscousBurgers::v_InitObject(), Nektar::PulseWaveSystem::v_InitObject(), Nektar::CompressibleFlowSystem::v_InitObject(), Nektar::CoupledLinearNS::v_InitObject(), v_InitObject(), v_L2Error(), v_LinfError(), Nektar::EigenValuesAdvection::v_NumericalFlux(), Nektar::ImageWarpingSystem::v_NumericalFlux(), Nektar::CFLtester::v_NumericalFlux(), Nektar::IncNavierStokes::v_NumericalFlux(), Nektar::SolverUtils::UnsteadySystem::v_NumFluxforScalar(), Nektar::SolverUtils::UnsteadySystem::v_NumFluxforVector(), Nektar::CoupledLinearNS::v_Output(), Nektar::NonlinearSWE::v_PrimitiveToConservative(), Nektar::LinearSWE::v_PrimitiveToConservative(), Nektar::NonlinearPeregrine::v_PrimitiveToConservative(), Nektar::NavierStokesCFE::v_SetInitialConditions(), v_SetInitialConditions(), Nektar::VCSMapping::v_SetUpPressureForcing(), Nektar::VelocityCorrectionScheme::v_SetUpPressureForcing(), Nektar::VCSMapping::v_SetUpViscousForcing(), Nektar::VelocityCorrectionScheme::v_SetUpViscousForcing(), Nektar::VCSMapping::v_SolvePressure(), Nektar::VCSMapping::v_SolveViscous(), Nektar::VelocityCorrectionScheme::v_SolveViscous(), Nektar::VelocityCorrectionScheme::v_TransCoeffToPhys(), Nektar::CoupledLinearNS::v_TransCoeffToPhys(), Nektar::VelocityCorrectionScheme::v_TransPhysToCoeff(), Nektar::CoupledLinearNS::v_TransPhysToCoeff(), Nektar::APE::WallBC(), Nektar::CompressibleFlowSystem::WallBC(), Nektar::NonlinearSWE::WallBoundary(), Nektar::LinearSWE::WallBoundary(), Nektar::NonlinearPeregrine::WallBoundary(), Nektar::NonlinearSWE::WallBoundary2D(), Nektar::LinearSWE::WallBoundary2D(), Nektar::NonlinearPeregrine::WallBoundary2D(), Nektar::NonlinearPeregrine::WallBoundaryContVariables(), Nektar::NonlinearPeregrine::WallBoundaryForcing(), Nektar::CompressibleFlowSystem::WallViscousBC(), Nektar::NonlinearPeregrine::WCESolve(), WeakAdvectionDivergenceForm(), WeakAdvectionGreensDivergenceForm(), WeakAdvectionNonConservativeForm(), WeakDGAdvection(), WeakDGDiffusion(), Nektar::SolverUtils::UnsteadySystem::WeakPenaltyforScalar(), Nektar::SolverUtils::UnsteadySystem::WeakPenaltyforVector(), WriteFld(), Nektar::IterativeElasticSystem::WriteGeometry(), and ZeroPhysFields().

NekDouble Nektar::SolverUtils::EquationSystem::m_fintime
protected

Finish time of the simulation.

Definition at line 476 of file EquationSystem.h.

Referenced by Nektar::SolverUtils::UnsteadySystem::v_DoSolve(), Nektar::PulseWaveSystem::v_InitObject(), and v_InitObject().

LibUtilities::FieldIOSharedPtr Nektar::SolverUtils::EquationSystem::m_fld
protected
Array<OneD, Array<OneD, Array<OneD,NekDouble> > > Nektar::SolverUtils::EquationSystem::m_gradtan
protected

1 x nvariable x nq

Definition at line 518 of file EquationSystem.h.

SpatialDomains::MeshGraphSharedPtr Nektar::SolverUtils::EquationSystem::m_graph
protected
bool Nektar::SolverUtils::EquationSystem::m_halfMode
protected

Flag to determine if half homogeneous mode is used.

Definition at line 498 of file EquationSystem.h.

Referenced by Nektar::IncNavierStokes::EvaluateAdvectionTerms(), SessionSummary(), SetUpBaseFields(), and v_InitObject().

int Nektar::SolverUtils::EquationSystem::m_HomoDirec
protected

number of homogenous directions

Definition at line 550 of file EquationSystem.h.

Referenced by v_InitObject().

bool Nektar::SolverUtils::EquationSystem::m_homogen_dealiasing
protected

Flag to determine if dealiasing is used for homogeneous simulations.

Definition at line 507 of file EquationSystem.h.

Referenced by SetUpBaseFields(), Nektar::VelocityCorrectionScheme::v_GenerateSummary(), Nektar::CoupledLinearNS::v_InitObject(), and v_InitObject().

enum HomogeneousType Nektar::SolverUtils::EquationSystem::m_HomogeneousType
protected
int Nektar::SolverUtils::EquationSystem::m_initialStep
protected

Number of the step where the simulation should begin.

Definition at line 474 of file EquationSystem.h.

Referenced by SetInitialStep(), Nektar::SolverUtils::UnsteadySystem::v_DoSolve(), and Nektar::SolverUtils::UnsteadySystem::v_InitObject().

map<std::string, Array<OneD, Array<OneD, unsigned int> > > Nektar::SolverUtils::EquationSystem::m_interpInds
protected

Map of the interpolation indices for a specific filename.

Definition at line 458 of file EquationSystem.h.

Referenced by EvaluateFunction().

map<std::string, Array<OneD, Array<OneD, float> > > Nektar::SolverUtils::EquationSystem::m_interpWeights
protected

Map of the interpolation weights for a specific filename.

Definition at line 456 of file EquationSystem.h.

Referenced by EvaluateFunction().

NekDouble Nektar::SolverUtils::EquationSystem::m_lambda
protected

Lambda constant in real system if one required.

Definition at line 480 of file EquationSystem.h.

Referenced by SetLambda(), and Nektar::CoupledLinearNS::v_DoInitialise().

NekDouble Nektar::SolverUtils::EquationSystem::m_LhomX
protected

physical length in X direction (if homogeneous)

Definition at line 542 of file EquationSystem.h.

NekDouble Nektar::SolverUtils::EquationSystem::m_LhomY