Nektar++
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Static Private Attributes | List of all members
Nektar::Extrapolate Class Referenceabstract

#include <Extrapolate.h>

Inheritance diagram for Nektar::Extrapolate:
[legend]

Public Member Functions

 Extrapolate (const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)
 
virtual ~Extrapolate ()
 
void GenerateHOPBCMap (const LibUtilities::SessionReaderSharedPtr &pSsession)
 
void UpdateRobinPrimCoeff (void)
 
void SubSteppingTimeIntegration (const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
 
void SubStepSaveFields (const int nstep)
 
void SubStepSetPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, const NekDouble Aii_DT, NekDouble kinvis)
 
void SubStepAdvance (const int nstep, NekDouble time)
 
void MountHOPBCs (int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
 
void EvaluatePressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
 
void SetForcing (const std::vector< SolverUtils::ForcingSharedPtr > &forcing)
 
void AddDuDt (void)
 
void AddVelBC (void)
 
void ExtrapolatePressureHBCs (void)
 
void CopyPressureHBCsToPbndExp (void)
 
Array< OneD, NekDoubleGetMaxStdVelocity (const Array< OneD, Array< OneD, NekDouble > > inarray)
 
void CorrectPressureBCs (const Array< OneD, NekDouble > &pressure)
 
void IProductNormVelocityOnHBC (const Array< OneD, const Array< OneD, NekDouble > > &Vel, Array< OneD, NekDouble > &IprodVn)
 
void IProductNormVelocityBCOnHBC (Array< OneD, NekDouble > &IprodVn)
 
std::string GetSubStepName (void)
 
void ExtrapolateArray (Array< OneD, Array< OneD, NekDouble > > &array)
 
void EvaluateBDFArray (Array< OneD, Array< OneD, NekDouble > > &array)
 
void ExtrapolateArray (Array< OneD, Array< OneD, NekDouble > > &oldarrays, Array< OneD, NekDouble > &newarray, Array< OneD, NekDouble > &outarray)
 
void AddNormVelOnOBC (const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
 
void AddPressureToOutflowBCs (NekDouble kinvis)
 
void GenerateBndElmtExpansion (void)
 

Protected Member Functions

virtual void v_EvaluatePressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)=0
 
virtual void v_SubSteppingTimeIntegration (const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)=0
 
virtual void v_SubStepSaveFields (int nstep)=0
 
virtual void v_SubStepSetPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_DT, NekDouble kinvis)=0
 
virtual void v_SubStepAdvance (int nstep, NekDouble time)=0
 
virtual void v_MountHOPBCs (int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)=0
 
virtual std::string v_GetSubStepName (void)
 
virtual void v_AccelerationBDF (Array< OneD, Array< OneD, NekDouble > > &array)
 
void CalcNeumannPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
 
virtual void v_CalcNeumannPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
 
virtual void v_CorrectPressureBCs (const Array< OneD, NekDouble > &pressure)
 
virtual void v_AddNormVelOnOBC (const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
 
void CalcOutflowBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble kinvis)
 
void RollOver (Array< OneD, Array< OneD, NekDouble > > &input)
 

Protected Attributes

LibUtilities::SessionReaderSharedPtr m_session
 
LibUtilities::CommSharedPtr m_comm
 
Array< OneD, HBCTypem_hbcType
 Array of type of high order BCs for splitting shemes. More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Velocity fields. More...
 
MultiRegions::ExpListSharedPtr m_pressure
 Pointer to field holding pressure field. More...
 
Array< OneD, int > m_velocity
 int which identifies which components of m_fields contains the velocity (u,v,w); More...
 
SolverUtils::AdvectionSharedPtr m_advObject
 
std::vector< SolverUtils::ForcingSharedPtrm_forcing
 
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
 
int m_curl_dim
 Curl-curl dimensionality. More...
 
int m_bnd_dim
 bounday dimensionality More...
 
Array< OneD, const SpatialDomains::BoundaryConditionShPtrm_PBndConds
 pressure boundary conditions container More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_PBndExp
 pressure boundary conditions expansion container More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_bndElmtExps
 Boundary expansions on each domain boundary. More...
 
int m_pressureCalls
 number of times the high-order pressure BCs have been called More...
 
int m_numHBCDof
 
int m_HBCnumber
 
int m_intSteps
 Maximum points used in pressure BC evaluation. More...
 
NekDouble m_timestep
 
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
 Storage for current and previous levels of high order pressure boundary conditions. More...
 
Array< OneD, Array< OneD, NekDouble > > m_iprodnormvel
 Storage for current and previous levels of the inner product of normal velocity. More...
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 
HighOrderOutflowSharedPtr m_houtflow
 

Static Protected Attributes

static NekDouble StifflyStable_Betaq_Coeffs [3][3]
 
static NekDouble StifflyStable_Alpha_Coeffs [3][3]
 
static NekDouble StifflyStable_Gamma0_Coeffs [3] = {1.0, 1.5, 11.0 / 6.0}
 

Static Private Attributes

static std::string def
 

Detailed Description

Definition at line 73 of file Extrapolate.h.

Constructor & Destructor Documentation

◆ Extrapolate()

Nektar::Extrapolate::Extrapolate ( const LibUtilities::SessionReaderSharedPtr  pSession,
Array< OneD, MultiRegions::ExpListSharedPtr pFields,
MultiRegions::ExpListSharedPtr  pPressure,
const Array< OneD, int >  pVel,
const SolverUtils::AdvectionSharedPtr  advObject 
)

Definition at line 54 of file Extrapolate.cpp.

59 : m_session(pSession), m_fields(pFields), m_pressure(pPressure),
60 m_velocity(pVel), m_advObject(advObject)
61{
62 m_session->LoadParameter("TimeStep", m_timestep, 0.01);
63 m_comm = m_session->GetComm();
64}
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
Definition: Extrapolate.h:204
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:201
NekDouble m_timestep
Definition: Extrapolate.h:243
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:210
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:208
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:193
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:195

References m_comm, m_session, and m_timestep.

◆ ~Extrapolate()

Nektar::Extrapolate::~Extrapolate ( )
virtual

Definition at line 66 of file Extrapolate.cpp.

67{
68}

Member Function Documentation

◆ AddDuDt()

void Nektar::Extrapolate::AddDuDt ( void  )

Definition at line 77 of file Extrapolate.cpp.

78{
79 if (m_numHBCDof)
80 {
81 // Update velocity BF at n+1 (actually only needs doing if
82 // velocity is time dependent on HBCs)
84
85 // Calculate acceleration term at level n based on previous steps
87
88 // Subtract acceleration term off m_pressureHBCs[nlevels-1]
90 1, m_pressureHBCs[m_intSteps - 1], 1,
92 }
93}
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:247
virtual void v_AccelerationBDF(Array< OneD, Array< OneD, NekDouble > > &array)
void IProductNormVelocityBCOnHBC(Array< OneD, NekDouble > &IprodVn)
Array< OneD, Array< OneD, NekDouble > > m_iprodnormvel
Storage for current and previous levels of the inner product of normal velocity.
Definition: Extrapolate.h:251
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:241
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 IProductNormVelocityBCOnHBC(), m_intSteps, m_iprodnormvel, m_numHBCDof, m_pressureHBCs, m_timestep, Vmath::Svtvp(), and v_AccelerationBDF().

Referenced by Nektar::StandardExtrapolate::v_EvaluatePressureBCs(), and Nektar::SubSteppingExtrapolate::v_SubStepSetPressureBCs().

◆ AddNormVelOnOBC()

void Nektar::Extrapolate::AddNormVelOnOBC ( const int  nbcoeffs,
const int  nreg,
Array< OneD, Array< OneD, NekDouble > > &  u 
)
inline

Definition at line 410 of file Extrapolate.h.

412{
413 v_AddNormVelOnOBC(nbcoeffs, nreg, u);
414}
virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)

References v_AddNormVelOnOBC().

Referenced by CalcOutflowBCs().

◆ AddPressureToOutflowBCs()

void Nektar::Extrapolate::AddPressureToOutflowBCs ( NekDouble  kinvis)

Definition at line 468 of file Extrapolate.cpp.

469{
470 if (!m_houtflow.get())
471 {
472 return;
473 }
474
475 for (size_t n = 0; n < m_PBndConds.size(); ++n)
476 {
477 if (m_hbcType[n] == eConvectiveOBC)
478 {
479 int nqb = m_PBndExp[n]->GetTotPoints();
480 int ncb = m_PBndExp[n]->GetNcoeffs();
481
482 m_pressure->FillBndCondFromField(n, m_pressure->GetCoeffs());
483 Array<OneD, NekDouble> pbc(nqb);
484
485 m_PBndExp[n]->BwdTrans(m_PBndExp[n]->GetCoeffs(), pbc);
486
487 if (m_PBndExp[n]->GetWaveSpace())
488 {
489 m_PBndExp[n]->HomogeneousBwdTrans(nqb, pbc, pbc);
490 }
491
492 Array<OneD, NekDouble> wk(nqb);
493 Array<OneD, NekDouble> wk1(ncb);
494
495 // Get normal vector
496 Array<OneD, Array<OneD, NekDouble>> normals;
497 m_fields[0]->GetBoundaryNormals(n, normals);
498
499 // Add 1/kinvis * (pbc n )
500 for (int i = 0; i < m_curl_dim; ++i)
501 {
502 Vmath::Vmul(nqb, normals[i], 1, pbc, 1, wk, 1);
503
504 Vmath::Smul(nqb, 1.0 / kinvis, wk, 1, wk, 1);
505
506 if (m_houtflow->m_UBndExp[i][n]->GetWaveSpace())
507 {
508 m_houtflow->m_UBndExp[i][n]->HomogeneousFwdTrans(nqb, wk,
509 wk);
510 }
511 m_houtflow->m_UBndExp[i][n]->IProductWRTBase(wk, wk1);
512
513 Vmath::Vadd(ncb, wk1, 1,
514 m_houtflow->m_UBndExp[i][n]->GetCoeffs(), 1,
515 m_houtflow->m_UBndExp[i][n]->UpdateCoeffs(), 1);
516 }
517 }
518 }
519}
int m_curl_dim
Curl-curl dimensionality.
Definition: Extrapolate.h:217
Array< OneD, HBCType > m_hbcType
Array of type of high order BCs for splitting shemes.
Definition: Extrapolate.h:198
HighOrderOutflowSharedPtr m_houtflow
Definition: Extrapolate.h:261
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:226
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > m_PBndConds
pressure boundary conditions container
Definition: Extrapolate.h:223
@ eConvectiveOBC
Definition: Extrapolate.h:55
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.hpp:72
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 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 Nektar::eConvectiveOBC, m_curl_dim, m_fields, m_hbcType, m_houtflow, m_PBndConds, m_PBndExp, m_pressure, Vmath::Smul(), Vmath::Vadd(), and Vmath::Vmul().

◆ AddVelBC()

void Nektar::Extrapolate::AddVelBC ( void  )

Definition at line 98 of file Extrapolate.cpp.

99{
100 if (m_numHBCDof)
101 {
102 int order = std::min(m_pressureCalls, m_intSteps);
103
104 // Update velocity BF at n+1 (actually only needs doing if
105 // velocity is time dependent on HBCs)
107
108 // Subtract acceleration term off m_pressureHBCs[nlevels-1]
110 -1.0 * StifflyStable_Gamma0_Coeffs[order - 1] / m_timestep,
112 m_pressureHBCs[m_intSteps - 1], 1);
113 }
114}
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:232
static NekDouble StifflyStable_Gamma0_Coeffs[3]
Definition: Extrapolate.h:258

References IProductNormVelocityBCOnHBC(), m_intSteps, m_iprodnormvel, m_numHBCDof, m_pressureCalls, m_pressureHBCs, m_timestep, StifflyStable_Gamma0_Coeffs, and Vmath::Svtvp().

Referenced by Nektar::ImplicitExtrapolate::v_EvaluatePressureBCs(), Nektar::WeakPressureExtrapolate::v_EvaluatePressureBCs(), and Nektar::SubSteppingExtrapolateWeakPressure::v_SubStepSetPressureBCs().

◆ CalcNeumannPressureBCs()

void Nektar::Extrapolate::CalcNeumannPressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  fields,
const Array< OneD, const Array< OneD, NekDouble > > &  N,
NekDouble  kinvis 
)
inlineprotected

Definition at line 172 of file Extrapolate.h.

175 {
176 v_CalcNeumannPressureBCs(fields, N, kinvis);
177 }
virtual void v_CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)

References v_CalcNeumannPressureBCs().

Referenced by Nektar::ImplicitExtrapolate::v_EvaluatePressureBCs(), Nektar::StandardExtrapolate::v_EvaluatePressureBCs(), Nektar::WeakPressureExtrapolate::v_EvaluatePressureBCs(), Nektar::SubSteppingExtrapolate::v_SubStepSetPressureBCs(), and Nektar::SubSteppingExtrapolateWeakPressure::v_SubStepSetPressureBCs().

◆ CalcOutflowBCs()

void Nektar::Extrapolate::CalcOutflowBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  fields,
NekDouble  kinvis 
)
protected

Definition at line 207 of file Extrapolate.cpp.

209{
210 if (!m_houtflow.get())
211 {
212 return;
213 }
214
215 Array<OneD, Array<OneD, NekDouble>> Velocity(m_curl_dim);
216 size_t cnt = 0;
217
218 // Evaluate robin primitive coefficient here so they can be
219 // updated whem m_int > 1 Currently not using this update
220 // since we only using u^n at outflow instead of BDF rule.
222
223 for (size_t n = 0; n < m_PBndConds.size(); ++n)
224 {
225 if ((m_hbcType[n] == eOBC) || (m_hbcType[n] == eConvectiveOBC))
226 {
227 // Get expansion with element on this boundary
228 m_bndElmtExps[n]->SetWaveSpace(m_fields[0]->GetWaveSpace());
229 int nqb = m_PBndExp[n]->GetTotPoints();
230 int nq = m_bndElmtExps[n]->GetTotPoints();
231
232 // Get velocity and extrapolate
233 for (int i = 0; i < m_curl_dim; i++)
234 {
235 m_fields[0]->ExtractPhysToBndElmt(
236 n, fields[i],
237 m_houtflow->m_outflowVel[cnt][i][m_intSteps - 1]);
238 ExtrapolateArray(m_houtflow->m_outflowVel[cnt][i]);
239 Velocity[i] = m_houtflow->m_outflowVel[cnt][i][m_intSteps - 1];
240 }
241
242 // Homogeneous case needs conversion to physical space
243 if (m_fields[0]->GetWaveSpace())
244 {
245 for (int i = 0; i < m_curl_dim; i++)
246 {
247 m_bndElmtExps[n]->HomogeneousBwdTrans(
248 Velocity[i].size(), Velocity[i], Velocity[i]);
249 }
250 m_bndElmtExps[n]->SetWaveSpace(false);
251 }
252
253 // Get normal vector
254 Array<OneD, Array<OneD, NekDouble>> normals;
255 m_fields[0]->GetBoundaryNormals(n, normals);
256
257 // Calculate n.gradU.n, div(U)
258 Array<OneD, NekDouble> nGradUn(nqb, 0.0);
259 Array<OneD, NekDouble> divU(nqb, 0.0);
260 Array<OneD, Array<OneD, NekDouble>> grad(m_curl_dim);
261 Array<OneD, NekDouble> bndVal(nqb, 0.0);
262 for (int i = 0; i < m_curl_dim; i++)
263 {
264 grad[i] = Array<OneD, NekDouble>(nq, 0.0);
265 }
266 for (int i = 0; i < m_curl_dim; i++)
267 {
268 if (m_curl_dim == 2)
269 {
270 m_bndElmtExps[n]->PhysDeriv(Velocity[i], grad[0], grad[1]);
271 }
272 else
273 {
274 m_bndElmtExps[n]->PhysDeriv(Velocity[i], grad[0], grad[1],
275 grad[2]);
276 }
277
278 for (int j = 0; j < m_curl_dim; j++)
279 {
280 m_fields[0]->ExtractElmtToBndPhys(n, grad[j], bndVal);
281 // div(U) = gradU_ii
282 if (i == j)
283 {
284 Vmath::Vadd(nqb, divU, 1, bndVal, 1, divU, 1);
285 }
286 // n.gradU.n = gradU_ij n_i n_j
287 Vmath::Vmul(nqb, normals[i], 1, bndVal, 1, bndVal, 1);
288 Vmath::Vvtvp(nqb, normals[j], 1, bndVal, 1, nGradUn, 1,
289 nGradUn, 1);
290 }
291 }
292
293 // Reset WaveSpace in m_bndElmtExp[n] for next time step
294 if (m_fields[0]->GetWaveSpace())
295 {
296 m_bndElmtExps[n]->SetWaveSpace(true);
297 }
298
299 // Obtain u at the boundary
300 Array<OneD, Array<OneD, NekDouble>> u(m_curl_dim);
301 for (int i = 0; i < m_curl_dim; i++)
302 {
303 u[i] = Array<OneD, NekDouble>(nqb, 0.0);
304 m_fields[0]->ExtractElmtToBndPhys(n, Velocity[i], u[i]);
305 }
306
307 // Calculate u.n and u^2
308 Array<OneD, NekDouble> un(nqb, 0.0);
309 Array<OneD, NekDouble> u2(nqb, 0.0);
310 for (int i = 0; i < m_curl_dim; i++)
311 {
312 Vmath::Vvtvp(nqb, normals[i], 1, u[i], 1, un, 1, un, 1);
313 Vmath::Vvtvp(nqb, u[i], 1, u[i], 1, u2, 1, u2, 1);
314 }
315
316 // Calculate S_0(u.n) = 0.5*(1-tanh(u.n/*U0*delta))
317 Array<OneD, NekDouble> S0(nqb, 0.0);
318 for (int i = 0; i < nqb; i++)
319 {
320 S0[i] = 0.5 * (1.0 - tanh(un[i] / (m_houtflow->m_U0 *
321 m_houtflow->m_delta)));
322 }
323
324 // Calculate E(n,u) = ((theta+alpha2)*0.5*(u^2)n +
325 // (1-theta+alpha1)*0.5*(n.u)u ) * S_0(u.n)
326 NekDouble k1 =
327 0.5 * (m_houtflow->m_obcTheta + m_houtflow->m_obcAlpha2);
328 NekDouble k2 =
329 0.5 * (1 - m_houtflow->m_obcTheta + m_houtflow->m_obcAlpha1);
330
331 Array<OneD, Array<OneD, NekDouble>> E(m_curl_dim);
332 for (int i = 0; i < m_curl_dim; i++)
333 {
334 E[i] = Array<OneD, NekDouble>(nqb, 0.0);
335
336 Vmath::Smul(nqb, k1, u2, 1, E[i], 1);
337 Vmath::Vmul(nqb, E[i], 1, normals[i], 1, E[i], 1);
338 // Use bndVal as a temporary storage
339 Vmath::Smul(nqb, k2, un, 1, bndVal, 1);
340 Vmath::Vvtvp(nqb, u[i], 1, bndVal, 1, E[i], 1, E[i], 1);
341 Vmath::Vmul(nqb, E[i], 1, S0, 1, E[i], 1);
342 }
343
344 // if non-zero forcing is provided we want to subtract
345 // value if we want to interpret values as being the
346 // desired pressure value. This is now precribed from
347 // the velocity forcing to be consistent with the
348 // paper except f_b = -f_b
349
350 // Calculate (E(n,u) + f_b).n
351 Array<OneD, NekDouble> En(nqb, 0.0);
352 for (int i = 0; i < m_bnd_dim; i++)
353 {
354 // Use bndVal as temporary
355 Vmath::Vsub(nqb, E[i], 1,
356 m_houtflow->m_UBndExp[i][n]->GetPhys(), 1, bndVal,
357 1);
358
359 Vmath::Vvtvp(nqb, normals[i], 1, bndVal, 1, En, 1, En, 1);
360 }
361
362 // Calculate pressure bc = kinvis*n.gradU.n - E.n + f_b.n
363 Array<OneD, NekDouble> pbc(nqb, 0.0);
364 Vmath::Svtvm(nqb, kinvis, nGradUn, 1, En, 1, pbc, 1);
365
366 if (m_hbcType[n] == eOBC)
367 {
368
369 if (m_PBndExp[n]->GetWaveSpace())
370 {
371 m_PBndExp[n]->HomogeneousFwdTrans(nqb, pbc, bndVal);
372 m_PBndExp[n]->FwdTrans(bndVal,
373 m_PBndExp[n]->UpdateCoeffs());
374 }
375 else
376 {
377 m_PBndExp[n]->FwdTrans(pbc, m_PBndExp[n]->UpdateCoeffs());
378 }
379 }
380 else if (m_hbcType[n] == eConvectiveOBC) // add outflow values to
381 // calculation from HBC
382 {
383 int nbcoeffs = m_PBndExp[n]->GetNcoeffs();
384 Array<OneD, NekDouble> bndCoeffs(nbcoeffs, 0.0);
385 if (m_PBndExp[n]->GetWaveSpace())
386 {
387 m_PBndExp[n]->HomogeneousFwdTrans(nqb, pbc, bndVal);
388 m_PBndExp[n]->IProductWRTBase(bndVal, bndCoeffs);
389 }
390 else
391 {
392 m_PBndExp[n]->IProductWRTBase(pbc, bndCoeffs);
393 }
394 // Note we have the negative of what is in the Dong paper in
395 // bndVal
396 Vmath::Svtvp(nbcoeffs, m_houtflow->m_pressurePrimCoeff[n],
397 bndCoeffs, 1, m_PBndExp[n]->UpdateCoeffs(), 1,
398 m_PBndExp[n]->UpdateCoeffs(), 1);
399
400 // evaluate u^n at outflow boundary for velocity BC
401 for (int i = 0; i < m_curl_dim; i++)
402 {
403 m_fields[0]->ExtractElmtToBndPhys(
404 n, m_houtflow->m_outflowVel[cnt][i][0],
405 m_houtflow->m_outflowVelBnd[cnt][i][m_intSteps - 1]);
406
407 EvaluateBDFArray(m_houtflow->m_outflowVelBnd[cnt][i]);
408
409 // point u[i] to BDF evalauted value \hat{u}
410 u[i] = m_houtflow->m_outflowVelBnd[cnt][i][m_intSteps - 1];
411 }
412
413 // Add normal velocity if weak pressure
414 // formulation. In this case there is an
415 // additional \int \hat{u}.n ds on the outflow
416 // boundary since we use the inner product wrt
417 // deriv of basis in pressure solve.
418 AddNormVelOnOBC(cnt, n, u);
419 }
420
421 // Calculate velocity boundary conditions
422 if (m_hbcType[n] == eOBC)
423 {
424 // = (pbc n - kinvis divU n)
425 Vmath::Smul(nqb, kinvis, divU, 1, divU, 1);
426 Vmath::Vsub(nqb, pbc, 1, divU, 1, bndVal, 1);
427 }
428 else if (m_hbcType[n] == eConvectiveOBC)
429 {
430 // = (-kinvis divU n)
431 Vmath::Smul(nqb, -1.0 * kinvis, divU, 1, bndVal, 1);
432
433 // pbc needs to be added after pressure solve
434 }
435
436 for (int i = 0; i < m_curl_dim; ++i)
437 {
438 // Reuse divU -> En
439 Vmath::Vvtvp(nqb, normals[i], 1, bndVal, 1, E[i], 1, divU, 1);
440 // - f_b
441 Vmath::Vsub(nqb, divU, 1,
442 m_houtflow->m_UBndExp[i][n]->GetPhys(), 1, divU, 1);
443 // * 1/kinvis
444 Vmath::Smul(nqb, 1.0 / kinvis, divU, 1, divU, 1);
445
446 if (m_hbcType[n] == eConvectiveOBC)
447 {
448 Vmath::Svtvp(nqb, m_houtflow->m_velocityPrimCoeff[i][n],
449 u[i], 1, divU, 1, divU, 1);
450 }
451
452 if (m_houtflow->m_UBndExp[i][n]->GetWaveSpace())
453 {
454 m_houtflow->m_UBndExp[i][n]->HomogeneousFwdTrans(nqb, divU,
455 divU);
456 }
457
458 m_houtflow->m_UBndExp[i][n]->IProductWRTBase(
459 divU, m_houtflow->m_UBndExp[i][n]->UpdateCoeffs());
460 }
461
462 // Get offset for next terms
463 cnt++;
464 }
465 }
466}
int m_bnd_dim
bounday dimensionality
Definition: Extrapolate.h:220
void EvaluateBDFArray(Array< OneD, Array< OneD, NekDouble > > &array)
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &array)
void AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
Definition: Extrapolate.h:410
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndElmtExps
Boundary expansions on each domain boundary.
Definition: Extrapolate.h:229
void UpdateRobinPrimCoeff(void)
double NekDouble
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.hpp:366
void Svtvm(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvm (scalar times vector minus vector): z = alpha*x - y.
Definition: Vmath.hpp:424
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.hpp:220

References AddNormVelOnOBC(), Nektar::eConvectiveOBC, Nektar::eOBC, EvaluateBDFArray(), ExtrapolateArray(), m_bnd_dim, m_bndElmtExps, m_curl_dim, m_fields, m_hbcType, m_houtflow, m_intSteps, m_PBndConds, m_PBndExp, Vmath::Smul(), Vmath::Svtvm(), Vmath::Svtvp(), UpdateRobinPrimCoeff(), Vmath::Vadd(), Vmath::Vmul(), Vmath::Vsub(), and Vmath::Vvtvp().

Referenced by Nektar::ImplicitExtrapolate::v_EvaluatePressureBCs(), Nektar::StandardExtrapolate::v_EvaluatePressureBCs(), Nektar::WeakPressureExtrapolate::v_EvaluatePressureBCs(), Nektar::SubSteppingExtrapolate::v_SubStepSetPressureBCs(), and Nektar::SubSteppingExtrapolateWeakPressure::v_SubStepSetPressureBCs().

◆ CopyPressureHBCsToPbndExp()

void Nektar::Extrapolate::CopyPressureHBCsToPbndExp ( void  )

Definition at line 1063 of file Extrapolate.cpp.

1064{
1065 size_t n, cnt;
1066 for (cnt = n = 0; n < m_PBndConds.size(); ++n)
1067 {
1068 if ((m_hbcType[n] == eHBCNeumann) || (m_hbcType[n] == eConvectiveOBC))
1069 {
1070 int nq = m_PBndExp[n]->GetNcoeffs();
1071 Vmath::Vcopy(nq, &(m_pressureHBCs[m_intSteps - 1])[cnt], 1,
1072 &(m_PBndExp[n]->UpdateCoeffs()[0]), 1);
1073 cnt += nq;
1074 }
1075 }
1076}
@ eHBCNeumann
Definition: Extrapolate.h:53
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825

References Nektar::eConvectiveOBC, Nektar::eHBCNeumann, m_hbcType, m_intSteps, m_PBndConds, m_PBndExp, m_pressureHBCs, and Vmath::Vcopy().

Referenced by Nektar::ImplicitExtrapolate::v_EvaluatePressureBCs(), Nektar::StandardExtrapolate::v_EvaluatePressureBCs(), Nektar::WeakPressureExtrapolate::v_EvaluatePressureBCs(), Nektar::SubSteppingExtrapolate::v_SubStepSetPressureBCs(), and Nektar::SubSteppingExtrapolateWeakPressure::v_SubStepSetPressureBCs().

◆ CorrectPressureBCs()

void Nektar::Extrapolate::CorrectPressureBCs ( const Array< OneD, NekDouble > &  pressure)
inline

Definition at line 401 of file Extrapolate.h.

403{
405}
virtual void v_CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)

References CG_Iterations::pressure, and v_CorrectPressureBCs().

◆ EvaluateBDFArray()

void Nektar::Extrapolate::EvaluateBDFArray ( Array< OneD, Array< OneD, NekDouble > > &  array)

At the start, the newest value is stored in array[nlevels-1] and the previous values in the first positions At the end, the value of the bdf explicit part is stored in array[nlevels-1] and the storage has been updated to included the new value

Definition at line 1008 of file Extrapolate.cpp.

1009{
1010 int nint = min(m_pressureCalls, m_intSteps);
1011 int nlevels = array.size();
1012 int nPts = array[0].size();
1013
1014 // Update array
1015 RollOver(array);
1016
1017 // Extrapolate to outarray
1018 Vmath::Smul(nPts, StifflyStable_Alpha_Coeffs[nint - 1][nint - 1],
1019 array[nint - 1], 1, array[nlevels - 1], 1);
1020
1021 for (int n = 0; n < nint - 1; ++n)
1022 {
1023 Vmath::Svtvp(nPts, StifflyStable_Alpha_Coeffs[nint - 1][n], array[n], 1,
1024 array[nlevels - 1], 1, array[nlevels - 1], 1);
1025 }
1026}
static NekDouble StifflyStable_Alpha_Coeffs[3][3]
Definition: Extrapolate.h:257
void RollOver(Array< OneD, Array< OneD, NekDouble > > &input)

References m_intSteps, m_pressureCalls, RollOver(), Vmath::Smul(), StifflyStable_Alpha_Coeffs, and Vmath::Svtvp().

Referenced by CalcOutflowBCs(), Nektar::SubSteppingExtrapolateWeakPressure::v_AddNormVelOnOBC(), and Nektar::WeakPressureExtrapolate::v_AddNormVelOnOBC().

◆ EvaluatePressureBCs()

void Nektar::Extrapolate::EvaluatePressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
const Array< OneD, const Array< OneD, NekDouble > > &  N,
NekDouble  kinvis 
)
inline

Evaluate Pressure Boundary Conditions for Standard Extrapolation

Definition at line 329 of file Extrapolate.h.

332{
333 v_EvaluatePressureBCs(inarray, N, kinvis);
334}
virtual void v_EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)=0

References v_EvaluatePressureBCs().

◆ ExtrapolateArray() [1/2]

void Nektar::Extrapolate::ExtrapolateArray ( Array< OneD, Array< OneD, NekDouble > > &  array)

At the start, the newest value is stored in array[nlevels-1] and the previous values in the first positions At the end, the extrapolated value is stored in array[nlevels-1] and the storage has been updated to included the new value

Definition at line 977 of file Extrapolate.cpp.

978{
979 int nint = min(m_pressureCalls, m_intSteps);
980 int nlevels = array.size();
981 int nPts = array[0].size();
982
983 // Check integer for time levels
984 // Note that ExtrapolateArray assumes m_pressureCalls is >= 1
985 // meaning v_EvaluatePressureBCs has been called previously
986 ASSERTL0(nint > 0, "nint must be > 0 when calling ExtrapolateArray.");
987
988 // Update array
989 RollOver(array);
990
991 // Extrapolate to outarray
992 Vmath::Smul(nPts, StifflyStable_Betaq_Coeffs[nint - 1][nint - 1],
993 array[nint - 1], 1, array[nlevels - 1], 1);
994
995 for (int n = 0; n < nint - 1; ++n)
996 {
997 Vmath::Svtvp(nPts, StifflyStable_Betaq_Coeffs[nint - 1][n], array[n], 1,
998 array[nlevels - 1], 1, array[nlevels - 1], 1);
999 }
1000}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
static NekDouble StifflyStable_Betaq_Coeffs[3][3]
Definition: Extrapolate.h:256

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

Referenced by CalcOutflowBCs(), Nektar::StandardExtrapolate::v_EvaluatePressureBCs(), Nektar::WeakPressureExtrapolate::v_EvaluatePressureBCs(), Nektar::SubSteppingExtrapolate::v_SubStepSetPressureBCs(), and Nektar::SubSteppingExtrapolateWeakPressure::v_SubStepSetPressureBCs().

◆ ExtrapolateArray() [2/2]

void Nektar::Extrapolate::ExtrapolateArray ( Array< OneD, Array< OneD, NekDouble > > &  oldarrays,
Array< OneD, NekDouble > &  newarray,
Array< OneD, NekDouble > &  outarray 
)

◆ ExtrapolatePressureHBCs()

void Nektar::Extrapolate::ExtrapolatePressureHBCs ( void  )

◆ GenerateBndElmtExpansion()

void Nektar::Extrapolate::GenerateBndElmtExpansion ( void  )

Initialise boundary expansion lists for each domain boundary Each boundary expansion list contains all elements that touch the boundary. Construct for every boundary and not only higher-order pressure BCs.

Definition at line 621 of file Extrapolate.cpp.

622{
623 size_t n, nBndElmtExp = m_pressure->GetBndConditions().size();
624
625 // Initialise Array of pointers to BndEltmExpansion(-Lists)
626 m_bndElmtExps = Array<OneD, MultiRegions::ExpListSharedPtr>(nBndElmtExp);
627
628 // Loop n domain boundaries and initialise the boundary expansion list
629 for (n = 0; n < nBndElmtExp; ++n)
630 {
631 m_fields[0]->GetBndElmtExpansion(n, m_bndElmtExps[n], false);
632 }
633}

References m_bndElmtExps, m_fields, and m_pressure.

◆ GenerateHOPBCMap()

void Nektar::Extrapolate::GenerateHOPBCMap ( const LibUtilities::SessionReaderSharedPtr pSession)

Initialize HOBCs

Definition at line 638 of file Extrapolate.cpp.

640{
641 m_PBndConds = m_pressure->GetBndConditions();
642 m_PBndExp = m_pressure->GetBndCondExpansions();
643
644 size_t cnt, n;
645
646 // Storage array for high order pressure BCs
647 m_pressureHBCs = Array<OneD, Array<OneD, NekDouble>>(m_intSteps);
648 m_iprodnormvel = Array<OneD, Array<OneD, NekDouble>>(m_intSteps + 1);
649
650 // Get useful values for HOBCs
651 m_HBCnumber = 0;
652 m_numHBCDof = 0;
653
654 int outHBCnumber = 0;
655 int numOutHBCPts = 0;
656
657 m_hbcType = Array<OneD, HBCType>(m_PBndConds.size(), eNOHBC);
658 for (n = 0; n < m_PBndConds.size(); ++n)
659 {
660 // High order boundary Neumann Condiiton
661 if (boost::iequals(m_PBndConds[n]->GetUserDefined(), "H"))
662 {
664 m_numHBCDof += m_PBndExp[n]->GetNcoeffs();
665 m_HBCnumber += m_PBndExp[n]->GetExpSize();
666 }
667
668 // High order outflow convective condition
669 if (m_PBndConds[n]->GetBoundaryConditionType() ==
671 boost::iequals(m_PBndConds[n]->GetUserDefined(), "HOutflow"))
672 {
674 m_numHBCDof += m_PBndExp[n]->GetNcoeffs();
675 m_HBCnumber += m_PBndExp[n]->GetExpSize();
676 numOutHBCPts += m_PBndExp[n]->GetTotPoints();
677 outHBCnumber++;
678 }
679 // High order outflow boundary condition;
680 else if (boost::iequals(m_PBndConds[n]->GetUserDefined(), "HOutflow"))
681 {
682 m_hbcType[n] = eOBC;
683 numOutHBCPts += m_PBndExp[n]->GetTotPoints();
684 outHBCnumber++;
685 }
686 }
687
688 m_iprodnormvel[0] = Array<OneD, NekDouble>(m_numHBCDof, 0.0);
689 for (int n = 0; n < m_intSteps; ++n)
690 {
691 m_pressureHBCs[n] = Array<OneD, NekDouble>(m_numHBCDof, 0.0);
692 m_iprodnormvel[n + 1] = Array<OneD, NekDouble>(m_numHBCDof, 0.0);
693 }
694
695 m_pressureCalls = 0;
696
697 switch (m_pressure->GetExpType())
698 {
700 {
701 m_curl_dim = 2;
702 m_bnd_dim = 2;
703 }
704 break;
706 {
707 m_curl_dim = 3;
708 m_bnd_dim = 2;
709 }
710 break;
712 {
713 m_curl_dim = 3;
714 m_bnd_dim = 1;
715 }
716 break;
718 {
719 m_curl_dim = 3;
720 m_bnd_dim = 3;
721 }
722 break;
723 default:
724 ASSERTL0(0, "Dimension not supported");
725 break;
726 }
727
728 // Initialise storage for outflow HOBCs
729 if (numOutHBCPts > 0)
730 {
732 numOutHBCPts, outHBCnumber, m_curl_dim, pSession);
733
734 // set up boundary expansions link
735 for (int i = 0; i < m_curl_dim; ++i)
736 {
737 m_houtflow->m_UBndExp[i] =
738 m_fields[m_velocity[i]]->GetBndCondExpansions();
739 }
740
741 for (n = 0, cnt = 0; n < m_PBndConds.size(); ++n)
742 {
743 if (boost::iequals(m_PBndConds[n]->GetUserDefined(), "HOutflow"))
744 {
745 m_houtflow->m_outflowVel[cnt] =
746 Array<OneD, Array<OneD, Array<OneD, NekDouble>>>(
747 m_curl_dim);
748
749 m_houtflow->m_outflowVelBnd[cnt] =
750 Array<OneD, Array<OneD, Array<OneD, NekDouble>>>(
751 m_curl_dim);
752
753 int nqb = m_PBndExp[n]->GetTotPoints();
754 int nq = m_bndElmtExps[n]->GetTotPoints();
755 for (int j = 0; j < m_curl_dim; ++j)
756 {
757 m_houtflow->m_outflowVel[cnt][j] =
758 Array<OneD, Array<OneD, NekDouble>>(m_intSteps);
759
760 m_houtflow->m_outflowVelBnd[cnt][j] =
761 Array<OneD, Array<OneD, NekDouble>>(m_intSteps);
762
763 for (int k = 0; k < m_intSteps; ++k)
764 {
765 m_houtflow->m_outflowVel[cnt][j][k] =
766 Array<OneD, NekDouble>(nq, 0.0);
767 m_houtflow->m_outflowVelBnd[cnt][j][k] =
768 Array<OneD, NekDouble>(nqb, 0.0);
769 }
770 }
771 cnt++;
772 }
773
774 // evaluate convective primitive coefficient if
775 // convective OBCs are used
776 if (m_hbcType[n] == eConvectiveOBC)
777 {
778 // initialise convective members of
779 // HighOrderOutflow struct
780 if (m_houtflow->m_pressurePrimCoeff.size() == 0)
781 {
782 m_houtflow->m_pressurePrimCoeff =
783 Array<OneD, NekDouble>(m_PBndConds.size(), 0.0);
784 m_houtflow->m_velocityPrimCoeff =
785 Array<OneD, Array<OneD, NekDouble>>(m_curl_dim);
786
787 for (int i = 0; i < m_curl_dim; ++i)
788 {
789 m_houtflow->m_velocityPrimCoeff[i] =
790 Array<OneD, NekDouble>(m_PBndConds.size(), 0.0);
791 }
792 }
793
794 LibUtilities::Equation coeff =
795 std::static_pointer_cast<
796 SpatialDomains::RobinBoundaryCondition>(m_PBndConds[n])
797 ->m_robinPrimitiveCoeff;
798
799 // checkout equation evaluation options!!
800 m_houtflow->m_pressurePrimCoeff[n] = coeff.Evaluate();
801
802 for (int i = 0; i < m_curl_dim; ++i)
803 {
804 Array<OneD, const SpatialDomains::BoundaryConditionShPtr>
805 UBndConds = m_fields[m_velocity[i]]->GetBndConditions();
806
807 LibUtilities::Equation coeff1 =
808 std::static_pointer_cast<
809 SpatialDomains::RobinBoundaryCondition>(
810 UBndConds[n])
811 ->m_robinPrimitiveCoeff;
812
813 m_houtflow->m_defVelPrimCoeff[i] = coeff1.GetExpression();
814
815 ASSERTL1(UBndConds[n]->GetBoundaryConditionType() ==
817 "Require Velocity "
818 "conditions to be of Robin type when pressure"
819 "outflow is specticied as Robin Boundary type");
820
821 // checkout equation evaluation options!!
822 m_houtflow->m_velocityPrimCoeff[i][n] = coeff1.Evaluate();
823 }
824 }
825 }
826 }
827}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
@ eNOHBC
Definition: Extrapolate.h:52

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, ASSERTL1, Nektar::MultiRegions::e2D, Nektar::MultiRegions::e3D, Nektar::MultiRegions::e3DH1D, Nektar::MultiRegions::e3DH2D, Nektar::eConvectiveOBC, Nektar::eHBCNeumann, Nektar::eNOHBC, Nektar::eOBC, Nektar::SpatialDomains::eRobin, Nektar::LibUtilities::Equation::Evaluate(), Nektar::LibUtilities::Equation::GetExpression(), m_bnd_dim, m_bndElmtExps, m_curl_dim, m_fields, m_HBCnumber, m_hbcType, m_houtflow, m_intSteps, m_iprodnormvel, m_numHBCDof, m_PBndConds, m_PBndExp, m_pressure, m_pressureCalls, m_pressureHBCs, and m_velocity.

◆ GetMaxStdVelocity()

Array< OneD, NekDouble > Nektar::Extrapolate::GetMaxStdVelocity ( const Array< OneD, Array< OneD, NekDouble > >  inarray)

Definition at line 871 of file Extrapolate.cpp.

873{
874 // Checking if the problem is 2D
875 ASSERTL0(m_curl_dim >= 2, "Method not implemented for 1D");
876
877 size_t n_points_0 = m_fields[0]->GetExp(0)->GetTotPoints();
878 size_t n_element = m_fields[0]->GetExpSize();
879 size_t nvel = inarray.size();
880 size_t cnt;
881
882 NekDouble pntVelocity;
883
884 // Getting the standard velocity vector
885 Array<OneD, Array<OneD, NekDouble>> stdVelocity(nvel);
886 Array<OneD, NekDouble> tmp;
887 Array<OneD, NekDouble> maxV(n_element, 0.0);
889
890 for (size_t i = 0; i < nvel; ++i)
891 {
892 stdVelocity[i] = Array<OneD, NekDouble>(n_points_0);
893 }
894
895 cnt = 0.0;
896 for (size_t el = 0; el < n_element; ++el)
897 {
898 size_t n_points = m_fields[0]->GetExp(el)->GetTotPoints();
899 ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
900
901 // reset local space
902 if (n_points != n_points_0)
903 {
904 for (size_t j = 0; j < nvel; ++j)
905 {
906 stdVelocity[j] = Array<OneD, NekDouble>(n_points, 0.0);
907 }
908 n_points_0 = n_points;
909 }
910 else
911 {
912 for (size_t j = 0; j < nvel; ++j)
913 {
914 Vmath::Zero(n_points, stdVelocity[j], 1);
915 }
916 }
917
918 Array<TwoD, const NekDouble> gmat = m_fields[0]
919 ->GetExp(el)
920 ->GetGeom()
921 ->GetMetricInfo()
922 ->GetDerivFactors(ptsKeys);
923
924 if (m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetGtype() ==
926 {
927 for (size_t j = 0; j < nvel; ++j)
928 {
929 for (size_t k = 0; k < nvel; ++k)
930 {
931 Vmath::Vvtvp(n_points, gmat[k * nvel + j], 1,
932 tmp = inarray[k] + cnt, 1, stdVelocity[j], 1,
933 stdVelocity[j], 1);
934 }
935 }
936 }
937 else
938 {
939 for (size_t j = 0; j < nvel; ++j)
940 {
941 for (size_t k = 0; k < nvel; ++k)
942 {
943 Vmath::Svtvp(n_points, gmat[k * nvel + j][0],
944 tmp = inarray[k] + cnt, 1, stdVelocity[j], 1,
945 stdVelocity[j], 1);
946 }
947 }
948 }
949 cnt += n_points;
950
951 // Calculate total velocity in stdVelocity[0]
952 Vmath::Vmul(n_points, stdVelocity[0], 1, stdVelocity[0], 1,
953 stdVelocity[0], 1);
954 for (size_t k = 1; k < nvel; ++k)
955 {
956 Vmath::Vvtvp(n_points, stdVelocity[k], 1, stdVelocity[k], 1,
957 stdVelocity[0], 1, stdVelocity[0], 1);
958 }
959 pntVelocity = Vmath::Vmax(n_points, stdVelocity[0], 1);
960 maxV[el] = sqrt(pntVelocity);
961 }
962
963 return maxV;
964}
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:231
@ eDeformed
Geometry is curved or has non-constant factors.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.hpp:273
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
Definition: Vmath.hpp:644
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294

References ASSERTL0, Nektar::SpatialDomains::eDeformed, m_curl_dim, m_fields, tinysimd::sqrt(), Vmath::Svtvp(), Vmath::Vmax(), Vmath::Vmul(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by Nektar::SubSteppingExtrapolate::GetSubstepTimeStep().

◆ GetSubStepName()

std::string Nektar::Extrapolate::GetSubStepName ( void  )
inline

Definition at line 393 of file Extrapolate.h.

394{
395 return v_GetSubStepName();
396}
virtual std::string v_GetSubStepName(void)

References v_GetSubStepName().

◆ IProductNormVelocityBCOnHBC()

void Nektar::Extrapolate::IProductNormVelocityBCOnHBC ( Array< OneD, NekDouble > &  IprodVn)

Definition at line 550 of file Extrapolate.cpp.

551{
552
553 if (!m_HBCnumber)
554 {
555 return;
556 }
557 int i;
558 size_t n, cnt;
559 Array<OneD, NekDouble> IProdVnTmp;
560 Array<OneD, Array<OneD, NekDouble>> velbc(m_bnd_dim);
561 Array<OneD, Array<OneD, MultiRegions::ExpListSharedPtr>> VelBndExp(
562 m_bnd_dim);
563 for (i = 0; i < m_bnd_dim; ++i)
564 {
565 VelBndExp[i] = m_fields[m_velocity[i]]->GetBndCondExpansions();
566 }
567
568 for (n = cnt = 0; n < m_PBndConds.size(); ++n)
569 {
570 // High order boundary condition;
571 if (m_hbcType[n] == eHBCNeumann)
572 {
573 for (i = 0; i < m_bnd_dim; ++i)
574 {
575 velbc[i] = Array<OneD, NekDouble>(
576 VelBndExp[i][n]->GetTotPoints(), 0.0);
577 VelBndExp[i][n]->SetWaveSpace(
578 m_fields[m_velocity[i]]->GetWaveSpace());
579 VelBndExp[i][n]->BwdTrans(VelBndExp[i][n]->GetCoeffs(),
580 velbc[i]);
581 }
582 IProdVnTmp = IProdVn + cnt;
583 m_PBndExp[n]->NormVectorIProductWRTBase(velbc, IProdVnTmp);
584 cnt += m_PBndExp[n]->GetNcoeffs();
585 }
586 else if (m_hbcType[n] == eConvectiveOBC)
587 {
588 // skip over convective OBC
589 cnt += m_PBndExp[n]->GetNcoeffs();
590 }
591 }
592}

References Nektar::eConvectiveOBC, Nektar::eHBCNeumann, m_bnd_dim, m_fields, m_HBCnumber, m_hbcType, m_PBndConds, m_PBndExp, and m_velocity.

Referenced by AddDuDt(), and AddVelBC().

◆ IProductNormVelocityOnHBC()

void Nektar::Extrapolate::IProductNormVelocityOnHBC ( const Array< OneD, const Array< OneD, NekDouble > > &  Vel,
Array< OneD, NekDouble > &  IprodVn 
)

Definition at line 521 of file Extrapolate.cpp.

524{
525 int i;
526 size_t n, cnt;
527 Array<OneD, NekDouble> IProdVnTmp;
528 Array<OneD, Array<OneD, NekDouble>> velbc(m_bnd_dim);
529
530 for (n = cnt = 0; n < m_PBndConds.size(); ++n)
531 {
532 // High order boundary condition;
533 if (m_hbcType[n] == eHBCNeumann)
534 {
535 for (i = 0; i < m_bnd_dim; ++i)
536 {
537 m_fields[0]->ExtractPhysToBnd(n, Vel[i], velbc[i]);
538 }
539 IProdVnTmp = IProdVn + cnt;
540 m_PBndExp[n]->NormVectorIProductWRTBase(velbc, IProdVnTmp);
541 cnt += m_PBndExp[n]->GetNcoeffs();
542 }
543 else if (m_hbcType[n] == eConvectiveOBC) // skip over conective OBC
544 {
545 cnt += m_PBndExp[n]->GetNcoeffs();
546 }
547 }
548}

References Nektar::eConvectiveOBC, Nektar::eHBCNeumann, m_bnd_dim, m_fields, m_hbcType, m_PBndConds, and m_PBndExp.

Referenced by Nektar::SubSteppingExtrapolate::v_SubStepAdvance().

◆ MountHOPBCs()

void Nektar::Extrapolate::MountHOPBCs ( int  HBCdata,
NekDouble  kinvis,
Array< OneD, NekDouble > &  Q,
Array< OneD, const NekDouble > &  Advection 
)
inline

Definition at line 383 of file Extrapolate.h.

386{
387 v_MountHOPBCs(HBCdata, kinvis, Q, Advection);
388}
virtual void v_MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)=0

References v_MountHOPBCs().

Referenced by v_CalcNeumannPressureBCs(), and Nektar::MappingExtrapolate::v_CalcNeumannPressureBCs().

◆ RollOver()

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

Function to roll time-level storages to the next step layout. The stored data associated with the oldest time-level (not required anymore) are moved to the top, where they will be overwritten as the solution process progresses.

Definition at line 600 of file Extrapolate.cpp.

601{
602 int nlevels = input.size();
603
604 Array<OneD, NekDouble> tmp;
605
606 tmp = input[nlevels - 1];
607
608 for (int n = nlevels - 1; n > 0; --n)
609 {
610 input[n] = input[n - 1];
611 }
612
613 input[0] = tmp;
614}

Referenced by EvaluateBDFArray(), ExtrapolateArray(), v_AccelerationBDF(), Nektar::StandardExtrapolate::v_AccelerationBDF(), and Nektar::SubSteppingExtrapolate::v_AccelerationBDF().

◆ SetForcing()

void Nektar::Extrapolate::SetForcing ( const std::vector< SolverUtils::ForcingSharedPtr > &  forcing)
inline

Definition at line 356 of file Extrapolate.h.

358{
359 m_forcing = forcing;
360}
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Definition: Extrapolate.h:212

References m_forcing.

◆ SubStepAdvance()

void Nektar::Extrapolate::SubStepAdvance ( const int  nstep,
NekDouble  time 
)
inline

Definition at line 375 of file Extrapolate.h.

376{
377 v_SubStepAdvance(nstep, time);
378}
virtual void v_SubStepAdvance(int nstep, NekDouble time)=0

References v_SubStepAdvance().

◆ SubSteppingTimeIntegration()

void Nektar::Extrapolate::SubSteppingTimeIntegration ( const LibUtilities::TimeIntegrationSchemeSharedPtr IntegrationScheme)
inline

Definition at line 339 of file Extrapolate.h.

341{
342 v_SubSteppingTimeIntegration(IntegrationScheme);
343}
virtual void v_SubSteppingTimeIntegration(const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)=0

References v_SubSteppingTimeIntegration().

◆ SubStepSaveFields()

void Nektar::Extrapolate::SubStepSaveFields ( const int  nstep)
inline

Definition at line 348 of file Extrapolate.h.

349{
350 v_SubStepSaveFields(nstep);
351}
virtual void v_SubStepSaveFields(int nstep)=0

References v_SubStepSaveFields().

◆ SubStepSetPressureBCs()

void Nektar::Extrapolate::SubStepSetPressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
const NekDouble  Aii_DT,
NekDouble  kinvis 
)
inline

Definition at line 365 of file Extrapolate.h.

368{
369 v_SubStepSetPressureBCs(inarray, Aii_DT, kinvis);
370}
virtual void v_SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_DT, NekDouble kinvis)=0

References v_SubStepSetPressureBCs().

◆ UpdateRobinPrimCoeff()

void Nektar::Extrapolate::UpdateRobinPrimCoeff ( void  )

Definition at line 829 of file Extrapolate.cpp.

830{
831
833 {
834 return;
835 }
836
837 for (size_t n = 0; n < m_PBndConds.size(); ++n)
838 {
839 // Get expansion with element on this boundary
840 if (m_hbcType[n] == eConvectiveOBC)
841 {
842 for (int i = 0; i < m_curl_dim; ++i)
843 {
844 Array<OneD, SpatialDomains::BoundaryConditionShPtr> UBndConds =
845 m_fields[m_velocity[i]]->UpdateBndConditions();
846
847 std::string primcoeff =
848 m_houtflow->m_defVelPrimCoeff[i] + "*" +
849 boost::lexical_cast<std::string>(
851
852 SpatialDomains::RobinBCShPtr rcond = std::dynamic_pointer_cast<
853 SpatialDomains::RobinBoundaryCondition>(UBndConds[n]);
854
858 m_session, rcond->m_robinFunction.GetExpression(),
859 primcoeff, rcond->GetUserDefined(),
860 rcond->m_filename);
861
862 UBndConds[n] = bcond;
863 }
864 }
865 }
866}
std::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
Definition: Conditions.h:212
std::shared_ptr< RobinBoundaryCondition > RobinBCShPtr
Definition: Conditions.h:215

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::eConvectiveOBC, m_curl_dim, m_fields, m_hbcType, m_houtflow, m_intSteps, m_PBndConds, m_pressureCalls, m_session, m_velocity, and StifflyStable_Gamma0_Coeffs.

Referenced by CalcOutflowBCs().

◆ v_AccelerationBDF()

void Nektar::Extrapolate::v_AccelerationBDF ( Array< OneD, Array< OneD, NekDouble > > &  array)
protectedvirtual

At the start, the newest value is stored in array[nlevels-1] and the previous values in the first positions At the end, the acceleration from BDF is stored in array[nlevels-1] and the storage has been updated to included the new value

Reimplemented in Nektar::StandardExtrapolate, and Nektar::SubSteppingExtrapolate.

Definition at line 1034 of file Extrapolate.cpp.

1035{
1036 int nlevels = array.size();
1037 int nPts = array[0].size();
1038
1039 if (nPts)
1040 {
1041 // Update array
1042 RollOver(array);
1043
1044 // Calculate acceleration using Backward Differentiation Formula
1045 Array<OneD, NekDouble> accelerationTerm(nPts, 0.0);
1046 if (m_pressureCalls > 2)
1047 {
1048 int acc_order = min(m_pressureCalls - 2, m_intSteps);
1049 Vmath::Smul(nPts, StifflyStable_Gamma0_Coeffs[acc_order - 1],
1050 array[0], 1, accelerationTerm, 1);
1051
1052 for (int i = 0; i < acc_order; i++)
1053 {
1055 nPts, -1 * StifflyStable_Alpha_Coeffs[acc_order - 1][i],
1056 array[i + 1], 1, accelerationTerm, 1, accelerationTerm, 1);
1057 }
1058 }
1059 array[nlevels - 1] = accelerationTerm;
1060 }
1061}

References m_intSteps, m_pressureCalls, RollOver(), Vmath::Smul(), StifflyStable_Alpha_Coeffs, StifflyStable_Gamma0_Coeffs, and Vmath::Svtvp().

Referenced by AddDuDt().

◆ v_AddNormVelOnOBC()

void Nektar::Extrapolate::v_AddNormVelOnOBC ( const int  nbcoeffs,
const int  nreg,
Array< OneD, Array< OneD, NekDouble > > &  u 
)
protectedvirtual

Reimplemented in Nektar::SubSteppingExtrapolateWeakPressure, and Nektar::WeakPressureExtrapolate.

Definition at line 201 of file Extrapolate.cpp.

204{
205}

Referenced by AddNormVelOnOBC().

◆ v_CalcNeumannPressureBCs()

void Nektar::Extrapolate::v_CalcNeumannPressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  fields,
const Array< OneD, const Array< OneD, NekDouble > > &  N,
NekDouble  kinvis 
)
protectedvirtual

Unified routine for calculation high-oder terms

Reimplemented in Nektar::MappingExtrapolate.

Definition at line 119 of file Extrapolate.cpp.

122{
123 size_t n, cnt;
124
125 Array<OneD, NekDouble> Pvals;
126
127 Array<OneD, Array<OneD, NekDouble>> Velocity(m_curl_dim);
128 Array<OneD, Array<OneD, NekDouble>> Advection(m_bnd_dim);
129
130 Array<OneD, Array<OneD, NekDouble>> BndValues(m_bnd_dim);
131 Array<OneD, Array<OneD, NekDouble>> Q(m_curl_dim);
132
133 // Loop all boundary conditions
134 for (n = cnt = 0; n < m_PBndConds.size(); ++n)
135 {
136 // Detect higher order boundary conditions
137 if ((m_hbcType[n] == eHBCNeumann) || (m_hbcType[n] == eConvectiveOBC))
138 {
139 m_bndElmtExps[n]->SetWaveSpace(m_fields[0]->GetWaveSpace());
140 int nqb = m_PBndExp[n]->GetTotPoints();
141 int nq = m_bndElmtExps[n]->GetTotPoints();
142 int ncoeffs = m_PBndExp[n]->GetNcoeffs();
143
144 for (int i = 0; i < m_bnd_dim; i++)
145 {
146 BndValues[i] = Array<OneD, NekDouble>(nqb, 0.0);
147 }
148
149 for (int i = 0; i < m_curl_dim; i++)
150 {
151 Q[i] = Array<OneD, NekDouble>(nq, 0.0);
152 }
153
154 // Obtaining fields on BndElmtExp
155 for (int i = 0; i < m_curl_dim; i++)
156 {
157 m_fields[0]->ExtractPhysToBndElmt(n, fields[i], Velocity[i]);
158 }
159
160 if (N.size()) // not required for some extrapolation
161 {
162 for (int i = 0; i < m_bnd_dim; i++)
163 {
164 m_fields[0]->ExtractPhysToBndElmt(n, N[i], Advection[i]);
165 }
166 }
167
168 // CurlCurl
169 m_bndElmtExps[n]->CurlCurl(Velocity, Q);
170
171 // Mounting advection component into the high-order condition
172 for (int i = 0; i < m_bnd_dim; i++)
173 {
174 MountHOPBCs(nq, kinvis, Q[i], Advection[i]);
175 }
176
177 Pvals = (m_pressureHBCs[m_intSteps - 1]) + cnt;
178
179 // Getting values on the boundary and filling the pressure bnd
180 // expansion. Multiplication by the normal is required
181 for (int i = 0; i < m_bnd_dim; i++)
182 {
183 m_fields[0]->ExtractElmtToBndPhys(n, Q[i], BndValues[i]);
184 }
185
186 m_PBndExp[n]->NormVectorIProductWRTBase(BndValues, Pvals);
187
188 // Get offset for next terms
189 cnt += ncoeffs;
190 }
191 }
192}
void MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
Definition: Extrapolate.h:383

References Nektar::eConvectiveOBC, Nektar::eHBCNeumann, m_bnd_dim, m_bndElmtExps, m_curl_dim, m_fields, m_hbcType, m_intSteps, m_PBndConds, m_PBndExp, m_pressureHBCs, and MountHOPBCs().

Referenced by CalcNeumannPressureBCs(), and Nektar::MappingExtrapolate::v_CalcNeumannPressureBCs().

◆ v_CorrectPressureBCs()

void Nektar::Extrapolate::v_CorrectPressureBCs ( const Array< OneD, NekDouble > &  pressure)
protectedvirtual

Reimplemented in Nektar::MappingExtrapolate.

Definition at line 195 of file Extrapolate.cpp.

197{
198}

Referenced by CorrectPressureBCs().

◆ v_EvaluatePressureBCs()

virtual void Nektar::Extrapolate::v_EvaluatePressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
const Array< OneD, const Array< OneD, NekDouble > > &  N,
NekDouble  kinvis 
)
protectedpure virtual

◆ v_GetSubStepName()

std::string Nektar::Extrapolate::v_GetSubStepName ( void  )
protectedvirtual

Reimplemented in Nektar::SubSteppingExtrapolate.

Definition at line 966 of file Extrapolate.cpp.

967{
968 return "";
969}

Referenced by GetSubStepName().

◆ v_MountHOPBCs()

virtual void Nektar::Extrapolate::v_MountHOPBCs ( int  HBCdata,
NekDouble  kinvis,
Array< OneD, NekDouble > &  Q,
Array< OneD, const NekDouble > &  Advection 
)
protectedpure virtual

◆ v_SubStepAdvance()

virtual void Nektar::Extrapolate::v_SubStepAdvance ( int  nstep,
NekDouble  time 
)
protectedpure virtual

◆ v_SubSteppingTimeIntegration()

virtual void Nektar::Extrapolate::v_SubSteppingTimeIntegration ( const LibUtilities::TimeIntegrationSchemeSharedPtr IntegrationScheme)
protectedpure virtual

◆ v_SubStepSaveFields()

virtual void Nektar::Extrapolate::v_SubStepSaveFields ( int  nstep)
protectedpure virtual

◆ v_SubStepSetPressureBCs()

virtual void Nektar::Extrapolate::v_SubStepSetPressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
NekDouble  Aii_DT,
NekDouble  kinvis 
)
protectedpure virtual

Member Data Documentation

◆ def

std::string Nektar::Extrapolate::def
staticprivate
Initial value:
=
"StandardExtrapolate", "StandardExtrapolate")
static std::string RegisterDefaultSolverInfo(const std::string &pName, const std::string &pValue)
Registers the default string value of a solver info property.

Definition at line 264 of file Extrapolate.h.

◆ m_advObject

SolverUtils::AdvectionSharedPtr Nektar::Extrapolate::m_advObject
protected

Definition at line 210 of file Extrapolate.h.

Referenced by Nektar::SubSteppingExtrapolate::SubStepAdvection().

◆ m_bnd_dim

int Nektar::Extrapolate::m_bnd_dim
protected

◆ m_bndElmtExps

Array<OneD, MultiRegions::ExpListSharedPtr> Nektar::Extrapolate::m_bndElmtExps
protected

Boundary expansions on each domain boundary.

Definition at line 229 of file Extrapolate.h.

Referenced by CalcOutflowBCs(), GenerateBndElmtExpansion(), GenerateHOPBCMap(), and v_CalcNeumannPressureBCs().

◆ m_comm

LibUtilities::CommSharedPtr Nektar::Extrapolate::m_comm
protected

◆ m_curl_dim

int Nektar::Extrapolate::m_curl_dim
protected

◆ m_fields

Array<OneD, MultiRegions::ExpListSharedPtr> Nektar::Extrapolate::m_fields
protected

◆ m_forcing

std::vector<SolverUtils::ForcingSharedPtr> Nektar::Extrapolate::m_forcing
protected

Definition at line 212 of file Extrapolate.h.

Referenced by SetForcing(), and Nektar::SubSteppingExtrapolate::SubStepAdvection().

◆ m_HBCnumber

int Nektar::Extrapolate::m_HBCnumber
protected

◆ m_hbcType

Array<OneD, HBCType> Nektar::Extrapolate::m_hbcType
protected

◆ m_houtflow

HighOrderOutflowSharedPtr Nektar::Extrapolate::m_houtflow
protected

◆ m_intSteps

int Nektar::Extrapolate::m_intSteps
protected

◆ m_iprodnormvel

Array<OneD, Array<OneD, NekDouble> > Nektar::Extrapolate::m_iprodnormvel
protected

Storage for current and previous levels of the inner product of normal velocity.

Definition at line 251 of file Extrapolate.h.

Referenced by AddDuDt(), AddVelBC(), GenerateHOPBCMap(), Nektar::MappingExtrapolate::v_CalcNeumannPressureBCs(), and Nektar::SubSteppingExtrapolate::v_SubStepAdvance().

◆ m_numHBCDof

int Nektar::Extrapolate::m_numHBCDof
protected

◆ m_PBndConds

Array<OneD, const SpatialDomains::BoundaryConditionShPtr> Nektar::Extrapolate::m_PBndConds
protected

◆ m_PBndExp

Array<OneD, MultiRegions::ExpListSharedPtr> Nektar::Extrapolate::m_PBndExp
protected

◆ m_pressure

MultiRegions::ExpListSharedPtr Nektar::Extrapolate::m_pressure
protected

Pointer to field holding pressure field.

Definition at line 204 of file Extrapolate.h.

Referenced by AddPressureToOutflowBCs(), GenerateBndElmtExpansion(), GenerateHOPBCMap(), and Nektar::MappingExtrapolate::v_CorrectPressureBCs().

◆ m_pressureCalls

int Nektar::Extrapolate::m_pressureCalls
protected

◆ m_pressureHBCs

Array<OneD, Array<OneD, NekDouble> > Nektar::Extrapolate::m_pressureHBCs
protected

◆ m_previousVelFields

Array<OneD, Array<OneD, NekDouble> > Nektar::Extrapolate::m_previousVelFields
protected

Definition at line 214 of file Extrapolate.h.

◆ m_session

LibUtilities::SessionReaderSharedPtr Nektar::Extrapolate::m_session
protected

◆ m_timestep

NekDouble Nektar::Extrapolate::m_timestep
protected

◆ m_traceNormals

Array<OneD, Array<OneD, NekDouble> > Nektar::Extrapolate::m_traceNormals
protected

◆ m_velocity

Array<OneD, int> Nektar::Extrapolate::m_velocity
protected

◆ StifflyStable_Alpha_Coeffs

NekDouble Nektar::Extrapolate::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 257 of file Extrapolate.h.

Referenced by EvaluateBDFArray(), v_AccelerationBDF(), and Nektar::SubSteppingExtrapolate::v_AccelerationBDF().

◆ StifflyStable_Betaq_Coeffs

NekDouble Nektar::Extrapolate::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 256 of file Extrapolate.h.

Referenced by ExtrapolateArray().

◆ StifflyStable_Gamma0_Coeffs

NekDouble Nektar::Extrapolate::StifflyStable_Gamma0_Coeffs = {1.0, 1.5, 11.0 / 6.0}
staticprotected