Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Nektar::SubSteppingExtrapolate Class Reference

#include <SubSteppingExtrapolate.h>

Inheritance diagram for Nektar::SubSteppingExtrapolate:
[legend]

Public Member Functions

 SubSteppingExtrapolate (const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)
 
virtual ~SubSteppingExtrapolate ()
 
- Public Member Functions inherited from Nektar::Extrapolate
 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 int intMethod, const LibUtilities::TimeIntegrationWrapperSharedPtr &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 LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln, 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 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)
 
LibUtilities::TimeIntegrationMethod GetSubStepIntegrationMethod (void)
 
void ExtrapolateArray (Array< OneD, Array< OneD, NekDouble > > &array)
 
void EvaluateBDFArray (Array< OneD, Array< OneD, NekDouble > > &array)
 
void AccelerationBDF (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)
 

Static Public Member Functions

static ExtrapolateSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, MultiRegions::ExpListSharedPtr &pPressure, const Array< OneD, int > &pVel, const SolverUtils::AdvectionSharedPtr &advObject)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className
 Name of class. More...
 

Protected Member Functions

virtual void v_EvaluatePressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
 
virtual void v_SubSteppingTimeIntegration (int intMethod, const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
 
virtual void v_SubStepSaveFields (int nstep)
 
virtual void v_SubStepSetPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_Dt, NekDouble kinvis)
 
virtual void v_SubStepAdvance (const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln, int nstep, NekDouble time)
 
virtual void v_MountHOPBCs (int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
 
virtual LibUtilities::TimeIntegrationMethod v_GetSubStepIntegrationMethod (void)
 
void SubStepAdvection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 
void SubStepProjection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 
void SubStepExtrapolateField (NekDouble toff, Array< OneD, Array< OneD, NekDouble > > &ExtVel)
 
void AddAdvectionPenaltyFlux (const Array< OneD, const Array< OneD, NekDouble > > &velfield, const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
NekDouble GetSubstepTimeStep ()
 
- Protected Member Functions inherited from Nektar::Extrapolate
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::TimeIntegrationWrapperSharedPtr m_subStepIntegrationScheme
 
LibUtilities::TimeIntegrationSchemeOperators m_subStepIntegrationOps
 
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
 
NekDouble m_cflSafetyFactor
 
int m_infosteps
 
int m_minsubsteps
 
int m_maxsubsteps
 
- Protected Attributes inherited from Nektar::Extrapolate
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
 
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...
 
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
 

Additional Inherited Members

- Static Protected Attributes inherited from Nektar::Extrapolate
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 57 of file SubSteppingExtrapolate.h.

Constructor & Destructor Documentation

◆ SubSteppingExtrapolate()

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

Definition at line 50 of file SubSteppingExtrapolate.cpp.

References m_cflSafetyFactor, Nektar::Extrapolate::m_fields, m_infosteps, m_maxsubsteps, m_minsubsteps, Nektar::Extrapolate::m_session, and Nektar::Extrapolate::m_traceNormals.

56  : Extrapolate(pSession,pFields,pPressure,pVel,advObject)
57  {
58  m_session->LoadParameter("IO_InfoSteps", m_infosteps, 0);
59  m_session->LoadParameter("SubStepCFL", m_cflSafetyFactor, 0.5);
60  m_session->LoadParameter("MinSubSteps", m_minsubsteps,1);
61  m_session->LoadParameter("MaxSubSteps", m_maxsubsteps,100);
62 
63  int dim = m_fields[0]->GetCoordim(0);
64  m_traceNormals = Array<OneD, Array<OneD, NekDouble> >(dim);
65 
66  int nTracePts = m_fields[0]->GetTrace()->GetNpoints();
67  for(int i = 0; i < dim; ++i)
68  {
69  m_traceNormals[i] = Array<OneD, NekDouble> (nTracePts);
70  }
71  m_fields[0]->GetTrace()->GetNormals(m_traceNormals);
72 
73  }
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:210
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:218
Extrapolate(const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)
Definition: Extrapolate.cpp:55
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: Extrapolate.h:263

◆ ~SubSteppingExtrapolate()

Nektar::SubSteppingExtrapolate::~SubSteppingExtrapolate ( )
virtual

Definition at line 75 of file SubSteppingExtrapolate.cpp.

76  {
77  }

Member Function Documentation

◆ AddAdvectionPenaltyFlux()

void Nektar::SubSteppingExtrapolate::AddAdvectionPenaltyFlux ( const Array< OneD, const Array< OneD, NekDouble > > &  velfield,
const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
protected

Number of trace points

Number of spatial dimensions

Forward state array

Backward state array

upwind numerical flux state array

Normal velocity array

Extract forwards/backwards trace spaces Note: Needs to have correct i value to get boundary conditions

Upwind between elements

Construct difference between numflux and Fwd,Bwd

Calculate the numerical fluxes multipling Fwd, Bwd and numflux by the normal advection velocity

Definition at line 415 of file SubSteppingExtrapolate.cpp.

References ASSERTL1, Nektar::Extrapolate::m_bnd_dim, Nektar::Extrapolate::m_fields, Nektar::Extrapolate::m_traceNormals, Vmath::Vmul(), Vmath::Vsub(), and Vmath::Vvtvp().

Referenced by SubStepAdvection().

419  {
420  ASSERTL1(
421  physfield.num_elements() == Outarray.num_elements(),
422  "Physfield and outarray are of different dimensions");
423 
424  int i;
425 
426  /// Number of trace points
427  int nTracePts = m_fields[0]->GetTrace()->GetNpoints();
428 
429  /// Number of spatial dimensions
430  int nDimensions = m_bnd_dim;
431 
432  /// Forward state array
433  Array<OneD, NekDouble> Fwd(3*nTracePts);
434 
435  /// Backward state array
436  Array<OneD, NekDouble> Bwd = Fwd + nTracePts;
437 
438  /// upwind numerical flux state array
439  Array<OneD, NekDouble> numflux = Bwd + nTracePts;
440 
441  /// Normal velocity array
442  Array<OneD, NekDouble> Vn (nTracePts, 0.0);
443 
444  // Extract velocity field along the trace space and multiply by trace normals
445  for(i = 0; i < nDimensions; ++i)
446  {
447  m_fields[0]->ExtractTracePhys(velfield[i], Fwd);
448  Vmath::Vvtvp(nTracePts, m_traceNormals[i], 1, Fwd, 1, Vn, 1, Vn, 1);
449  }
450 
451  for(i = 0; i < physfield.num_elements(); ++i)
452  {
453  /// Extract forwards/backwards trace spaces
454  /// Note: Needs to have correct i value to get boundary conditions
455  m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd, Bwd);
456 
457  /// Upwind between elements
458  m_fields[0]->GetTrace()->Upwind(Vn, Fwd, Bwd, numflux);
459 
460  /// Construct difference between numflux and Fwd,Bwd
461  Vmath::Vsub(nTracePts, numflux, 1, Fwd, 1, Fwd, 1);
462  Vmath::Vsub(nTracePts, numflux, 1, Bwd, 1, Bwd, 1);
463 
464  /// Calculate the numerical fluxes multipling Fwd, Bwd and
465  /// numflux by the normal advection velocity
466  Vmath::Vmul(nTracePts, Fwd, 1, Vn, 1, Fwd, 1);
467  Vmath::Vmul(nTracePts, Bwd, 1, Vn, 1, Bwd, 1);
468 
469  m_fields[0]->AddFwdBwdTraceIntegral(Fwd,Bwd,Outarray[i]);
470  }
471  }
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.cpp:445
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:218
int m_bnd_dim
bounday dimensionality
Definition: Extrapolate.h:235
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.cpp:346
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: Extrapolate.h:263
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
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.cpp:186

◆ create()

static ExtrapolateSharedPtr Nektar::SubSteppingExtrapolate::create ( const LibUtilities::SessionReaderSharedPtr pSession,
Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields,
MultiRegions::ExpListSharedPtr pPressure,
const Array< OneD, int > &  pVel,
const SolverUtils::AdvectionSharedPtr advObject 
)
inlinestatic

Creates an instance of this class.

Definition at line 62 of file SubSteppingExtrapolate.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and CellMLToNektar.cellml_metadata::p.

68  {
70  ::AllocateSharedPtr(pSession,pFields,pPressure,pVel,advObject);
71  return p;
72  }
std::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:59
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ GetSubstepTimeStep()

NekDouble Nektar::SubSteppingExtrapolate::GetSubstepTimeStep ( )
protected

Definition at line 381 of file SubSteppingExtrapolate.cpp.

References Nektar::Extrapolate::GetMaxStdVelocity(), m_cflSafetyFactor, Nektar::Extrapolate::m_comm, Nektar::Extrapolate::m_fields, Nektar::Extrapolate::m_velocity, Nektar::LibUtilities::ReduceMin, and Vmath::Vmin().

Referenced by v_SubStepAdvance().

382  {
383  int n_element = m_fields[0]->GetExpSize();
384 
385  const Array<OneD, int> ExpOrder=m_fields[0]->EvalBasisNumModesMaxPerExp();
386 
387  const NekDouble cLambda = 0.2; // Spencer book pag. 317
388 
389  Array<OneD, NekDouble> tstep (n_element, 0.0);
390  Array<OneD, NekDouble> stdVelocity(n_element, 0.0);
391  Array<OneD, Array<OneD, NekDouble> > velfields(m_velocity.num_elements());
392 
393  for(int i = 0; i < m_velocity.num_elements(); ++i)
394  {
395  velfields[i] = m_fields[m_velocity[i]]->UpdatePhys();
396  }
397  stdVelocity = GetMaxStdVelocity(velfields);
398 
399  for(int el = 0; el < n_element; ++el)
400  {
401  tstep[el] = m_cflSafetyFactor /
402  (stdVelocity[el] * cLambda *
403  (ExpOrder[el]-1) * (ExpOrder[el]-1));
404  }
405 
406  NekDouble TimeStep = Vmath::Vmin(n_element, tstep, 1);
407  m_comm->AllReduce(TimeStep,LibUtilities::ReduceMin);
408 
409  return TimeStep;
410  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:225
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
Definition: Vmath.cpp:874
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:212
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:218
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > inarray)
double NekDouble

◆ SubStepAdvection()

void Nektar::SubSteppingExtrapolate::SubStepAdvection ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  time 
)
protected

Explicit Advection terms used by SubStepAdvance time integration

Get the number of coefficients

Define an auxiliary variable to compute the RHS

Operations to compute the RHS

Multiply the flux by the inverse of the mass matrix

Store in outarray the physical values of the RHS

Definition at line 160 of file SubSteppingExtrapolate.cpp.

References AddAdvectionPenaltyFlux(), Nektar::Extrapolate::m_advObject, Nektar::Extrapolate::m_fields, Nektar::Extrapolate::m_timestep, Nektar::Extrapolate::m_velocity, Vmath::Neg(), and SubStepExtrapolateField().

Referenced by v_SubSteppingTimeIntegration().

164  {
165  int i;
166  int nVariables = inarray.num_elements();
167  int nQuadraturePts = inarray[0].num_elements();
168 
169  /// Get the number of coefficients
170  int ncoeffs = m_fields[0]->GetNcoeffs();
171 
172  /// Define an auxiliary variable to compute the RHS
173  Array<OneD, Array<OneD, NekDouble> > WeakAdv(nVariables);
174  WeakAdv[0] = Array<OneD, NekDouble> (ncoeffs*nVariables);
175  for(i = 1; i < nVariables; ++i)
176  {
177  WeakAdv[i] = WeakAdv[i-1] + ncoeffs;
178  }
179 
180  Array<OneD, Array<OneD, NekDouble> > Velfields(m_velocity.num_elements());
181 
182  Velfields[0] = Array<OneD, NekDouble> (nQuadraturePts*m_velocity.num_elements());
183 
184  for(i = 1; i < m_velocity.num_elements(); ++i)
185  {
186  Velfields[i] = Velfields[i-1] + nQuadraturePts;
187  }
188 
189  SubStepExtrapolateField(fmod(time,m_timestep), Velfields);
190 
191  m_advObject->Advect(m_velocity.num_elements(), m_fields, Velfields, inarray, outarray, time);
192 
193  for(i = 0; i < nVariables; ++i)
194  {
195  m_fields[i]->IProductWRTBase(outarray[i],WeakAdv[i]);
196  // negation requried due to sign of DoAdvection term to be consistent
197  Vmath::Neg(ncoeffs, WeakAdv[i], 1);
198  }
199 
200  AddAdvectionPenaltyFlux(Velfields, inarray, WeakAdv);
201 
202  /// Operations to compute the RHS
203  for(i = 0; i < nVariables; ++i)
204  {
205  // Negate the RHS
206  Vmath::Neg(ncoeffs, WeakAdv[i], 1);
207 
208  /// Multiply the flux by the inverse of the mass matrix
209  m_fields[i]->MultiplyByElmtInvMass(WeakAdv[i], WeakAdv[i]);
210 
211  /// Store in outarray the physical values of the RHS
212  m_fields[i]->BwdTrans(WeakAdv[i], outarray[i]);
213  }
214  }
void SubStepExtrapolateField(NekDouble toff, Array< OneD, Array< OneD, NekDouble > > &ExtVel)
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:225
void AddAdvectionPenaltyFlux(const Array< OneD, const Array< OneD, NekDouble > > &velfield, const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &outarray)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:218
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:227
NekDouble m_timestep
Definition: Extrapolate.h:255

◆ SubStepExtrapolateField()

void Nektar::SubSteppingExtrapolate::SubStepExtrapolateField ( NekDouble  toff,
Array< OneD, Array< OneD, NekDouble > > &  ExtVel 
)
protected

Extrapolate field using equally time spaced field un,un-1,un-2, (at dt intervals) to time n+t at order Ord

Definition at line 477 of file SubSteppingExtrapolate.cpp.

References Blas::Daxpy(), Vmath::Fill(), Nektar::Extrapolate::m_fields, Nektar::Extrapolate::m_intSteps, m_previousVelFields, Nektar::Extrapolate::m_timestep, Nektar::Extrapolate::m_velocity, and Vmath::Smul().

Referenced by SubStepAdvection().

480  {
481  int npts = m_fields[0]->GetTotPoints();
482  int nvel = m_velocity.num_elements();
483  int i,j;
484  Array<OneD, NekDouble> l(4);
485 
486  int ord = m_intSteps;
487 
488  // calculate Lagrange interpolants
489  Vmath::Fill(4,1.0,l,1);
490 
491  for(i = 0; i <= ord; ++i)
492  {
493  for(j = 0; j <= ord; ++j)
494  {
495  if(i != j)
496  {
497  l[i] *= (j*m_timestep+toff);
498  l[i] /= (j*m_timestep-i*m_timestep);
499  }
500  }
501  }
502 
503  for(i = 0; i < nvel; ++i)
504  {
505  Vmath::Smul(npts,l[0],m_previousVelFields[i],1,ExtVel[i],1);
506 
507  for(j = 1; j <= ord; ++j)
508  {
509  Blas::Daxpy(npts,l[j],m_previousVelFields[j*nvel+i],1,
510  ExtVel[i],1);
511  }
512  }
513  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:225
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:218
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:216
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:253
static void Daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: y = alpha x plus y.
Definition: Blas.hpp:110
NekDouble m_timestep
Definition: Extrapolate.h:255

◆ SubStepProjection()

void Nektar::SubSteppingExtrapolate::SubStepProjection ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  time 
)
protected

Projection used by SubStepAdvance time integration

Definition at line 219 of file SubSteppingExtrapolate.cpp.

References ASSERTL1, and Vmath::Vcopy().

Referenced by v_SubSteppingTimeIntegration().

223  {
224  ASSERTL1(inarray.num_elements() == outarray.num_elements(),"Inarray and outarray of different sizes ");
225 
226  for(int i = 0; i < inarray.num_elements(); ++i)
227  {
228  Vmath::Vcopy(inarray[i].num_elements(),inarray[i],1,outarray[i],1);
229  }
230  }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064

◆ v_EvaluatePressureBCs()

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

Implements Nektar::Extrapolate.

Definition at line 79 of file SubSteppingExtrapolate.cpp.

References ASSERTL0.

80  {
81  ASSERTL0(false,"This method should not be called by Substepping routine");
82  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

◆ v_GetSubStepIntegrationMethod()

LibUtilities::TimeIntegrationMethod Nektar::SubSteppingExtrapolate::v_GetSubStepIntegrationMethod ( void  )
protectedvirtual

Reimplemented from Nektar::Extrapolate.

Definition at line 527 of file SubSteppingExtrapolate.cpp.

References m_subStepIntegrationScheme.

528  {
529  return m_subStepIntegrationScheme->GetIntegrationMethod();
530  }
LibUtilities::TimeIntegrationWrapperSharedPtr m_subStepIntegrationScheme

◆ v_MountHOPBCs()

void Nektar::SubSteppingExtrapolate::v_MountHOPBCs ( int  HBCdata,
NekDouble  kinvis,
Array< OneD, NekDouble > &  Q,
Array< OneD, const NekDouble > &  Advection 
)
protectedvirtual

Implements Nektar::Extrapolate.

Definition at line 518 of file SubSteppingExtrapolate.cpp.

References Vmath::Smul().

523  {
524  Vmath::Smul(HBCdata,-kinvis,Q,1,Q,1);
525  }
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:216

◆ v_SubStepAdvance()

void Nektar::SubSteppingExtrapolate::v_SubStepAdvance ( const LibUtilities::TimeIntegrationSolutionSharedPtr integrationSoln,
int  nstep,
NekDouble  time 
)
protectedvirtual

Implements Nektar::Extrapolate.

Definition at line 316 of file SubSteppingExtrapolate.cpp.

References ASSERTL0, GetSubstepTimeStep(), Nektar::Extrapolate::IProductNormVelocityOnHBC(), m_cflSafetyFactor, Nektar::Extrapolate::m_comm, Nektar::Extrapolate::m_fields, m_infosteps, Nektar::Extrapolate::m_intSteps, Nektar::Extrapolate::m_iprodnormvel, m_maxsubsteps, m_minsubsteps, m_subStepIntegrationOps, m_subStepIntegrationScheme, and Nektar::Extrapolate::m_timestep.

320  {
321  int n;
322  int nsubsteps;
323 
324  NekDouble dt;
325 
326  Array<OneD, Array<OneD, NekDouble> > fields;
327 
328  static int ncalls = 1;
329  int nint = min(ncalls++, m_intSteps);
330 
331  //this needs to change
332  m_comm = m_fields[0]->GetComm()->GetRowComm();
333 
334  // Get the proper time step with CFL control
335  dt = GetSubstepTimeStep();
336 
337  nsubsteps = (m_timestep > dt)? ((int)(m_timestep/dt)+1):1;
338  nsubsteps = max(m_minsubsteps, nsubsteps);
339 
340  ASSERTL0(nsubsteps < m_maxsubsteps,"Number of substeps has exceeded maximum");
341 
342  dt = m_timestep/nsubsteps;
343 
344  if (m_infosteps && !((nstep+1)%m_infosteps) && m_comm->GetRank() == 0)
345  {
346  cout << "Sub-integrating using "<< nsubsteps
347  << " steps over Dt = " << m_timestep
348  << " (SubStep CFL=" << m_cflSafetyFactor << ")"<< endl;
349  }
350 
351  for (int m = 0; m < nint; ++m)
352  {
353  // We need to update the fields held by the m_integrationSoln
354  fields = integrationSoln->UpdateSolutionVector()[m];
355 
356  // Initialise NS solver which is set up to use a GLM method
357  // with calls to EvaluateAdvection_SetPressureBCs and
358  // SolveUnsteadyStokesSystem
360  SubIntegrationSoln = m_subStepIntegrationScheme->
361  InitializeScheme(dt, fields, time, m_subStepIntegrationOps);
362 
363  for(n = 0; n < nsubsteps; ++n)
364  {
365  fields = m_subStepIntegrationScheme->TimeIntegrate(n, dt, SubIntegrationSoln,
367  }
368 
369  // set up HBC m_acceleration field for Pressure BCs
371 
372  // Reset time integrated solution in m_integrationSoln
373  integrationSoln->SetSolVector(m,fields);
374  }
375  }
LibUtilities::TimeIntegrationWrapperSharedPtr m_subStepIntegrationScheme
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
void IProductNormVelocityOnHBC(const Array< OneD, const Array< OneD, NekDouble > > &Vel, Array< OneD, NekDouble > &IprodVn)
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:212
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:218
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:253
double NekDouble
std::shared_ptr< TimeIntegrationSolution > TimeIntegrationSolutionSharedPtr
Array< OneD, Array< OneD, NekDouble > > m_iprodnormvel
Storage for current and previous levels of the inner product of normal velocity.
Definition: Extrapolate.h:261
NekDouble m_timestep
Definition: Extrapolate.h:255
LibUtilities::TimeIntegrationSchemeOperators m_subStepIntegrationOps

◆ v_SubSteppingTimeIntegration()

void Nektar::SubSteppingExtrapolate::v_SubSteppingTimeIntegration ( int  intMethod,
const LibUtilities::TimeIntegrationWrapperSharedPtr IntegrationScheme 
)
protectedvirtual

Implements Nektar::Extrapolate.

Definition at line 85 of file SubSteppingExtrapolate.cpp.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::LibUtilities::TimeIntegrationSchemeOperators::DefineOdeRhs(), Nektar::LibUtilities::TimeIntegrationSchemeOperators::DefineProjection(), Nektar::LibUtilities::eBackwardEuler, Nektar::LibUtilities::eBDFImplicitOrder1, Nektar::LibUtilities::eBDFImplicitOrder2, Nektar::LibUtilities::GetTimeIntegrationWrapperFactory(), Nektar::Extrapolate::m_fields, Nektar::Extrapolate::m_intSteps, m_previousVelFields, Nektar::Extrapolate::m_session, m_subStepIntegrationOps, m_subStepIntegrationScheme, Nektar::Extrapolate::m_velocity, SubStepAdvection(), and SubStepProjection().

88  {
89  int i;
90 
91  // Set to 1 for first step and it will then be increased in
92  // time advance routines
93  switch(intMethod)
94  {
97  {
98  std::string vSubStepIntScheme = "ForwardEuler";
99 
100  if(m_session->DefinesSolverInfo("SubStepIntScheme"))
101  {
102  vSubStepIntScheme = m_session->GetSolverInfo("SubStepIntScheme");
103  }
104 
106 
107  int nvel = m_velocity.num_elements();
108 
109  // Fields for linear interpolation
110  m_previousVelFields = Array<OneD, Array<OneD, NekDouble> >(2*nvel);
111  int ntotpts = m_fields[0]->GetTotPoints();
112  m_previousVelFields[0] = Array<OneD, NekDouble>(2*nvel*ntotpts);
113  for(i = 1; i < 2*nvel; ++i)
114  {
115  m_previousVelFields[i] = m_previousVelFields[i-1] + ntotpts;
116  }
117 
118  }
119  break;
121  {
122  std::string vSubStepIntScheme = "RungeKutta2_ImprovedEuler";
123 
124  if(m_session->DefinesSolverInfo("SubStepIntScheme"))
125  {
126  vSubStepIntScheme = m_session->GetSolverInfo("SubStepIntScheme");
127  }
128 
130 
131  int nvel = m_velocity.num_elements();
132 
133  // Fields for quadratic interpolation
134  m_previousVelFields = Array<OneD, Array<OneD, NekDouble> >(3*nvel);
135 
136  int ntotpts = m_fields[0]->GetTotPoints();
137  m_previousVelFields[0] = Array<OneD, NekDouble>(3*nvel*ntotpts);
138  for(i = 1; i < 3*nvel; ++i)
139  {
140  m_previousVelFields[i] = m_previousVelFields[i-1] + ntotpts;
141  }
142 
143  }
144  break;
145  default:
146  ASSERTL0(0,"Integration method not suitable: Options include BackwardEuler or BDFImplicitOrder1");
147  break;
148  }
149 
150  m_intSteps = IntegrationScheme->GetIntegrationSteps();
151 
152  // set explicit time-integration class operators
155  }
void SubStepProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
LibUtilities::TimeIntegrationWrapperSharedPtr m_subStepIntegrationScheme
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
LibUtilities::SessionReaderSharedPtr m_session
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:225
BDF multi-step scheme of order 1 (implicit)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:218
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:253
TimeIntegrationWrapperFactory & GetTimeIntegrationWrapperFactory()
void SubStepAdvection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
BDF multi-step scheme of order 2 (implicit)
LibUtilities::TimeIntegrationSchemeOperators m_subStepIntegrationOps

◆ v_SubStepSaveFields()

void Nektar::SubSteppingExtrapolate::v_SubStepSaveFields ( int  nstep)
protectedvirtual

Implements Nektar::Extrapolate.

Definition at line 267 of file SubSteppingExtrapolate.cpp.

References Nektar::Extrapolate::m_fields, m_previousVelFields, Nektar::Extrapolate::m_velocity, and Vmath::Vcopy().

268  {
269  int i,n;
270  int nvel = m_velocity.num_elements();
271  int npts = m_fields[0]->GetTotPoints();
272 
273  // rotate fields
274  int nblocks = m_previousVelFields.num_elements()/nvel;
275  Array<OneD, NekDouble> save;
276 
277  // rotate storage space
278  for(n = 0; n < nvel; ++n)
279  {
280  save = m_previousVelFields[(nblocks-1)*nvel+n];
281 
282  for(i = nblocks-1; i > 0; --i)
283  {
284  m_previousVelFields[i*nvel+n] = m_previousVelFields[(i-1)*nvel+n];
285  }
286 
287  m_previousVelFields[n] = save;
288  }
289 
290  // Put previous field
291  for(i = 0; i < nvel; ++i)
292  {
293  m_fields[m_velocity[i]]->BwdTrans(m_fields[m_velocity[i]]->GetCoeffs(),
294  m_fields[m_velocity[i]]->UpdatePhys());
295  Vmath::Vcopy(npts,m_fields[m_velocity[i]]->GetPhys(),1,
296  m_previousVelFields[i],1);
297  }
298 
299  if(nstep == 0)// initialise all levels with first field
300  {
301  for(n = 0; n < nvel; ++n)
302  {
303  for(i = 1; i < nblocks; ++i)
304  {
305  Vmath::Vcopy(npts,m_fields[m_velocity[n]]->GetPhys(),1,
306  m_previousVelFields[i*nvel+n],1);
307 
308  }
309  }
310  }
311  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:225
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:218
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064

◆ v_SubStepSetPressureBCs()

void Nektar::SubSteppingExtrapolate::v_SubStepSetPressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
NekDouble  Aii_Dt,
NekDouble  kinvis 
)
protectedvirtual

Implements Nektar::Extrapolate.

Reimplemented in Nektar::SubSteppingExtrapolateWeakPressure.

Definition at line 236 of file SubSteppingExtrapolate.cpp.

References Nektar::Extrapolate::AddDuDt(), Nektar::Extrapolate::CalcNeumannPressureBCs(), Nektar::Extrapolate::CalcOutflowBCs(), Nektar::Extrapolate::CopyPressureHBCsToPbndExp(), Nektar::Extrapolate::ExtrapolateArray(), Nektar::Extrapolate::m_pressureCalls, and Nektar::Extrapolate::m_pressureHBCs.

240  {
241  //int nConvectiveFields =m_fields.num_elements()-1;
242  Array<OneD, Array<OneD, NekDouble> > nullvelfields;
243 
244  m_pressureCalls++;
245 
246  // Calculate non-linear and viscous BCs at current level and
247  // put in m_pressureHBCs[0]
248  CalcNeumannPressureBCs(inarray,nullvelfields,kinvis);
249 
250  // Extrapolate to m_pressureHBCs to n+1
252 
253  // Add (phi,Du/Dt) term to m_presureHBC
254  AddDuDt();
255 
256  // Copy m_pressureHBCs to m_PbndExp
258 
259  // Evaluate High order outflow conditiosn if required.
260  CalcOutflowBCs(inarray, kinvis);
261  }
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &array)
void CopyPressureHBCsToPbndExp(void)
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:244
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:258
void CalcOutflowBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble kinvis)
void CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.h:187

Member Data Documentation

◆ className

std::string Nektar::SubSteppingExtrapolate::className
static
Initial value:

Name of class.

Registers the class with the Factory.

Definition at line 75 of file SubSteppingExtrapolate.h.

◆ m_cflSafetyFactor

NekDouble Nektar::SubSteppingExtrapolate::m_cflSafetyFactor
protected

◆ m_infosteps

int Nektar::SubSteppingExtrapolate::m_infosteps
protected

Definition at line 144 of file SubSteppingExtrapolate.h.

Referenced by SubSteppingExtrapolate(), and v_SubStepAdvance().

◆ m_maxsubsteps

int Nektar::SubSteppingExtrapolate::m_maxsubsteps
protected

Definition at line 146 of file SubSteppingExtrapolate.h.

Referenced by SubSteppingExtrapolate(), and v_SubStepAdvance().

◆ m_minsubsteps

int Nektar::SubSteppingExtrapolate::m_minsubsteps
protected

Definition at line 145 of file SubSteppingExtrapolate.h.

Referenced by SubSteppingExtrapolate(), and v_SubStepAdvance().

◆ m_previousVelFields

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

◆ m_subStepIntegrationOps

LibUtilities::TimeIntegrationSchemeOperators Nektar::SubSteppingExtrapolate::m_subStepIntegrationOps
protected

Definition at line 139 of file SubSteppingExtrapolate.h.

Referenced by v_SubStepAdvance(), and v_SubSteppingTimeIntegration().

◆ m_subStepIntegrationScheme

LibUtilities::TimeIntegrationWrapperSharedPtr Nektar::SubSteppingExtrapolate::m_subStepIntegrationScheme
protected