35 #ifndef NEKTAR_SOLVERUTILS_EQUATIONSYSTEM_H
36 #define NEKTAR_SOLVERUTILS_EQUATIONSYSTEM_H
55 namespace FieldUtils {
61 class FilterOperators;
114 std::shared_ptr<T>
as()
116 return std::dynamic_pointer_cast<T>( shared_from_this() );
136 std::vector<std::string> &variables);
153 bool dumpInitialConditions =
true,
154 const int domain = 0);
167 bool Normalised =
false);
172 bool Normalised =
false)
190 std::vector<std::string> &variables);
200 const std::string &outname,
203 std::vector<std::string> &variables);
207 const std::string &infile,
212 const std::string &infile,
219 const std::string &infile,
220 std::vector<std::string> &fieldStr,
226 const std::string &infile,
228 std::string &pFieldName);
291 const bool modbasis);
453 bool Normalised =
false);
466 bool dumpInitialConditions =
true,
467 const int domain = 0);
482 std::vector<std::string> &variables);
491 const int goal)
const
576 return v_L2Error(field, exactsoln, Normalised);
596 std::vector<std::string> &variables)
610 if (
m_session->GetComm()->GetRank() == 0)
612 std::vector<std::pair<std::string, std::string> > vSummary;
615 out <<
"=======================================================================" << std::endl;
616 for (
auto &x : vSummary)
620 out << x.first <<
": " << x.second << std::endl;
622 out <<
"=======================================================================" << std::endl;
632 bool dumpInitialConditions,
664 return m_fields[0]->GetNcoeffs(eid);
669 return m_graph->GetExpansionInfo().begin()->second->m_basisKeyVector[0]
675 return m_fields[0]->EvalBasisNumModesMaxPerExp();
695 return m_fields[0]->GetTrace()->GetNpoints();
705 return m_fields[0]->GetPhys_Offset(n);
710 return m_fields[0]->GetCoeff_Offset(n);
720 return m_fields[0]->GetTotPoints(n);
#define SOLVER_UTILS_EXPORT
Provides a generic Factory class.
A base class for describing how to solve specific equations.
std::shared_ptr< T > as()
SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
Reset Session name.
virtual SOLVER_UTILS_EXPORT void v_DoInitialise()
Virtual function for initialisation implementation.
SOLVER_UTILS_EXPORT Array< OneD, MultiRegions::ExpListSharedPtr > & UpdateFields()
SOLVER_UTILS_EXPORT int GetSteps()
int m_spacedim
Spatial dimension (>= expansion dim).
SOLVER_UTILS_EXPORT void SetInitialStep(const int step)
SOLVER_UTILS_EXPORT int GetTraceNpoints()
SOLVER_UTILS_EXPORT void ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
SOLVER_UTILS_EXPORT LibUtilities::FieldMetaDataMap & UpdateFieldMetaDataMap()
Get hold of FieldInfoMap so it can be updated.
bool m_useFFT
Flag to determine if FFT is used for homogeneous transform.
SOLVER_UTILS_EXPORT int GetNvariables()
SOLVER_UTILS_EXPORT int GetCheckpointSteps()
int m_expdim
Expansion dimension.
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
SOLVER_UTILS_EXPORT void SessionSummary(SummaryList &vSummary)
Write out a session summary.
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
virtual SOLVER_UTILS_EXPORT ~EquationSystem()
Destructor.
SOLVER_UTILS_EXPORT void SetSteps(const int steps)
SOLVER_UTILS_EXPORT void TransCoeffToPhys()
Transform from coefficient to physical space.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
int m_npointsX
number of points in X direction (if homogeneous)
LibUtilities::CommSharedPtr m_comm
Communicator.
NekDouble m_timestep
Time step size.
SOLVER_UTILS_EXPORT void ImportFld(const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Input field data from the given file.
NekDouble m_time
Current time of simulation.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
bool m_multipleModes
Flag to determine if use multiple homogenenous modes are used.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT void DoInitialise()
Perform any initialisation necessary before solving the problem.
SOLVER_UTILS_EXPORT NekDouble LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
Linf error computation.
SOLVER_UTILS_EXPORT const std::string GetVariable(unsigned int i)
NekDouble m_LhomX
physical length in X direction (if homogeneous)
SOLVER_UTILS_EXPORT void DoSolve()
Solve the problem.
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff()
Virtual function for transformation to coefficient space.
SOLVER_UTILS_EXPORT NekDouble L2Error(unsigned int field, bool Normalised=false)
Compute the L2 error of the fields.
SOLVER_UTILS_EXPORT void EvaluateExactSolution(int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
Evaluates an exact solution.
NekDouble m_fintime
Finish time of the simulation.
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.
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure(void)
NekDouble m_lambda
Lambda constant in real system if one required.
NekDouble m_lastCheckTime
SOLVER_UTILS_EXPORT void SetCheckpointNumber(int num)
int m_npointsZ
number of points in Z direction (if homogeneous)
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
std::map< std::string, SolverUtils::SessionFunctionSharedPtr > m_sessionFunctions
Map of known SessionFunctions.
NekDouble m_checktime
Time between checkpoints.
SOLVER_UTILS_EXPORT NekDouble GetTimeStep()
SOLVER_UTILS_EXPORT void TransPhysToCoeff()
Transform from physical to coefficient space.
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.
SOLVER_UTILS_EXPORT int GetCoeff_Offset(int n)
SOLVER_UTILS_EXPORT void Output()
Perform output operations after solve.
SOLVER_UTILS_EXPORT const Array< OneD, int > GetNumExpModesPerExp()
static std::string equationSystemTypeLookupIds[]
NekDouble m_timestepMax
Time step size.
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
SOLVER_UTILS_EXPORT NekDouble GetFinalTime()
Return final time.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
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.
SOLVER_UTILS_EXPORT int GetExpSize()
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.
NekDouble m_LhomY
physical length in Y direction (if homogeneous)
int m_npointsY
number of points in Y direction (if homogeneous)
SOLVER_UTILS_EXPORT void SetModifiedBasis(const bool modbasis)
std::string m_sessionName
Name of the session.
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow(const int n)
Write base flow file of m_fields.
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
bool m_singleMode
Flag to determine if single homogeneous mode is used.
HomogeneousType
Parameter for homogeneous expansions.
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp()
Virtual function to identify if operator is negated in DoSolve.
SOLVER_UTILS_EXPORT void ZeroPhysFields()
int m_HomoDirec
number of homogenous directions
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
SOLVER_UTILS_EXPORT void SetCheckpointSteps(int num)
int m_initialStep
Number of the step where the simulation should begin.
enum HomogeneousType m_HomogeneousType
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].
SOLVER_UTILS_EXPORT std::string GetSessionName()
Get Session name.
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, bool > m_checkIfSystemSingular
Flag to indicate if the fields should be checked for singularity.
bool m_homogen_dealiasing
Flag to determine if dealiasing is used for homogeneous simulations.
SOLVER_UTILS_EXPORT int GetNcoeffs()
int m_nchk
Number of checkpoints written so far.
SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr GetSession()
Get Session name.
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
NekDouble m_TimeIncrementFactor
SOLVER_UTILS_EXPORT void CopyFromPhysField(const int i, Array< OneD, NekDouble > &output)
virtual SOLVER_UTILS_EXPORT void v_DoSolve()
Virtual function for solve implementation.
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure()
Get pressure field if available.
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
virtual SOLVER_UTILS_EXPORT Array< OneD, bool > v_GetSystemSingularChecks()
SOLVER_UTILS_EXPORT void SetLambda(NekDouble lambda)
Set parameter m_lambda.
int m_steps
Number of steps to take.
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
SOLVER_UTILS_EXPORT void PrintProgressbar(const int position, const int goal) const
SOLVER_UTILS_EXPORT EquationSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises EquationSystem class members.
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
SOLVER_UTILS_EXPORT int GetNumExpModes()
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
Pointer to boundary conditions object.
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
NekDouble m_LhomZ
physical length in Z direction (if homogeneous)
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &l)
Virtual function for generating summary information.
bool m_halfMode
Flag to determine if half homogeneous mode is used.
SOLVER_UTILS_EXPORT void FwdTransFields()
SOLVER_UTILS_EXPORT void InitObject()
Initialises the members of this object.
int m_checksteps
Number of steps between checkpoints.
SOLVER_UTILS_EXPORT void SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
Initialise the data in the dependent fields.
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Initialisation object for EquationSystem.
SOLVER_UTILS_EXPORT int GetCheckpointNumber()
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
Get a SessionFunction by name.
SOLVER_UTILS_EXPORT void CopyToPhysField(const int i, Array< OneD, NekDouble > &output)
SOLVER_UTILS_EXPORT int GetTotPoints()
SOLVER_UTILS_EXPORT void SetUpTraceNormals(void)
virtual SOLVER_UTILS_EXPORT void v_Output(void)
SOLVER_UTILS_EXPORT void SetTime(const NekDouble time)
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys()
Virtual function for transformation to physical space.
SOLVER_UTILS_EXPORT void PrintSummary(std::ostream &out)
Print a summary of parameters and solver characteristics.
std::shared_ptr< FieldIO > FieldIOSharedPtr
std::map< std::string, std::string > FieldMetaDataMap
int PrintProgressbar(const int position, const int goal, const std::string message, int lastprogress=-1)
Prints a progressbar.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
ProjectionType
Type of Galerkin projection.
static ExpListSharedPtr NullExpListSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::vector< std::pair< std::string, std::string > > SummaryList
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
LibUtilities::NekFactory< std::string, EquationSystem, const LibUtilities::SessionReaderSharedPtr &, const SpatialDomains::MeshGraphSharedPtr & > EquationSystemFactory
Datatype of the NekFactory used to instantiate classes derived from the EquationSystem class.
EquationSystemFactory & GetEquationSystemFactory()
std::shared_ptr< SessionFunction > SessionFunctionSharedPtr
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
The above copyright notice and this permission notice shall be included.
static Array< OneD, NekDouble > NullNekDouble1DArray
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)