Nektar++
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  /// Wrapper to the time integration scheme
66  /// The time integration scheme operators to use.
68  ///
70  ///
72  /// Indicates if explicit or implicit treatment of diffusion is used.
74  /// Indicates if explicit or implicit treatment of advection is used.
76  /// Indicates if explicit or implicit treatment of reaction is used.
78  /// Flag to determine if simulation should start in homogeneous
79  /// forward transformed state.
81 
82  std::vector<int> m_intVariables;
83 
84  std::vector<FilterSharedPtr> m_filters;
85 
86  /// Initialises UnsteadySystem class members.
88  const LibUtilities::SessionReaderSharedPtr& pSession);
89 
90  /// Init object for UnsteadySystem class.
91  SOLVER_UTILS_EXPORT virtual void v_InitObject();
92 
93  /// Get the maximum timestep estimator for cfl control.
95 
96  /// Solves an unsteady problem.
97  SOLVER_UTILS_EXPORT virtual void v_DoSolve();
98 
99  /// Sets up initial conditions.
100  SOLVER_UTILS_EXPORT virtual void v_DoInitialise();
101 
102  /// Print a summary of time stepping parameters.
104 
105  /// Print the solution at each solution point in a txt file
107  Array<OneD, Array<OneD, NekDouble> > &solution1D);
108 
109  ///
111  Array<OneD, Array<OneD, NekDouble> > &physfield,
112  Array<OneD, Array<OneD, NekDouble> > &numflux);
113 
114  ///
116  Array<OneD, Array<OneD, NekDouble> > &physfield,
117  Array<OneD, Array<OneD, NekDouble> > &numfluxX,
118  Array<OneD, Array<OneD, NekDouble> > &numfluxY );
119 
120  ///
122  const Array<OneD, Array<OneD, NekDouble> > &ufield,
124 
125  ///
127  const Array<OneD, Array<OneD, NekDouble> > &ufield,
129  Array<OneD, Array<OneD, NekDouble> > &qflux);
130 
132  const Array<OneD, const Array<OneD, NekDouble> > &inarray);
133 
134  SOLVER_UTILS_EXPORT virtual bool v_PreIntegrate(int step);
135  SOLVER_UTILS_EXPORT virtual bool v_PostIntegrate(int step);
136  SOLVER_UTILS_EXPORT virtual bool v_SteadyStateCheck(int step);
137 
139 
140 
141  private:
142  ///
144  const int var,
145  const Array<OneD, const NekDouble> &physfield,
146  Array<OneD, NekDouble> &penaltyflux,
147  NekDouble time=0.0);
148 
149  ///
151  const int var,
152  const int dir,
153  const Array<OneD, const NekDouble> &physfield,
154  Array<OneD, NekDouble> &penaltyflux,
155  NekDouble C11,
156  NekDouble time=0.0);
157  };
158  }
159 }
160 
161 #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)
SOLVER_UTILS_EXPORT void CheckForRestartTime(NekDouble &time)
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.
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator()
Get the maximum timestep estimator for cfl control.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:50
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)
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.