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#include <boost/core/ignore_unused.hpp>
43
44namespace Nektar::SolverUtils
45{
46
47struct ALEBase;
48typedef std::shared_ptr<ALEBase> ALEBaseShPtr;
49
51{
52public:
53 virtual ~ALEHelper() = default;
58
60 const NekDouble &time);
61
64
66 Array<OneD, Array<OneD, NekDouble>> &traceNormals,
68
70 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
72
74 const NekDouble &time,
75 Array<OneD, Array<OneD, NekDouble>> &traceNormals);
76
78 {
79 return m_gridVelocity;
80 }
81
85 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
86 std::vector<std::string> &variables);
87
88protected:
92 std::vector<ALEBaseShPtr> m_ALEs;
93 bool m_ALESolver = false;
94 bool m_ImplicitALESolver = false;
97};
98
99struct ALEBase
100{
101 virtual ~ALEBase() = default;
102
103 inline void UpdateGridVel(
104 const NekDouble time,
106 Array<OneD, Array<OneD, NekDouble>> &gridVelocity)
107 {
108 v_UpdateGridVel(time, fields, gridVelocity);
109 }
110
111private:
112 virtual void v_UpdateGridVel(
113 const NekDouble time,
115 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) = 0;
116};
117
118struct ALEFixed final : public ALEBase
119{
121
122 void v_UpdateGridVel(
123 const NekDouble time,
125 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) final;
126
127private:
129};
130
131struct ALETranslate final : public ALEBase
132{
134
135 void v_UpdateGridVel(
136 const NekDouble time,
138 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) final;
139
140private:
142};
143
144struct ALERotate final : public ALEBase
145{
147
148 void v_UpdateGridVel(
149 const NekDouble time,
151 Array<OneD, Array<OneD, NekDouble>> &gridVelocity) final;
152
153private:
155};
156
157typedef std::shared_ptr<ALEFixed> ALEFixedShPtr;
158typedef std::shared_ptr<ALETranslate> ALETranslateShPtr;
159typedef std::shared_ptr<ALERotate> ALERotateShPtr;
160
161} // namespace Nektar::SolverUtils
162#endif // NEKTAR_SOLVERUTILS_ALEHELPER_H
#define SOLVER_UTILS_EXPORT
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsALE
Definition: ALEHelper.h:89
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:91
SOLVER_UTILS_EXPORT void ALEDoElmtInvMassBwdTrans(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: ALEHelper.cpp:149
const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocity()
Definition: ALEHelper.h:77
virtual ~ALEHelper()=default
SOLVER_UTILS_EXPORT void ExtraFldOutputGridVelocity(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
Definition: ALEHelper.cpp:392
SOLVER_UTILS_EXPORT void MoveMesh(const NekDouble &time, Array< OneD, Array< OneD, NekDouble > > &traceNormals)
Definition: ALEHelper.cpp:169
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:290
Array< OneD, Array< OneD, NekDouble > > m_gridVelocity
Definition: ALEHelper.h:90
std::vector< ALEBaseShPtr > m_ALEs
Definition: ALEHelper.h:92
std::shared_ptr< ALETranslate > ALETranslateShPtr
Definition: ALEHelper.h:158
std::shared_ptr< ALEBase > ALEBaseShPtr
Definition: ALEHelper.h:48
std::shared_ptr< ALERotate > ALERotateShPtr
Definition: ALEHelper.h:159
std::shared_ptr< ALEFixed > ALEFixedShPtr
Definition: ALEHelper.h:157
std::shared_ptr< ZoneBase > ZoneBaseShPtr
Definition: Zones.h:170
std::shared_ptr< ZoneTranslate > ZoneTranslateShPtr
Definition: Zones.h:313
std::shared_ptr< ZoneRotate > ZoneRotateShPtr
Definition: Zones.h:312
std::shared_ptr< ZoneFixed > ZoneFixedShPtr
Definition: Zones.h:314
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:103
virtual ~ALEBase()=default
void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final
Definition: ALEHelper.cpp:300
ALEFixed(SpatialDomains::ZoneBaseShPtr zone)
Definition: ALEHelper.cpp:295
SpatialDomains::ZoneFixedShPtr m_zone
Definition: ALEHelper.h:128
SpatialDomains::ZoneRotateShPtr m_zone
Definition: ALEHelper.h:154
ALERotate(SpatialDomains::ZoneBaseShPtr zone)
Definition: ALEHelper.cpp:339
void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final
Definition: ALEHelper.cpp:344
SpatialDomains::ZoneTranslateShPtr m_zone
Definition: ALEHelper.h:141
ALETranslate(SpatialDomains::ZoneBaseShPtr zone)
Definition: ALEHelper.cpp:307
void v_UpdateGridVel(const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final
Definition: ALEHelper.cpp:312