Nektar++
EquationSystem.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: EquationSystem.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Base class for individual solvers.
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERUTILS_EQUATIONSYSTEM_H
36#define NEKTAR_SOLVERUTILS_EQUATIONSYSTEM_H
37
52#include <boost/numeric/ublas/matrix.hpp>
53
54namespace Nektar
55{
56namespace FieldUtils
57{
58template <typename T> class Interpolator;
59}
60namespace SolverUtils
61{
62class EquationSystem;
63class FilterOperators;
64
65/// A shared pointer to an EquationSystem object
66typedef std::shared_ptr<EquationSystem> EquationSystemSharedPtr;
67/// Datatype of the NekFactory used to instantiate classes derived from
68/// the EquationSystem class.
69typedef LibUtilities::NekFactory<std::string, EquationSystem,
74
75/// A base class for describing how to solve specific equations.
76class EquationSystem : public std::enable_shared_from_this<EquationSystem>
77{
78public:
79 /// Destructor
81
82 /// Initialises the members of this object.
83 SOLVER_UTILS_EXPORT inline void InitObject(bool DeclareField = true);
84
85 /// Perform any initialisation necessary before solving the problem.
87 bool dumpInitialConditions = true);
88
89 /// Solve the problem.
90 SOLVER_UTILS_EXPORT inline void DoSolve();
91
92 /// Transform from coefficient to physical space.
94
95 /// Transform from physical to coefficient space.
97
98 /// Perform output operations after solve.
99 SOLVER_UTILS_EXPORT inline void Output();
100
101 /// Get Session name
103 {
104 return m_sessionName;
105 }
106
107 template <class T> std::shared_ptr<T> as()
108 {
109 return std::dynamic_pointer_cast<T>(shared_from_this());
110 }
111
112 /// Reset Session name
113 SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
114 {
115 m_sessionName = newname;
116 }
117
118 /// Get Session name
120 {
121 return m_session;
122 }
123
124 /// Get pressure field if available
126
128 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
129 std::vector<std::string> &variables);
130
131 /// Print a summary of parameters and solver characteristics.
132 SOLVER_UTILS_EXPORT inline void PrintSummary(std::ostream &out);
133
134 /// Set parameter m_lambda
135 SOLVER_UTILS_EXPORT inline void SetLambda(NekDouble lambda);
136
137 /// Get a SessionFunction by name
139 GetFunction(std::string name,
140 const MultiRegions::ExpListSharedPtr &field =
142 bool cache = false);
143
144 /// Initialise the data in the dependent fields.
146 NekDouble initialtime = 0.0, bool dumpInitialConditions = true,
147 const int domain = 0);
148
149 /// Evaluates an exact solution
151 int field, Array<OneD, NekDouble> &outfield, const NekDouble time);
152
153 /// Compute the L2 error between fields and a given exact
154 /// solution.
156 L2Error(unsigned int field, const Array<OneD, NekDouble> &exactsoln,
157 bool Normalised = false);
158
159 /// Compute the L2 error of the fields
160 SOLVER_UTILS_EXPORT inline NekDouble L2Error(unsigned int field,
161 bool Normalised = false)
162 {
163 return L2Error(field, NullNekDouble1DArray, Normalised);
164 }
165
166 /// Linf error computation
168 LinfError(unsigned int field,
170
171 /// Compute error (L2 and L_inf) over an larger set of quadrature
172 /// points return [L2 Linf]
174 unsigned int field);
175
176 /// Write checkpoint file of #m_fields.
177 SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n);
178
179 /// Write checkpoint file of custom data fields.
181 const int n, MultiRegions::ExpListSharedPtr &field,
182 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
183 std::vector<std::string> &variables);
184
185 /// Write base flow file of #m_fields.
187
188 /// Write field data to the given filename.
189 SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname);
190
191 /// Write input fields to the given filename.
193 const std::string &outname, MultiRegions::ExpListSharedPtr &field,
194 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
195 std::vector<std::string> &variables);
196
197 /// Input field data from the given file.
199 const std::string &infile,
201
202 /// Input field data from the given file to multiple domains
204 const std::string &infile,
206 const int ndomains);
207
208 /// Output a field.
209 /// Input field data into array from the given file.
211 const std::string &infile, std::vector<std::string> &fieldStr,
213
214 /// Output a field.
215 /// Input field data into ExpList from the given file.
216 SOLVER_UTILS_EXPORT void ImportFld(const std::string &infile,
218 std::string &pFieldName);
219
220 /// Write out a session summary.
222
224 &UpdateFields();
225
226 /// Get hold of FieldInfoMap so it can be updated
229
230 /// Return final time
232
233 SOLVER_UTILS_EXPORT inline int GetNcoeffs();
234
235 SOLVER_UTILS_EXPORT inline int GetNcoeffs(const int eid);
236
238
240
242
243 SOLVER_UTILS_EXPORT inline const std::string GetVariable(unsigned int i);
244
246
248
249 SOLVER_UTILS_EXPORT inline int GetExpSize();
250
251 SOLVER_UTILS_EXPORT inline int GetPhys_Offset(int n);
252
253 SOLVER_UTILS_EXPORT inline int GetCoeff_Offset(int n);
254
256
257 SOLVER_UTILS_EXPORT inline int GetTotPoints(int n);
258
259 SOLVER_UTILS_EXPORT inline int GetNpoints();
260
261 SOLVER_UTILS_EXPORT inline int GetSteps();
262
264
266 const int i, Array<OneD, NekDouble> &output);
267
269 const int i, const Array<OneD, const NekDouble> &input);
270
271 SOLVER_UTILS_EXPORT inline void SetSteps(const int steps);
272
274
276
277 SOLVER_UTILS_EXPORT inline void SetModifiedBasis(const bool modbasis);
278
280 {
281 return m_nchk;
282 }
283
285 {
286 m_nchk = num;
287 }
288
290 {
291 return m_checksteps;
292 }
293
295 {
296 m_checksteps = num;
297 }
298
300 {
301 return m_infosteps;
302 }
303
305 {
306 m_infosteps = num;
307 }
308
310 {
311 m_iterPIT = num;
312 }
313
315 {
316 m_windowPIT = num;
317 }
318
320 {
321 return m_traceNormals;
322 }
323
325 {
326 m_time = time;
327 }
328
330 {
331 m_timestep = timestep;
332 }
333
335 {
336 m_initialStep = step;
337 }
338
339 /// Evaluates the boundary conditions at the given time.
341
342 /// Identify if operator is negated in DoSolve
344
345 /// Check if solver use Parallel-in-Time
347 {
348 return m_comm->GetSize() != m_comm->GetSpaceComm()->GetSize();
349 }
350
351protected:
352 /// Communicator
355 /// The session reader
357 /// Map of known SessionFunctions
358 std::map<std::string, SolverUtils::SessionFunctionSharedPtr>
360 /// Field input/output
362 /// Array holding all dependent variables.
364 /// Pointer to boundary conditions object.
366 /// Pointer to graph defining mesh.
368 /// Name of the session.
369 std::string m_sessionName;
370 /// Current time of simulation.
372 /// Number of the step where the simulation should begin
374 /// Finish time of the simulation.
376 /// Time step size
378
379 /// Lambda constant in real system if one required.
381 /// Time between checkpoints.
384
386
387 /// Number of checkpoints written so far
389 /// Number of steps to take.
391 /// Number of steps between checkpoints.
393 /// Number of time steps between outputting status information.
395 /// Number of parallel-in-time time iteration.
396 int m_iterPIT = 0;
397 /// Index of windows for parallel-in-time time iteration.
398 int m_windowPIT = 0;
399 /// Spatial dimension (>= expansion dim).
401 /// Expansion dimension.
403 /// Flag to determine if single homogeneous mode is used.
405 /// Flag to determine if half homogeneous mode is used.
407 /// Flag to determine if use multiple homogenenous modes are used.
409 /// Flag to determine if FFT is used for homogeneous transform.
411 /**
412 * \brief Flag to determine if dealiasing is used for
413 * homogeneous simulations.
414 */
416 /**
417 * \brief Flag to determine if dealisising is usde for the
418 * Spectral/hp element discretisation.
419 */
421 /// Type of projection; e.g continuous or discontinuous.
423 /// Array holding trace normals for DG simulations in the forwards
424 /// direction.
426 /// Flag to indicate if the fields should be checked for singularity.
428 /// Map to identify relevant solver info to dump in output fields
430
431 /// Moving frame of reference velocities
433
434 /// Moving frame of reference angles with respect to the
435 // stationary inertial frame
437
438 /// Projection matrix for transformation between inertial and moving
439 // frame of reference
440 boost::numeric::ublas::matrix<NekDouble> m_movingFrameProjMat;
441
442 /// Number of Quadrature points used to work out the error
444
445 /// Parameter for homogeneous expansions
447 {
452 };
453
455
456 NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
457 NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
458 NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
459
460 int m_npointsX; ///< number of points in X direction (if homogeneous)
461 int m_npointsY; ///< number of points in Y direction (if homogeneous)
462 int m_npointsZ; ///< number of points in Z direction (if homogeneous)
463
464 int m_HomoDirec; ///< number of homogenous directions
465
466 /// Initialises EquationSystem class members.
470
471 SOLVER_UTILS_EXPORT virtual void v_InitObject(bool DeclareFeld = true);
472
473 /// Virtual function for initialisation implementation.
475 bool dumpInitialConditions = true);
476
477 /// Virtual function for solve implementation.
478 SOLVER_UTILS_EXPORT virtual void v_DoSolve();
479
480 /// Virtual function for the L_inf error computation between fields and a
481 /// given exact solution.
483 unsigned int field,
485
486 /// Virtual function for the L_2 error computation between fields and a
487 /// given exact solution.
489 unsigned int field,
491 bool Normalised = false);
492
493 /// Virtual function for transformation to physical space.
495
496 /// Virtual function for transformation to coefficient space.
498
499 /// Virtual function for generating summary information.
501
503 NekDouble initialtime = 0.0, bool dumpInitialConditions = true,
504 const int domain = 0);
505
507 unsigned int field, Array<OneD, NekDouble> &outfield,
508 const NekDouble time);
509
510 // Ouptut field information
511 SOLVER_UTILS_EXPORT virtual void v_Output(void);
512
513 // Get pressure field if available
515 void);
516
517 /// Virtual function to identify if operator is negated in DoSolve
518 SOLVER_UTILS_EXPORT virtual bool v_NegatedOp(void);
519
521 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
522 std::vector<std::string> &variables);
523
524 static std::string equationSystemTypeLookupIds[];
525 static std::string projectionTypeLookupIds[];
526
527private:
529
530 SOLVER_UTILS_EXPORT void PrintProgressbar(const int position,
531 const int goal) const
532 {
533 LibUtilities::PrintProgressbar(position, goal, "Interpolating");
534 }
535};
536
537/**
538 * This is the second part of the two-phase initialisation process.
539 * Calls to virtual functions will correctly resolve to the derived class
540 * during this phase of the construction.
541 */
542inline void EquationSystem::InitObject(bool DeclareField)
543{
544 v_InitObject(DeclareField);
545}
546
547/**
548 * This allows initialisation of the solver which cannot be completed
549 * during object construction (such as setting of initial conditions).
550 *
551 * Public interface routine to virtual function implementation.
552 */
553inline void EquationSystem::DoInitialise(bool dumpInitialConditions)
554{
555 v_DoInitialise(dumpInitialConditions);
556}
557
558/**
559 * Performs the transformation from coefficient to physical space.
560 *
561 * Public interface routine to virtual function implementation.
562 */
564{
566}
567
568/**
569 * Performs the transformation from physical to coefficient space.
570 *
571 * Public interface routine to virtual function implementation.
572 */
574{
576}
577
578/**
579 * Performs the actual solve.
580 *
581 * Public interface routine to virtual function implementation.
582 */
583inline void EquationSystem::DoSolve(void)
584{
585 v_DoSolve();
586}
587
588/**
589 * Perform output operations after solve.
590 */
591inline void EquationSystem::Output(void)
592{
593 v_Output();
594}
595
596/**
597 * L_inf Error computation
598 * Public interface routine to virtual function implementation.
599 */
601 unsigned int field, const Array<OneD, NekDouble> &exactsoln)
602{
603 return v_LinfError(field, exactsoln);
604}
605
606/**
607 * L_2 Error computation
608 * Public interface routine to virtual function implementation.
609 */
611 unsigned int field, const Array<OneD, NekDouble> &exactsoln,
612 bool Normalised)
613{
614 return v_L2Error(field, exactsoln, Normalised);
615}
616
617/**
618 * Get Pressure field if available
619 */
621{
622 return v_GetPressure();
623}
624
625/**
626 * Append the coefficients and name of variables with solver specific
627 * extra variables
628 *
629 * @param fieldcoeffs Vector with coefficients
630 * @param variables Vector with name of variables
631 */
633 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
634 std::vector<std::string> &variables)
635{
636 v_ExtraFldOutput(fieldcoeffs, variables);
637}
638
639/**
640 * Prints a summary of variables and problem parameters.
641 *
642 * Public interface routine to virtual function implementation.
643 *
644 * @param out The ostream object to write to.
645 */
646inline void EquationSystem::PrintSummary(std::ostream &out)
647{
648 if (m_session->GetComm()->GetRank() == 0)
649 {
650 std::vector<std::pair<std::string, std::string>> vSummary;
651 v_GenerateSummary(vSummary);
652
653 out << "==============================================================="
654 "========"
655 << std::endl
656 << std::flush;
657 for (auto &x : vSummary)
658 {
659 out << "\t";
660 out.width(20);
661 out << x.first << ": " << x.second << std::endl << std::flush;
662 }
663 out << "==============================================================="
664 "========"
665 << std::endl
666 << std::flush;
667 }
668}
669
671{
672 m_lambda = lambda;
673}
674
676 bool dumpInitialConditions,
677 const int domain)
678{
679 v_SetInitialConditions(initialtime, dumpInitialConditions, domain);
680}
681
682/// Evaluates an exact solution
684 int field, Array<OneD, NekDouble> &outfield, const NekDouble time)
685{
686 v_EvaluateExactSolution(field, outfield, time);
687}
688
689/// Identify if operator is negated in DoSolve
691{
692 return v_NegatedOp();
693}
694
697{
698 return m_fields;
699}
700
701/// Return final time
703{
704 return m_time;
705}
706
708{
709 return m_fields[0]->GetNcoeffs();
710}
711
712inline int EquationSystem::GetNcoeffs(const int eid)
713{
714 return m_fields[0]->GetNcoeffs(eid);
715}
716
718{
719 return m_graph->GetExpansionInfo()
720 .begin()
721 ->second->m_basisKeyVector[0]
722 .GetNumModes();
723}
724
726{
727 return m_fields[0]->EvalBasisNumModesMaxPerExp();
728}
729
731{
732 return m_session->GetVariables().size();
733}
734
735inline const std::string EquationSystem::GetVariable(unsigned int i)
736{
737 return m_session->GetVariable(i);
738}
739
741{
742 return GetTraceNpoints();
743}
744
746{
747 return m_fields[0]->GetTrace()->GetNpoints();
748}
749
751{
752 return m_fields[0]->GetExpSize();
753}
754
756{
757 return m_fields[0]->GetPhys_Offset(n);
758}
759
761{
762 return m_fields[0]->GetCoeff_Offset(n);
763}
764
766{
767 return m_fields[0]->GetNpoints();
768}
769
771{
772 return m_fields[0]->GetTotPoints(n);
773}
774
776{
777 return m_fields[0]->GetNpoints();
778}
779
781{
782 return m_steps;
783}
784
786{
787 return m_timestep;
788}
789
790inline void EquationSystem::SetSteps(const int steps)
791{
792 m_steps = steps;
793}
794
795inline void EquationSystem::CopyFromPhysField(const int i,
797{
798 Vmath::Vcopy(output.size(), m_fields[i]->GetPhys(), 1, output, 1);
799}
800
802 const int i, const Array<OneD, const NekDouble> &input)
803{
804 Vmath::Vcopy(input.size(), input, 1, m_fields[i]->UpdatePhys(), 1);
805}
806
807} // namespace SolverUtils
808} // namespace Nektar
809
810#endif
#define SOLVER_UTILS_EXPORT
Provides a generic Factory class.
Definition: NekFactory.hpp:105
A base class for describing how to solve specific equations.
SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
Reset Session name.
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()
boost::numeric::ublas::matrix< NekDouble > m_movingFrameProjMat
Projection matrix for transformation between inertial and moving.
SOLVER_UTILS_EXPORT void ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
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.
SOLVER_UTILS_EXPORT bool ParallelInTime()
Check if solver use Parallel-in-Time.
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.
int m_infosteps
Number of time steps between outputting status information.
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 bool NegatedOp()
Identify if operator is negated in DoSolve.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
SOLVER_UTILS_EXPORT void SetWindowNumberPIT(int num)
int m_iterPIT
Number of parallel-in-time time iteration.
bool m_multipleModes
Flag to determine if use multiple homogenenous modes are used.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
int m_windowPIT
Index of windows for parallel-in-time time iteration.
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.
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp(void)
Virtual function to identify if operator is negated in DoSolve.
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.
static std::string projectionTypeLookupIds[]
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 void v_InitObject(bool DeclareFeld=true)
Initialisation object for EquationSystem.
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[]
SOLVER_UTILS_EXPORT int GetInfoSteps()
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
virtual SOLVER_UTILS_EXPORT void v_DoInitialise(bool dumpInitialConditions=true)
Virtual function for initialisation implementation.
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.
Array< OneD, NekDouble > m_movingFrameVelsxyz
Moving frame of reference velocities.
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.
SOLVER_UTILS_EXPORT LibUtilities::FieldMetaDataMap & UpdateFieldMetaDataMap()
Get hold of FieldInfoMap so it can be updated.
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.
SOLVER_UTILS_EXPORT Array< OneD, const Array< OneD, NekDouble > > GetTraceNormals()
bool m_singleMode
Flag to determine if single homogeneous mode is used.
SOLVER_UTILS_EXPORT void SetIterationNumberPIT(int num)
HomogeneousType
Parameter for homogeneous expansions.
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.
SOLVER_UTILS_EXPORT void DoInitialise(bool dumpInitialConditions=true)
Perform any initialisation necessary before solving the problem.
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 void SetTimeStep(const NekDouble timestep)
SOLVER_UTILS_EXPORT int GetNcoeffs()
int m_nchk
Number of checkpoints written so far.
SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr GetSession()
Get Session name.
SOLVER_UTILS_EXPORT void SetInfoSteps(int num)
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
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.
Array< OneD, NekDouble > m_movingFrameTheta
Moving frame of reference angles with respect to the.
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()
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.
SOLVER_UTILS_EXPORT void InitObject(bool DeclareField=true)
Initialises the members of this object.
SOLVER_UTILS_EXPORT void CopyToPhysField(const int i, const Array< OneD, const NekDouble > &input)
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 int GetTotPoints()
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
Definition: FieldIO.h:327
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:52
int PrintProgressbar(const int position, const int goal, const std::string message, int lastprogress=-1)
Prints a progressbar.
Definition: Progressbar.hpp:67
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:57
ProjectionType
Type of Galerkin projection.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1514
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList 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.
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:48
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
EquationSystemFactory & GetEquationSystemFactory()
std::shared_ptr< SessionFunction > SessionFunctionSharedPtr
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
Definition: Conditions.h:289
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:176
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
static Array< OneD, NekDouble > NullNekDouble1DArray
double NekDouble
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1191