Nektar++
Loading...
Searching...
No Matches
HOPressureBndCondOp.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: HOPressureBndCondOp.hpp
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: Higher-order pressure boundary condition operator.
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#pragma once
36
38
39namespace Nektar
40{
41
42/**
43 * @brief Higher-order pressure boundary condition, added to the pressure
44 * system as a Neumann contribution.
45 *
46 * @details
47 * On every pressure boundary region with a Neumann condition and
48 * USERDEFINEDTYPE="H", the pressure flux is the normal component of
49 * scale * (rhs - kinvis * CurlCurl(velocity)), less the acceleration needed
50 * to reach the prescribed boundary velocity, in the velocity components that
51 * are Dirichlet on the region. The prescribed velocity is taken as the
52 * velocity solve imposes it, projected onto the boundary expansion of the
53 * velocity. Update() computes the flux from the current fields, with the
54 * kinematic viscosity set by SetKinvis(), the scale set by SetScale() and at
55 * the time set by SetTime(); Apply() adds its inner product to the pressure
56 * forcing. UpdateWeak() computes the flux of the weak pressure form, which
57 * leaves the explicit contribution to the volume term. It is added to the
58 * pressure system with LinearSystemOp::AddNeumannBCOp(op, userDefinedType),
59 * so that the default Neumann operator of the system leaves its regions out.
60 */
61template <typename TData>
63{
64public:
65 static std::shared_ptr<HOPressureBndCondOp<TData>> Create(
66 const MultiRegions::ExpListSharedPtr &expansionList,
67 const std::vector<std::string> &components,
68 const std::string &execStr = "")
69 {
71 HOPressureBndCondOp>(expansionList, components, execStr);
72 }
73
74 static inline const std::string name = "HOPressureBndCond";
75
76 /// USERDEFINEDTYPE of the pressure Neumann conditions the operator
77 /// applies.
78 static inline const std::string userDefinedType = "H";
79
80 /**
81 * @brief Set the velocity expansion list and the names of the velocity
82 * components, from which the boundary-adjacent elements are found.
83 */
85 const MultiRegions::ExpListSharedPtr &velocityExpansionList,
86 const std::vector<std::string> &velocityComponents)
87 {
88 v_SetVelocityContext(velocityExpansionList, velocityComponents);
89 }
90
91 /**
92 * @brief Set the kinematic viscosity kinvis Update() uses.
93 */
94 void SetKinvis(const TData &kinvis)
95 {
96 m_kinvis = kinvis;
97 m_isSetKinvis = true;
98 }
99
100 /**
101 * @brief Set the time at which UpdateWithAcceleration() evaluates the
102 * prescribed boundary velocity (default 0).
103 */
104 void SetTime(const TData &time)
105 {
106 m_time = time;
107 }
108
109 /**
110 * @brief Set the scale by which Update() multiplies the fields it is
111 * passed (default 1).
112 */
113 void SetScale(const TData &scale)
114 {
115 m_scale = scale;
116 }
117
118 /**
119 * @brief Compute the pressure flux scale * (rhs - kinvis *
120 * CurlCurl(velocity)) . n on the boundary.
121 */
127
128 /**
129 * @brief Compute the pressure flux, adding the acceleration needed to
130 * reach the prescribed boundary velocity at the time set by SetTime().
131 *
132 * @details
133 * @p predictor is the complete right-hand side of the implicit stage,
134 * which holds the explicit contribution @p rhs of Update(), so rhs
135 * cancels from the flux scale * (rhs - kinvis * CurlCurl(velocity)) . n
136 * + scale * (predictor - rhs) . n - scale * u_b(time) . n, which is
137 * scale * (predictor - kinvis * CurlCurl(velocity)) . n
138 * - scale * u_b(time) . n, with u_b the prescribed boundary velocity
139 * projected onto the boundary expansion of the velocity, the value the
140 * velocity solve imposes and the predictor carries on the boundary. It
141 * is evaluated at every call where a Dirichlet velocity condition of the
142 * region is time-dependent, and at the first call otherwise.
143 *
144 * A velocity component that is not Dirichlet on a region has no
145 * prescribed boundary velocity and takes no acceleration: its flux there
146 * is scale * (rhs - kinvis * CurlCurl(velocity)) n_d. @p rhs is read
147 * only when HasNonDirichletVelocity(), and may be uninstantiated
148 * otherwise.
149 */
157
158 /**
159 * @brief Compute the pressure flux of the weak pressure form: the flux of
160 * UpdateWithAcceleration() less scale * predictor . n.
161 *
162 * @details
163 * The weak form takes the predictor, which holds the explicit advection
164 * and forcing, into the volume term of the pressure equation, so the
165 * flux is -scale * kinvis * CurlCurl(velocity) . n
166 * - scale * u_b(time) . n, the viscous term and the acceleration needed
167 * to reach the prescribed boundary velocity u_b of
168 * UpdateWithAcceleration().
169 *
170 * A velocity component that is not Dirichlet on a region takes
171 * predictor - rhs, the velocity the predictor carries, as its boundary
172 * velocity, as UpdateWithAcceleration() does: its flux there is
173 * -scale * (kinvis * CurlCurl(velocity) + predictor - rhs) n_d. @p rhs
174 * and @p predictor are read only when HasNonDirichletVelocity(), and
175 * @p rhs may be uninstantiated otherwise.
176 */
183
184 /**
185 * @brief Whether a region on this rank has a velocity component that is
186 * not Dirichlet, so that UpdateWithAcceleration() and UpdateWeak() read
187 * rhs.
188 */
190 {
192 }
193
194protected:
195 /// Set by SetVelocityContext(); read by HasNonDirichletVelocity().
197 /// Set by SetKinvis(); checked by Update() in debug builds.
198 bool m_isSetKinvis = false;
199 /// Kinematic viscosity, set by SetKinvis().
200 TData m_kinvis = 0.0;
201 /// Time of the prescribed boundary velocity, set by SetTime().
202 TData m_time = 0.0;
203 /// Scale of the fields passed to Update(), set by SetScale().
204 TData m_scale = 1.0;
205
207 const std::vector<std::string> &components)
208 : MultiRegions::NeuBndCondOp<TData>(expansionList, components)
209 {
210 }
211
212 ~HOPressureBndCondOp() override = default;
213
215 const MultiRegions::ExpListSharedPtr &velocityExpansionList,
216 const std::vector<std::string> &velocityComponents) = 0;
217
218 virtual void v_Update(
221
226
227 virtual void v_UpdateWeak(
231};
232
233} // namespace Nektar
Higher-order pressure boundary condition, added to the pressure system as a Neumann contribution.
~HOPressureBndCondOp() override=default
HOPressureBndCondOp(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
void SetKinvis(const TData &kinvis)
Set the kinematic viscosity kinvis Update() uses.
static const std::string userDefinedType
USERDEFINEDTYPE of the pressure Neumann conditions the operator applies.
void SetVelocityContext(const MultiRegions::ExpListSharedPtr &velocityExpansionList, const std::vector< std::string > &velocityComponents)
Set the velocity expansion list and the names of the velocity components, from which the boundary-adj...
static std::shared_ptr< HOPressureBndCondOp< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="")
bool m_isSetKinvis
Set by SetKinvis(); checked by Update() in debug builds.
virtual void v_UpdateWeak(LibUtilities::Field< TData, FieldState::Phys > &rhs, LibUtilities::Field< TData, FieldState::Phys > &velocity, LibUtilities::Field< TData, FieldState::Phys > &predictor)=0
void SetTime(const TData &time)
Set the time at which UpdateWithAcceleration() evaluates the prescribed boundary velocity (default 0)...
TData m_kinvis
Kinematic viscosity, set by SetKinvis().
virtual void v_Update(LibUtilities::Field< TData, FieldState::Phys > &rhs, LibUtilities::Field< TData, FieldState::Phys > &velocity)=0
TData m_time
Time of the prescribed boundary velocity, set by SetTime().
void UpdateWithAcceleration(LibUtilities::Field< TData, FieldState::Phys > &rhs, LibUtilities::Field< TData, FieldState::Phys > &velocity, LibUtilities::Field< TData, FieldState::Phys > &predictor)
Compute the pressure flux, adding the acceleration needed to reach the prescribed boundary velocity a...
virtual void v_SetVelocityContext(const MultiRegions::ExpListSharedPtr &velocityExpansionList, const std::vector< std::string > &velocityComponents)=0
static const std::string name
bool HasNonDirichletVelocity() const
Whether a region on this rank has a velocity component that is not Dirichlet, so that UpdateWithAccel...
void Update(LibUtilities::Field< TData, FieldState::Phys > &rhs, LibUtilities::Field< TData, FieldState::Phys > &velocity)
Compute the pressure flux scale * (rhs - kinvis * CurlCurl(velocity)) . n on the boundary.
virtual void v_UpdateWithAcceleration(LibUtilities::Field< TData, FieldState::Phys > &rhs, LibUtilities::Field< TData, FieldState::Phys > &velocity, LibUtilities::Field< TData, FieldState::Phys > &predictor)=0
void SetScale(const TData &scale)
Set the scale by which Update() multiplies the fields it is passed (default 1).
void UpdateWeak(LibUtilities::Field< TData, FieldState::Phys > &rhs, LibUtilities::Field< TData, FieldState::Phys > &velocity, LibUtilities::Field< TData, FieldState::Phys > &predictor)
Compute the pressure flux of the weak pressure form: the flux of UpdateWithAcceleration() less scale ...
TData m_scale
Scale of the fields passed to Update(), set by SetScale().
bool m_hasNonDirichletVelocity
Set by SetVelocityContext(); read by HasNonDirichletVelocity().
A Field represents expansion data to be operated on.
Common base class of the operator family interfaces: holds the expansion list, component names and da...
Definition Operator.hpp:100
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.