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 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, Array<OneD, NekDouble> &output);
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_traceNormals;
304  }
305 
307  {
308  m_time = time;
309  }
310 
311  SOLVER_UTILS_EXPORT void SetInitialStep(const int step)
312  {
313  m_initialStep = step;
314  }
315 
316  /// Evaluates the boundary conditions at the given time.
318 
319  /// Virtual function to identify if operator is negated in DoSolve
320  SOLVER_UTILS_EXPORT virtual bool v_NegatedOp();
321 
322 protected:
323  /// Communicator
325  bool m_verbose;
326  bool m_root;
327  /// The session reader
329  /// Map of known SessionFunctions
330  std::map<std::string, SolverUtils::SessionFunctionSharedPtr>
332  /// Field input/output
334  /// Array holding all dependent variables.
336  /// Pointer to boundary conditions object.
338  /// Pointer to graph defining mesh.
340  /// Name of the session.
341  std::string m_sessionName;
342  /// Current time of simulation.
344  /// Number of the step where the simulation should begin
346  /// Finish time of the simulation.
348  /// Time step size
350  /// Time step size
352 
353  /// Lambda constant in real system if one required.
355  /// Time between checkpoints.
358 
360 
361  /// Number of checkpoints written so far
362  int m_nchk;
363  /// Number of steps to take.
364  int m_steps;
365  /// Number of steps between checkpoints.
367  /// Spatial dimension (>= expansion dim).
369  /// Expansion dimension.
370  int m_expdim;
371  /// Flag to determine if single homogeneous mode is used.
373  /// Flag to determine if half homogeneous mode is used.
375  /// Flag to determine if use multiple homogenenous modes are used.
377  /// Flag to determine if FFT is used for homogeneous transform.
378  bool m_useFFT;
379  /**
380  * \brief Flag to determine if dealiasing is used for
381  * homogeneous simulations.
382  */
384  /**
385  * \brief Flag to determine if dealisising is usde for the
386  * Spectral/hp element discretisation.
387  */
389  /// Type of projection; e.g continuous or discontinuous.
391  /// Array holding trace normals for DG simulations in the forwards
392  /// direction.
394  /// Flag to indicate if the fields should be checked for singularity.
396  /// Map to identify relevant solver info to dump in output fields
398 
399  /// Moving frame of reference velocities
401 
402  /// Moving frame of reference angles with respect to the
403  // stationary inertial frame
405 
406  /// Projection matrix for transformation between inertial and moving
407  // frame of reference
408  boost::numeric::ublas::matrix<NekDouble> m_movingFrameProjMat;
409 
410  /// Number of Quadrature points used to work out the error
412 
413  /// Parameter for homogeneous expansions
415  {
420  };
421 
423 
424  NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
425  NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
426  NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
427 
428  int m_npointsX; ///< number of points in X direction (if homogeneous)
429  int m_npointsY; ///< number of points in Y direction (if homogeneous)
430  int m_npointsZ; ///< number of points in Z direction (if homogeneous)
431 
432  int m_HomoDirec; ///< number of homogenous directions
433 
434  /// Initialises EquationSystem class members.
436  const LibUtilities::SessionReaderSharedPtr &pSession,
437  const SpatialDomains::MeshGraphSharedPtr &pGraph);
438 
439  SOLVER_UTILS_EXPORT virtual void v_InitObject(bool DeclareFeld = true);
440 
441  /// Virtual function for initialisation implementation.
442  SOLVER_UTILS_EXPORT virtual void v_DoInitialise();
443 
444  /// Virtual function for solve implementation.
445  SOLVER_UTILS_EXPORT virtual void v_DoSolve();
446 
447  /// Virtual function for the L_inf error computation between fields and a
448  /// given exact solution.
450  unsigned int field,
451  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray);
452 
453  /// Virtual function for the L_2 error computation between fields and a
454  /// given exact solution.
456  unsigned int field,
457  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray,
458  bool Normalised = false);
459 
460  /// Virtual function for transformation to physical space.
462 
463  /// Virtual function for transformation to coefficient space.
465 
466  /// Virtual function for generating summary information.
468 
470  NekDouble initialtime = 0.0, bool dumpInitialConditions = true,
471  const int domain = 0);
472 
474  unsigned int field, Array<OneD, NekDouble> &outfield,
475  const NekDouble time);
476 
477  // Ouptut field information
478  SOLVER_UTILS_EXPORT virtual void v_Output(void);
479 
480  // Get pressure field if available
482  void);
483 
485  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
486  std::vector<std::string> &variables);
487 
488  static std::string equationSystemTypeLookupIds[];
489 
490 private:
492 
493  SOLVER_UTILS_EXPORT void PrintProgressbar(const int position,
494  const int goal) const
495  {
496  LibUtilities::PrintProgressbar(position, goal, "Interpolating");
497  }
498 };
499 
500 /**
501  * This is the second part of the two-phase initialisation process.
502  * Calls to virtual functions will correctly resolve to the derived class
503  * during this phase of the construction.
504  */
505 inline void EquationSystem::InitObject(bool DeclareField)
506 {
507  v_InitObject(DeclareField);
508 }
509 
510 /**
511  * This allows initialisation of the solver which cannot be completed
512  * during object construction (such as setting of initial conditions).
513  *
514  * Public interface routine to virtual function implementation.
515  */
517 {
518  v_DoInitialise();
519 }
520 
521 /**
522  * Performs the transformation from coefficient to physical space.
523  *
524  * Public interface routine to virtual function implementation.
525  */
527 {
529 }
530 
531 /**
532  * Performs the transformation from physical to coefficient space.
533  *
534  * Public interface routine to virtual function implementation.
535  */
537 {
539 }
540 
541 /**
542  * Performs the actual solve.
543  *
544  * Public interface routine to virtual function implementation.
545  */
546 inline void EquationSystem::DoSolve(void)
547 {
548  v_DoSolve();
549 }
550 
551 /**
552  * Perform output operations after solve.
553  */
554 inline void EquationSystem::Output(void)
555 {
556  v_Output();
557 }
558 
559 /**
560  * L_inf Error computation
561  * Public interface routine to virtual function implementation.
562  */
564  unsigned int field, const Array<OneD, NekDouble> &exactsoln)
565 {
566  return v_LinfError(field, exactsoln);
567 }
568 
569 /**
570  * L_2 Error computation
571  * Public interface routine to virtual function implementation.
572  */
574  unsigned int field, const Array<OneD, NekDouble> &exactsoln,
575  bool Normalised)
576 {
577  return v_L2Error(field, exactsoln, Normalised);
578 }
579 
580 /**
581  * Get Pressure field if available
582  */
584 {
585  return v_GetPressure();
586 }
587 
588 /**
589  * Append the coefficients and name of variables with solver specific
590  * extra variables
591  *
592  * @param fieldcoeffs Vector with coefficients
593  * @param variables Vector with name of variables
594  */
596  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
597  std::vector<std::string> &variables)
598 {
599  v_ExtraFldOutput(fieldcoeffs, variables);
600 }
601 
602 /**
603  * Prints a summary of variables and problem parameters.
604  *
605  * Public interface routine to virtual function implementation.
606  *
607  * @param out The ostream object to write to.
608  */
609 inline void EquationSystem::PrintSummary(std::ostream &out)
610 {
611  if (m_session->GetComm()->GetRank() == 0)
612  {
613  std::vector<std::pair<std::string, std::string>> vSummary;
614  v_GenerateSummary(vSummary);
615 
616  out << "==============================================================="
617  "========"
618  << std::endl;
619  for (auto &x : vSummary)
620  {
621  out << "\t";
622  out.width(20);
623  out << x.first << ": " << x.second << std::endl;
624  }
625  out << "==============================================================="
626  "========"
627  << std::endl;
628  }
629 }
630 
632 {
633  m_lambda = lambda;
634 }
635 
637  bool dumpInitialConditions,
638  const int domain)
639 {
640  v_SetInitialConditions(initialtime, dumpInitialConditions, domain);
641 }
642 
643 /// Evaluates an exact solution
645  int field, Array<OneD, NekDouble> &outfield, const NekDouble time)
646 {
647  v_EvaluateExactSolution(field, outfield, time);
648 }
649 
652 {
653  return m_fields;
654 }
655 
656 /// Return final time
658 {
659  return m_time;
660 }
661 
663 {
664  return m_fields[0]->GetNcoeffs();
665 }
666 
667 inline int EquationSystem::GetNcoeffs(const int eid)
668 {
669  return m_fields[0]->GetNcoeffs(eid);
670 }
671 
673 {
674  return m_graph->GetExpansionInfo()
675  .begin()
676  ->second->m_basisKeyVector[0]
677  .GetNumModes();
678 }
679 
681 {
682  return m_fields[0]->EvalBasisNumModesMaxPerExp();
683 }
684 
686 {
687  return m_session->GetVariables().size();
688 }
689 
690 inline const std::string EquationSystem::GetVariable(unsigned int i)
691 {
692  return m_session->GetVariable(i);
693 }
694 
696 {
697  return GetTraceNpoints();
698 }
699 
701 {
702  return m_fields[0]->GetTrace()->GetNpoints();
703 }
704 
706 {
707  return m_fields[0]->GetExpSize();
708 }
709 
711 {
712  return m_fields[0]->GetPhys_Offset(n);
713 }
714 
716 {
717  return m_fields[0]->GetCoeff_Offset(n);
718 }
719 
721 {
722  return m_fields[0]->GetNpoints();
723 }
724 
726 {
727  return m_fields[0]->GetTotPoints(n);
728 }
729 
731 {
732  return m_fields[0]->GetNpoints();
733 }
734 
735 inline int EquationSystem::GetSteps(void)
736 {
737  return m_steps;
738 }
739 
741 {
742  return m_timestep;
743 }
744 
745 inline void EquationSystem::SetSteps(const int steps)
746 {
747  m_steps = steps;
748 }
749 
750 inline void EquationSystem::CopyFromPhysField(const int i,
751  Array<OneD, NekDouble> &output)
752 {
753  Vmath::Vcopy(output.size(), m_fields[i]->GetPhys(), 1, output, 1);
754 }
755 
756 inline void EquationSystem::CopyToPhysField(const int i,
757  Array<OneD, NekDouble> &output)
758 {
759  Vmath::Vcopy(output.size(), output, 1, m_fields[i]->UpdatePhys(), 1);
760 }
761 } // namespace SolverUtils
762 } // namespace Nektar
763 
764 #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.
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.
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 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[]
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()
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 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.
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 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
Definition: FieldIO.h:301
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:1633
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:1
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