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 
47 #include <MultiRegions/ExpList.h>
48 #include <SolverUtils/Core/Misc.h>
52 #include <boost/numeric/ublas/matrix.hpp>
53 
54 namespace Nektar
55 {
56 namespace FieldUtils
57 {
58 template <typename T> class Interpolator;
59 }
60 namespace SolverUtils
61 {
62 class EquationSystem;
63 class FilterOperators;
64 
65 /// A shared pointer to an EquationSystem object
66 typedef std::shared_ptr<EquationSystem> EquationSystemSharedPtr;
67 /// Datatype of the NekFactory used to instantiate classes derived from
68 /// the EquationSystem class.
69 typedef LibUtilities::NekFactory<std::string, EquationSystem,
74 
75 /// A base class for describing how to solve specific equations.
76 class EquationSystem : public std::enable_shared_from_this<EquationSystem>
77 {
78 public:
79  /// Destructor
81 
82  // Set up trace normals if required
84 
85  /// Initialises the members of this object.
86  SOLVER_UTILS_EXPORT inline void InitObject(bool DeclareField = true);
87 
88  /// Perform any initialisation necessary before solving the problem.
89  SOLVER_UTILS_EXPORT inline void DoInitialise();
90 
91  /// Solve the problem.
92  SOLVER_UTILS_EXPORT inline void DoSolve();
93 
94  /// Transform from coefficient to physical space.
96 
97  /// Transform from physical to coefficient space.
99 
100  /// Perform output operations after solve.
101  SOLVER_UTILS_EXPORT inline void Output();
102 
103  /// Linf error computation
105  unsigned int field,
106  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray);
107 
108  /// Get Session name
110  {
111  return m_sessionName;
112  }
113 
114  template <class T> std::shared_ptr<T> as()
115  {
116  return std::dynamic_pointer_cast<T>(shared_from_this());
117  }
118 
119  /// Reset Session name
120  SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
121  {
122  m_sessionName = newname;
123  }
124 
125  /// Get Session name
127  {
128  return m_session;
129  }
130 
131  /// Get pressure field if available
133 
135  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
136  std::vector<std::string> &variables);
137 
138  /// Print a summary of parameters and solver characteristics.
139  SOLVER_UTILS_EXPORT inline void PrintSummary(std::ostream &out);
140 
141  /// Set parameter m_lambda
142  SOLVER_UTILS_EXPORT inline void SetLambda(NekDouble lambda);
143 
144  /// Get a SessionFunction by name
146  GetFunction(std::string name,
147  const MultiRegions::ExpListSharedPtr &field =
149  bool cache = false);
150 
151  /// Initialise the data in the dependent fields.
153  NekDouble initialtime = 0.0, bool dumpInitialConditions = true,
154  const int domain = 0);
155 
156  /// Evaluates an exact solution
158  int field, Array<OneD, NekDouble> &outfield, const NekDouble time);
159 
160  /// Compute the L2 error between fields and a given exact
161  /// solution.
163  L2Error(unsigned int field, const Array<OneD, NekDouble> &exactsoln,
164  bool Normalised = false);
165 
166  /// Compute the L2 error of the fields
167  SOLVER_UTILS_EXPORT inline NekDouble L2Error(unsigned int field,
168  bool Normalised = false)
169  {
170  return L2Error(field, NullNekDouble1DArray, Normalised);
171  }
172 
173  /// Compute error (L2 and L_inf) over an larger set of quadrature
174  /// points return [L2 Linf]
176  unsigned int field);
177 
178  /// Write checkpoint file of #m_fields.
179  SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n);
180 
181  /// Write checkpoint file of custom data fields.
183  const int n, MultiRegions::ExpListSharedPtr &field,
184  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
185  std::vector<std::string> &variables);
186 
187  /// Write base flow file of #m_fields.
188  SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow(const int n);
189 
190  /// Write field data to the given filename.
191  SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname);
192 
193  /// Write input fields to the given filename.
195  const std::string &outname, MultiRegions::ExpListSharedPtr &field,
196  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
197  std::vector<std::string> &variables);
198 
199  /// Input field data from the given file.
201  const std::string &infile,
203 
204  /// Input field data from the given file to multiple domains
206  const std::string &infile,
208  const int ndomains);
209 
210  /// Output a field.
211  /// Input field data into array from the given file.
213  const std::string &infile, std::vector<std::string> &fieldStr,
214  Array<OneD, Array<OneD, NekDouble>> &coeffs);
215 
216  /// Output a field.
217  /// Input field data into ExpList from the given file.
218  SOLVER_UTILS_EXPORT void ImportFld(const std::string &infile,
220  std::string &pFieldName);
221 
222  /// Write out a session summary.
224 
226  &UpdateFields();
227 
228  /// Get hold of FieldInfoMap so it can be updated
231 
232  /// Return final time
234 
235  SOLVER_UTILS_EXPORT inline int GetNcoeffs();
236 
237  SOLVER_UTILS_EXPORT inline int GetNcoeffs(const int eid);
238 
239  SOLVER_UTILS_EXPORT inline int GetNumExpModes();
240 
242 
243  SOLVER_UTILS_EXPORT inline int GetNvariables();
244 
245  SOLVER_UTILS_EXPORT inline const std::string GetVariable(unsigned int i);
246 
248 
250 
251  SOLVER_UTILS_EXPORT inline int GetExpSize();
252 
253  SOLVER_UTILS_EXPORT inline int GetPhys_Offset(int n);
254 
255  SOLVER_UTILS_EXPORT inline int GetCoeff_Offset(int n);
256 
257  SOLVER_UTILS_EXPORT inline int GetTotPoints();
258 
259  SOLVER_UTILS_EXPORT inline int GetTotPoints(int n);
260 
261  SOLVER_UTILS_EXPORT inline int GetNpoints();
262 
263  SOLVER_UTILS_EXPORT inline int GetSteps();
264 
266 
268  const int i, Array<OneD, NekDouble> &output);
269 
271  const int i, const Array<OneD, const NekDouble> &input);
272 
273  SOLVER_UTILS_EXPORT inline void SetSteps(const int steps);
274 
276 
278 
279  SOLVER_UTILS_EXPORT inline void SetModifiedBasis(const bool modbasis);
280 
282  {
283  return m_nchk;
284  }
285 
287  {
288  m_nchk = num;
289  }
290 
292  {
293  return m_checksteps;
294  }
295 
297  {
298  m_checksteps = num;
299  }
300 
302  {
303  return m_infosteps;
304  }
305 
307  {
308  m_infosteps = num;
309  }
310 
312  {
313  return m_pararealIter;
314  }
315 
317  {
318  m_pararealIter = num;
319  }
320 
322  {
323  return m_useInitialCondition;
324  }
325 
327  {
328  m_useInitialCondition = num;
329  }
330 
332  {
333  return m_traceNormals;
334  }
335 
337  {
338  m_time = time;
339  }
340 
342  {
343  m_timestep = timestep;
344  }
345 
346  SOLVER_UTILS_EXPORT void SetInitialStep(const int step)
347  {
348  m_initialStep = step;
349  }
350 
351  /// Evaluates the boundary conditions at the given time.
353 
354  /// Virtual function to identify if operator is negated in DoSolve
355  SOLVER_UTILS_EXPORT virtual bool v_NegatedOp();
356 
357  /// Check if solver use Parallel-in-Time
359  {
360  return m_comm->GetSize() != m_comm->GetSpaceComm()->GetSize();
361  }
362 
363 protected:
364  /// Communicator
366  bool m_verbose;
367  /// The session reader
369  /// Map of known SessionFunctions
370  std::map<std::string, SolverUtils::SessionFunctionSharedPtr>
372  /// Field input/output
374  /// Array holding all dependent variables.
376  /// Pointer to boundary conditions object.
378  /// Pointer to graph defining mesh.
380  /// Name of the session.
381  std::string m_sessionName;
382  /// Current time of simulation.
384  /// Number of the step where the simulation should begin
386  /// Finish time of the simulation.
388  /// Time step size
390  /// Time step size
392 
393  /// Lambda constant in real system if one required.
395  /// Time between checkpoints.
398 
400 
401  /// Number of checkpoints written so far
402  int m_nchk;
403  /// Number of steps to take.
404  int m_steps;
405  /// Number of steps between checkpoints.
407  /// Number of time steps between outputting status information.
409  /// Number of parareal time iteration.
411  /// Spatial dimension (>= expansion dim).
413  /// Expansion dimension.
414  int m_expdim;
415  /// Flag to determine if single homogeneous mode is used.
417  /// Flag to determine if half homogeneous mode is used.
419  /// Flag to determine if use multiple homogenenous modes are used.
421  /// Flag to determine if FFT is used for homogeneous transform.
422  bool m_useFFT;
423  /// Flag to determine if IC are used.
425  /**
426  * \brief Flag to determine if dealiasing is used for
427  * homogeneous simulations.
428  */
430  /**
431  * \brief Flag to determine if dealisising is usde for the
432  * Spectral/hp element discretisation.
433  */
435  /// Type of projection; e.g continuous or discontinuous.
437  /// Array holding trace normals for DG simulations in the forwards
438  /// direction.
440  /// Flag to indicate if the fields should be checked for singularity.
442  /// Map to identify relevant solver info to dump in output fields
444 
445  /// Moving frame of reference velocities
447 
448  /// Moving frame of reference angles with respect to the
449  // stationary inertial frame
451 
452  /// Projection matrix for transformation between inertial and moving
453  // frame of reference
454  boost::numeric::ublas::matrix<NekDouble> m_movingFrameProjMat;
455 
456  /// Number of Quadrature points used to work out the error
458 
459  /// Parameter for homogeneous expansions
461  {
466  };
467 
469 
470  NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
471  NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
472  NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
473 
474  int m_npointsX; ///< number of points in X direction (if homogeneous)
475  int m_npointsY; ///< number of points in Y direction (if homogeneous)
476  int m_npointsZ; ///< number of points in Z direction (if homogeneous)
477 
478  int m_HomoDirec; ///< number of homogenous directions
479 
480  /// Initialises EquationSystem class members.
482  const LibUtilities::SessionReaderSharedPtr &pSession,
483  const SpatialDomains::MeshGraphSharedPtr &pGraph);
484 
485  SOLVER_UTILS_EXPORT virtual void v_InitObject(bool DeclareFeld = true);
486 
487  /// Virtual function for initialisation implementation.
488  SOLVER_UTILS_EXPORT virtual void v_DoInitialise();
489 
490  /// Virtual function for solve implementation.
491  SOLVER_UTILS_EXPORT virtual void v_DoSolve();
492 
493  /// Virtual function for the L_inf error computation between fields and a
494  /// given exact solution.
496  unsigned int field,
497  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray);
498 
499  /// Virtual function for the L_2 error computation between fields and a
500  /// given exact solution.
502  unsigned int field,
503  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray,
504  bool Normalised = false);
505 
506  /// Virtual function for transformation to physical space.
508 
509  /// Virtual function for transformation to coefficient space.
511 
512  /// Virtual function for generating summary information.
514 
516  NekDouble initialtime = 0.0, bool dumpInitialConditions = true,
517  const int domain = 0);
518 
520  unsigned int field, Array<OneD, NekDouble> &outfield,
521  const NekDouble time);
522 
523  // Ouptut field information
524  SOLVER_UTILS_EXPORT virtual void v_Output(void);
525 
526  // Get pressure field if available
528  void);
529 
531  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
532  std::vector<std::string> &variables);
533 
534  static std::string equationSystemTypeLookupIds[];
535 
536 private:
538 
539  SOLVER_UTILS_EXPORT void PrintProgressbar(const int position,
540  const int goal) const
541  {
542  LibUtilities::PrintProgressbar(position, goal, "Interpolating");
543  }
544 };
545 
546 /**
547  * This is the second part of the two-phase initialisation process.
548  * Calls to virtual functions will correctly resolve to the derived class
549  * during this phase of the construction.
550  */
551 inline void EquationSystem::InitObject(bool DeclareField)
552 {
553  v_InitObject(DeclareField);
554 }
555 
556 /**
557  * This allows initialisation of the solver which cannot be completed
558  * during object construction (such as setting of initial conditions).
559  *
560  * Public interface routine to virtual function implementation.
561  */
563 {
564  v_DoInitialise();
565 }
566 
567 /**
568  * Performs the transformation from coefficient to physical space.
569  *
570  * Public interface routine to virtual function implementation.
571  */
573 {
575 }
576 
577 /**
578  * Performs the transformation from physical to coefficient space.
579  *
580  * Public interface routine to virtual function implementation.
581  */
583 {
585 }
586 
587 /**
588  * Performs the actual solve.
589  *
590  * Public interface routine to virtual function implementation.
591  */
592 inline void EquationSystem::DoSolve(void)
593 {
594  v_DoSolve();
595 }
596 
597 /**
598  * Perform output operations after solve.
599  */
600 inline void EquationSystem::Output(void)
601 {
602  v_Output();
603 }
604 
605 /**
606  * L_inf Error computation
607  * Public interface routine to virtual function implementation.
608  */
610  unsigned int field, const Array<OneD, NekDouble> &exactsoln)
611 {
612  return v_LinfError(field, exactsoln);
613 }
614 
615 /**
616  * L_2 Error computation
617  * Public interface routine to virtual function implementation.
618  */
620  unsigned int field, const Array<OneD, NekDouble> &exactsoln,
621  bool Normalised)
622 {
623  return v_L2Error(field, exactsoln, Normalised);
624 }
625 
626 /**
627  * Get Pressure field if available
628  */
630 {
631  return v_GetPressure();
632 }
633 
634 /**
635  * Append the coefficients and name of variables with solver specific
636  * extra variables
637  *
638  * @param fieldcoeffs Vector with coefficients
639  * @param variables Vector with name of variables
640  */
642  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
643  std::vector<std::string> &variables)
644 {
645  v_ExtraFldOutput(fieldcoeffs, variables);
646 }
647 
648 /**
649  * Prints a summary of variables and problem parameters.
650  *
651  * Public interface routine to virtual function implementation.
652  *
653  * @param out The ostream object to write to.
654  */
655 inline void EquationSystem::PrintSummary(std::ostream &out)
656 {
657  if (m_session->GetComm()->GetRank() == 0)
658  {
659  std::vector<std::pair<std::string, std::string>> vSummary;
660  v_GenerateSummary(vSummary);
661 
662  out << "==============================================================="
663  "========"
664  << std::endl
665  << std::flush;
666  for (auto &x : vSummary)
667  {
668  out << "\t";
669  out.width(20);
670  out << x.first << ": " << x.second << std::endl << std::flush;
671  }
672  out << "==============================================================="
673  "========"
674  << std::endl
675  << std::flush;
676  }
677 }
678 
680 {
681  m_lambda = lambda;
682 }
683 
685  bool dumpInitialConditions,
686  const int domain)
687 {
688  v_SetInitialConditions(initialtime, dumpInitialConditions, domain);
689 }
690 
691 /// Evaluates an exact solution
693  int field, Array<OneD, NekDouble> &outfield, const NekDouble time)
694 {
695  v_EvaluateExactSolution(field, outfield, time);
696 }
697 
700 {
701  return m_fields;
702 }
703 
704 /// Return final time
706 {
707  return m_time;
708 }
709 
711 {
712  return m_fields[0]->GetNcoeffs();
713 }
714 
715 inline int EquationSystem::GetNcoeffs(const int eid)
716 {
717  return m_fields[0]->GetNcoeffs(eid);
718 }
719 
721 {
722  return m_graph->GetExpansionInfo()
723  .begin()
724  ->second->m_basisKeyVector[0]
725  .GetNumModes();
726 }
727 
729 {
730  return m_fields[0]->EvalBasisNumModesMaxPerExp();
731 }
732 
734 {
735  return m_session->GetVariables().size();
736 }
737 
738 inline const std::string EquationSystem::GetVariable(unsigned int i)
739 {
740  return m_session->GetVariable(i);
741 }
742 
744 {
745  return GetTraceNpoints();
746 }
747 
749 {
750  return m_fields[0]->GetTrace()->GetNpoints();
751 }
752 
754 {
755  return m_fields[0]->GetExpSize();
756 }
757 
759 {
760  return m_fields[0]->GetPhys_Offset(n);
761 }
762 
764 {
765  return m_fields[0]->GetCoeff_Offset(n);
766 }
767 
769 {
770  return m_fields[0]->GetNpoints();
771 }
772 
774 {
775  return m_fields[0]->GetTotPoints(n);
776 }
777 
779 {
780  return m_fields[0]->GetNpoints();
781 }
782 
783 inline int EquationSystem::GetSteps(void)
784 {
785  return m_steps;
786 }
787 
789 {
790  return m_timestep;
791 }
792 
793 inline void EquationSystem::SetSteps(const int steps)
794 {
795  m_steps = steps;
796 }
797 
798 inline void EquationSystem::CopyFromPhysField(const int i,
799  Array<OneD, NekDouble> &output)
800 {
801  Vmath::Vcopy(output.size(), m_fields[i]->GetPhys(), 1, output, 1);
802 }
803 
805  const int i, const Array<OneD, const NekDouble> &input)
806 {
807  Vmath::Vcopy(input.size(), input, 1, m_fields[i]->UpdatePhys(), 1);
808 }
809 } // namespace SolverUtils
810 } // namespace Nektar
811 
812 #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 SetUseInitialCondition(bool num)
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()
boost::numeric::ublas::matrix< NekDouble > m_movingFrameProjMat
Projection matrix for transformation between inertial and moving.
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.
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 Array< OneD, const Array< OneD, NekDouble > > GetTraceNormals()
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.
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.
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()
bool m_useInitialCondition
Flag to determine if IC are used.
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.
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.
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()
SOLVER_UTILS_EXPORT bool GetUseInitialCondition()
int m_pararealIter
Number of parareal time iteration.
SOLVER_UTILS_EXPORT void SetPararealIterationNumber(int num)
int m_HomoDirec
number of homogenous directions
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble >> &fieldcoeffs, std::vector< std::string > &variables)
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 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.
SOLVER_UTILS_EXPORT void ExtraFldOutput(std::vector< Array< OneD, NekDouble >> &fieldcoeffs, std::vector< std::string > &variables)
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 int GetPararealIterationNumber()
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()
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
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:54
ProjectionType
Type of Galerkin projection.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1479
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:172
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:1255