Nektar++
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 ()
 
void Update (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &Adv, std::map< std::string, NekDouble > &params)
 
void Initialise (const LibUtilities::SessionReaderSharedPtr &pSession)
 

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 64 of file IncBaseCondition.h.

Constructor & Destructor Documentation

◆ ~IncBaseCondition()

Nektar::IncBaseCondition::~IncBaseCondition ( )
virtual

Definition at line 64 of file IncBaseCondition.cpp.

65{
66}

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

60 : m_spacedim(spacedim), m_bnddim(bnddim), m_nbnd(nbnd), m_field(pFields[0])
61{
62}
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 185 of file IncBaseCondition.cpp.

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

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

153{
154 if (m_intSteps == 1)
155 {
156 return;
157 }
158 int nint = std::min(numCalls, m_intSteps);
159 int nlevels = array.size();
160 int dim = array[0].size();
161 int nPts = array[0][0].size();
162 // Check integer for time levels
163 // Note that ExtrapolateArray assumes m_pressureCalls is >= 1
164 // meaning v_EvaluatePressureBCs has been called previously
165 ASSERTL0(nint > 0, "nint must be > 0 when calling ExtrapolateArray.");
166 // Update array
167 RollOver(array);
168 // Extrapolate to outarray
169 for (int i = 0; i < dim; ++i)
170 {
171 Vmath::Smul(nPts, StifflyStable_Betaq_Coeffs[nint - 1][nint - 1],
172 array[nint - 1][i], 1, array[nlevels - 1][i], 1);
173 }
174 for (int n = 0; n < nint - 1; ++n)
175 {
176 for (int i = 0; i < dim; ++i)
177 {
178 Vmath::Svtvp(nPts, StifflyStable_Betaq_Coeffs[nint - 1][n],
179 array[n][i], 1, array[nlevels - 1][i], 1,
180 array[nlevels - 1][i], 1);
181 }
182 }
183}
#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 76 of file IncBaseCondition.h.

77 {
78 v_Initialise(pSession);
79 }
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 119 of file IncBaseCondition.cpp.

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

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

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

268{
269 int nlevels = input.size();
270 Array<OneD, Array<OneD, NekDouble>> tmp;
271 tmp = input[nlevels - 1];
272 for (int n = nlevels - 1; n > 0; --n)
273 {
274 input[n] = input[n - 1];
275 }
276 input[0] = tmp;
277}

Referenced by ExtrapolateArray().

◆ SetNumPointsOnPlane0()

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

Definition at line 100 of file IncBaseCondition.cpp.

101{
102 if (m_BndExp.begin()->second->GetExpType() == MultiRegions::e2DH1D)
103 {
104 if (m_field->GetZIDs()[0] == 0)
105 {
106 npointsPlane0 = m_BndExp.begin()->second->GetPlane(0)->GetNpoints();
107 }
108 else
109 {
110 npointsPlane0 = 0;
111 }
112 }
113 else
114 {
115 npointsPlane0 = m_BndExp.begin()->second->GetNpoints();
116 }
117}

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 69 of file IncBaseCondition.h.

72 {
73 v_Update(fields, Adv, params);
74 };
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 68 of file IncBaseCondition.cpp.

70{
71 m_npoints = m_BndExp.begin()->second->GetNpoints();
72 m_numCalls = 0;
73 if (pSession->DefinesParameter("ExtrapolateOrder"))
74 {
75 m_intSteps = std::round(pSession->GetParameter("ExtrapolateOrder"));
76 m_intSteps = std::min(3, std::max(0, m_intSteps));
77 }
78 else if (pSession->DefinesSolverInfo("TimeIntegrationMethod"))
79 {
80 if (pSession->GetSolverInfo("TimeIntegrationMethod") == "IMEXOrder1")
81 {
82 m_intSteps = 1;
83 }
84 else if (pSession->GetSolverInfo("TimeIntegrationMethod") ==
85 "IMEXOrder2")
86 {
87 m_intSteps = 2;
88 }
89 else
90 {
91 m_intSteps = 3;
92 }
93 }
94 else
95 {
96 m_intSteps = 0;
97 }
98}

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()

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 
)
protectedvirtual

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

Definition at line 351 of file IncBaseCondition.cpp.

355{
356}

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 130 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 137 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 136 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 138 of file IncBaseCondition.h.