Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
UnsteadySystem.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File UnsteadySystem.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: Generic timestepping for Unsteady solvers
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERUTILS_UNSTEADYSYSTEM_H
37 #define NEKTAR_SOLVERUTILS_UNSTEADYSYSTEM_H
38 
42 
43 namespace Nektar
44 {
45  namespace SolverUtils
46  {
47  /// Base class for unsteady solvers.
49  {
50  public:
51  /// Destructor
53 
54  /// Calculate the larger time-step mantaining the problem stable.
56  const Array<OneD, const Array<OneD, NekDouble> > &inarray);
57 
58  /// CFL safety factor (comprise between 0 to 1).
60 
61  protected:
62  /// Number of time steps between outputting status information.
64 
66  /// Wrapper to the time integration scheme
68  /// The time integration scheme operators to use.
70  ///
72  ///
74  /// Indicates if explicit or implicit treatment of diffusion is used.
76  /// Indicates if explicit or implicit treatment of advection is used.
78  /// Indicates if explicit or implicit treatment of reaction is used.
80  /// Flag to determine if simulation should start in homogeneous
81  /// forward transformed state.
83 
84  std::vector<int> m_intVariables;
85 
86  std::vector<FilterSharedPtr> m_filters;
87 
88  /// Initialises UnsteadySystem class members.
90  const LibUtilities::SessionReaderSharedPtr& pSession);
91 
92  /// Init object for UnsteadySystem class.
93  SOLVER_UTILS_EXPORT virtual void v_InitObject();
94 
95  /// Get the maximum timestep estimator for cfl control.
97 
98  /// Solves an unsteady problem.
99  SOLVER_UTILS_EXPORT virtual void v_DoSolve();
100 
101  /// Sets up initial conditions.
102  SOLVER_UTILS_EXPORT virtual void v_DoInitialise();
103 
104  /// Print a summary of time stepping parameters.
106 
107  /// Print the solution at each solution point in a txt file
109  Array<OneD, Array<OneD, NekDouble> > &solution1D);
110 
111  ///
113  Array<OneD, Array<OneD, NekDouble> > &physfield,
114  Array<OneD, Array<OneD, NekDouble> > &numflux);
115 
116  ///
118  Array<OneD, Array<OneD, NekDouble> > &physfield,
119  Array<OneD, Array<OneD, NekDouble> > &numfluxX,
120  Array<OneD, Array<OneD, NekDouble> > &numfluxY );
121 
122  ///
124  const Array<OneD, Array<OneD, NekDouble> > &ufield,
126 
127  ///
129  const Array<OneD, Array<OneD, NekDouble> > &ufield,
131  Array<OneD, Array<OneD, NekDouble> > &qflux);
132 
134  const Array<OneD, const Array<OneD, NekDouble> > &inarray);
135 
136  SOLVER_UTILS_EXPORT virtual bool v_PreIntegrate(int step);
137  SOLVER_UTILS_EXPORT virtual bool v_PostIntegrate(int step);
138  SOLVER_UTILS_EXPORT virtual bool v_SteadyStateCheck(int step);
139 
141  {
142  return true;
143  }
144 
145  SOLVER_UTILS_EXPORT void CheckForRestartTime(NekDouble &time, int &nchk);
146 
147  /// \brief Evaluate the SVV diffusion coefficient
148  /// according to Moura's paper where it should
149  /// proportional to h time velocity
151  vel,
152  StdRegions::VarCoeffMap &varCoeffMap);
153 
154 
155  private:
156  ///
158  const int var,
159  const Array<OneD, const NekDouble> &physfield,
160  Array<OneD, NekDouble> &penaltyflux,
161  NekDouble time=0.0);
162 
163  ///
165  const int var,
166  const int dir,
167  const Array<OneD, const NekDouble> &physfield,
168  Array<OneD, NekDouble> &penaltyflux,
169  NekDouble C11,
170  NekDouble time=0.0);
171  };
172 
173  }
174 }
175 
176 #endif
virtual SOLVER_UTILS_EXPORT bool v_SteadyStateCheck(int step)
virtual SOLVER_UTILS_EXPORT void v_DoSolve()
Solves an unsteady problem.
bool m_explicitReaction
Indicates if explicit or implicit treatment of reaction is used.
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)
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate(int step)
A base class for describing how to solve specific equations.
bool m_homoInitialFwd
Flag to determine if simulation should start in homogeneous forward transformed state.
bool m_explicitDiffusion
Indicates if explicit or implicit treatment of diffusion is used.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:47
void WeakPenaltyforVector(const int var, const int dir, const Array< OneD, const NekDouble > &physfield, Array< OneD, NekDouble > &penaltyflux, NekDouble C11, NekDouble time=0.0)
virtual SOLVER_UTILS_EXPORT void v_AppendOutput1D(Array< OneD, Array< OneD, NekDouble > > &solution1D)
Print the solution at each solution point in a txt file.
boost::shared_ptr< TimeIntegrationWrapper > TimeIntegrationWrapperSharedPtr
virtual SOLVER_UTILS_EXPORT NekDouble v_GetTimeStep(const Array< OneD, const Array< OneD, NekDouble > > &inarray)
Return the timestep to be used for the next step in the time-marching loop.
virtual SOLVER_UTILS_EXPORT bool v_RequireFwdTrans()
SOLVER_UTILS_EXPORT void CheckForRestartTime(NekDouble &time, int &nchk)
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator()
Get the maximum timestep estimator for cfl control.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
SOLVER_UTILS_EXPORT void SVVVarDiffCoeff(const Array< OneD, Array< OneD, NekDouble > > vel, StdRegions::VarCoeffMap &varCoeffMap)
Evaluate the SVV diffusion coefficient according to Moura's paper where it should proportional to h t...
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &s)
Print a summary of time stepping parameters.
bool m_explicitAdvection
Indicates if explicit or implicit treatment of advection is used.
virtual SOLVER_UTILS_EXPORT ~UnsteadySystem()
Destructor.
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate(int step)
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:227
Base class for unsteady solvers.
double NekDouble
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Init object for UnsteadySystem class.
SOLVER_UTILS_EXPORT NekDouble GetTimeStep()
NekDouble m_cflSafetyFactor
CFL safety factor (comprise between 0 to 1).
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 UnsteadySystem(const LibUtilities::SessionReaderSharedPtr &pSession)
Initialises UnsteadySystem class members.
virtual SOLVER_UTILS_EXPORT void v_NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
#define SOLVER_UTILS_EXPORT
boost::shared_ptr< TimeIntegrationSolution > TimeIntegrationSolutionSharedPtr
LibUtilities::TimeIntegrationWrapperSharedPtr m_intScheme
Wrapper to the time integration scheme.
std::vector< FilterSharedPtr > m_filters
int m_infosteps
Number of time steps between outputting status information.
void WeakPenaltyforScalar(const int var, const Array< OneD, const NekDouble > &physfield, Array< OneD, NekDouble > &penaltyflux, NekDouble time=0.0)
LibUtilities::TimeIntegrationSolutionSharedPtr m_intSoln
virtual SOLVER_UTILS_EXPORT void v_DoInitialise()
Sets up initial conditions.