Nektar++
Loading...
Searching...
No Matches
MRFWall.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: MRFWall.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.
32//
33///////////////////////////////////////////////////////////////////////////////
34
37
38namespace Nektar
39{
40
42 "MRFWall", MRFWall::create,
43 "Wall 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 = "MRFWall";
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{
75 if (!(pSession->GetSolverInfo("SolverType") == "VCSFSI"))
76 {
77 ASSERTL0(false, "The boundary condition MRFWall is only "
78 "supported for use in the SolverType 'VCSFSI'");
79 }
80 m_field->GetBndElmtExpansion(m_nbnd, m_bndElmtExps, false);
81 if (m_hasPressure)
82 {
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 (params.find("pressure") != params.end() && m_hasPressure &&
115 fields.size() > 0)
116 {
117 ++m_numCalls;
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 AddExtrapAcceVisPressureBCs(fields, rhs, params, nptsPlane0);
125 m_BndExp[m_pressure]->NormVectorIProductWRTBase(
126 rhs, m_BndExp[m_pressure]->UpdateCoeffs());
127 }
128 // velocity
129 if (params.find("velocity") != params.end() && m_hasVels && nptsPlane0)
130 {
132 for (size_t k = 0; k < m_bnddim; ++k)
133 {
134 if (m_BndExp.find(k) != m_BndExp.end())
135 {
136 velocities[k] = Array<OneD, NekDouble>(nptsPlane0, 0.0);
137 }
138 }
139 RigidBodyVelocity(velocities, params, nptsPlane0);
140 for (int k = 0; k < m_bnddim; ++k)
141 {
142 if (m_BndExp.find(k) != m_BndExp.end())
143 {
144 if (m_BndExp[k]->GetExpType() == MultiRegions::e2DH1D)
145 {
146 m_BndExp[k]->GetPlane(0)->FwdTransBndConstrained(
147 velocities[k],
148 m_BndExp[k]->GetPlane(0)->UpdateCoeffs());
149 }
150 else
151 {
152 m_BndExp[k]->FwdTransBndConstrained(
153 velocities[k], m_BndExp[k]->UpdateCoeffs());
154 }
155 }
156 }
157 }
158}
159
161 const Array<OneD, const Array<OneD, NekDouble>> &fields,
163 std::map<std::string, NekDouble> &params, int npts0)
164{
165 for (int i = 0; i < m_bnddim; ++i)
166 {
168 }
169 AddVisPressureBCs(fields, m_extrapArray[m_intSteps - 1], params);
170 AddRigidBodyAcc(m_extrapArray[m_intSteps - 1], params, npts0);
172 for (int i = 0; i < m_bnddim; i++)
173 {
174 Vmath::Vadd(m_npoints, m_extrapArray[m_intSteps - 1][i], 1, N[i], 1,
175 N[i], 1);
176 }
177}
178
179} // namespace Nektar
#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
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.
MRFWall(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)
Definition MRFWall.cpp:45
bool m_hasPressure
Definition MRFWall.h:87
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)
Definition MRFWall.cpp:100
void v_Initialise(const LibUtilities::SessionReaderSharedPtr &pSession) override
Definition MRFWall.cpp:72
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)
Definition MRFWall.h:53
void AddExtrapAcceVisPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &N, std::map< std::string, NekDouble > &params, int npts0)
Definition MRFWall.cpp:160
static std::string className
Definition MRFWall.h:66
std::shared_ptr< SessionReader > SessionReaderSharedPtr
IncBCFactory & GetIncBCFactory()
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