Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Nektar::IncBaseCondition Class Reference

#include <IncBaseCondition.h>

Inheritance diagram for Nektar::IncBaseCondition:
[legend]

Public Member Functions

virtual ~IncBaseCondition ()=default
 
void Initialise (const LibUtilities::SessionReaderSharedPtr &pSession)
 
void Update (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &Adv, std::map< std::string, NekDouble > &params)
 

Protected Member Functions

 IncBaseCondition (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)
 
virtual void v_Initialise (const LibUtilities::SessionReaderSharedPtr &pSession)
 
virtual 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)
 
void ExtrapolateArray (const int numCalls, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &array)
 
void RollOver (Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &input)
 
void AddVisPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &N, std::map< std::string, NekDouble > &params)
 
void AddRigidBodyAcc (Array< OneD, Array< OneD, NekDouble > > &N, std::map< std::string, NekDouble > &params, int npts0)
 
void RigidBodyVelocity (Array< OneD, Array< OneD, NekDouble > > &velocities, std::map< std::string, NekDouble > &params, int npts0)
 
void InitialiseCoords (std::map< std::string, NekDouble > &params)
 
void SetNumPointsOnPlane0 (int &npointsPlane0)
 

Protected Attributes

int m_spacedim
 
int m_bnddim
 bounday dimensionality
 
int m_nbnd
 
int m_numCalls
 
int m_intSteps
 
std::map< int, SpatialDomains::BoundaryConditionShPtrm_BndConds
 
std::map< int, MultiRegions::ExpListSharedPtrm_BndExp
 
int m_npoints
 
Array< OneD, Array< OneD, NekDouble > > m_coords
 
MultiRegions::ExpListSharedPtr m_bndElmtExps
 
MultiRegions::ExpListSharedPtr m_field
 
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_viscous
 
int m_pressure
 
std::string classname
 

Static Protected Attributes

static NekDouble StifflyStable_Betaq_Coeffs [3][3]
 
static NekDouble StifflyStable_Alpha_Coeffs [3][3]
 
static NekDouble StifflyStable_Gamma0_Coeffs [3]
 

Detailed Description

Definition at line 65 of file IncBaseCondition.h.

Constructor & Destructor Documentation

◆ ~IncBaseCondition()

virtual Nektar::IncBaseCondition::~IncBaseCondition ( )
virtualdefault

◆ IncBaseCondition()

Nektar::IncBaseCondition::IncBaseCondition ( 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 
)
protected

Definition at line 54 of file IncBaseCondition.cpp.

61 : m_spacedim(spacedim), m_bnddim(bnddim), m_nbnd(nbnd), m_field(pFields[0])
62{
63}
MultiRegions::ExpListSharedPtr m_field
int m_bnddim
bounday dimensionality

Member Function Documentation

◆ AddRigidBodyAcc()

void Nektar::IncBaseCondition::AddRigidBodyAcc ( Array< OneD, Array< OneD, NekDouble > > &  N,
std::map< std::string, NekDouble > &  params,
int  npts0 
)
protected

Definition at line 170 of file IncBaseCondition.cpp.

173{
174 if (npts0 == 0)
175 {
176 return;
177 }
178 Array<OneD, Array<OneD, NekDouble>> acceleration(m_spacedim);
179 for (size_t k = 0; k < m_spacedim; ++k)
180 {
181 acceleration[k] = Array<OneD, NekDouble>(npts0, 0.0);
182 }
183
184 // set up pressure condition
185 if (params.find("Omega_z") != params.end())
186 {
187 NekDouble Wz2 = params["Omega_z"] * params["Omega_z"];
188 NekDouble dWz = 0.;
189 if (params.find("DOmega_z") != params.end())
190 {
191 dWz = params["DOmega_z"];
192 }
193 Vmath::Svtsvtp(npts0, Wz2, m_coords[0], 1, dWz, m_coords[1], 1, N[0],
194 1);
195 Vmath::Svtsvtp(npts0, Wz2, m_coords[1], 1, -dWz, m_coords[0], 1, N[1],
196 1);
197 }
198 std::vector<std::string> vars = {"A_x", "A_y", "A_z"};
199 for (int k = 0; k < m_bnddim; ++k)
200 {
201 if (params.find(vars[k]) != params.end())
202 {
203 Vmath::Sadd(npts0, -params[vars[k]], N[k], 1, N[k], 1);
204 }
205 }
206}
Array< OneD, Array< OneD, NekDouble > > m_coords
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
Svtsvtp (scalar times vector plus scalar times vector):
Definition Vmath.hpp:473
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

References m_bnddim, m_coords, m_spacedim, Vmath::Sadd(), and Vmath::Svtsvtp().

Referenced by Nektar::MovingFrameWall::v_Update(), and Nektar::TransMovingWall::v_Update().

◆ AddVisPressureBCs()

void Nektar::IncBaseCondition::AddVisPressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  fields,
Array< OneD, Array< OneD, NekDouble > > &  N,
std::map< std::string, NekDouble > &  params 
)
protected

Definition at line 208 of file IncBaseCondition.cpp.

212{
213 if (m_intSteps == 0 || params.find("Kinvis") == params.end() ||
214 params["Kinvis"] <= 0. || fields.size() == 0)
215 {
216 return;
217 }
218 NekDouble kinvis = params["Kinvis"];
219 m_bndElmtExps->SetWaveSpace(m_field->GetWaveSpace());
220 Array<OneD, Array<OneD, NekDouble>> Velocity(m_spacedim);
221 Array<OneD, Array<OneD, NekDouble>> Q(m_spacedim);
222 // Loop all boundary conditions
223 int nq = m_bndElmtExps->GetTotPoints();
224 for (int i = 0; i < m_spacedim; i++)
225 {
226 Q[i] = Array<OneD, NekDouble>(nq, 0.0);
227 }
228
229 for (int i = 0; i < m_spacedim; i++)
230 {
231 m_field->ExtractPhysToBndElmt(m_nbnd, fields[i], Velocity[i]);
232 }
233
234 // CurlCurl
235 m_bndElmtExps->CurlCurl(Velocity, Q);
236
237 Array<OneD, NekDouble> temp(m_npoints);
238 for (int i = 0; i < m_bnddim; i++)
239 {
240 m_field->ExtractElmtToBndPhys(m_nbnd, Q[i],
241 m_viscous[m_intSteps - 1][i]);
242 }
244 for (int i = 0; i < m_bnddim; i++)
245 {
246 Vmath::Svtvp(m_npoints, -kinvis, m_viscous[m_intSteps - 1][i], 1, N[i],
247 1, N[i], 1);
248 }
249}
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_viscous
void ExtrapolateArray(const int numCalls, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &array)
MultiRegions::ExpListSharedPtr m_bndElmtExps
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

References ExtrapolateArray(), m_bnddim, m_bndElmtExps, m_field, m_intSteps, m_nbnd, m_npoints, m_numCalls, m_spacedim, m_viscous, and Vmath::Svtvp().

Referenced by Nektar::MovingFrameWall::v_Update(), Nektar::StaticWall::v_Update(), and Nektar::TransMovingWall::v_Update().

◆ ExtrapolateArray()

void Nektar::IncBaseCondition::ExtrapolateArray ( const int  numCalls,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  array 
)
protected

Definition at line 136 of file IncBaseCondition.cpp.

138{
139 if (m_intSteps == 1)
140 {
141 return;
142 }
143 int nint = std::min(numCalls, m_intSteps);
144 int nlevels = array.size();
145 int dim = array[0].size();
146 int nPts = array[0][0].size();
147 // Check integer for time levels
148 // Note that ExtrapolateArray assumes m_pressureCalls is >= 1
149 // meaning v_EvaluatePressureBCs has been called previously
150 ASSERTL0(nint > 0, "nint must be > 0 when calling ExtrapolateArray.");
151 // Update array
152 RollOver(array);
153 // Extrapolate to outarray
154 for (int i = 0; i < dim; ++i)
155 {
156 Vmath::Smul(nPts, StifflyStable_Betaq_Coeffs[nint - 1][nint - 1],
157 array[nint - 1][i], 1, array[nlevels - 1][i], 1);
158 }
159 for (int n = 0; n < nint - 1; ++n)
160 {
161 for (int i = 0; i < dim; ++i)
162 {
163 Vmath::Svtvp(nPts, StifflyStable_Betaq_Coeffs[nint - 1][n],
164 array[n][i], 1, array[nlevels - 1][i], 1,
165 array[nlevels - 1][i], 1);
166 }
167 }
168}
#define ASSERTL0(condition, msg)
void RollOver(Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &input)
static NekDouble StifflyStable_Betaq_Coeffs[3][3]
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition Vmath.hpp:100

References ASSERTL0, m_intSteps, RollOver(), Vmath::Smul(), StifflyStable_Betaq_Coeffs, and Vmath::Svtvp().

Referenced by AddVisPressureBCs().

◆ Initialise()

void Nektar::IncBaseCondition::Initialise ( const LibUtilities::SessionReaderSharedPtr pSession)
inline

Definition at line 70 of file IncBaseCondition.h.

71 {
72 v_Initialise(pSession);
73 }
virtual void v_Initialise(const LibUtilities::SessionReaderSharedPtr &pSession)

References v_Initialise().

◆ InitialiseCoords()

void Nektar::IncBaseCondition::InitialiseCoords ( std::map< std::string, NekDouble > &  params)
protected

Definition at line 104 of file IncBaseCondition.cpp.

106{
107 MultiRegions::ExpListSharedPtr bndexp = m_BndExp.begin()->second;
108 if (m_coords.size() == 0)
109 {
110 m_coords = Array<OneD, Array<OneD, NekDouble>>(m_spacedim);
111 for (size_t k = 0; k < m_spacedim; ++k)
112 {
113 m_coords[k] = Array<OneD, NekDouble>(m_npoints, 0.0);
114 }
115 if (m_spacedim == 2)
116 {
117 bndexp->GetCoords(m_coords[0], m_coords[1]);
118 }
119 else
120 {
121 bndexp->GetCoords(m_coords[0], m_coords[1], m_coords[2]);
122 }
123 // move the centre to the location of pivot
124 std::vector<std::string> xyz = {"X0", "Y0", "Z0"};
125 for (int i = 0; i < m_spacedim; ++i)
126 {
127 if (params.find(xyz[i]) != params.end())
128 {
129 Vmath::Sadd(m_npoints, -params[xyz[i]], m_coords[i], 1,
130 m_coords[i], 1);
131 }
132 }
133 }
134}
std::map< int, MultiRegions::ExpListSharedPtr > m_BndExp
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.

References m_BndExp, m_coords, m_npoints, m_spacedim, and Vmath::Sadd().

Referenced by Nektar::MovingFrameWall::v_Update().

◆ RigidBodyVelocity()

void Nektar::IncBaseCondition::RigidBodyVelocity ( Array< OneD, Array< OneD, NekDouble > > &  velocities,
std::map< std::string, NekDouble > &  params,
int  npts0 
)
protected

Definition at line 264 of file IncBaseCondition.cpp.

267{
268 if (npts0 == 0)
269 {
270 return;
271 }
272 // for the wall we need to calculate:
273 // [V_wall]_xyz = [V_frame]_xyz + [Omega X r]_xyz
274 // Note all vectors must be in moving frame coordinates xyz
275 // not in inertial frame XYZ
276
277 // vx = OmegaY*z-OmegaZ*y
278 // vy = OmegaZ*x-OmegaX*z
279 // vz = OmegaX*y-OmegaY*x
280 if (params.find("Omega_z") != params.end())
281 {
282 NekDouble Wz = params["Omega_z"];
283 if (m_BndExp.find(0) != m_BndExp.end())
284 {
285 Vmath::Smul(npts0, -Wz, m_coords[1], 1, velocities[0], 1);
286 }
287 if (m_BndExp.find(1) != m_BndExp.end())
288 {
289 Vmath::Smul(npts0, Wz, m_coords[0], 1, velocities[1], 1);
290 }
291 }
292 if (m_bnddim == 3)
293 {
294 if (params.find("Omega_x") != params.end())
295 {
296 NekDouble Wx = params["Omega_x"];
297 if (m_BndExp.find(2) != m_BndExp.end())
298 {
299 Vmath::Smul(npts0, Wx, m_coords[1], 1, velocities[2], 1);
300 }
301 if (m_BndExp.find(1) != m_BndExp.end())
302 {
303 Vmath::Svtvp(npts0, -Wx, m_coords[2], 1, velocities[1], 1,
304 velocities[1], 1);
305 }
306 }
307 if (params.find("Omega_y") != params.end())
308 {
309 NekDouble Wy = params["Omega_x"];
310 if (m_BndExp.find(0) != m_BndExp.end())
311 {
312 Vmath::Svtvp(npts0, Wy, m_coords[2], 1, velocities[0], 1,
313 velocities[0], 1);
314 }
315 if (m_BndExp.find(2) != m_BndExp.end())
316 {
317 Vmath::Svtvp(npts0, -Wy, m_coords[0], 1, velocities[2], 1,
318 velocities[2], 1);
319 }
320 }
321 }
322
323 // add the translation velocity
324 std::vector<std::string> vars = {"U", "V", "W"};
325 for (int k = 0; k < m_bnddim; ++k)
326 {
327 if (params.find(vars[k]) != params.end() &&
328 m_BndExp.find(k) != m_BndExp.end())
329 {
330 Vmath::Sadd(npts0, params[vars[k]], velocities[k], 1, velocities[k],
331 1);
332 }
333 }
334}

References m_bnddim, m_BndExp, m_coords, Vmath::Sadd(), Vmath::Smul(), and Vmath::Svtvp().

Referenced by Nektar::MovingFrameWall::v_Update().

◆ RollOver()

void Nektar::IncBaseCondition::RollOver ( Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  input)
protected

Definition at line 251 of file IncBaseCondition.cpp.

253{
254 int nlevels = input.size();
255 Array<OneD, Array<OneD, NekDouble>> tmp;
256 tmp = input[nlevels - 1];
257 for (int n = nlevels - 1; n > 0; --n)
258 {
259 input[n] = input[n - 1];
260 }
261 input[0] = tmp;
262}

Referenced by ExtrapolateArray().

◆ SetNumPointsOnPlane0()

void Nektar::IncBaseCondition::SetNumPointsOnPlane0 ( int &  npointsPlane0)
protected

Definition at line 85 of file IncBaseCondition.cpp.

86{
87 if (m_BndExp.begin()->second->GetExpType() == MultiRegions::e2DH1D)
88 {
89 if (m_field->GetZIDs()[0] == 0)
90 {
91 npointsPlane0 = m_BndExp.begin()->second->GetPlane(0)->GetNpoints();
92 }
93 else
94 {
95 npointsPlane0 = 0;
96 }
97 }
98 else
99 {
100 npointsPlane0 = m_BndExp.begin()->second->GetNpoints();
101 }
102}

References Nektar::MultiRegions::e2DH1D, m_BndExp, and m_field.

Referenced by Nektar::MovingFrameFar::v_Update(), Nektar::MovingFrameWall::v_Update(), and Nektar::TransMovingWall::v_Update().

◆ Update()

void Nektar::IncBaseCondition::Update ( const Array< OneD, const Array< OneD, NekDouble > > &  fields,
const Array< OneD, const Array< OneD, NekDouble > > &  Adv,
std::map< std::string, NekDouble > &  params 
)
inline

Definition at line 75 of file IncBaseCondition.h.

78 {
79 v_Update(fields, Adv, params);
80 };
virtual 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)

References v_Update().

◆ v_Initialise()

void Nektar::IncBaseCondition::v_Initialise ( const LibUtilities::SessionReaderSharedPtr pSession)
protectedvirtual

Reimplemented in Nektar::MovingFrameFar, Nektar::MovingFrameWall, Nektar::StaticWall, and Nektar::TransMovingWall.

Definition at line 65 of file IncBaseCondition.cpp.

67{
68 m_npoints = m_BndExp.begin()->second->GetNpoints();
69 m_numCalls = 0;
70 if (pSession->DefinesParameter("ExtrapolateOrder"))
71 {
72 m_intSteps = std::round(pSession->GetParameter("ExtrapolateOrder"));
73 m_intSteps = std::min(3, std::max(0, m_intSteps));
74 }
75 else if (pSession->DefinesTimeIntScheme())
76 {
77 m_intSteps = pSession->GetTimeIntScheme().order;
78 }
79 else
80 {
81 m_intSteps = 0;
82 }
83}

References m_BndExp, m_intSteps, m_npoints, and m_numCalls.

Referenced by Initialise(), Nektar::MovingFrameFar::v_Initialise(), Nektar::MovingFrameWall::v_Initialise(), and Nektar::StaticWall::v_Initialise().

◆ v_Update()

virtual void Nektar::IncBaseCondition::v_Update ( const Array< OneD, const Array< OneD, NekDouble > > &  fields,
const Array< OneD, const Array< OneD, NekDouble > > &  Adv,
std::map< std::string, NekDouble > &  params 
)
inlineprotectedvirtual

Reimplemented in Nektar::MovingFrameFar, Nektar::MovingFrameWall, Nektar::StaticWall, and Nektar::TransMovingWall.

Definition at line 92 of file IncBaseCondition.h.

97 {
98 }

Referenced by Update().

Member Data Documentation

◆ classname

std::string Nektar::IncBaseCondition::classname
protected

◆ m_BndConds

std::map<int, SpatialDomains::BoundaryConditionShPtr> Nektar::IncBaseCondition::m_BndConds
protected

◆ m_bnddim

int Nektar::IncBaseCondition::m_bnddim
protected

◆ m_bndElmtExps

MultiRegions::ExpListSharedPtr Nektar::IncBaseCondition::m_bndElmtExps
protected

◆ m_BndExp

std::map<int, MultiRegions::ExpListSharedPtr> Nektar::IncBaseCondition::m_BndExp
protected

◆ m_coords

Array<OneD, Array<OneD, NekDouble> > Nektar::IncBaseCondition::m_coords
protected

Definition at line 129 of file IncBaseCondition.h.

Referenced by AddRigidBodyAcc(), InitialiseCoords(), and RigidBodyVelocity().

◆ m_field

MultiRegions::ExpListSharedPtr Nektar::IncBaseCondition::m_field
protected

◆ m_intSteps

int Nektar::IncBaseCondition::m_intSteps
protected

◆ m_nbnd

int Nektar::IncBaseCondition::m_nbnd
protected

◆ m_npoints

int Nektar::IncBaseCondition::m_npoints
protected

◆ m_numCalls

int Nektar::IncBaseCondition::m_numCalls
protected

◆ m_pressure

int Nektar::IncBaseCondition::m_pressure
protected

◆ m_spacedim

int Nektar::IncBaseCondition::m_spacedim
protected

◆ m_viscous

Array<OneD, Array<OneD, Array<OneD, NekDouble> > > Nektar::IncBaseCondition::m_viscous
protected

◆ StifflyStable_Alpha_Coeffs

NekDouble Nektar::IncBaseCondition::StifflyStable_Alpha_Coeffs
staticprotected
Initial value:
= {
{1.0, 0.0, 0.0}, {2.0, -0.5, 0.0}, {3.0, -1.5, 1.0 / 3.0}}

Definition at line 136 of file IncBaseCondition.h.

◆ StifflyStable_Betaq_Coeffs

NekDouble Nektar::IncBaseCondition::StifflyStable_Betaq_Coeffs
staticprotected
Initial value:
= {
{1.0, 0.0, 0.0}, {2.0, -1.0, 0.0}, {3.0, -3.0, 1.0}}

Definition at line 135 of file IncBaseCondition.h.

Referenced by ExtrapolateArray().

◆ StifflyStable_Gamma0_Coeffs

NekDouble Nektar::IncBaseCondition::StifflyStable_Gamma0_Coeffs
staticprotected
Initial value:
= {1.0, 1.5,
11.0 / 6.0}

Definition at line 137 of file IncBaseCondition.h.