Nektar++
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;
47typedef std::shared_ptr<ALEBase> ALEBaseShPtr;
48
50{
51public:
52 virtual ~ALEHelper() = default;
57
59 const NekDouble &time);
60
63
65 Array<OneD, Array<OneD, NekDouble>> &traceNormals,
67
69 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
71
73 const NekDouble &time,
74 Array<OneD, Array<OneD, NekDouble>> &traceNormals);
75
77 {
78 return m_gridVelocity;
79 }
80
84 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
85 std::vector<std::string> &variables);
86
87protected:
91 std::vector<ALEBaseShPtr> m_ALEs;
92 bool m_ALESolver = false;
93 bool m_ImplicitALESolver = false;
96};
97
98struct ALEBase
99{
100 virtual ~ALEBase() = default;
101
102 inline void UpdateGridVel(
103 const NekDouble time,
105 Array<OneD, Array<OneD, NekDouble>> &gridVelocity)
106 {
107 v_UpdateGridVel(time, fields, gridVelocity);
108 }
109
110private:
111 virtual void v_UpdateGridVel(
112 const NekDouble time,
114 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) = 0;
115};
116
117struct ALEFixed final : public ALEBase
118{
120
121 void v_UpdateGridVel(
122 const NekDouble time,
124 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) final;
125
126private:
128};
129
130struct ALETranslate final : public ALEBase
131{
133
134 void v_UpdateGridVel(
135 const NekDouble time,
137 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) final;
138
139private:
141};
142
143struct ALERotate final : public ALEBase
144{
146
147 void v_UpdateGridVel(
148 const NekDouble time,
150 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) final;
151
152private:
154};
155
156typedef std::shared_ptr<ALEFixed> ALEFixedShPtr;
157typedef std::shared_ptr<ALETranslate> ALETranslateShPtr;
158typedef std::shared_ptr<ALERotate> ALERotateShPtr;
159
160} // namespace Nektar::SolverUtils
161#endif // NEKTAR_SOLVERUTILS_ALEHELPER_H
#define SOLVER_UTILS_EXPORT
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsALE
Definition: ALEHelper.h:88
virtual SOLVER_UTILS_EXPORT void v_ALEPreMultiplyMass(Array< OneD, Array< OneD, NekDouble > > &fields)
Definition: ALEHelper.cpp:108
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....
Definition: ALEHelper.cpp:131
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:90
SOLVER_UTILS_EXPORT void ALEDoElmtInvMassBwdTrans(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: ALEHelper.cpp:148
const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocity()
Definition: ALEHelper.h:76
virtual ~ALEHelper()=default
SOLVER_UTILS_EXPORT void ExtraFldOutputGridVelocity(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
Definition: ALEHelper.cpp:389
SOLVER_UTILS_EXPORT void MoveMesh(const NekDouble &time, Array< OneD, Array< OneD, NekDouble > > &traceNormals)
Definition: ALEHelper.cpp:168
virtual SOLVER_UTILS_EXPORT void v_UpdateGridVelocity(const NekDouble &time)
Definition: ALEHelper.cpp:90
SOLVER_UTILS_EXPORT const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocityTrace()
Definition: ALEHelper.cpp:289
Array< OneD, Array< OneD, NekDouble > > m_gridVelocity
Definition: ALEHelper.h:89
std::vector< ALEBaseShPtr > m_ALEs
Definition: ALEHelper.h:91
std::shared_ptr< ALETranslate > ALETranslateShPtr
Definition: ALEHelper.h:157
std::shared_ptr< ALEBase > ALEBaseShPtr
Definition: ALEHelper.h:47
std::shared_ptr< ALERotate > ALERotateShPtr
Definition: ALEHelper.h:158
std::shared_ptr< ALEFixed > ALEFixedShPtr
Definition: ALEHelper.h:156
std::shared_ptr< ZoneBase > ZoneBaseShPtr
Definition: Zones.h:171
std::shared_ptr< ZoneTranslate > ZoneTranslateShPtr
Definition: Zones.h:314
std::shared_ptr< ZoneRotate > ZoneRotateShPtr
Definition: Zones.h:313
std::shared_ptr< ZoneFixed > ZoneFixedShPtr
Definition: Zones.h:315
double NekDouble
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:102
virtual ~ALEBase()=default
void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final
Definition: ALEHelper.cpp:299
ALEFixed(SpatialDomains::ZoneBaseShPtr zone)
Definition: ALEHelper.cpp:294
SpatialDomains::ZoneFixedShPtr m_zone
Definition: ALEHelper.h:127
SpatialDomains::ZoneRotateShPtr m_zone
Definition: ALEHelper.h:153
ALERotate(SpatialDomains::ZoneBaseShPtr zone)
Definition: ALEHelper.cpp:337
void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final
Definition: ALEHelper.cpp:342
SpatialDomains::ZoneTranslateShPtr m_zone
Definition: ALEHelper.h:140
ALETranslate(SpatialDomains::ZoneBaseShPtr zone)
Definition: ALEHelper.cpp:306
void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final
Definition: ALEHelper.cpp:311