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

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 (const LibUtilities::TimeIntegrationSchemeSharedPtr &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 (int nstep, NekDouble time)
 
virtual void v_MountHOPBCs (int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
 
virtual std::string v_GetSubStepName (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
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::TimeIntegrationSchemeSharedPtr m_intScheme
 
LibUtilities::TimeIntegrationSchemeSharedPtr 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
 
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...
 
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 51 of file SubSteppingExtrapolate.cpp.

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

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

◆ ~SubSteppingExtrapolate()

Nektar::SubSteppingExtrapolate::~SubSteppingExtrapolate ( )
virtual

Definition at line 76 of file SubSteppingExtrapolate.cpp.

77  {
78  }

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 411 of file SubSteppingExtrapolate.cpp.

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

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

◆ 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.

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

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

◆ GetSubstepTimeStep()

NekDouble Nektar::SubSteppingExtrapolate::GetSubstepTimeStep ( )
protected

Definition at line 377 of file SubSteppingExtrapolate.cpp.

378  {
379  int n_element = m_fields[0]->GetExpSize();
380 
381  const Array<OneD, int> ExpOrder=m_fields[0]->EvalBasisNumModesMaxPerExp();
382 
383  const NekDouble cLambda = 0.2; // Spencer book pag. 317
384 
385  Array<OneD, NekDouble> tstep (n_element, 0.0);
386  Array<OneD, NekDouble> stdVelocity(n_element, 0.0);
387  Array<OneD, Array<OneD, NekDouble> > velfields(m_velocity.size());
388 
389  for(int i = 0; i < m_velocity.size(); ++i)
390  {
391  velfields[i] = m_fields[m_velocity[i]]->UpdatePhys();
392  }
393  stdVelocity = GetMaxStdVelocity(velfields);
394 
395  for(int el = 0; el < n_element; ++el)
396  {
397  tstep[el] = m_cflSafetyFactor /
398  (stdVelocity[el] * cLambda *
399  (ExpOrder[el]-1) * (ExpOrder[el]-1));
400  }
401 
402  NekDouble TimeStep = Vmath::Vmin(n_element, tstep, 1);
403  m_comm->AllReduce(TimeStep,LibUtilities::ReduceMin);
404 
405  return TimeStep;
406  }
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > inarray)
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:224
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:211
double NekDouble
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:992

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

◆ 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 148 of file SubSteppingExtrapolate.cpp.

152  {
153  int i;
154  int nVariables = inarray.size();
155  int nQuadraturePts = inarray[0].size();
156 
157  /// Get the number of coefficients
158  int ncoeffs = m_fields[0]->GetNcoeffs();
159 
160  /// Define an auxiliary variable to compute the RHS
161  Array<OneD, Array<OneD, NekDouble> > WeakAdv(nVariables);
162  WeakAdv[0] = Array<OneD, NekDouble> (ncoeffs*nVariables);
163  for(i = 1; i < nVariables; ++i)
164  {
165  WeakAdv[i] = WeakAdv[i-1] + ncoeffs;
166  }
167 
168  Array<OneD, Array<OneD, NekDouble> > Velfields(m_velocity.size());
169 
170  Velfields[0] = Array<OneD, NekDouble> (nQuadraturePts*m_velocity.size());
171 
172  for(i = 1; i < m_velocity.size(); ++i)
173  {
174  Velfields[i] = Velfields[i-1] + nQuadraturePts;
175  }
176 
177  SubStepExtrapolateField(fmod(time,m_timestep), Velfields);
178 
179  for (auto &x : m_forcing)
180  {
181  x->PreApply(m_fields, Velfields, Velfields, time);
182  }
183  m_advObject->Advect(m_velocity.size(), m_fields, Velfields, inarray, outarray, time);
184  for (auto &x : m_forcing)
185  {
186  x->Apply(m_fields, outarray, outarray, time);
187  }
188 
189  for(i = 0; i < nVariables; ++i)
190  {
191  m_fields[i]->IProductWRTBase(outarray[i],WeakAdv[i]);
192  // negation requried due to sign of DoAdvection term to be consistent
193  Vmath::Neg(ncoeffs, WeakAdv[i], 1);
194  }
195 
196  AddAdvectionPenaltyFlux(Velfields, inarray, WeakAdv);
197 
198  /// Operations to compute the RHS
199  for(i = 0; i < nVariables; ++i)
200  {
201  // Negate the RHS
202  Vmath::Neg(ncoeffs, WeakAdv[i], 1);
203 
204  /// Multiply the flux by the inverse of the mass matrix
205  m_fields[i]->MultiplyByElmtInvMass(WeakAdv[i], WeakAdv[i]);
206 
207  /// Store in outarray the physical values of the RHS
208  m_fields[i]->BwdTrans(WeakAdv[i], outarray[i]);
209  }
210  }
NekDouble m_timestep
Definition: Extrapolate.h:256
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Definition: Extrapolate.h:228
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:226
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)
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:461

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

Referenced by v_SubSteppingTimeIntegration().

◆ 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 473 of file SubSteppingExtrapolate.cpp.

476  {
477  int npts = m_fields[0]->GetTotPoints();
478  int nvel = m_velocity.size();
479  int i,j;
480  Array<OneD, NekDouble> l(4);
481 
482  int ord = m_intSteps;
483 
484  // calculate Lagrange interpolants
485  Vmath::Fill(4,1.0,l,1);
486 
487  for(i = 0; i <= ord; ++i)
488  {
489  for(j = 0; j <= ord; ++j)
490  {
491  if(i != j)
492  {
493  l[i] *= (j*m_timestep+toff);
494  l[i] /= (j*m_timestep-i*m_timestep);
495  }
496  }
497  }
498 
499  for(i = 0; i < nvel; ++i)
500  {
501  Vmath::Smul(npts,l[0],m_previousVelFields[i],1,ExtVel[i],1);
502 
503  for(j = 1; j <= ord; ++j)
504  {
505  Blas::Daxpy(npts,l[j],m_previousVelFields[j*nvel+i],1,
506  ExtVel[i],1);
507  }
508  }
509  }
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:254
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
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:167
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.cpp:225
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45

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

◆ 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 215 of file SubSteppingExtrapolate.cpp.

219  {
220  ASSERTL1(inarray.size() == outarray.size(),"Inarray and outarray of different sizes ");
221 
222  for(int i = 0; i < inarray.size(); ++i)
223  {
224  Vmath::Vcopy(inarray[i].size(),inarray[i],1,outarray[i],1);
225  }
226  }
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1199

References ASSERTL1, and Vmath::Vcopy().

Referenced by v_SubSteppingTimeIntegration().

◆ 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 80 of file SubSteppingExtrapolate.cpp.

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

References ASSERTL0.

◆ v_GetSubStepName()

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

Reimplemented from Nektar::Extrapolate.

Definition at line 523 of file SubSteppingExtrapolate.cpp.

524  {
525  return m_subStepIntegrationScheme->GetName();
526  }
LibUtilities::TimeIntegrationSchemeSharedPtr m_subStepIntegrationScheme

References 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 514 of file SubSteppingExtrapolate.cpp.

519  {
520  Vmath::Smul(HBCdata,-kinvis,Q,1,Q,1);
521  }

References Vmath::Smul().

◆ v_SubStepAdvance()

void Nektar::SubSteppingExtrapolate::v_SubStepAdvance ( int  nstep,
NekDouble  time 
)
protectedvirtual

Implements Nektar::Extrapolate.

Definition at line 312 of file SubSteppingExtrapolate.cpp.

315  {
316  int n;
317  int nsubsteps;
318 
319  NekDouble dt;
320 
321  Array<OneD, Array<OneD, NekDouble> > fields;
322 
323  static int ncalls = 1;
324  int nint = std::min(ncalls++, m_intSteps);
325 
326  //this needs to change
327  m_comm = m_fields[0]->GetComm()->GetRowComm();
328 
329  // Get the proper time step with CFL control
330  dt = GetSubstepTimeStep();
331 
332  nsubsteps = (m_timestep > dt)? ((int)(m_timestep/dt)+1):1;
333  nsubsteps = std::max(m_minsubsteps, nsubsteps);
334 
335  ASSERTL0(nsubsteps < m_maxsubsteps,"Number of substeps has exceeded maximum");
336 
337  dt = m_timestep/nsubsteps;
338 
339  if (m_infosteps && !((nstep+1)%m_infosteps) && m_comm->GetRank() == 0)
340  {
341  std::cout << "Sub-integrating using "<< nsubsteps
342  << " steps over Dt = " << m_timestep
343  << " (SubStep CFL=" << m_cflSafetyFactor << ")"<< std::endl;
344  }
345 
346  const TripleArray &solutionVector = m_intScheme->GetSolutionVector();
347 
348  for (int m = 0; m < nint; ++m)
349  {
350  // We need to update the fields held by the m_intScheme
351  fields = solutionVector[m];
352 
353  // Initialise NS solver which is set up to use a GLM method
354  // with calls to EvaluateAdvection_SetPressureBCs and
355  // SolveUnsteadyStokesSystem
357  InitializeScheme(dt, fields, time, m_subStepIntegrationOps);
358 
359  for(n = 0; n < nsubsteps; ++n)
360  {
361  fields = m_subStepIntegrationScheme->
362  TimeIntegrate(n, dt, m_subStepIntegrationOps);
363  }
364 
365  // set up HBC m_acceleration field for Pressure BCs
367 
368  // Reset time integrated solution in m_intScheme
369  m_intScheme->SetSolutionVector(m,fields);
370  }
371  }
Array< OneD, Array< OneD, NekDouble > > m_iprodnormvel
Storage for current and previous levels of the inner product of normal velocity.
Definition: Extrapolate.h:262
void IProductNormVelocityOnHBC(const Array< OneD, const Array< OneD, NekDouble > > &Vel, Array< OneD, NekDouble > &IprodVn)
LibUtilities::TimeIntegrationSchemeOperators m_subStepIntegrationOps
LibUtilities::TimeIntegrationSchemeSharedPtr m_intScheme
AT< AT< AT< NekDouble > > > TripleArray

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

◆ v_SubSteppingTimeIntegration()

void Nektar::SubSteppingExtrapolate::v_SubSteppingTimeIntegration ( const LibUtilities::TimeIntegrationSchemeSharedPtr IntegrationScheme)
protectedvirtual

Implements Nektar::Extrapolate.

Definition at line 85 of file SubSteppingExtrapolate.cpp.

87  {
88  m_intScheme = IntegrationScheme;
89 
90  unsigned int order = IntegrationScheme->GetOrder();
91 
92  // Set to 1 for first step and it will then be increased in
93  // time advance routines
94  if( (IntegrationScheme->GetName() == "Euler" &&
95  IntegrationScheme->GetVariant() == "Backward") ||
96 
97  (IntegrationScheme->GetName() == "BDFImplicit" &&
98  (order == 1 || order == 2)) )
99  {
100  // Note RK first order SSP is just Forward Euler.
101  std::string vSubStepIntScheme = "RungeKutta";
102  std::string vSubStepIntSchemeVariant = "SSP";
103  int vSubStepIntSchemeOrder = order;
104 
105  if( m_session->DefinesSolverInfo( "SubStepIntScheme" ) )
106  {
107  vSubStepIntScheme =
108  m_session->GetSolverInfo( "SubStepIntScheme" );
109  vSubStepIntSchemeVariant = "";
110  vSubStepIntSchemeOrder = order;
111  }
112 
115  vSubStepIntScheme,
116  vSubStepIntSchemeVariant,
117  vSubStepIntSchemeOrder,
118  std::vector<NekDouble>() );
119 
120  int nvel = m_velocity.size();
121  int ndim = order+1;
122 
123  // Fields for linear/quadratic interpolation
124  m_previousVelFields = Array<OneD, Array<OneD, NekDouble> >(ndim*nvel);
125  int ntotpts = m_fields[0]->GetTotPoints();
126  m_previousVelFields[0] = Array<OneD, NekDouble>(ndim*nvel*ntotpts);
127 
128  for( int i = 1; i < ndim*nvel; ++i )
129  {
130  m_previousVelFields[i] = m_previousVelFields[i-1] + ntotpts;
131  }
132  }
133  else
134  {
135  ASSERTL0(0,"Integration method not suitable: Options include BackwardEuler or BDFImplicitOrder{1,2}");
136  }
137 
138  m_intSteps = IntegrationScheme->GetNumIntegrationPhases();
139 
140  // set explicit time-integration class operators
143  }
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:145
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
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)
TimeIntegrationSchemeFactory & GetTimeIntegrationSchemeFactory()

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

◆ v_SubStepSaveFields()

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

Implements Nektar::Extrapolate.

Definition at line 263 of file SubSteppingExtrapolate.cpp.

264  {
265  int i,n;
266  int nvel = m_velocity.size();
267  int npts = m_fields[0]->GetTotPoints();
268 
269  // rotate fields
270  int nblocks = m_previousVelFields.size()/nvel;
271  Array<OneD, NekDouble> save;
272 
273  // rotate storage space
274  for(n = 0; n < nvel; ++n)
275  {
276  save = m_previousVelFields[(nblocks-1)*nvel+n];
277 
278  for(i = nblocks-1; i > 0; --i)
279  {
280  m_previousVelFields[i*nvel+n] = m_previousVelFields[(i-1)*nvel+n];
281  }
282 
283  m_previousVelFields[n] = save;
284  }
285 
286  // Put previous field
287  for(i = 0; i < nvel; ++i)
288  {
289  m_fields[m_velocity[i]]->BwdTrans(m_fields[m_velocity[i]]->GetCoeffs(),
290  m_fields[m_velocity[i]]->UpdatePhys());
291  Vmath::Vcopy(npts,m_fields[m_velocity[i]]->GetPhys(),1,
292  m_previousVelFields[i],1);
293  }
294 
295  if(nstep == 0)// initialise all levels with first field
296  {
297  for(n = 0; n < nvel; ++n)
298  {
299  for(i = 1; i < nblocks; ++i)
300  {
301  Vmath::Vcopy(npts,m_fields[m_velocity[n]]->GetPhys(),1,
302  m_previousVelFields[i*nvel+n],1);
303 
304  }
305  }
306  }
307  }

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

◆ 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 232 of file SubSteppingExtrapolate.cpp.

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

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.

Member Data Documentation

◆ className

std::string Nektar::SubSteppingExtrapolate::className
static
Initial value:
"SubStepping",
"SubStepping")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:200
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.
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:49

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 142 of file SubSteppingExtrapolate.h.

Referenced by SubSteppingExtrapolate(), and v_SubStepAdvance().

◆ m_intScheme

LibUtilities::TimeIntegrationSchemeSharedPtr Nektar::SubSteppingExtrapolate::m_intScheme
protected

Definition at line 135 of file SubSteppingExtrapolate.h.

Referenced by v_SubStepAdvance(), and v_SubSteppingTimeIntegration().

◆ m_maxsubsteps

int Nektar::SubSteppingExtrapolate::m_maxsubsteps
protected

Definition at line 144 of file SubSteppingExtrapolate.h.

Referenced by SubSteppingExtrapolate(), and v_SubStepAdvance().

◆ m_minsubsteps

int Nektar::SubSteppingExtrapolate::m_minsubsteps
protected

Definition at line 143 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 137 of file SubSteppingExtrapolate.h.

Referenced by v_SubStepAdvance(), and v_SubSteppingTimeIntegration().

◆ m_subStepIntegrationScheme

LibUtilities::TimeIntegrationSchemeSharedPtr Nektar::SubSteppingExtrapolate::m_subStepIntegrationScheme
protected