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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Base class for individual solvers.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERUTILS_EQUATIONSYSTEM_H
37 #define NEKTAR_SOLVERUTILS_EQUATIONSYSTEM_H
38 
48 #include <MultiRegions/ExpList.h>
50 #include <SolverUtils/Core/Misc.h>
51 
52 namespace Nektar
53 {
54  namespace SolverUtils
55  {
57 
58  /// A shared pointer to an EquationSystem object
59  typedef boost::shared_ptr<EquationSystem> EquationSystemSharedPtr;
60  /// Datatype of the NekFactory used to instantiate classes derived from
61  /// the EquationSystem class.
63  std::string, EquationSystem,
67 
68  /// A base class for describing how to solve specific equations.
69  class EquationSystem : public boost::enable_shared_from_this<EquationSystem>
70  {
71  public:
72  /// Destructor
74 
75  // Set up trace normals if required
77 
78  /// Initialises the members of this object.
79  SOLVER_UTILS_EXPORT inline void InitObject();
80 
81  /// Perform any initialisation necessary before solving the problem.
82  SOLVER_UTILS_EXPORT inline void DoInitialise();
83 
84  /// Solve the problem.
85  SOLVER_UTILS_EXPORT inline void DoSolve();
86 
87  /// Transform from coefficient to physical space.
89 
90  /// Transform from physical to coefficient space.
92 
93  /// Perform output operations after solve.
94  SOLVER_UTILS_EXPORT inline void Output();
95 
96  /// Linf error computation
97  SOLVER_UTILS_EXPORT inline NekDouble LinfError(unsigned int field, const Array<OneD,NekDouble> &exactsoln = NullNekDouble1DArray);
98 
99  /// Get Session name
101  {
102  return m_sessionName;
103  }
104 
105  template<class T>
106  boost::shared_ptr<T> as()
107  {
108 #if defined __INTEL_COMPILER && BOOST_VERSION > 105200
109  typedef typename boost::shared_ptr<T>::element_type E;
110  E * p = dynamic_cast< E* >( shared_from_this().get() );
111  ASSERTL1(p, "Cannot perform cast");
112  return boost::shared_ptr<T>( shared_from_this(), p );
113 #else
114  return boost::dynamic_pointer_cast<T>( shared_from_this() );
115 #endif
116  }
117 
118  /// Reset Session name
119  SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
120  {
121  m_sessionName = newname;
122  }
123 
124  /// Get Session name
126  {
127  return m_session;
128  }
129 
130  /// Get pressure field if available
132 
133  /// Print a summary of parameters and solver characteristics.
134  SOLVER_UTILS_EXPORT inline void PrintSummary(std::ostream &out);
135 
136  /// Set parameter m_lambda
137  SOLVER_UTILS_EXPORT inline void SetLambda(NekDouble lambda);
138 
139  /// Evaluates a function as specified in the session file.
141  Array<OneD, Array<OneD, NekDouble> >& pArray,
142  std::string pFunctionName,
143  const NekDouble pTime = 0.0,
144  const int domain = 0);
145 
146  /// Populate given fields with the function from session.
148  std::vector<std::string> pFieldNames,
149  Array<OneD, Array<OneD, NekDouble> > &pFields,
150  const std::string& pName,
151  const int domain = 0);
152 
153  /// Populate given fields with the function from session.
155  std::vector<std::string> pFieldNames,
157  const std::string& pName,
158  const int domain = 0);
159 
160  // Populate an array with a function variable from session.
162  std::string pFieldName,
163  Array<OneD, NekDouble>& pArray,
164  const std::string& pFunctionName,
165  const NekDouble& pTime = 0.0,
166  const int domain = 0);
167 
168  // Describe a function.
170  std::string pFieldName,
171  const std::string &pFunctionName,
172  const int domain);
173 
174  /// Perform initialisation of the base flow.
177 
178  /// Initialise the data in the dependent fields.
180  NekDouble initialtime = 0.0,
181  bool dumpInitialConditions = true,
182  const int domain = 0);
183 
184  /// Evaluates an exact solution
186  int field,
187  Array<OneD, NekDouble> &outfield,
188  const NekDouble time);
189 
190  /// Compute the L2 error between fields and a given exact
191  /// solution.
193  unsigned int field,
194  const Array<OneD,NekDouble> &exactsoln,
195  bool Normalised = false);
196 
197  /// Compute the L2 error of the fields
199  unsigned int field,
200  bool Normalised = false)
201  {
202  return L2Error(field,NullNekDouble1DArray,Normalised);
203  }
204 
205  /// Compute error (L2 and L_inf) over an larger set of quadrature
206  /// points return [L2 Linf]
208  unsigned int field);
209 
210  /// Compute the inner product \f$ (\nabla \phi \cdot F) \f$.
212  const Array<OneD, Array<OneD, NekDouble> > &F,
213  Array<OneD, NekDouble> &outarray);
214 
215  /// Compute the inner product \f$ (\phi, \nabla \cdot F) \f$.
217  const Array<OneD, Array<OneD, NekDouble> > &F,
218  Array<OneD, NekDouble> &outarray);
219 
220  /// Compute the inner product \f$ (\phi, V\cdot \nabla u) \f$.
222  const Array<OneD, Array<OneD, NekDouble> > &V,
224  Array<OneD, NekDouble> &outarray,
225  bool UseContCoeffs = false);
226 
227  /// Compute the non-conservative advection \f$ (V \cdot \nabla u)
228  /// \f$.
230  const Array<OneD, Array<OneD, NekDouble> > &V,
232  Array<OneD, NekDouble> &outarray,
234 
235  /// Calculate the weak discontinuous Galerkin advection.
237  const Array<OneD, Array<OneD, NekDouble> >& InField,
238  Array<OneD, Array<OneD, NekDouble> >& OutField,
239  bool NumericalFluxIncludesNormal = true,
240  bool InFieldIsInPhysSpace = false,
241  int nvariables = 0);
242 
243  /// Calculate weak DG Diffusion in the LDG form.
245  const Array<OneD, Array<OneD, NekDouble> >& InField,
246  Array<OneD, Array<OneD, NekDouble> >& OutField,
247  bool NumericalFluxIncludesNormal = true,
248  bool InFieldIsInPhysSpace = false);
249 
250  /// Write checkpoint file of #m_fields.
251  SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n);
252 
253  /// Write checkpoint file of custom data fields.
255  const int n,
257  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
258  std::vector<std::string> &variables);
259 
260  /// Write base flow file of #m_fields.
261  SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow(const int n);
262 
263  /// Write field data to the given filename.
264  SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname);
265 
266  /// Write input fields to the given filename.
268  const std::string &outname,
270  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
271  std::vector<std::string> &variables);
272 
273  /// Input field data from the given file.
275  const std::string &infile,
277 
278  /// Input field data from the given file to multiple domains
280  const std::string &infile,
282  const int ndomains);
283 
284  /// Output a field.
285  /// Input field data into array from the given file.
287  const std::string &infile,
288  std::vector<std::string> &fieldStr,
289  Array<OneD, Array<OneD, NekDouble> > &coeffs);
290 
291  /// Output a field.
292  /// Input field data into ExpList from the given file.
294  const std::string &infile,
296  std::string &pFieldName);
297 
298  /// Builds map of which element holds each history point.
300 
301  /// Probe each history point and write to file.
302  SOLVER_UTILS_EXPORT void WriteHistoryData (std::ostream &out);
303 
304  /// Write out a session summary.
306 
307  SOLVER_UTILS_EXPORT inline Array<
309 
310 
311  /// Get hold of FieldInfoMap so it can be updated
314 
315  /// Return final time
317 
318  SOLVER_UTILS_EXPORT inline int GetNcoeffs();
319 
320  SOLVER_UTILS_EXPORT inline int GetNcoeffs(const int eid);
321 
322  SOLVER_UTILS_EXPORT inline int GetNumExpModes();
323 
326 
327  SOLVER_UTILS_EXPORT inline int GetNvariables();
328 
329  SOLVER_UTILS_EXPORT inline const std::string
330  GetVariable(unsigned int i);
331 
333 
335 
336  SOLVER_UTILS_EXPORT inline int GetExpSize();
337 
338  SOLVER_UTILS_EXPORT inline int GetPhys_Offset(int n);
339 
340  SOLVER_UTILS_EXPORT inline int GetCoeff_Offset(int n);
341 
342  SOLVER_UTILS_EXPORT inline int GetTotPoints();
343 
344  SOLVER_UTILS_EXPORT inline int GetTotPoints(int n);
345 
346  SOLVER_UTILS_EXPORT inline int GetNpoints();
347 
349 
350  SOLVER_UTILS_EXPORT inline int GetSteps();
351 
353 
354  SOLVER_UTILS_EXPORT inline void CopyFromPhysField(const int i,
355  Array<OneD, NekDouble> &output);
356 
357  SOLVER_UTILS_EXPORT inline void CopyToPhysField(const int i,
358  Array<OneD, NekDouble> &output);
359 
360  SOLVER_UTILS_EXPORT inline void SetStepsToOne();
361 
363 
365 
367  const int i,
368  Array<OneD, Array<OneD, NekDouble> >&physfield,
369  Array<OneD, Array<OneD, NekDouble> >&flux);
370 
372  const int i,
373  Array<OneD, Array<OneD, NekDouble> >&physfield,
374  Array<OneD, Array<OneD, NekDouble> >&fluxX,
375  Array<OneD, Array<OneD, NekDouble> > &fluxY);
376 
378  const int i,
379  const int j,
380  Array<OneD, Array<OneD, NekDouble> > &physfield,
381  Array<OneD, Array<OneD, NekDouble> > &flux);
382 
384  Array<OneD, Array<OneD, NekDouble> > &physfield,
385  Array<OneD, Array<OneD, NekDouble> > &numflux);
386 
388  Array<OneD, Array<OneD, NekDouble> > &physfield,
389  Array<OneD, Array<OneD, NekDouble> > &numfluxX,
390  Array<OneD, Array<OneD, NekDouble> > &numfluxY);
391 
393  const Array<OneD, Array<OneD, NekDouble> > &ufield,
394  Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &uflux);
395 
397  const Array<OneD, Array<OneD, NekDouble> > &ufield,
398  Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &qfield,
399  Array<OneD, Array<OneD, NekDouble> > &qflux);
400 
402  const bool modbasis);
403 
404  /// Perform a case-insensitive string comparison.
406  const string & s1, const string& s2) ;
407 
408  /// Virtual function to identify if operator is negated in DoSolve
409  SOLVER_UTILS_EXPORT virtual bool v_NegatedOp();
410 
411  protected:
412  /// Communicator
414  /// The session reader
416  /// Field input/output
418  /// Map of the interpolation weights for a specific filename.
419  map<std::string, Array<OneD, Array<OneD, float> > > m_interpWeights;
420  /// Map of the interpolation indices for a specific filename.
421  map<std::string, Array<OneD, Array<OneD, unsigned int> > > m_interpInds;
422  /// Array holding all dependent variables.
424  /// Base fields.
426  /// Array holding all dependent variables.
428  /// Pointer to boundary conditions object.
430  /// Pointer to graph defining mesh.
432  /// Name of the session.
433  std::string m_sessionName;
434  /// Current time of simulation.
436  /// Finish time of the simulation.
438  /// Time step size
440  /// Lambda constant in real system if one required.
442  /// Time between checkpoints.
444  /// Number of steps to take.
445  int m_steps;
446  /// Number of steps between checkpoints.
448  /// Spatial dimension (>= expansion dim).
450  /// Expansion dimension.
451  int m_expdim;
452  /// Flag to determine if single homogeneous mode is used.
454  /// Flag to determine if half homogeneous mode is used.
456  /// Flag to determine if use multiple homogenenous modes are used.
458  /// Flag to determine if FFT is used for homogeneous transform.
459  bool m_useFFT;
460  /**
461  * \brief Flag to determine if dealiasing is used for
462  * homogeneous simulations.
463  */
465  /**
466  * \brief Flag to determine if dealisising is usde for the
467  * Spectral/hp element discretisation.
468  */
470  /// Type of projection; e.g continuous or discontinuous.
472  /// Array holding trace normals for DG simulations in the forwards direction.
474  /// 1 x nvariable x nq
476  /// 2 x m_spacedim x nq
478  /// Flag to indicate if the fields should be checked for singularity.
480  /// Map to identify relevant solver info to dump in output fields
482 
483  /// Number of Quadrature points used to work out the error
485 
486  /// Parameter for homogeneous expansions
488  {
493  };
494 
495 
496 
498 
499  NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
500  NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
501  NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
502 
503  int m_npointsX; ///< number of points in X direction (if homogeneous)
504  int m_npointsY; ///< number of points in Y direction (if homogeneous)
505  int m_npointsZ; ///< number of points in Z direction (if homogeneous)
506 
507  int m_HomoDirec; ///< number of homogenous directions
508 
509  int m_NumMode; ///< Mode to use in case of single mode analysis
510 
511 
512  /// Initialises EquationSystem class members.
514 
515  // Here for consistency purposes with old version
516  int nocase_cmp(const string & s1, const string& s2)
517  {
518  return NoCaseStringCompare(s1,s2);
519  }
520 
521  SOLVER_UTILS_EXPORT virtual void v_InitObject();
522 
523  /// Evaluates the boundary conditions at the given time.
525 
526  /// Virtual function for initialisation implementation.
527  SOLVER_UTILS_EXPORT virtual void v_DoInitialise();
528 
529  /// Virtual function for solve implementation.
530  SOLVER_UTILS_EXPORT virtual void v_DoSolve();
531 
532 
533  /// Virtual function for the L_inf error computation between fields and a given exact solution.
535  unsigned int field,
536  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray);
537 
538  /// Virtual function for the L_2 error computation between fields and a given exact solution.
540  unsigned int field,
541  const Array<OneD, NekDouble> &exactsoln = NullNekDouble1DArray,
542  bool Normalised = false);
543 
544  /// Virtual function for transformation to physical space.
546 
547  /// Virtual function for transformation to coefficient space.
549 
550  /// Virtual function for generating summary information.
552 
554  NekDouble initialtime = 0.0,
555  bool dumpInitialConditions = true,
556  const int domain = 0);
557 
559  unsigned int field,
560  Array<OneD, NekDouble> &outfield,
561  const NekDouble time);
562 
563  //Initialise m_base in order to store the base flow from a file
565 
566  // Fill m_base with the values stored in a fld file
568  std::string pInfile,
570 
571  // Ouptut field information
572  SOLVER_UTILS_EXPORT virtual void v_Output(void);
573 
574  // Get pressure field if available
576 
578  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
579  std::vector<std::string> &variables);
580 
581  private:
582 
585  const int i, Array<OneD,
586  Array<OneD, NekDouble> >&physfield,
587  Array<OneD, Array<OneD, NekDouble> >&flux);
588 
590  const int i, const int j,
591  Array<OneD, Array<OneD, NekDouble> >&physfield,
592  Array<OneD, Array<OneD, NekDouble> >&flux);
593 
595  const int i, Array<OneD,
596  Array<OneD, NekDouble> >&physfield,
597  Array<OneD, Array<OneD, NekDouble> >&fluxX,
598  Array<OneD, Array<OneD, NekDouble> > &fluxY);
599 
601  Array<OneD, Array<OneD, NekDouble> > &physfield,
602  Array<OneD, Array<OneD, NekDouble> > &numflux);
603 
605  Array<OneD, Array<OneD, NekDouble> > &physfield,
606  Array<OneD, Array<OneD, NekDouble> > &numfluxX,
607  Array<OneD, Array<OneD, NekDouble> > &numfluxY);
608 
610  const Array<OneD, Array<OneD, NekDouble> > &ufield,
611  Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &uflux);
612 
614  const Array<OneD, Array<OneD, NekDouble> > &ufield,
615  Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &qfield,
616  Array<OneD, Array<OneD, NekDouble > > &qflux);
617 
618  SOLVER_UTILS_EXPORT void PrintProgressbar(const int position,
619  const int goal) const
620  {
621  LibUtilities::PrintProgressbar(position, goal, "Interpolating");
622  }
623  };
624 
625 
626  /**
627  * This is the second part of the two-phase initialisation process.
628  * Calls to virtual functions will correctly resolve to the derived class
629  * during this phase of the construction.
630  */
632  {
633  v_InitObject();
634  }
635 
636 
637  /**
638  * This allows initialisation of the solver which cannot be completed
639  * during object construction (such as setting of initial conditions).
640  *
641  * Public interface routine to virtual function implementation.
642  */
644  {
645  v_DoInitialise();
646  }
647 
648 
649  /**
650  * Performs the transformation from coefficient to physical space.
651  *
652  * Public interface routine to virtual function implementation.
653  */
655  {
657  }
658 
659  /**
660  * Performs the transformation from physical to coefficient space.
661  *
662  * Public interface routine to virtual function implementation.
663  */
665  {
667  }
668 
669 
670  /**
671  * Performs the actual solve.
672  *
673  * Public interface routine to virtual function implementation.
674  */
675  inline void EquationSystem::DoSolve(void)
676  {
677  v_DoSolve();
678  }
679 
680 
681  /**
682  * Perform output operations after solve.
683  */
684  inline void EquationSystem::Output(void)
685  {
686  v_Output();
687  }
688 
689  /**
690  * L_inf Error computation
691  * Public interface routine to virtual function implementation.
692  */
693  inline NekDouble EquationSystem::LinfError(unsigned int field, const Array<OneD,NekDouble> &exactsoln)
694  {
695  return v_LinfError(field, exactsoln);
696  }
697 
698  /**
699  * L_2 Error computation
700  * Public interface routine to virtual function implementation.
701  */
702  inline NekDouble EquationSystem::L2Error(unsigned int field, const Array<OneD,NekDouble> &exactsoln, bool Normalised)
703  {
704  return v_L2Error(field, exactsoln, Normalised);
705  }
706 
707  /**
708  * Get Pressure field if available
709  */
711  {
712  return v_GetPressure();
713  }
714 
715  /**
716  * Prints a summary of variables and problem parameters.
717  *
718  * Public interface routine to virtual function implementation.
719  *
720  * @param out The ostream object to write to.
721  */
722  inline void EquationSystem::PrintSummary(std::ostream &out)
723  {
724  if (m_session->GetComm()->GetRank() == 0)
725  {
726  std::vector<std::pair<std::string, std::string> > vSummary;
727  v_GenerateSummary(vSummary);
728 
729  out << "=======================================================================" << endl;
730  SummaryList::const_iterator x;
731  for (x = vSummary.begin(); x != vSummary.end(); ++x)
732  {
733  out << "\t";
734  out.width(20);
735  out << x->first << ": " << x->second << endl;
736  }
737  out << "=======================================================================" << endl;
738  }
739  }
740 
742  {
743  m_lambda = lambda;
744  }
745 
747  bool dumpInitialConditions,
748  const int domain)
749  {
750  v_SetInitialConditions(initialtime,dumpInitialConditions,domain);
751  }
752 
753  /// Evaluates an exact solution
755  Array<OneD, NekDouble> &outfield,
756  const NekDouble time)
757  {
758  v_EvaluateExactSolution(field, outfield, time);
759  }
760 
762  {
763  return m_fields;
764  }
765 
766  /// Return final time
768  {
769  return m_time;
770  }
771 
772  inline int EquationSystem::GetNcoeffs(void)
773  {
774  return m_fields[0]->GetNcoeffs();
775  }
776 
777  inline int EquationSystem::GetNcoeffs(const int eid)
778  {
779  return m_fields[0]->GetNcoeffs(eid);
780  }
781 
783  {
784  return m_graph->GetExpansions().begin()->second->m_basisKeyVector[0]
785  .GetNumModes();
786  }
787 
789  {
790  return m_fields[0]->EvalBasisNumModesMaxPerExp();
791  }
792 
794  {
795  return m_session->GetVariables().size();
796  }
797 
798  inline const std::string EquationSystem::GetVariable(unsigned int i)
799  {
800  return m_session->GetVariable(i);
801  }
802 
804  {
805  return GetTraceNpoints();
806  }
807 
809  {
810  return m_fields[0]->GetTrace()->GetNpoints();
811  }
812 
813  inline int EquationSystem::GetExpSize(void)
814  {
815  return m_fields[0]->GetExpSize();
816  }
817 
819  {
820  return m_fields[0]->GetPhys_Offset(n);
821  }
822 
824  {
825  return m_fields[0]->GetCoeff_Offset(n);
826  }
827 
829  {
830  return m_fields[0]->GetNpoints();
831  }
832 
834  {
835  return m_fields[0]->GetTotPoints(n);
836  }
837 
838  inline int EquationSystem::GetNpoints(void)
839  {
840  return m_fields[0]->GetNpoints();
841  }
842 
844  {
845  return (m_fields.num_elements() - 1);
846  }
847 
848  inline int EquationSystem::GetSteps(void)
849  {
850  return m_steps;
851  }
852 
854  {
855  return m_timestep;
856  }
857 
859  {
860  m_steps=1;
861  }
862 
863  inline void EquationSystem::CopyFromPhysField(const int i,
864  Array<OneD, NekDouble> &output)
865  {
866  Vmath::Vcopy(output.num_elements(), m_fields[i]->GetPhys(), 1, output, 1 );
867  }
868 
869  inline void EquationSystem::CopyToPhysField(const int i,
870  Array<OneD, NekDouble> &output)
871  {
872  Vmath::Vcopy(output.num_elements(), output, 1, m_fields[i]->UpdatePhys(), 1 );
873  }
874 
875  inline void EquationSystem::GetFluxVector(const int i,
876  Array<OneD, Array<OneD, NekDouble> >&physfield,
878  {
879  v_GetFluxVector(i,physfield, flux);
880  }
881 
882  inline void EquationSystem::GetFluxVector(const int i,
883  Array<OneD, Array<OneD, NekDouble> >&physfield,
886  {
887  v_GetFluxVector(i,physfield, fluxX, fluxY);
888  }
889 
890  inline void EquationSystem::GetFluxVector(const int i, const int j,
891  Array<OneD, Array<OneD, NekDouble> > &physfield,
893  {
894  v_GetFluxVector(i,j,physfield,flux);
895  }
896 
898  Array<OneD, Array<OneD, NekDouble> > &numflux)
899  {
900  v_NumericalFlux(physfield, numflux);
901  }
902 
904  Array<OneD, Array<OneD, NekDouble> > &numfluxX,
905  Array<OneD, Array<OneD, NekDouble> > &numfluxY)
906  {
907  v_NumericalFlux(physfield, numfluxX, numfluxY);
908  }
909 
911  const Array<OneD, Array<OneD, NekDouble> > &ufield,
913  {
914  v_NumFluxforScalar(ufield, uflux);
915  }
916 
918  const Array<OneD, Array<OneD, NekDouble> > &ufield,
921  {
922  v_NumFluxforVector(ufield, qfield, qflux);
923  }
924  }
925 }
926 
927 #endif
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &l)
Virtual function for generating summary information.
bool m_singleMode
Flag to determine if single homogeneous mode is used.
SOLVER_UTILS_EXPORT void NumFluxforScalar(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
f SOLVER_UTILS_EXPORT void AdvectionNonConservativeForm(const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wk=NullNekDouble1DArray)
Compute the non-conservative advection.
SOLVER_UTILS_EXPORT void InitialiseBaseFlow(Array< OneD, Array< OneD, NekDouble > > &base)
Perform initialisation of the base flow.
LibUtilities::NekFactory< std::string, EquationSystem, const LibUtilities::SessionReaderSharedPtr & > EquationSystemFactory
Datatype of the NekFactory used to instantiate classes derived from the EquationSystem class...
SOLVER_UTILS_EXPORT std::string DescribeFunction(std::string pFieldName, const std::string &pFunctionName, const int domain)
Provide a description of a function for a given field name.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_gradtan
1 x nvariable x nq
A base class for describing how to solve specific equations.
int nocase_cmp(const string &s1, const string &s2)
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.
SOLVER_UTILS_EXPORT void WeakAdvectionNonConservativeForm(const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, bool UseContCoeffs=false)
Compute the inner product .
NekDouble m_timestep
Time step size.
SOLVER_UTILS_EXPORT void SetUpTraceNormals(void)
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:47
NekDouble m_lambda
Lambda constant in real system if one required.
SOLVER_UTILS_EXPORT void SetStepsToOne()
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)
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.
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.
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
NekDouble m_LhomX
physical length in X direction (if homogeneous)
SOLVER_UTILS_EXPORT Array< OneD, MultiRegions::ExpListSharedPtr > & UpdateFields()
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
map< std::string, Array< OneD, Array< OneD, unsigned int > > > m_interpInds
Map of the interpolation indices for a specific filename.
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].
ProjectionType
Type of Galerkin projection.
SOLVER_UTILS_EXPORT void WeakAdvectionGreensDivergenceForm(const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
Compute the inner product .
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.
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
SOLVER_UTILS_EXPORT void PrintProgressbar(const int position, const int goal) const
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...
int m_npointsZ
number of points in Z direction (if homogeneous)
virtual SOLVER_UTILS_EXPORT ~EquationSystem()
Destructor.
std::string m_sessionName
Name of the session.
int m_NumMode
Mode to use in case of single mode analysis.
SOLVER_UTILS_EXPORT void WeakAdvectionDivergenceForm(const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
Compute the inner product .
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:50
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:65
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 SetModifiedBasis(const bool modbasis)
SOLVER_UTILS_EXPORT LibUtilities::FieldMetaDataMap & UpdateFieldMetaDataMap()
Get hold of FieldInfoMap so it can be updated.
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 Output()
Perform output operations after solve.
NekDouble m_fintime
Finish time of the simulation.
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Initialisation object for EquationSystem.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tanbasis
2 x m_spacedim x nq
SOLVER_UTILS_EXPORT void CopyToPhysField(const int i, Array< OneD, NekDouble > &output)
boost::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
int m_steps
Number of steps to take.
SOLVER_UTILS_EXPORT int NoCaseStringCompare(const string &s1, const string &s2)
Perform a case-insensitive string comparison.
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 void FwdTransFields()
Array< OneD, MultiRegions::ExpListSharedPtr > m_derivedfields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT void WeakDGDiffusion(const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false)
Calculate weak DG Diffusion in the LDG form.
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
SOLVER_UTILS_EXPORT int GetSteps()
bool m_multipleModes
Flag to determine if use multiple homogenenous modes are used.
virtual SOLVER_UTILS_EXPORT Array< OneD, bool > v_GetSystemSingularChecks()
SOLVER_UTILS_EXPORT void TransPhysToCoeff()
Transform from physical to coefficient space.
SOLVER_UTILS_EXPORT void NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
SOLVER_UTILS_EXPORT void SetUpBaseFields(SpatialDomains::MeshGraphSharedPtr &mesh)
SOLVER_UTILS_EXPORT void CopyFromPhysField(const int i, Array< OneD, NekDouble > &output)
int m_npointsY
number of points in Y direction (if homogeneous)
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff()
Virtual function for transformation to coefficient space.
virtual SOLVER_UTILS_EXPORT void v_GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Definition: ExpList.h:1340
virtual SOLVER_UTILS_EXPORT void v_Output(void)
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.
boost::shared_ptr< FieldIO > FieldIOSharedPtr
Definition: FieldIO.h:236
double NekDouble
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
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()
SOLVER_UTILS_EXPORT void GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
SOLVER_UTILS_EXPORT void ScanForHistoryPoints()
Builds map of which element holds each history point.
virtual SOLVER_UTILS_EXPORT void v_DoInitialise()
Virtual function for initialisation implementation.
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()
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.
int m_npointsX
number of points in X direction (if homogeneous)
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
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 void WriteFld(const std::string &outname)
Write field data to the given filename.
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.
Array< OneD, MultiRegions::ExpListSharedPtr > m_base
Base fields.
SOLVER_UTILS_EXPORT NekDouble LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
Linf error computation.
boost::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
Definition: Conditions.h:269
SOLVER_UTILS_EXPORT int GetTraceNpoints()
SOLVER_UTILS_EXPORT int GetNcoeffs()
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
HomogeneousType
Parameter for homogeneous expansions.
virtual SOLVER_UTILS_EXPORT void v_NumFluxforVector(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure()
Get pressure field if available.
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp()
Virtual function to identify if operator is negated in DoSolve.
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure(void)
SOLVER_UTILS_EXPORT void NumFluxforVector(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
SOLVER_UTILS_EXPORT void ZeroPhysFields()
SOLVER_UTILS_EXPORT void EvaluateExactSolution(int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
Evaluates an exact solution.
SOLVER_UTILS_EXPORT void SessionSummary(SummaryList &vSummary)
Write out a session summary.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
virtual SOLVER_UTILS_EXPORT void v_NumFluxforScalar(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
SOLVER_UTILS_EXPORT void WriteHistoryData(std::ostream &out)
Probe each history point and write to file.
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 WeakDGAdvection(const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false, int nvariables=0)
Calculate the weak discontinuous Galerkin advection.
SOLVER_UTILS_EXPORT int GetNumElmVelocity()
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow(const int n)
Write base flow file of m_fields.
SOLVER_UTILS_EXPORT void ImportFldBase(std::string pInfile, SpatialDomains::MeshGraphSharedPtr pGraph)
virtual SOLVER_UTILS_EXPORT void v_DoSolve()
Virtual function for solve implementation.
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:432
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:1038
void PrintProgressbar(const int position, const int goal, const string message)
Prints a progressbar.
Definition: Progressbar.hpp:69
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys()
Virtual function for transformation to physical space.
map< std::string, Array< OneD, Array< OneD, float > > > m_interpWeights
Map of the interpolation weights for a specific filename.
SOLVER_UTILS_EXPORT void SetLambda(NekDouble lambda)
Set parameter m_lambda.
SOLVER_UTILS_EXPORT EquationSystem(const LibUtilities::SessionReaderSharedPtr &pSession)
Initialises EquationSystem class members.
virtual SOLVER_UTILS_EXPORT void v_NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
enum HomogeneousType m_HomogeneousType
Provides a generic Factory class.
Definition: NekFactory.hpp:116
SOLVER_UTILS_EXPORT void ImportFld(const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Input field data from the given file.