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>
52 
53 namespace Nektar
54 {
55  namespace FieldUtils {
56  class Interpolator;
57  }
58  namespace SolverUtils
59  {
60  class EquationSystem;
61  class FilterOperators;
62 
63  /// A shared pointer to an EquationSystem object
64  typedef std::shared_ptr<EquationSystem> EquationSystemSharedPtr;
65  /// Datatype of the NekFactory used to instantiate classes derived from
66  /// the EquationSystem class.
68  std::string,
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();
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
104  SOLVER_UTILS_EXPORT inline NekDouble LinfError(unsigned int field,
105  const Array<OneD,NekDouble> &exactsoln = NullNekDouble1DArray);
106 
107  /// Get Session name
109  {
110  return m_sessionName;
111  }
112 
113  template<class T>
114  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  std::string name,
148  bool cache = false);
149 
150  /// Initialise the data in the dependent fields.
152  NekDouble initialtime = 0.0,
153  bool dumpInitialConditions = true,
154  const int domain = 0);
155 
156  /// Evaluates an exact solution
158  int field,
159  Array<OneD, NekDouble> &outfield,
160  const NekDouble time);
161 
162  /// Compute the L2 error between fields and a given exact
163  /// solution.
165  unsigned int field,
166  const Array<OneD,NekDouble> &exactsoln,
167  bool Normalised = false);
168 
169  /// Compute the L2 error of the fields
171  unsigned int field,
172  bool Normalised = false)
173  {
174  return L2Error(field,NullNekDouble1DArray,Normalised);
175  }
176 
177  /// Compute error (L2 and L_inf) over an larger set of quadrature
178  /// points return [L2 Linf]
180  unsigned int field);
181 
182  /// Write checkpoint file of #m_fields.
183  SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n);
184 
185  /// Write checkpoint file of custom data fields.
187  const int n,
189  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
190  std::vector<std::string> &variables);
191 
192  /// Write base flow file of #m_fields.
193  SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow(const int n);
194 
195  /// Write field data to the given filename.
196  SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname);
197 
198  /// Write input fields to the given filename.
200  const std::string &outname,
202  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
203  std::vector<std::string> &variables);
204 
205  /// Input field data from the given file.
207  const std::string &infile,
209 
210  /// Input field data from the given file to multiple domains
212  const std::string &infile,
214  const int ndomains);
215 
216  /// Output a field.
217  /// Input field data into array from the given file.
219  const std::string &infile,
220  std::vector<std::string> &fieldStr,
221  Array<OneD, Array<OneD, NekDouble> > &coeffs);
222 
223  /// Output a field.
224  /// Input field data into ExpList from the given file.
226  const std::string &infile,
228  std::string &pFieldName);
229 
230  /// Write out a session summary.
232 
233  SOLVER_UTILS_EXPORT inline Array<
235 
236 
237  /// Get hold of FieldInfoMap so it can be updated
240 
241  /// Return final time
243 
244  SOLVER_UTILS_EXPORT inline int GetNcoeffs();
245 
246  SOLVER_UTILS_EXPORT inline int GetNcoeffs(const int eid);
247 
248  SOLVER_UTILS_EXPORT inline int GetNumExpModes();
249 
252 
253  SOLVER_UTILS_EXPORT inline int GetNvariables();
254 
255  SOLVER_UTILS_EXPORT inline const std::string
256  GetVariable(unsigned int i);
257 
259 
261 
262  SOLVER_UTILS_EXPORT inline int GetExpSize();
263 
264  SOLVER_UTILS_EXPORT inline int GetPhys_Offset(int n);
265 
266  SOLVER_UTILS_EXPORT inline int GetCoeff_Offset(int n);
267 
268  SOLVER_UTILS_EXPORT inline int GetTotPoints();
269 
270  SOLVER_UTILS_EXPORT inline int GetTotPoints(int n);
271 
272  SOLVER_UTILS_EXPORT inline int GetNpoints();
273 
274  SOLVER_UTILS_EXPORT inline int GetSteps();
275 
277 
278  SOLVER_UTILS_EXPORT inline void CopyFromPhysField(const int i,
279  Array<OneD, NekDouble> &output);
280 
281  SOLVER_UTILS_EXPORT inline void CopyToPhysField(const int i,
282  Array<OneD, NekDouble> &output);
283 
284  SOLVER_UTILS_EXPORT inline void SetSteps(const int steps);
285 
287 
289 
291  const bool modbasis);
292 
294  {
295  return m_nchk;
296  }
297 
299  {
300  m_nchk = num;
301  }
302 
304  {
305  return m_checksteps;
306  }
307 
309  {
310  m_checksteps = num;
311  }
312 
314  const NekDouble time)
315  {
316  m_time = time;
317  }
318 
320  const int step)
321  {
322  m_initialStep = step;
323  }
324 
325  /// Evaluates the boundary conditions at the given time.
327 
328  /// Virtual function to identify if operator is negated in DoSolve
329  SOLVER_UTILS_EXPORT virtual bool v_NegatedOp();
330 
331  protected:
332  /// Communicator
334  bool m_verbose;
335  bool m_root;
336  /// The session reader
338  /// Map of known SessionFunctions
339  std::map<std::string, SolverUtils::SessionFunctionSharedPtr> m_sessionFunctions;
340  /// Field input/output
342  /// Array holding all dependent variables.
344  /// Pointer to boundary conditions object.
346  /// Pointer to graph defining mesh.
348  /// Name of the session.
349  std::string m_sessionName;
350  /// Current time of simulation.
352  /// Number of the step where the simulation should begin
354  /// Finish time of the simulation.
356  /// Time step size
358  /// Time step size
360 
361  /// Lambda constant in real system if one required.
363  /// Time between checkpoints.
366 
368 
369  /// Number of checkpoints written so far
370  int m_nchk;
371  /// Number of steps to take.
372  int m_steps;
373  /// Number of steps between checkpoints.
375  /// Spatial dimension (>= expansion dim).
377  /// Expansion dimension.
378  int m_expdim;
379  /// Flag to determine if single homogeneous mode is used.
381  /// Flag to determine if half homogeneous mode is used.
383  /// Flag to determine if use multiple homogenenous modes are used.
385  /// Flag to determine if FFT is used for homogeneous transform.
386  bool m_useFFT;
387  /**
388  * \brief Flag to determine if dealiasing is used for
389  * homogeneous simulations.
390  */
392  /**
393  * \brief Flag to determine if dealisising is usde for the
394  * Spectral/hp element discretisation.
395  */
397  /// Type of projection; e.g continuous or discontinuous.
399  /// Array holding trace normals for DG simulations in the forwards direction.
401  /// Flag to indicate if the fields should be checked for singularity.
403  /// Map to identify relevant solver info to dump in output fields
405 
406  /// Number of Quadrature points used to work out the error
408 
409  /// Parameter for homogeneous expansions
411  {
416  };
417 
419 
420  NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
421  NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
422  NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
423 
424  int m_npointsX; ///< number of points in X direction (if homogeneous)
425  int m_npointsY; ///< number of points in Y direction (if homogeneous)
426  int m_npointsZ; ///< number of points in Z direction (if homogeneous)
427 
428  int m_HomoDirec; ///< number of homogenous directions
429 
430  /// Initialises EquationSystem class members.
432  const LibUtilities::SessionReaderSharedPtr& pSession,
433  const SpatialDomains::MeshGraphSharedPtr& pGraph);
434 
435  SOLVER_UTILS_EXPORT virtual void v_InitObject();
436 
437  /// Virtual function for initialisation implementation.
438  SOLVER_UTILS_EXPORT virtual void v_DoInitialise();
439 
440  /// Virtual function for solve implementation.
441  SOLVER_UTILS_EXPORT virtual void v_DoSolve();
442 
443 
444  /// Virtual function for the L_inf error computation between fields and a given exact solution.
446  unsigned int field,
447  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray);
448 
449  /// Virtual function for the L_2 error computation between fields and a given exact solution.
451  unsigned int field,
452  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray,
453  bool Normalised = false);
454 
455  /// Virtual function for transformation to physical space.
457 
458  /// Virtual function for transformation to coefficient space.
460 
461  /// Virtual function for generating summary information.
463 
465  NekDouble initialtime = 0.0,
466  bool dumpInitialConditions = true,
467  const int domain = 0);
468 
470  unsigned int field,
471  Array<OneD, NekDouble> &outfield,
472  const NekDouble time);
473 
474  // Ouptut field information
475  SOLVER_UTILS_EXPORT virtual void v_Output(void);
476 
477  // Get pressure field if available
479 
481  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
482  std::vector<std::string> &variables);
483 
484  static std::string equationSystemTypeLookupIds[];
485 
486  private:
487 
489 
490  SOLVER_UTILS_EXPORT void PrintProgressbar(const int position,
491  const int goal) const
492  {
493  LibUtilities::PrintProgressbar(position, goal, "Interpolating");
494  }
495  };
496 
497 
498  /**
499  * This is the second part of the two-phase initialisation process.
500  * Calls to virtual functions will correctly resolve to the derived class
501  * during this phase of the construction.
502  */
504  {
505  v_InitObject();
506  }
507 
508 
509  /**
510  * This allows initialisation of the solver which cannot be completed
511  * during object construction (such as setting of initial conditions).
512  *
513  * Public interface routine to virtual function implementation.
514  */
516  {
517  v_DoInitialise();
518  }
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  /**
543  * Performs the actual solve.
544  *
545  * Public interface routine to virtual function implementation.
546  */
547  inline void EquationSystem::DoSolve(void)
548  {
549  v_DoSolve();
550  }
551 
552 
553  /**
554  * Perform output operations after solve.
555  */
556  inline void EquationSystem::Output(void)
557  {
558  v_Output();
559  }
560 
561  /**
562  * L_inf Error computation
563  * Public interface routine to virtual function implementation.
564  */
565  inline NekDouble EquationSystem::LinfError(unsigned int field, const Array<OneD,NekDouble> &exactsoln)
566  {
567  return v_LinfError(field, exactsoln);
568  }
569 
570  /**
571  * L_2 Error computation
572  * Public interface routine to virtual function implementation.
573  */
574  inline NekDouble EquationSystem::L2Error(unsigned int field, const Array<OneD,NekDouble> &exactsoln, bool Normalised)
575  {
576  return v_L2Error(field, exactsoln, Normalised);
577  }
578 
579  /**
580  * Get Pressure field if available
581  */
583  {
584  return v_GetPressure();
585  }
586 
587  /**
588  * Append the coefficients and name of variables with solver specific
589  * extra variables
590  *
591  * @param fieldcoeffs Vector with coefficients
592  * @param variables Vector with name of variables
593  */
595  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
596  std::vector<std::string> &variables)
597  {
598  v_ExtraFldOutput(fieldcoeffs, variables);
599  }
600 
601  /**
602  * Prints a summary of variables and problem parameters.
603  *
604  * Public interface routine to virtual function implementation.
605  *
606  * @param out The ostream object to write to.
607  */
608  inline void EquationSystem::PrintSummary(std::ostream &out)
609  {
610  if (m_session->GetComm()->GetRank() == 0)
611  {
612  std::vector<std::pair<std::string, std::string> > vSummary;
613  v_GenerateSummary(vSummary);
614 
615  out << "=======================================================================" << std::endl;
616  for (auto &x : vSummary)
617  {
618  out << "\t";
619  out.width(20);
620  out << x.first << ": " << x.second << std::endl;
621  }
622  out << "=======================================================================" << std::endl;
623  }
624  }
625 
627  {
628  m_lambda = lambda;
629  }
630 
632  bool dumpInitialConditions,
633  const int domain)
634  {
635  v_SetInitialConditions(initialtime,dumpInitialConditions,domain);
636  }
637 
638  /// Evaluates an exact solution
640  Array<OneD, NekDouble> &outfield,
641  const NekDouble time)
642  {
643  v_EvaluateExactSolution(field, outfield, time);
644  }
645 
647  {
648  return m_fields;
649  }
650 
651  /// Return final time
653  {
654  return m_time;
655  }
656 
657  inline int EquationSystem::GetNcoeffs(void)
658  {
659  return m_fields[0]->GetNcoeffs();
660  }
661 
662  inline int EquationSystem::GetNcoeffs(const int eid)
663  {
664  return m_fields[0]->GetNcoeffs(eid);
665  }
666 
668  {
669  return m_graph->GetExpansionInfo().begin()->second->m_basisKeyVector[0]
670  .GetNumModes();
671  }
672 
674  {
675  return m_fields[0]->EvalBasisNumModesMaxPerExp();
676  }
677 
679  {
680  return m_session->GetVariables().size();
681  }
682 
683  inline const std::string EquationSystem::GetVariable(unsigned int i)
684  {
685  return m_session->GetVariable(i);
686  }
687 
689  {
690  return GetTraceNpoints();
691  }
692 
694  {
695  return m_fields[0]->GetTrace()->GetNpoints();
696  }
697 
698  inline int EquationSystem::GetExpSize(void)
699  {
700  return m_fields[0]->GetExpSize();
701  }
702 
704  {
705  return m_fields[0]->GetPhys_Offset(n);
706  }
707 
709  {
710  return m_fields[0]->GetCoeff_Offset(n);
711  }
712 
714  {
715  return m_fields[0]->GetNpoints();
716  }
717 
719  {
720  return m_fields[0]->GetTotPoints(n);
721  }
722 
723  inline int EquationSystem::GetNpoints(void)
724  {
725  return m_fields[0]->GetNpoints();
726  }
727 
728  inline int EquationSystem::GetSteps(void)
729  {
730  return m_steps;
731  }
732 
734  {
735  return m_timestep;
736  }
737 
738  inline void EquationSystem::SetSteps(const int steps)
739  {
740  m_steps = steps;
741  }
742 
743  inline void EquationSystem::CopyFromPhysField(const int i,
744  Array<OneD, NekDouble> &output)
745  {
746  Vmath::Vcopy(output.size(), m_fields[i]->GetPhys(), 1, output, 1 );
747  }
748 
749  inline void EquationSystem::CopyToPhysField(const int i,
750  Array<OneD, NekDouble> &output)
751  {
752  Vmath::Vcopy(output.size(), output, 1, m_fields[i]->UpdatePhys(), 1 );
753  }
754  }
755 }
756 
757 #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()
SOLVER_UTILS_EXPORT void ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
SOLVER_UTILS_EXPORT LibUtilities::FieldMetaDataMap & UpdateFieldMetaDataMap()
Get hold of FieldInfoMap so it can be updated.
bool m_useFFT
Flag to determine if FFT is used for homogeneous transform.
SOLVER_UTILS_EXPORT int GetNvariables()
SOLVER_UTILS_EXPORT int GetCheckpointSteps()
int m_expdim
Expansion dimension.
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
SOLVER_UTILS_EXPORT void SessionSummary(SummaryList &vSummary)
Write out a session summary.
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
virtual SOLVER_UTILS_EXPORT ~EquationSystem()
Destructor.
SOLVER_UTILS_EXPORT void SetSteps(const int steps)
SOLVER_UTILS_EXPORT void TransCoeffToPhys()
Transform from coefficient to physical space.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
int m_npointsX
number of points in X direction (if homogeneous)
LibUtilities::CommSharedPtr m_comm
Communicator.
NekDouble m_timestep
Time step size.
SOLVER_UTILS_EXPORT void ImportFld(const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Input field data from the given file.
NekDouble m_time
Current time of simulation.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
bool m_multipleModes
Flag to determine if use multiple homogenenous modes are used.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT void DoInitialise()
Perform any initialisation necessary before solving the problem.
SOLVER_UTILS_EXPORT NekDouble LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
Linf error computation.
SOLVER_UTILS_EXPORT const std::string GetVariable(unsigned int i)
NekDouble m_LhomX
physical length in X direction (if homogeneous)
SOLVER_UTILS_EXPORT void DoSolve()
Solve the problem.
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff()
Virtual function for transformation to coefficient space.
SOLVER_UTILS_EXPORT NekDouble L2Error(unsigned int field, bool Normalised=false)
Compute the L2 error of the fields.
SOLVER_UTILS_EXPORT void EvaluateExactSolution(int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
Evaluates an exact solution.
NekDouble m_fintime
Finish time of the simulation.
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
Virtual function for the L_2 error computation between fields and a given exact solution.
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure(void)
NekDouble m_lambda
Lambda constant in real system if one required.
SOLVER_UTILS_EXPORT void SetCheckpointNumber(int num)
int m_npointsZ
number of points in Z direction (if homogeneous)
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
std::map< std::string, SolverUtils::SessionFunctionSharedPtr > m_sessionFunctions
Map of known SessionFunctions.
NekDouble m_checktime
Time between checkpoints.
SOLVER_UTILS_EXPORT NekDouble GetTimeStep()
SOLVER_UTILS_EXPORT void TransPhysToCoeff()
Transform from physical to coefficient space.
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
Virtual function for the L_inf error computation between fields and a given exact solution.
SOLVER_UTILS_EXPORT int GetCoeff_Offset(int n)
SOLVER_UTILS_EXPORT void Output()
Perform output operations after solve.
SOLVER_UTILS_EXPORT const Array< OneD, int > GetNumExpModesPerExp()
static std::string equationSystemTypeLookupIds[]
NekDouble m_timestepMax
Time step size.
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
SOLVER_UTILS_EXPORT NekDouble GetFinalTime()
Return final time.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
SOLVER_UTILS_EXPORT NekDouble L2Error(unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised=false)
Compute the L2 error between fields and a given exact solution.
SOLVER_UTILS_EXPORT int GetExpSize()
SOLVER_UTILS_EXPORT void ImportFldToMultiDomains(const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const int ndomains)
Input field data from the given file to multiple domains.
NekDouble m_LhomY
physical length in Y direction (if homogeneous)
int m_npointsY
number of points in Y direction (if homogeneous)
SOLVER_UTILS_EXPORT void SetModifiedBasis(const bool modbasis)
std::string m_sessionName
Name of the session.
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow(const int n)
Write base flow file of m_fields.
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
bool m_singleMode
Flag to determine if single homogeneous mode is used.
HomogeneousType
Parameter for homogeneous expansions.
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp()
Virtual function to identify if operator is negated in DoSolve.
SOLVER_UTILS_EXPORT void ZeroPhysFields()
int m_HomoDirec
number of homogenous directions
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
SOLVER_UTILS_EXPORT void SetCheckpointSteps(int num)
int m_initialStep
Number of the step where the simulation should begin.
enum HomogeneousType m_HomogeneousType
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > ErrorExtraPoints(unsigned int field)
Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf].
SOLVER_UTILS_EXPORT std::string GetSessionName()
Get Session name.
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, bool > m_checkIfSystemSingular
Flag to indicate if the fields should be checked for singularity.
bool m_homogen_dealiasing
Flag to determine if dealiasing is used for homogeneous simulations.
SOLVER_UTILS_EXPORT int GetNcoeffs()
int m_nchk
Number of checkpoints written so far.
SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr GetSession()
Get Session name.
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
SOLVER_UTILS_EXPORT void CopyFromPhysField(const int i, Array< OneD, NekDouble > &output)
virtual SOLVER_UTILS_EXPORT void v_DoSolve()
Virtual function for solve implementation.
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure()
Get pressure field if available.
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
virtual SOLVER_UTILS_EXPORT Array< OneD, bool > v_GetSystemSingularChecks()
SOLVER_UTILS_EXPORT void SetLambda(NekDouble lambda)
Set parameter m_lambda.
int m_steps
Number of steps to take.
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
SOLVER_UTILS_EXPORT void PrintProgressbar(const int position, const int goal) const
SOLVER_UTILS_EXPORT EquationSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises EquationSystem class members.
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
SOLVER_UTILS_EXPORT int GetNumExpModes()
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
Pointer to boundary conditions object.
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
NekDouble m_LhomZ
physical length in Z direction (if homogeneous)
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &l)
Virtual function for generating summary information.
bool m_halfMode
Flag to determine if half homogeneous mode is used.
SOLVER_UTILS_EXPORT void FwdTransFields()
SOLVER_UTILS_EXPORT void InitObject()
Initialises the members of this object.
int m_checksteps
Number of steps between checkpoints.
SOLVER_UTILS_EXPORT void SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
Initialise the data in the dependent fields.
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Initialisation object for EquationSystem.
SOLVER_UTILS_EXPORT int GetCheckpointNumber()
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
Get a SessionFunction by name.
SOLVER_UTILS_EXPORT void CopyToPhysField(const int i, Array< OneD, NekDouble > &output)
SOLVER_UTILS_EXPORT int GetTotPoints()
SOLVER_UTILS_EXPORT void SetUpTraceNormals(void)
virtual SOLVER_UTILS_EXPORT void v_Output(void)
SOLVER_UTILS_EXPORT void SetTime(const NekDouble time)
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys()
Virtual function for transformation to physical space.
SOLVER_UTILS_EXPORT void PrintSummary(std::ostream &out)
Print a summary of parameters and solver characteristics.
std::shared_ptr< FieldIO > FieldIOSharedPtr
Definition: FieldIO.h:306
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:1792
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
LibUtilities::NekFactory< std::string, EquationSystem, const LibUtilities::SessionReaderSharedPtr &, const SpatialDomains::MeshGraphSharedPtr & > EquationSystemFactory
Datatype of the NekFactory used to instantiate classes derived from the EquationSystem class.
EquationSystemFactory & GetEquationSystemFactory()
std::shared_ptr< SessionFunction > SessionFunctionSharedPtr
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
Definition: Conditions.h:289
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
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:1199