Nektar++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 More...
 
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 193 of file IncBaseCondition.cpp.

196{
197 if (npts0 == 0)
198 {
199 return;
200 }
201 Array<OneD, Array<OneD, NekDouble>> acceleration(m_spacedim);
202 for (size_t k = 0; k < m_spacedim; ++k)
203 {
204 acceleration[k] = Array<OneD, NekDouble>(npts0, 0.0);
205 }
206
207 // set up pressure condition
208 if (params.find("Omega_z") != params.end())
209 {
210 NekDouble Wz2 = params["Omega_z"] * params["Omega_z"];
211 NekDouble dWz = 0.;
212 if (params.find("DOmega_z") != params.end())
213 {
214 dWz = params["DOmega_z"];
215 }
216 Vmath::Svtsvtp(npts0, Wz2, m_coords[0], 1, dWz, m_coords[1], 1, N[0],
217 1);
218 Vmath::Svtsvtp(npts0, Wz2, m_coords[1], 1, -dWz, m_coords[0], 1, N[1],
219 1);
220 }
221 std::vector<std::string> vars = {"A_x", "A_y", "A_z"};
222 for (int k = 0; k < m_bnddim; ++k)
223 {
224 if (params.find(vars[k]) != params.end())
225 {
226 Vmath::Sadd(npts0, -params[vars[k]], N[k], 1, N[k], 1);
227 }
228 }
229}
Array< OneD, Array< OneD, NekDouble > > m_coords
double NekDouble
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 231 of file IncBaseCondition.cpp.

235{
236 if (m_intSteps == 0 || params.find("Kinvis") == params.end() ||
237 params["Kinvis"] <= 0. || fields.size() == 0)
238 {
239 return;
240 }
241 NekDouble kinvis = params["Kinvis"];
242 m_bndElmtExps->SetWaveSpace(m_field->GetWaveSpace());
243 Array<OneD, Array<OneD, NekDouble>> Velocity(m_spacedim);
244 Array<OneD, Array<OneD, NekDouble>> Q(m_spacedim);
245 // Loop all boundary conditions
246 int nq = m_bndElmtExps->GetTotPoints();
247 for (int i = 0; i < m_spacedim; i++)
248 {
249 Q[i] = Array<OneD, NekDouble>(nq, 0.0);
250 }
251
252 for (int i = 0; i < m_spacedim; i++)
253 {
254 m_field->ExtractPhysToBndElmt(m_nbnd, fields[i], Velocity[i]);
255 }
256
257 // CurlCurl
258 m_bndElmtExps->CurlCurl(Velocity, Q);
259
260 Array<OneD, NekDouble> temp(m_npoints);
261 for (int i = 0; i < m_bnddim; i++)
262 {
263 m_field->ExtractElmtToBndPhys(m_nbnd, Q[i],
264 m_viscous[m_intSteps - 1][i]);
265 }
267 for (int i = 0; i < m_bnddim; i++)
268 {
269 Vmath::Svtvp(m_npoints, -kinvis, m_viscous[m_intSteps - 1][i], 1, N[i],
270 1, N[i], 1);
271 }
272}
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 159 of file IncBaseCondition.cpp.

161{
162 if (m_intSteps == 1)
163 {
164 return;
165 }
166 int nint = std::min(numCalls, m_intSteps);
167 int nlevels = array.size();
168 int dim = array[0].size();
169 int nPts = array[0][0].size();
170 // Check integer for time levels
171 // Note that ExtrapolateArray assumes m_pressureCalls is >= 1
172 // meaning v_EvaluatePressureBCs has been called previously
173 ASSERTL0(nint > 0, "nint must be > 0 when calling ExtrapolateArray.");
174 // Update array
175 RollOver(array);
176 // Extrapolate to outarray
177 for (int i = 0; i < dim; ++i)
178 {
179 Vmath::Smul(nPts, StifflyStable_Betaq_Coeffs[nint - 1][nint - 1],
180 array[nint - 1][i], 1, array[nlevels - 1][i], 1);
181 }
182 for (int n = 0; n < nint - 1; ++n)
183 {
184 for (int i = 0; i < dim; ++i)
185 {
186 Vmath::Svtvp(nPts, StifflyStable_Betaq_Coeffs[nint - 1][n],
187 array[n][i], 1, array[nlevels - 1][i], 1,
188 array[nlevels - 1][i], 1);
189 }
190 }
191}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
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 127 of file IncBaseCondition.cpp.

129{
130 MultiRegions::ExpListSharedPtr bndexp = m_BndExp.begin()->second;
131 if (m_coords.size() == 0)
132 {
133 m_coords = Array<OneD, Array<OneD, NekDouble>>(m_spacedim);
134 for (size_t k = 0; k < m_spacedim; ++k)
135 {
136 m_coords[k] = Array<OneD, NekDouble>(m_npoints, 0.0);
137 }
138 if (m_spacedim == 2)
139 {
140 bndexp->GetCoords(m_coords[0], m_coords[1]);
141 }
142 else
143 {
144 bndexp->GetCoords(m_coords[0], m_coords[1], m_coords[2]);
145 }
146 // move the centre to the location of pivot
147 std::vector<std::string> xyz = {"X0", "Y0", "Z0"};
148 for (int i = 0; i < m_spacedim; ++i)
149 {
150 if (params.find(xyz[i]) != params.end())
151 {
152 Vmath::Sadd(m_npoints, -params[xyz[i]], m_coords[i], 1,
153 m_coords[i], 1);
154 }
155 }
156 }
157}
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 287 of file IncBaseCondition.cpp.

290{
291 if (npts0 == 0)
292 {
293 return;
294 }
295 // for the wall we need to calculate:
296 // [V_wall]_xyz = [V_frame]_xyz + [Omega X r]_xyz
297 // Note all vectors must be in moving frame coordinates xyz
298 // not in inertial frame XYZ
299
300 // vx = OmegaY*z-OmegaZ*y
301 // vy = OmegaZ*x-OmegaX*z
302 // vz = OmegaX*y-OmegaY*x
303 if (params.find("Omega_z") != params.end())
304 {
305 NekDouble Wz = params["Omega_z"];
306 if (m_BndExp.find(0) != m_BndExp.end())
307 {
308 Vmath::Smul(npts0, -Wz, m_coords[1], 1, velocities[0], 1);
309 }
310 if (m_BndExp.find(1) != m_BndExp.end())
311 {
312 Vmath::Smul(npts0, Wz, m_coords[0], 1, velocities[1], 1);
313 }
314 }
315 if (m_bnddim == 3)
316 {
317 if (params.find("Omega_x") != params.end())
318 {
319 NekDouble Wx = params["Omega_x"];
320 if (m_BndExp.find(2) != m_BndExp.end())
321 {
322 Vmath::Smul(npts0, Wx, m_coords[1], 1, velocities[2], 1);
323 }
324 if (m_BndExp.find(1) != m_BndExp.end())
325 {
326 Vmath::Svtvp(npts0, -Wx, m_coords[2], 1, velocities[1], 1,
327 velocities[1], 1);
328 }
329 }
330 if (params.find("Omega_y") != params.end())
331 {
332 NekDouble Wy = params["Omega_x"];
333 if (m_BndExp.find(0) != m_BndExp.end())
334 {
335 Vmath::Svtvp(npts0, Wy, m_coords[2], 1, velocities[0], 1,
336 velocities[0], 1);
337 }
338 if (m_BndExp.find(2) != m_BndExp.end())
339 {
340 Vmath::Svtvp(npts0, -Wy, m_coords[0], 1, velocities[2], 1,
341 velocities[2], 1);
342 }
343 }
344 }
345
346 // add the translation velocity
347 std::vector<std::string> vars = {"U", "V", "W"};
348 for (int k = 0; k < m_bnddim; ++k)
349 {
350 if (params.find(vars[k]) != params.end() &&
351 m_BndExp.find(k) != m_BndExp.end())
352 {
353 Vmath::Sadd(npts0, params[vars[k]], velocities[k], 1, velocities[k],
354 1);
355 }
356 }
357}

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 274 of file IncBaseCondition.cpp.

276{
277 int nlevels = input.size();
278 Array<OneD, Array<OneD, NekDouble>> tmp;
279 tmp = input[nlevels - 1];
280 for (int n = nlevels - 1; n > 0; --n)
281 {
282 input[n] = input[n - 1];
283 }
284 input[0] = tmp;
285}

Referenced by ExtrapolateArray().

◆ SetNumPointsOnPlane0()

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

Definition at line 108 of file IncBaseCondition.cpp.

109{
110 if (m_BndExp.begin()->second->GetExpType() == MultiRegions::e2DH1D)
111 {
112 if (m_field->GetZIDs()[0] == 0)
113 {
114 npointsPlane0 = m_BndExp.begin()->second->GetPlane(0)->GetNpoints();
115 }
116 else
117 {
118 npointsPlane0 = 0;
119 }
120 }
121 else
122 {
123 npointsPlane0 = m_BndExp.begin()->second->GetNpoints();
124 }
125}

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->DefinesSolverInfo("TimeIntegrationMethod") ||
76 pSession->DefinesTimeIntScheme())
77 {
78 std::string method;
79 if (pSession->DefinesTimeIntScheme())
80 {
81 auto timeInt = pSession->GetTimeIntScheme();
82 method = timeInt.method + "Order" + std::to_string(timeInt.order);
83 }
84 else
85 {
86 method = pSession->GetSolverInfo("TimeIntegrationMethod");
87 }
88
89 if (method == "IMEXOrder1")
90 {
91 m_intSteps = 1;
92 }
93 else if (method == "IMEXOrder2")
94 {
95 m_intSteps = 2;
96 }
97 else
98 {
99 m_intSteps = 3;
100 }
101 }
102 else
103 {
104 m_intSteps = 0;
105 }
106}

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.