Nektar++
Loading...
Searching...
No Matches
MRFWallPressDecomp.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: MRFWallPressDecomp.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: Wall boundary condition of moving reference frame with pressure
32// decomposition.
33//
34///////////////////////////////////////////////////////////////////////////////
35
38
39namespace Nektar
40{
43 "MRFWallPressDecomp", MRFWallPressDecomp::create,
44 "Wall boundary condition of moving reference frame with pressure "
45 "decomposition");
46
48 [[maybe_unused]] const LibUtilities::SessionReaderSharedPtr pSession,
49 [[maybe_unused]] Array<OneD, MultiRegions::ExpListSharedPtr> pFields,
52 [[maybe_unused]] int nbnd, [[maybe_unused]] int spacedim,
53 [[maybe_unused]] int bnddim)
54 : StaticWall(pSession, pFields, cond, exp, nbnd, spacedim, bnddim)
55{
56 classname = "MRFWallPressDecomp";
57 m_hasVels = false;
58 for (size_t i = 0; i < m_bnddim; ++i)
59 {
60 if (cond[i]->GetUserDefined() == classname)
61 {
62 m_hasVels = true;
63 m_BndExp[i] = exp[i];
64 }
65 }
66 m_pressure = cond.size() - 1;
67 m_hasPressure = cond[m_pressure]->GetUserDefined() == classname;
68 if (m_hasPressure)
69 {
71 }
72}
73
77
80{
82 if (!(pSession->GetSolverInfo("SolverType") == "PressDecompVCSFSI"))
83 {
84 ASSERTL0(false,
85 "The boundary condition MRFWallPressDecomp is only "
86 "supported for use in the SolverType 'PressDecompVCSFSI'");
87 }
88 m_field->GetBndElmtExpansion(m_nbnd, m_bndElmtExps, false);
89 if (m_hasPressure)
90 {
93 for (int n = 0; n < m_intSteps; ++n)
94 {
96 for (int i = 0; i < m_bnddim; ++i)
97 {
99 }
100 }
101 }
102}
103
104/// @brief v_Update set correct BCs (in wavespace)
105/// @param fields
106/// @param Adv is in wavespace for 3DH1D
107/// @param params
109 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &fields,
110 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &Adv,
111 std::map<std::string, NekDouble> &params)
112{
113 int nptsPlane0 = 0;
114 SetNumPointsOnPlane0(nptsPlane0);
115 if (params.find("Omega_x") != params.end() ||
116 params.find("Omega_y") != params.end() ||
117 params.find("Omega_z") != params.end())
118 {
119 InitialiseCoords(params);
120 }
121 // pressure, do if not define velocity
122 if (params.find("pressure") != params.end() && m_hasPressure &&
123 fields.size() > 0)
124 {
125 ++m_numCalls;
126
128 for (int i = 0; i < m_bnddim; ++i)
129 {
130 rhs[i] = Array<OneD, NekDouble>(m_npoints, 0.);
131 }
132 // add viscous term and centripetal acceleration
133 AddExtrapCentVisPressureBCs(fields, rhs, params, nptsPlane0);
134 m_BndExp[m_pressure]->NormVectorIProductWRTBase(
135 rhs, m_BndExp[m_pressure]->UpdateCoeffs());
136 }
137 // velocity, do if define velocity
138 if (params.find("velocity") != params.end() && m_hasVels && nptsPlane0)
139 {
141 for (size_t k = 0; k < m_bnddim; ++k)
142 {
143 if (m_BndExp.find(k) != m_BndExp.end())
144 {
145 velocities[k] = Array<OneD, NekDouble>(nptsPlane0, 0.0);
146 }
147 }
148 RigidBodyVelocity(velocities, params, nptsPlane0);
149 for (int k = 0; k < m_bnddim; ++k)
150 {
151 if (m_BndExp.find(k) != m_BndExp.end())
152 {
153 if (m_BndExp[k]->GetExpType() == MultiRegions::e2DH1D)
154 {
155 m_BndExp[k]->GetPlane(0)->FwdTransBndConstrained(
156 velocities[k],
157 m_BndExp[k]->GetPlane(0)->UpdateCoeffs());
158 }
159 else
160 {
161 m_BndExp[k]->FwdTransBndConstrained(
162 velocities[k], m_BndExp[k]->UpdateCoeffs());
163 }
164 }
165 }
166 }
167}
168
171 std::map<std::string, NekDouble> &params, int npts0)
172{
173 if (npts0 == 0 || params.find("Omega_z") == params.end())
174 {
175 return;
176 }
177 // add centripetal acceleration
178 NekDouble Omega = params["Omega_z"];
179 NekDouble Wz2 = Omega * Omega;
180 Vmath::Svtvp(npts0, Wz2, m_coords[0], 1, N[0], 1, N[0], 1);
181 Vmath::Svtvp(npts0, Wz2, m_coords[1], 1, N[1], 1, N[1], 1);
182 if (params.find("U") != params.end())
183 {
184 NekDouble mOmegaU0 = -Omega * params["U"];
185 Vmath::Sadd(npts0, mOmegaU0, N[1], 1, N[1], 1);
186 }
187 if (params.find("V") != params.end())
188 {
189 NekDouble OmegaV0 = Omega * params["V"];
190 Vmath::Sadd(npts0, OmegaV0, N[0], 1, N[0], 1);
191 }
192}
193
195 const Array<OneD, const Array<OneD, NekDouble>> &fields,
197 std::map<std::string, NekDouble> &params, int npts0)
198{
199 for (int i = 0; i < m_bnddim; ++i)
200 {
202 }
203 AddVisPressureBCs(fields, m_extrapArray[m_intSteps - 1], params);
204 AddCentripetalAcc(m_extrapArray[m_intSteps - 1], params, npts0);
206 for (int i = 0; i < m_bnddim; i++)
207 {
208 Vmath::Vadd(m_npoints, m_extrapArray[m_intSteps - 1][i], 1, N[i], 1,
209 N[i], 1);
210 }
211}
212
213} // namespace Nektar
const NekDouble Omega
#define ASSERTL0(condition, msg)
std::map< int, MultiRegions::ExpListSharedPtr > m_BndExp
MultiRegions::ExpListSharedPtr m_field
int m_bnddim
bounday dimensionality
void InitialiseCoords(std::map< std::string, NekDouble > &params)
void ExtrapolateArray(const int numCalls, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &array)
void RigidBodyVelocity(Array< OneD, Array< OneD, NekDouble > > &velocities, std::map< std::string, NekDouble > &params, int npts0)
MultiRegions::ExpListSharedPtr m_bndElmtExps
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_extrapArray
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)
Array< OneD, Array< OneD, NekDouble > > m_coords
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
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)
void AddExtrapCentVisPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &N, std::map< std::string, NekDouble > &params, int npts0)
MRFWallPressDecomp(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_Initialise(const LibUtilities::SessionReaderSharedPtr &pSession) override
void AddCentripetalAcc(Array< OneD, Array< OneD, NekDouble > > &N, std::map< std::string, NekDouble > &params, int npts0)
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)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
IncBCFactory & GetIncBCFactory()
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
Definition Vmath.hpp:396
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition Vmath.hpp:180
void Zero(int n, T *x, const int incx)
Zero vector.
Definition Vmath.hpp:273
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
Definition Vmath.hpp:194