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{
42 "MovingFrameWall", MovingFrameWall::create,
43 "Far field boundary condition of moving reference frame");
44
46 [[maybe_unused]] const LibUtilities::SessionReaderSharedPtr pSession,
47 [[maybe_unused]] Array<OneD, MultiRegions::ExpListSharedPtr> pFields,
50 [[maybe_unused]] int nbnd, [[maybe_unused]] int spacedim,
51 [[maybe_unused]] int bnddim)
52 : StaticWall(pSession, pFields, cond, exp, nbnd, spacedim, bnddim)
53{
54 classname = "MovingFrameWall";
55 m_hasVels = false;
56 for (size_t i = 0; i < m_bnddim; ++i)
57 {
58 if (cond[i]->GetUserDefined() == classname)
59 {
60 m_hasVels = true;
61 m_BndExp[i] = exp[i];
62 }
63 }
64 m_pressure = cond.size() - 1;
65 m_hasPressure = cond[m_pressure]->GetUserDefined() == classname;
66 if (m_hasPressure)
67 {
69 }
70}
71
73{
74}
75
78{
80 m_field->GetBndElmtExpansion(m_nbnd, m_bndElmtExps, false);
81 if (m_hasPressure)
82 {
83 m_viscous =
85 for (int n = 0; n < m_intSteps; ++n)
86 {
88 for (int i = 0; i < m_bnddim; ++i)
89 {
91 }
92 }
93 }
94}
95
96/// @brief v_Update set correct BCs (in wavespace)
97/// @param fields
98/// @param Adv is in wavespace for 3DH1D
99/// @param params
101 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &fields,
102 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &Adv,
103 std::map<std::string, NekDouble> &params)
104{
105 int nptsPlane0 = 0;
106 SetNumPointsOnPlane0(nptsPlane0);
107 if (params.find("Omega_x") != params.end() ||
108 params.find("Omega_y") != params.end() ||
109 params.find("Omega_z") != params.end())
110 {
111 InitialiseCoords(params);
112 }
113 // pressure
114 if (m_hasPressure && fields.size() > 0)
115 {
116 ++m_numCalls;
117
119 for (int i = 0; i < m_bnddim; ++i)
120 {
121 rhs[i] = Array<OneD, NekDouble>(m_npoints, 0.);
122 }
123 // add viscous term
124 AddVisPressureBCs(fields, rhs, params);
125 // add DuDt term
126 AddRigidBodyAcc(rhs, params, nptsPlane0);
127 m_BndExp[m_pressure]->NormVectorIProductWRTBase(
128 rhs, m_BndExp[m_pressure]->UpdateCoeffs());
129 }
130 // velocity
131 if (m_hasVels && nptsPlane0)
132 {
134 for (size_t k = 0; k < m_bnddim; ++k)
135 {
136 if (m_BndExp.find(k) != m_BndExp.end())
137 {
138 velocities[k] = Array<OneD, NekDouble>(nptsPlane0, 0.0);
139 }
140 }
141 RigidBodyVelocity(velocities, params, nptsPlane0);
142 for (int k = 0; k < m_bnddim; ++k)
143 {
144 if (m_BndExp.find(k) != m_BndExp.end())
145 {
146 if (m_BndExp[k]->GetExpType() == MultiRegions::e2DH1D)
147 {
148 m_BndExp[k]->GetPlane(0)->FwdTransBndConstrained(
149 velocities[k],
150 m_BndExp[k]->GetPlane(0)->UpdateCoeffs());
151 }
152 else
153 {
154 m_BndExp[k]->FwdTransBndConstrained(
155 velocities[k], m_BndExp[k]->UpdateCoeffs());
156 }
157 }
158 }
159 }
160}
161
162} // 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()