Nektar++
Loading...
Searching...
No Matches
ALEHelper.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: ALEHelper.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: Helper class for ALE process
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERUTILS_ALEHELPER_H
36#define NEKTAR_SOLVERUTILS_ALEHELPER_H
37
42
43namespace Nektar::SolverUtils
44{
45
46struct ALEBase
47{
48 virtual ~ALEBase() = default;
49
50 inline void UpdateGridVel(
51 const NekDouble time,
53 Array<OneD, Array<OneD, NekDouble>> &gridVelocity)
54 {
55 v_UpdateGridVel(time, fields, gridVelocity);
56 }
57
59 Array<OneD, Array<OneD, NekDouble>> &traceNormals,
61 {
62 v_ResetMatricesNormal(traceNormals, fields);
63 }
64
65 inline bool UpdateNormalsFlag()
66 {
67 return v_UpdateNormalsFlag();
68 }
69
70 bool m_meshDistorted = false;
71
72private:
73 virtual void v_UpdateGridVel(
74 const NekDouble time,
76 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) = 0;
77
79 Array<OneD, Array<OneD, NekDouble>> &traceNormals,
81
82 virtual bool v_UpdateNormalsFlag() = 0;
83};
84typedef std::shared_ptr<ALEBase> ALEBaseShPtr;
85
87{
88public:
89 virtual ~ALEHelper() = default;
94
96 const NekDouble &time);
97
100
102 Array<OneD, Array<OneD, NekDouble>> &traceNormals,
104
106 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
107 Array<OneD, Array<OneD, NekDouble>> &outarray);
108
110 const NekDouble &time,
111 Array<OneD, Array<OneD, NekDouble>> &traceNormals);
112
114 Array<OneD, Array<OneD, NekDouble>> &traceNormals);
115
116 // check all update nromal definitions and return true if any are true
118
123
124 inline bool &GetUpdateNormalsFlag()
125 {
126 return m_updateNormals;
127 }
128
132 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
133 std::vector<std::string> &variables);
134
136 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
137 std::vector<std::string> &variables);
138
139protected:
143 std::vector<ALEBaseShPtr> m_ALEs;
144
145 // Flag if using the ALE formulation
146 bool m_ALESolver = false;
147 // Mesh distorted is not implemented yet, use to avoid update mass matrix
148 bool m_meshDistorted = false;
149 // Flag if using implicit ALE solver
151 // Flag to indicate whether normals need to be updated for reimann solver
152 bool m_updateNormals = false;
153 // Previous time used to aviod multiple mesh movements
156};
157
158struct ALEFixed final : public ALEBase
159{
161
162 void v_UpdateGridVel(
163 const NekDouble time,
165 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) final;
166
168 {
169 return false;
170 }
171
173 Array<OneD, Array<OneD, NekDouble>> &traceNormals,
175
176private:
178};
179
180struct ALETranslate final : public ALEBase
181{
183
184 void v_UpdateGridVel(
185 const NekDouble time,
187 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) final;
188
190 {
191 return false;
192 }
193
195 Array<OneD, Array<OneD, NekDouble>> &traceNormals,
197
198private:
200};
201
202struct ALERotate final : public ALEBase
203{
205
206 void v_UpdateGridVel(
207 const NekDouble time,
209 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) final;
210
212 {
213 return true;
214 }
215
217 Array<OneD, Array<OneD, NekDouble>> &traceNormals,
219
220private:
222};
223
224typedef std::shared_ptr<ALEFixed> ALEFixedShPtr;
225typedef std::shared_ptr<ALETranslate> ALETranslateShPtr;
226typedef std::shared_ptr<ALERotate> ALERotateShPtr;
227
228} // namespace Nektar::SolverUtils
229#endif // NEKTAR_SOLVERUTILS_ALEHELPER_H
#define SOLVER_UTILS_EXPORT
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsALE
Definition ALEHelper.h:140
SOLVER_UTILS_EXPORT void UpdateNormalsFlag()
virtual SOLVER_UTILS_EXPORT void v_ALEPreMultiplyMass(Array< OneD, Array< OneD, NekDouble > > &fields)
SOLVER_UTILS_EXPORT void ExtraFldOutputGrid(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
virtual SOLVER_UTILS_EXPORT void v_ALEInitObject(int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
Definition ALEHelper.cpp:42
SOLVER_UTILS_EXPORT void ALEDoElmtInvMass(Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, Array< OneD, NekDouble > > &fields, NekDouble time)
Update m_fields with u^n by multiplying by inverse mass matrix. That's then used in e....
SOLVER_UTILS_EXPORT void InitObject(int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
Definition ALEHelper.cpp:48
Array< OneD, Array< OneD, NekDouble > > m_gridVelocityTrace
Definition ALEHelper.h:142
SOLVER_UTILS_EXPORT void ALEDoElmtInvMassBwdTrans(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocity()
Definition ALEHelper.h:119
virtual ~ALEHelper()=default
SOLVER_UTILS_EXPORT void ResetMatricesNormal(Array< OneD, Array< OneD, NekDouble > > &traceNormals)
SOLVER_UTILS_EXPORT void ExtraFldOutputGridVelocity(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
SOLVER_UTILS_EXPORT void MoveMesh(const NekDouble &time, Array< OneD, Array< OneD, NekDouble > > &traceNormals)
virtual SOLVER_UTILS_EXPORT void v_UpdateGridVelocity(const NekDouble &time)
Definition ALEHelper.cpp:97
SOLVER_UTILS_EXPORT const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocityTrace()
Array< OneD, Array< OneD, NekDouble > > m_gridVelocity
Definition ALEHelper.h:141
std::vector< ALEBaseShPtr > m_ALEs
Definition ALEHelper.h:143
std::shared_ptr< ALETranslate > ALETranslateShPtr
Definition ALEHelper.h:225
std::shared_ptr< ALEBase > ALEBaseShPtr
Definition ALEHelper.h:84
std::shared_ptr< ALERotate > ALERotateShPtr
Definition ALEHelper.h:226
std::shared_ptr< ALEFixed > ALEFixedShPtr
Definition ALEHelper.h:224
std::shared_ptr< ZoneBase > ZoneBaseShPtr
Definition Zones.h:177
std::shared_ptr< ZoneTranslate > ZoneTranslateShPtr
Definition Zones.h:376
std::shared_ptr< ZoneRotate > ZoneRotateShPtr
Definition Zones.h:375
std::shared_ptr< ZoneFixed > ZoneFixedShPtr
Definition Zones.h:377
virtual void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity)=0
void UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity)
Definition ALEHelper.h:50
virtual bool v_UpdateNormalsFlag()=0
virtual void v_ResetMatricesNormal(Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)=0
virtual ~ALEBase()=default
void ResetMatricesNormal(Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
Definition ALEHelper.h:58
void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final
void v_ResetMatricesNormal(Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, MultiRegions::ExpListSharedPtr > &fields) final
SpatialDomains::ZoneFixedShPtr m_zone
Definition ALEHelper.h:177
SpatialDomains::ZoneRotateShPtr m_zone
Definition ALEHelper.h:221
void v_ResetMatricesNormal(Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, MultiRegions::ExpListSharedPtr > &fields) final
void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final
SpatialDomains::ZoneTranslateShPtr m_zone
Definition ALEHelper.h:199
void v_ResetMatricesNormal(Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, MultiRegions::ExpListSharedPtr > &fields) final
void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final