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 
48 #include <MultiRegions/ExpList.h>
50 #include <SolverUtils/Core/Misc.h>
51 
52 namespace Nektar
53 {
54 namespace FieldUtils {
55 class Interpolator;
56 }
57  namespace SolverUtils
58  {
60 
61  /// A shared pointer to an EquationSystem object
62  typedef std::shared_ptr<EquationSystem> EquationSystemSharedPtr;
63  /// Datatype of the NekFactory used to instantiate classes derived from
64  /// the EquationSystem class.
66  std::string,
72 
73  /// A base class for describing how to solve specific equations.
74  class EquationSystem : public std::enable_shared_from_this<EquationSystem>
75  {
76  public:
77  /// Destructor
78  SOLVER_UTILS_EXPORT virtual ~EquationSystem();
79 
80  // Set up trace normals if required
81  SOLVER_UTILS_EXPORT void SetUpTraceNormals(void);
82 
83  /// Initialises the members of this object.
84  SOLVER_UTILS_EXPORT inline void InitObject();
85 
86  /// Perform any initialisation necessary before solving the problem.
87  SOLVER_UTILS_EXPORT inline void DoInitialise();
88 
89  /// Solve the problem.
90  SOLVER_UTILS_EXPORT inline void DoSolve();
91 
92  /// Transform from coefficient to physical space.
93  SOLVER_UTILS_EXPORT inline void TransCoeffToPhys();
94 
95  /// Transform from physical to coefficient space.
96  SOLVER_UTILS_EXPORT inline void TransPhysToCoeff();
97 
98  /// Perform output operations after solve.
99  SOLVER_UTILS_EXPORT inline void Output();
100 
101  /// Linf error computation
102  SOLVER_UTILS_EXPORT inline NekDouble LinfError(unsigned int field,
103  const Array<OneD,NekDouble> &exactsoln = NullNekDouble1DArray);
104 
105  /// Get Session name
107  {
108  return m_sessionName;
109  }
110 
111  template<class T>
112  std::shared_ptr<T> as()
113  {
114  return std::dynamic_pointer_cast<T>( shared_from_this() );
115  }
116 
117  /// Reset Session name
118  SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
119  {
120  m_sessionName = newname;
121  }
122 
123  /// Get Session name
124  SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr GetSession()
125  {
126  return m_session;
127  }
128 
129  /// Get pressure field if available
131 
132  SOLVER_UTILS_EXPORT inline void ExtraFldOutput(
133  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
134  std::vector<std::string> &variables);
135 
136  /// Print a summary of parameters and solver characteristics.
137  SOLVER_UTILS_EXPORT inline void PrintSummary(std::ostream &out);
138 
139  /// Set parameter m_lambda
140  SOLVER_UTILS_EXPORT inline void SetLambda(NekDouble lambda);
141 
142  /// Get a SessionFunction by name
144  std::string name,
146  bool cache = false);
147 
148  /// Initialise the data in the dependent fields.
149  SOLVER_UTILS_EXPORT inline void SetInitialConditions(
150  NekDouble initialtime = 0.0,
151  bool dumpInitialConditions = true,
152  const int domain = 0);
153 
154  /// Evaluates an exact solution
155  SOLVER_UTILS_EXPORT inline void EvaluateExactSolution(
156  int field,
157  Array<OneD, NekDouble> &outfield,
158  const NekDouble time);
159 
160  /// Compute the L2 error between fields and a given exact
161  /// solution.
163  unsigned int field,
164  const Array<OneD,NekDouble> &exactsoln,
165  bool Normalised = false);
166 
167  /// Compute the L2 error of the fields
169  unsigned int field,
170  bool Normalised = false)
171  {
172  return L2Error(field,NullNekDouble1DArray,Normalised);
173  }
174 
175  /// Compute error (L2 and L_inf) over an larger set of quadrature
176  /// points return [L2 Linf]
178  unsigned int field);
179 
180  /// Write checkpoint file of #m_fields.
181  SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n);
182 
183  /// Write checkpoint file of custom data fields.
184  SOLVER_UTILS_EXPORT void Checkpoint_Output(
185  const int n,
187  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
188  std::vector<std::string> &variables);
189 
190  /// Write base flow file of #m_fields.
191  SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow(const int n);
192 
193  /// Write field data to the given filename.
194  SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname);
195 
196  /// Write input fields to the given filename.
197  SOLVER_UTILS_EXPORT void WriteFld(
198  const std::string &outname,
200  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
201  std::vector<std::string> &variables);
202 
203  /// Input field data from the given file.
204  SOLVER_UTILS_EXPORT void ImportFld(
205  const std::string &infile,
207 
208  /// Input field data from the given file to multiple domains
209  SOLVER_UTILS_EXPORT void ImportFldToMultiDomains(
210  const std::string &infile,
212  const int ndomains);
213 
214  /// Output a field.
215  /// Input field data into array from the given file.
216  SOLVER_UTILS_EXPORT void ImportFld(
217  const std::string &infile,
218  std::vector<std::string> &fieldStr,
219  Array<OneD, Array<OneD, NekDouble> > &coeffs);
220 
221  /// Output a field.
222  /// Input field data into ExpList from the given file.
223  SOLVER_UTILS_EXPORT void ImportFld(
224  const std::string &infile,
226  std::string &pFieldName);
227 
228  /// Write out a session summary.
229  SOLVER_UTILS_EXPORT void SessionSummary (SummaryList& vSummary);
230 
231  SOLVER_UTILS_EXPORT inline Array<
232  OneD, MultiRegions::ExpListSharedPtr> &UpdateFields();
233 
234 
235  /// Get hold of FieldInfoMap so it can be updated
237  &UpdateFieldMetaDataMap();
238 
239  /// Return final time
240  SOLVER_UTILS_EXPORT inline NekDouble GetFinalTime();
241 
242  SOLVER_UTILS_EXPORT inline int GetNcoeffs();
243 
244  SOLVER_UTILS_EXPORT inline int GetNcoeffs(const int eid);
245 
246  SOLVER_UTILS_EXPORT inline int GetNumExpModes();
247 
249  GetNumExpModesPerExp();
250 
251  SOLVER_UTILS_EXPORT inline int GetNvariables();
252 
253  SOLVER_UTILS_EXPORT inline const std::string
254  GetVariable(unsigned int i);
255 
256  SOLVER_UTILS_EXPORT inline int GetTraceTotPoints();
257 
258  SOLVER_UTILS_EXPORT inline int GetTraceNpoints();
259 
260  SOLVER_UTILS_EXPORT inline int GetExpSize();
261 
262  SOLVER_UTILS_EXPORT inline int GetPhys_Offset(int n);
263 
264  SOLVER_UTILS_EXPORT inline int GetCoeff_Offset(int n);
265 
266  SOLVER_UTILS_EXPORT inline int GetTotPoints();
267 
268  SOLVER_UTILS_EXPORT inline int GetTotPoints(int n);
269 
270  SOLVER_UTILS_EXPORT inline int GetNpoints();
271 
272  SOLVER_UTILS_EXPORT inline int GetSteps();
273 
274  SOLVER_UTILS_EXPORT inline NekDouble GetTimeStep();
275 
276  SOLVER_UTILS_EXPORT inline void CopyFromPhysField(const int i,
277  Array<OneD, NekDouble> &output);
278 
279  SOLVER_UTILS_EXPORT inline void CopyToPhysField(const int i,
280  Array<OneD, NekDouble> &output);
281 
282  SOLVER_UTILS_EXPORT inline void SetSteps(const int steps);
283 
284  SOLVER_UTILS_EXPORT void ZeroPhysFields();
285 
286  SOLVER_UTILS_EXPORT void FwdTransFields();
287 
288  SOLVER_UTILS_EXPORT inline void SetModifiedBasis(
289  const bool modbasis);
290 
292  {
293  return m_nchk;
294  }
295 
297  {
298  m_nchk = num;
299  }
300 
302  {
303  return m_checksteps;
304  }
305 
307  {
308  m_checksteps = num;
309  }
310 
312  const NekDouble time)
313  {
314  m_time = time;
315  }
316 
318  const int step)
319  {
320  m_initialStep = step;
321  }
322 
323  /// Evaluates the boundary conditions at the given time.
324  SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time);
325 
326  /// Virtual function to identify if operator is negated in DoSolve
327  SOLVER_UTILS_EXPORT virtual bool v_NegatedOp();
328 
329  protected:
330  /// Communicator
332  /// The session reader
333  LibUtilities::SessionReaderSharedPtr m_session;
334  /// Map of known SessionFunctions
335  std::map<std::string, SolverUtils::SessionFunctionSharedPtr> m_sessionFunctions;
336  /// Field input/output
338  /// Array holding all dependent variables.
340  /// Pointer to boundary conditions object.
342  /// Pointer to graph defining mesh.
344  /// Name of the session.
345  std::string m_sessionName;
346  /// Current time of simulation.
348  /// Number of the step where the simulation should begin
350  /// Finish time of the simulation.
352  /// Time step size
354  /// Lambda constant in real system if one required.
356  /// Time between checkpoints.
358  /// Number of checkpoints written so far
359  int m_nchk;
360  /// Number of steps to take.
361  int m_steps;
362  /// Number of steps between checkpoints.
364  /// Spatial dimension (>= expansion dim).
366  /// Expansion dimension.
367  int m_expdim;
368  /// Flag to determine if single homogeneous mode is used.
370  /// Flag to determine if half homogeneous mode is used.
372  /// Flag to determine if use multiple homogenenous modes are used.
374  /// Flag to determine if FFT is used for homogeneous transform.
375  bool m_useFFT;
376  /**
377  * \brief Flag to determine if dealiasing is used for
378  * homogeneous simulations.
379  */
381  /**
382  * \brief Flag to determine if dealisising is usde for the
383  * Spectral/hp element discretisation.
384  */
386  /// Type of projection; e.g continuous or discontinuous.
387  enum MultiRegions::ProjectionType m_projectionType;
388  /// Array holding trace normals for DG simulations in the forwards direction.
390  /// Flag to indicate if the fields should be checked for singularity.
392  /// Map to identify relevant solver info to dump in output fields
394 
395  /// Number of Quadrature points used to work out the error
397 
398  /// Parameter for homogeneous expansions
400  {
404  eNotHomogeneous
405  };
406 
407  enum HomogeneousType m_HomogeneousType;
408 
409  NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
410  NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
411  NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
412 
413  int m_npointsX; ///< number of points in X direction (if homogeneous)
414  int m_npointsY; ///< number of points in Y direction (if homogeneous)
415  int m_npointsZ; ///< number of points in Z direction (if homogeneous)
416 
417  int m_HomoDirec; ///< number of homogenous directions
418 
419  /// Initialises EquationSystem class members.
420  SOLVER_UTILS_EXPORT EquationSystem(
421  const LibUtilities::SessionReaderSharedPtr& pSession,
422  const SpatialDomains::MeshGraphSharedPtr& pGraph);
423 
424  SOLVER_UTILS_EXPORT virtual void v_InitObject();
425 
426  /// Virtual function for initialisation implementation.
427  SOLVER_UTILS_EXPORT virtual void v_DoInitialise();
428 
429  /// Virtual function for solve implementation.
430  SOLVER_UTILS_EXPORT virtual void v_DoSolve();
431 
432 
433  /// Virtual function for the L_inf error computation between fields and a given exact solution.
434  SOLVER_UTILS_EXPORT virtual NekDouble v_LinfError(
435  unsigned int field,
436  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray);
437 
438  /// Virtual function for the L_2 error computation between fields and a given exact solution.
439  SOLVER_UTILS_EXPORT virtual NekDouble v_L2Error(
440  unsigned int field,
441  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray,
442  bool Normalised = false);
443 
444  /// Virtual function for transformation to physical space.
445  SOLVER_UTILS_EXPORT virtual void v_TransCoeffToPhys();
446 
447  /// Virtual function for transformation to coefficient space.
448  SOLVER_UTILS_EXPORT virtual void v_TransPhysToCoeff();
449 
450  /// Virtual function for generating summary information.
451  SOLVER_UTILS_EXPORT virtual void v_GenerateSummary(SummaryList& l);
452 
453  SOLVER_UTILS_EXPORT virtual void v_SetInitialConditions(
454  NekDouble initialtime = 0.0,
455  bool dumpInitialConditions = true,
456  const int domain = 0);
457 
458  SOLVER_UTILS_EXPORT virtual void v_EvaluateExactSolution(
459  unsigned int field,
460  Array<OneD, NekDouble> &outfield,
461  const NekDouble time);
462 
463  // Ouptut field information
464  SOLVER_UTILS_EXPORT virtual void v_Output(void);
465 
466  // Get pressure field if available
467  SOLVER_UTILS_EXPORT virtual MultiRegions::ExpListSharedPtr v_GetPressure(void);
468 
469  SOLVER_UTILS_EXPORT virtual void v_ExtraFldOutput(
470  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
471  std::vector<std::string> &variables);
472 
473  static std::string equationSystemTypeLookupIds[];
474 
475  private:
476 
477  SOLVER_UTILS_EXPORT virtual Array<OneD, bool> v_GetSystemSingularChecks();
478 
479  SOLVER_UTILS_EXPORT void PrintProgressbar(const int position,
480  const int goal) const
481  {
482  LibUtilities::PrintProgressbar(position, goal, "Interpolating");
483  }
484  };
485 
486 
487  /**
488  * This is the second part of the two-phase initialisation process.
489  * Calls to virtual functions will correctly resolve to the derived class
490  * during this phase of the construction.
491  */
493  {
494  v_InitObject();
495  }
496 
497 
498  /**
499  * This allows initialisation of the solver which cannot be completed
500  * during object construction (such as setting of initial conditions).
501  *
502  * Public interface routine to virtual function implementation.
503  */
505  {
506  v_DoInitialise();
507  }
508 
509 
510  /**
511  * Performs the transformation from coefficient to physical space.
512  *
513  * Public interface routine to virtual function implementation.
514  */
516  {
517  v_TransCoeffToPhys();
518  }
519 
520  /**
521  * Performs the transformation from physical to coefficient space.
522  *
523  * Public interface routine to virtual function implementation.
524  */
526  {
527  v_TransPhysToCoeff();
528  }
529 
530 
531  /**
532  * Performs the actual solve.
533  *
534  * Public interface routine to virtual function implementation.
535  */
536  inline void EquationSystem::DoSolve(void)
537  {
538  v_DoSolve();
539  }
540 
541 
542  /**
543  * Perform output operations after solve.
544  */
545  inline void EquationSystem::Output(void)
546  {
547  v_Output();
548  }
549 
550  /**
551  * L_inf Error computation
552  * Public interface routine to virtual function implementation.
553  */
554  inline NekDouble EquationSystem::LinfError(unsigned int field, const Array<OneD,NekDouble> &exactsoln)
555  {
556  return v_LinfError(field, exactsoln);
557  }
558 
559  /**
560  * L_2 Error computation
561  * Public interface routine to virtual function implementation.
562  */
563  inline NekDouble EquationSystem::L2Error(unsigned int field, const Array<OneD,NekDouble> &exactsoln, bool Normalised)
564  {
565  return v_L2Error(field, exactsoln, Normalised);
566  }
567 
568  /**
569  * Get Pressure field if available
570  */
572  {
573  return v_GetPressure();
574  }
575 
576  /**
577  * Append the coefficients and name of variables with solver specific
578  * extra variables
579  *
580  * @param fieldcoeffs Vector with coefficients
581  * @param variables Vector with name of variables
582  */
584  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
585  std::vector<std::string> &variables)
586  {
587  v_ExtraFldOutput(fieldcoeffs, variables);
588  }
589 
590  /**
591  * Prints a summary of variables and problem parameters.
592  *
593  * Public interface routine to virtual function implementation.
594  *
595  * @param out The ostream object to write to.
596  */
597  inline void EquationSystem::PrintSummary(std::ostream &out)
598  {
599  if (m_session->GetComm()->GetRank() == 0)
600  {
601  std::vector<std::pair<std::string, std::string> > vSummary;
602  v_GenerateSummary(vSummary);
603 
604  out << "=======================================================================" << std::endl;
605  for (auto &x : vSummary)
606  {
607  out << "\t";
608  out.width(20);
609  out << x.first << ": " << x.second << std::endl;
610  }
611  out << "=======================================================================" << std::endl;
612  }
613  }
614 
616  {
617  m_lambda = lambda;
618  }
619 
621  bool dumpInitialConditions,
622  const int domain)
623  {
624  v_SetInitialConditions(initialtime,dumpInitialConditions,domain);
625  }
626 
627  /// Evaluates an exact solution
629  Array<OneD, NekDouble> &outfield,
630  const NekDouble time)
631  {
632  v_EvaluateExactSolution(field, outfield, time);
633  }
634 
636  {
637  return m_fields;
638  }
639 
640  /// Return final time
642  {
643  return m_time;
644  }
645 
646  inline int EquationSystem::GetNcoeffs(void)
647  {
648  return m_fields[0]->GetNcoeffs();
649  }
650 
651  inline int EquationSystem::GetNcoeffs(const int eid)
652  {
653  return m_fields[0]->GetNcoeffs(eid);
654  }
655 
657  {
658  return m_graph->GetExpansions().begin()->second->m_basisKeyVector[0]
659  .GetNumModes();
660  }
661 
663  {
664  return m_fields[0]->EvalBasisNumModesMaxPerExp();
665  }
666 
668  {
669  return m_session->GetVariables().size();
670  }
671 
672  inline const std::string EquationSystem::GetVariable(unsigned int i)
673  {
674  return m_session->GetVariable(i);
675  }
676 
678  {
679  return GetTraceNpoints();
680  }
681 
683  {
684  return m_fields[0]->GetTrace()->GetNpoints();
685  }
686 
687  inline int EquationSystem::GetExpSize(void)
688  {
689  return m_fields[0]->GetExpSize();
690  }
691 
693  {
694  return m_fields[0]->GetPhys_Offset(n);
695  }
696 
698  {
699  return m_fields[0]->GetCoeff_Offset(n);
700  }
701 
703  {
704  return m_fields[0]->GetNpoints();
705  }
706 
708  {
709  return m_fields[0]->GetTotPoints(n);
710  }
711 
712  inline int EquationSystem::GetNpoints(void)
713  {
714  return m_fields[0]->GetNpoints();
715  }
716 
717  inline int EquationSystem::GetSteps(void)
718  {
719  return m_steps;
720  }
721 
723  {
724  return m_timestep;
725  }
726 
727  inline void EquationSystem::SetSteps(const int steps)
728  {
729  m_steps = steps;
730  }
731 
732  inline void EquationSystem::CopyFromPhysField(const int i,
733  Array<OneD, NekDouble> &output)
734  {
735  Vmath::Vcopy(output.num_elements(), m_fields[i]->GetPhys(), 1, output, 1 );
736  }
737 
738  inline void EquationSystem::CopyToPhysField(const int i,
739  Array<OneD, NekDouble> &output)
740  {
741  Vmath::Vcopy(output.num_elements(), output, 1, m_fields[i]->UpdatePhys(), 1 );
742  }
743  }
744 }
745 
746 #endif
bool m_singleMode
Flag to determine if single homogeneous mode is used.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
int PrintProgressbar(const int position, const int goal, const std::string message, int lastprogress=-1)
Prints a progressbar.
Definition: Progressbar.hpp:67
A base class for describing how to solve specific equations.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1550
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 m_time
Current time of simulation.
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
NekDouble m_timestep
Time step size.
SOLVER_UTILS_EXPORT void SetSteps(const int steps)
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
NekDouble m_lambda
Lambda constant in real system if one required.
SOLVER_UTILS_EXPORT int GetNvariables()
bool m_halfMode
Flag to determine if half homogeneous mode is used.
NekDouble m_LhomZ
physical length in Z direction (if homogeneous)
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
Definition: Conditions.h:289
SOLVER_UTILS_EXPORT const Array< OneD, int > GetNumExpModesPerExp()
Array< OneD, bool > m_checkIfSystemSingular
Flag to indicate if the fields should be checked for singularity.
int m_expdim
Expansion dimension.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
NekDouble m_LhomX
physical length in X direction (if homogeneous)
SOLVER_UTILS_EXPORT Array< OneD, MultiRegions::ExpListSharedPtr > & UpdateFields()
ProjectionType
Type of Galerkin projection.
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)
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
SOLVER_UTILS_EXPORT int GetNumExpModes()
SOLVER_UTILS_EXPORT void TransCoeffToPhys()
Transform from coefficient to physical space.
SOLVER_UTILS_EXPORT void InitObject()
Initialises the members of this object.
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.
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:52
int m_checksteps
Number of steps between checkpoints.
SOLVER_UTILS_EXPORT int GetCoeff_Offset(int n)
LibUtilities::CommSharedPtr m_comm
Communicator.
SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
Reset Session name.
SOLVER_UTILS_EXPORT int GetTotPoints()
SOLVER_UTILS_EXPORT const std::string GetVariable(unsigned int i)
SOLVER_UTILS_EXPORT void PrintProgressbar(const int position, const int goal) const
SOLVER_UTILS_EXPORT void Output()
Perform output operations after solve.
NekDouble m_fintime
Finish time of the simulation.
SOLVER_UTILS_EXPORT void CopyToPhysField(const int i, Array< OneD, NekDouble > &output)
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
SOLVER_UTILS_EXPORT int GetSteps()
SOLVER_UTILS_EXPORT int GetCheckpointSteps()
bool m_multipleModes
Flag to determine if use multiple homogenenous modes are used.
SOLVER_UTILS_EXPORT void TransPhysToCoeff()
Transform from physical to coefficient space.
SOLVER_UTILS_EXPORT void CopyFromPhysField(const int i, Array< OneD, NekDouble > &output)
SOLVER_UTILS_EXPORT void SetCheckpointSteps(int num)
int m_npointsY
number of points in Y direction (if homogeneous)
std::map< std::string, SolverUtils::SessionFunctionSharedPtr > m_sessionFunctions
Map of known SessionFunctions.
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...
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
Pointer to boundary conditions object.
int m_spacedim
Spatial dimension (>= expansion dim).
SOLVER_UTILS_EXPORT NekDouble L2Error(unsigned int field, bool Normalised=false)
Compute the L2 error of the fields.
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
double NekDouble
SOLVER_UTILS_EXPORT void DoInitialise()
Perform any initialisation necessary before solving the problem.
SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr GetSession()
Get Session name.
SOLVER_UTILS_EXPORT NekDouble GetTimeStep()
bool m_homogen_dealiasing
Flag to determine if dealiasing is used for homogeneous simulations.
SOLVER_UTILS_EXPORT std::string GetSessionName()
Get Session name.
EquationSystemFactory & GetEquationSystemFactory()
int m_npointsX
number of points in X direction (if homogeneous)
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
SOLVER_UTILS_EXPORT NekDouble GetFinalTime()
Return final time.
SOLVER_UTILS_EXPORT void PrintSummary(std::ostream &out)
Print a summary of parameters and solver characteristics.
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetExpSize()
#define SOLVER_UTILS_EXPORT
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT NekDouble LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
Linf error computation.
SOLVER_UTILS_EXPORT int GetTraceNpoints()
SOLVER_UTILS_EXPORT int GetNcoeffs()
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
HomogeneousType
Parameter for homogeneous expansions.
int m_initialStep
Number of the step where the simulation should begin.
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure()
Get pressure field if available.
SOLVER_UTILS_EXPORT void EvaluateExactSolution(int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
Evaluates an exact solution.
SOLVER_UTILS_EXPORT void SetTime(const NekDouble time)
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
SOLVER_UTILS_EXPORT void ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
SOLVER_UTILS_EXPORT void SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
Initialise the data in the dependent fields.
std::shared_ptr< SessionFunction > SessionFunctionSharedPtr
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
std::shared_ptr< FieldIO > FieldIOSharedPtr
Definition: FieldIO.h:306
SOLVER_UTILS_EXPORT void DoSolve()
Solve the problem.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
SOLVER_UTILS_EXPORT void SetInitialStep(const int step)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
SOLVER_UTILS_EXPORT void SetLambda(NekDouble lambda)
Set parameter m_lambda.
SOLVER_UTILS_EXPORT void SetCheckpointNumber(int num)
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
SOLVER_UTILS_EXPORT int GetCheckpointNumber()
Provides a generic Factory class.
Definition: NekFactory.hpp:103