Nektar++
MovingFrameWall.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: MovingFrameWall.cpp
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: Abstract base class for Extrapolate.
32//
33///////////////////////////////////////////////////////////////////////////////
34
37
38namespace Nektar
39{
40
43 "MovingFrameWall", MovingFrameWall::create,
44 "Far field boundary condition of moving reference frame");
45
47 [[maybe_unused]] const LibUtilities::SessionReaderSharedPtr pSession,
48 [[maybe_unused]] Array<OneD, MultiRegions::ExpListSharedPtr> pFields,
51 [[maybe_unused]] int nbnd, [[maybe_unused]] int spacedim,
52 [[maybe_unused]] int bnddim)
53 : StaticWall(pSession, pFields, cond, exp, nbnd, spacedim, bnddim)
54{
55 classname = "MovingFrameWall";
56 m_hasVels = false;
57 for (size_t i = 0; i < m_bnddim; ++i)
58 {
59 if (cond[i]->GetUserDefined() == classname)
60 {
61 m_hasVels = true;
62 m_BndExp[i] = exp[i];
63 }
64 }
65 m_pressure = cond.size() - 1;
66 m_hasPressure = cond[m_pressure]->GetUserDefined() == classname;
67 if (m_hasPressure)
68 {
70 }
71}
72
75{
77 m_field->GetBndElmtExpansion(m_nbnd, m_bndElmtExps, false);
78 if (m_hasPressure)
79 {
80 m_viscous =
82 for (int n = 0; n < m_intSteps; ++n)
83 {
85 for (int i = 0; i < m_bnddim; ++i)
86 {
88 }
89 }
90 }
91}
92
93/// @brief v_Update set correct BCs (in wavespace)
94/// @param fields
95/// @param Adv is in wavespace for 3DH1D
96/// @param params
98 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &fields,
99 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &Adv,
100 std::map<std::string, NekDouble> &params)
101{
102 int nptsPlane0 = 0;
103 SetNumPointsOnPlane0(nptsPlane0);
104 if (params.find("Omega_x") != params.end() ||
105 params.find("Omega_y") != params.end() ||
106 params.find("Omega_z") != params.end())
107 {
108 InitialiseCoords(params);
109 }
110 // pressure
111 if (m_hasPressure && fields.size() > 0)
112 {
113 ++m_numCalls;
114
116 for (int i = 0; i < m_bnddim; ++i)
117 {
118 rhs[i] = Array<OneD, NekDouble>(m_npoints, 0.);
119 }
120 // add viscous term
121 AddVisPressureBCs(fields, rhs, params);
122 // add DuDt term
123 AddRigidBodyAcc(rhs, params, nptsPlane0);
124 m_BndExp[m_pressure]->NormVectorIProductWRTBase(
125 rhs, m_BndExp[m_pressure]->UpdateCoeffs());
126 }
127 // velocity
128 if (m_hasVels && nptsPlane0)
129 {
131 for (size_t k = 0; k < m_bnddim; ++k)
132 {
133 if (m_BndExp.find(k) != m_BndExp.end())
134 {
135 velocities[k] = Array<OneD, NekDouble>(nptsPlane0, 0.0);
136 }
137 }
138 RigidBodyVelocity(velocities, params, nptsPlane0);
139 for (int k = 0; k < m_bnddim; ++k)
140 {
141 if (m_BndExp.find(k) != m_BndExp.end())
142 {
143 if (m_BndExp[k]->GetExpType() == MultiRegions::e2DH1D)
144 {
145 m_BndExp[k]->GetPlane(0)->FwdTransBndConstrained(
146 velocities[k],
147 m_BndExp[k]->GetPlane(0)->UpdateCoeffs());
148 }
149 else
150 {
151 m_BndExp[k]->FwdTransBndConstrained(
152 velocities[k], m_BndExp[k]->UpdateCoeffs());
153 }
154 }
155 }
156 }
157}
158
159} // namespace Nektar
std::map< int, MultiRegions::ExpListSharedPtr > m_BndExp
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_viscous
MultiRegions::ExpListSharedPtr m_field
int m_bnddim
bounday dimensionality
void InitialiseCoords(std::map< std::string, NekDouble > &params)
void RigidBodyVelocity(Array< OneD, Array< OneD, NekDouble > > &velocities, std::map< std::string, NekDouble > &params, int npts0)
MultiRegions::ExpListSharedPtr m_bndElmtExps
void AddRigidBodyAcc(Array< OneD, Array< OneD, NekDouble > > &N, std::map< std::string, NekDouble > &params, int npts0)
virtual void v_Initialise(const LibUtilities::SessionReaderSharedPtr &pSession)
void SetNumPointsOnPlane0(int &npointsPlane0)
void AddVisPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &N, std::map< std::string, NekDouble > &params)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
void v_Initialise(const LibUtilities::SessionReaderSharedPtr &pSession) override
static std::string className
MovingFrameWall(const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, Array< OneD, SpatialDomains::BoundaryConditionShPtr > cond, Array< OneD, MultiRegions::ExpListSharedPtr > exp, int nbnd, int spacedim, int bnddim)
void v_Update(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &Adv, std::map< std::string, NekDouble > &params) override
v_Update set correct BCs (in wavespace)
static IncBaseConditionSharedPtr create(const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, Array< OneD, SpatialDomains::BoundaryConditionShPtr > cond, Array< OneD, MultiRegions::ExpListSharedPtr > exp, int nbnd, int spacedim, int bnddim)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
IncBCFactory & GetIncBCFactory()