Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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:
Inheritance graph
[legend]
Collaboration diagram for Nektar::SubSteppingExtrapolate:
Collaboration graph
[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 ()
 
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 CalcExplicitDuDt (const Array< OneD, const Array< OneD, NekDouble > > &fields)
 
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 > > &oldarrays, Array< OneD, NekDouble > &newarray, Array< OneD, NekDouble > &outarray)
 

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 AddDuDt (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)
 
void CalcOutflowBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble kinvis)
 
void RollOver (Array< OneD, Array< OneD, NekDouble > > &input)
 
void CurlCurl (Array< OneD, Array< OneD, const NekDouble > > &Vel, Array< OneD, Array< OneD, NekDouble > > &Q, const int j)
 

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,
MultiRegions::ExpListSharedPtr
m_fields
 
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::BoundaryConditionShPtr
m_PBndConds
 pressure boundary conditions container More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_PBndExp
 pressure boundary conditions expansion container More...
 
int m_pressureCalls
 number of times the high-order pressure BCs have been called More...
 
int m_pressureBCsMaxPts
 Maximum points used in pressure BC evaluation. More...
 
int m_pressureBCsElmtMaxPts
 Maximum points used in Element adjacent to pressure BC evaluation. More...
 
int m_intSteps
 Maximum points used in pressure BC evaluation. More...
 
NekDouble m_timestep
 
bool m_SingleMode
 Flag to determine if single homogeneous mode is used. More...
 
bool m_HalfMode
 Flag to determine if half homogeneous mode is used. More...
 
bool m_MultipleModes
 Flag to determine if use multiple homogenenous modes are used. More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
Array< OneD, int > m_pressureBCtoElmtID
 Id of element to which pressure boundary condition belongs. More...
 
Array< OneD, int > m_pressureBCtoTraceID
 Id of edge (2D) or face (3D) to which pressure boundary condition belongs. More...
 
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_acceleration
 Storage for current and previous levels of the acceleration term. More...
 
Array< OneD, HBCInfom_HBCdata
 data structure to old all the information regarding High order pressure BCs More...
 
Array< OneD, NekDoublem_wavenumber
 wave number 2 pi k /Lz More...
 
Array< OneD, NekDoublem_negWavenumberSq
 minus Square of wavenumber More...
 
Array< OneD, Array< OneD,
Array< OneD, NekDouble > > > 
m_outflowVel
 Storage for current and previous velocity fields at the otuflow for high order outflow BCs. More...
 
Array< OneD, Array< OneD,
NekDouble > > 
m_traceNormals
 
Array< OneD, Array< OneD,
Array< OneD, NekDouble > > > 
m_PhyoutfVel
 Storage for current and previous velocity fields in physical space at the otuflow for high order outflow BCs. More...
 
Array< OneD, NekDoublem_nonlinearterm_phys
 (if homogeneous) More...
 
Array< OneD, NekDoublem_nonlinearterm_coeffs
 (if homogeneous) More...
 
Array< OneD, unsigned int > m_expsize_per_plane
 (if homogeneous) More...
 
Array< OneD, NekDoublem_PBndCoeffs
 (if homogeneous) More...
 
Array< OneD, Array< OneD,
NekDouble > > 
m_UBndCoeffs
 (if homogeneous) More...
 
int m_totexps_per_plane
 (if homogeneous) More...
 

Additional Inherited Members

- Static Protected Attributes inherited from Nektar::Extrapolate
static NekDouble StifflyStable_Betaq_Coeffs [3][3]
 total number of expansion for each plane (if homogeneous) More...
 
static NekDouble StifflyStable_Alpha_Coeffs [3][3]
 
static NekDouble StifflyStable_Gamma0_Coeffs [3]
 

Detailed Description

Definition at line 58 of file SubSteppingExtrapolate.h.

Constructor & Destructor Documentation

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

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

Definition at line 74 of file SubSteppingExtrapolate.cpp.

75  {
76  }

Member Function Documentation

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

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

Definition at line 540 of file SubSteppingExtrapolate.cpp.

References Nektar::Extrapolate::IProductNormVelocityBCOnHBC(), Nektar::Extrapolate::m_acceleration, Nektar::Extrapolate::m_intSteps, Nektar::Extrapolate::m_pressureCalls, Nektar::Extrapolate::m_pressureHBCs, Nektar::Extrapolate::m_timestep, Vmath::Smul(), Nektar::Extrapolate::StifflyStable_Alpha_Coeffs, Nektar::Extrapolate::StifflyStable_Gamma0_Coeffs, Vmath::Svtvp(), and Vmath::Vsub().

Referenced by v_SubStepSetPressureBCs().

541  {
542  int HBCPts = m_acceleration[0].num_elements();
543 
544  Array<OneD, NekDouble> accelerationTerm(HBCPts, 0.0);
545 
546  // Update velocity BF at n+1 (actually only needs doing if velocity is time dependent on HBCs)
548 
549  //Calculate acceleration term at level n based on previous steps
550  int acc_order = min(m_pressureCalls,m_intSteps);
552  m_acceleration[0], 1, accelerationTerm, 1);
553 
554  for(int i = 0; i < acc_order; i++)
555  {
556  Vmath::Svtvp(HBCPts,
557  -1*StifflyStable_Alpha_Coeffs[acc_order-1][i]/m_timestep,
558  m_acceleration[i+1], 1,
559  accelerationTerm, 1,
560  accelerationTerm, 1);
561  }
562 
563  // Subtract accleration term off m_pressureHBCs[nlevels-1]
564  int nlevels = m_pressureHBCs.num_elements();
565  Vmath::Vsub(HBCPts, m_pressureHBCs[nlevels-1],1,accelerationTerm, 1,
566  m_pressureHBCs[nlevels-1],1);
567  }
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.cpp:471
static NekDouble StifflyStable_Gamma0_Coeffs[3]
Definition: Extrapolate.h:314
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:199
Array< OneD, Array< OneD, NekDouble > > m_acceleration
Storage for current and previous levels of the acceleration term.
Definition: Extrapolate.h:274
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:247
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:238
void IProductNormVelocityBCOnHBC(Array< OneD, NekDouble > &IprodVn)
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:329
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:271
static NekDouble StifflyStable_Alpha_Coeffs[3][3]
Definition: Extrapolate.h:313
NekDouble m_timestep
Definition: Extrapolate.h:249
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 63 of file SubSteppingExtrapolate.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

69  {
71  ::AllocateSharedPtr(pSession,pFields,pPressure,pVel,advObject);
72  return p;
73  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:72
NekDouble Nektar::SubSteppingExtrapolate::GetSubstepTimeStep ( )
protected

Definition at line 390 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().

391  {
392  int n_element = m_fields[0]->GetExpSize();
393 
394  const Array<OneD, int> ExpOrder=m_fields[0]->EvalBasisNumModesMaxPerExp();
395  Array<OneD, int> ExpOrderList (n_element, ExpOrder);
396 
397  const NekDouble cLambda = 0.2; // Spencer book pag. 317
398 
399  Array<OneD, NekDouble> tstep (n_element, 0.0);
400  Array<OneD, NekDouble> stdVelocity(n_element, 0.0);
401  Array<OneD, Array<OneD, NekDouble> > velfields(m_velocity.num_elements());
402 
403  for(int i = 0; i < m_velocity.num_elements(); ++i)
404  {
405  velfields[i] = m_fields[m_velocity[i]]->UpdatePhys();
406  }
407  stdVelocity = GetMaxStdVelocity(velfields);
408 
409  for(int el = 0; el < n_element; ++el)
410  {
411  tstep[el] = m_cflSafetyFactor /
412  (stdVelocity[el] * cLambda *
413  (ExpOrder[el]-1) * (ExpOrder[el]-1));
414  }
415 
416  NekDouble TimeStep = Vmath::Vmin(n_element, tstep, 1);
417  m_comm->AllReduce(TimeStep,LibUtilities::ReduceMin);
418 
419  return TimeStep;
420  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:219
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:857
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:210
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Definition: Extrapolate.h:212
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > inarray)
double NekDouble
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 159 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().

163  {
164  int i;
165  int nVariables = inarray.num_elements();
166  int nQuadraturePts = inarray[0].num_elements();
167 
168  /// Get the number of coefficients
169  int ncoeffs = m_fields[0]->GetNcoeffs();
170 
171  /// Define an auxiliary variable to compute the RHS
172  Array<OneD, Array<OneD, NekDouble> > WeakAdv(nVariables);
173  WeakAdv[0] = Array<OneD, NekDouble> (ncoeffs*nVariables);
174  for(i = 1; i < nVariables; ++i)
175  {
176  WeakAdv[i] = WeakAdv[i-1] + ncoeffs;
177  }
178 
179  Array<OneD, Array<OneD, NekDouble> > Velfields(m_velocity.num_elements());
180  Array<OneD, int> VelIds(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:219
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
Definition: Extrapolate.h:212
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:382
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:221
NekDouble m_timestep
Definition: Extrapolate.h:249
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 487 of file SubSteppingExtrapolate.cpp.

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

Referenced by SubStepAdvection().

490  {
491  int npts = m_fields[0]->GetTotPoints();
492  int nvel = m_velocity.num_elements();
493  int i,j;
495 
496  int ord = m_intSteps;
497 
498  // calculate Lagrange interpolants
499  Vmath::Fill(4,1.0,l,1);
500 
501  for(i = 0; i <= ord; ++i)
502  {
503  for(j = 0; j <= ord; ++j)
504  {
505  if(i != j)
506  {
507  l[i] *= (j*m_timestep+toff);
508  l[i] /= (j*m_timestep-i*m_timestep);
509  }
510  }
511  }
512 
513  for(i = 0; i < nvel; ++i)
514  {
515  Vmath::Smul(npts,l[0],m_previousVelFields[i],1,ExtVel[i],1);
516 
517  for(j = 1; j <= ord; ++j)
518  {
519  Blas::Daxpy(npts,l[j],m_previousVelFields[j*nvel+i],1,
520  ExtVel[i],1);
521  }
522  }
523  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:219
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:46
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Definition: Extrapolate.h:212
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:199
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:247
static std::string npts
Definition: InputFld.cpp:43
NekDouble m_timestep
Definition: Extrapolate.h:249
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:191
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
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 78 of file SubSteppingExtrapolate.cpp.

References ASSERTL0.

79  {
80  ASSERTL0(false,"This method should not be called by Substepping routine");
81  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
LibUtilities::TimeIntegrationMethod Nektar::SubSteppingExtrapolate::v_GetSubStepIntegrationMethod ( void  )
protectedvirtual

Reimplemented from Nektar::Extrapolate.

Definition at line 569 of file SubSteppingExtrapolate.cpp.

References m_subStepIntegrationScheme.

570  {
571  return m_subStepIntegrationScheme->GetIntegrationMethod();
572  }
LibUtilities::TimeIntegrationWrapperSharedPtr m_subStepIntegrationScheme
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 528 of file SubSteppingExtrapolate.cpp.

References Vmath::Smul().

533  {
534  Vmath::Smul(HBCdata,-kinvis,Q,1,Q,1);
535  }
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:199
void Nektar::SubSteppingExtrapolate::v_SubStepAdvance ( const LibUtilities::TimeIntegrationSolutionSharedPtr integrationSoln,
int  nstep,
NekDouble  time 
)
protectedvirtual

Implements Nektar::Extrapolate.

Definition at line 323 of file SubSteppingExtrapolate.cpp.

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

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

Implements Nektar::Extrapolate.

Definition at line 84 of file SubSteppingExtrapolate.cpp.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, >::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().

87  {
88  int i;
89 
90  // Set to 1 for first step and it will then be increased in
91  // time advance routines
92  switch(intMethod)
93  {
96  {
97  std::string vSubStepIntScheme = "ForwardEuler";
98 
99  if(m_session->DefinesSolverInfo("SubStepIntScheme"))
100  {
101  vSubStepIntScheme = m_session->GetSolverInfo("SubStepIntScheme");
102  }
103 
105 
106  int nvel = m_velocity.num_elements();
107 
108  // Fields for linear interpolation
110  int ntotpts = m_fields[0]->GetTotPoints();
111  m_previousVelFields[0] = Array<OneD, NekDouble>(2*nvel*ntotpts);
112  for(i = 1; i < 2*nvel; ++i)
113  {
114  m_previousVelFields[i] = m_previousVelFields[i-1] + ntotpts;
115  }
116 
117  }
118  break;
120  {
121  std::string vSubStepIntScheme = "RungeKutta2_ImprovedEuler";
122 
123  if(m_session->DefinesSolverInfo("SubStepIntScheme"))
124  {
125  vSubStepIntScheme = m_session->GetSolverInfo("SubStepIntScheme");
126  }
127 
129 
130  int nvel = m_velocity.num_elements();
131 
132  // Fields for quadratic interpolation
134 
135  int ntotpts = m_fields[0]->GetTotPoints();
136  m_previousVelFields[0] = Array<OneD, NekDouble>(3*nvel*ntotpts);
137  for(i = 1; i < 3*nvel; ++i)
138  {
139  m_previousVelFields[i] = m_previousVelFields[i-1] + ntotpts;
140  }
141 
142  }
143  break;
144  default:
145  ASSERTL0(0,"Integration method not suitable: Options include BackwardEuler or BDFImplicitOrder1");
146  break;
147  }
148 
149  m_intSteps = IntegrationScheme->GetIntegrationSteps();
150 
151  // set explicit time-integration class operators
154  }
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:161
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:208
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:219
BDF multi-step scheme of order 1 (implicit)
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Definition: Extrapolate.h:212
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:247
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
void Nektar::SubSteppingExtrapolate::v_SubStepSaveFields ( int  nstep)
protectedvirtual

Implements Nektar::Extrapolate.

Definition at line 274 of file SubSteppingExtrapolate.cpp.

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

275  {
276  int i,n;
277  int nvel = m_velocity.num_elements();
278  int npts = m_fields[0]->GetTotPoints();
279 
280  // rotate fields
281  int nblocks = m_previousVelFields.num_elements()/nvel;
283 
284  // rotate storage space
285  for(n = 0; n < nvel; ++n)
286  {
287  save = m_previousVelFields[(nblocks-1)*nvel+n];
288 
289  for(i = nblocks-1; i > 0; --i)
290  {
291  m_previousVelFields[i*nvel+n] = m_previousVelFields[(i-1)*nvel+n];
292  }
293 
294  m_previousVelFields[n] = save;
295  }
296 
297  // Put previous field
298  for(i = 0; i < nvel; ++i)
299  {
300  m_fields[m_velocity[i]]->BwdTrans(m_fields[m_velocity[i]]->GetCoeffs(),
301  m_fields[m_velocity[i]]->UpdatePhys());
302  Vmath::Vcopy(npts,m_fields[m_velocity[i]]->GetPhys(),1,
303  m_previousVelFields[i],1);
304  }
305 
306  if(nstep == 0)// initialise all levels with first field
307  {
308  for(n = 0; n < nvel; ++n)
309  {
310  for(i = 1; i < nblocks; ++i)
311  {
312  Vmath::Vcopy(npts,m_fields[m_velocity[n]]->GetPhys(),1,
313  m_previousVelFields[i*nvel+n],1);
314 
315  }
316  }
317  }
318  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:219
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Definition: Extrapolate.h:212
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
static std::string npts
Definition: InputFld.cpp:43
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Nektar::SubSteppingExtrapolate::v_SubStepSetPressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
NekDouble  Aii_Dt,
NekDouble  kinvis 
)
protectedvirtual

Implements Nektar::Extrapolate.

Definition at line 236 of file SubSteppingExtrapolate.cpp.

References AddDuDt(), Nektar::Extrapolate::CalcNeumannPressureBCs(), Nektar::Extrapolate::CalcOutflowBCs(), Nektar::Extrapolate::CopyPressureHBCsToPbndExp(), Nektar::Extrapolate::ExtrapolatePressureHBCs(), Nektar::Extrapolate::m_fields, Nektar::Extrapolate::m_pressureCalls, Nektar::Extrapolate::m_pressureHBCs, Nektar::Extrapolate::m_velocity, and Nektar::Extrapolate::RollOver().

240  {
241  int nConvectiveFields =m_fields.num_elements()-1;
242  Array<OneD, Array<OneD, NekDouble> > velfields(nConvectiveFields);
243 
244  for(int i = 0; i < nConvectiveFields; ++i)
245  {
246  velfields[i] = m_fields[m_velocity[i]]->GetPhys();
247  }
248 
249  m_pressureCalls++;
250 
251  // Rotate HOPBCs storage
253 
254  // Calculate non-linear and viscous BCs at current level and
255  // put in m_pressureHBCs[0]
256  CalcNeumannPressureBCs(inarray,velfields,kinvis);
257 
258  // Extrapolate to m_pressureHBCs to n+1
260 
261  // Add (phi,Du/Dt) term to m_presureHBC
262  AddDuDt();
263 
264  // Copy m_pressureHBCs to m_PbndExp
266 
267  // Evaluate High order outflow conditiosn if required.
268  CalcOutflowBCs(inarray, kinvis);
269  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:219
void RollOver(Array< OneD, Array< OneD, NekDouble > > &input)
void CopyPressureHBCsToPbndExp(void)
void ExtrapolatePressureHBCs(void)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Definition: Extrapolate.h:212
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:238
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:271
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:179

Member Data Documentation

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

Name of class.

Registers the class with the Factory.

Definition at line 76 of file SubSteppingExtrapolate.h.

NekDouble Nektar::SubSteppingExtrapolate::m_cflSafetyFactor
protected
int Nektar::SubSteppingExtrapolate::m_infosteps
protected

Definition at line 148 of file SubSteppingExtrapolate.h.

Referenced by SubSteppingExtrapolate(), and v_SubStepAdvance().

int Nektar::SubSteppingExtrapolate::m_maxsubsteps
protected

Definition at line 150 of file SubSteppingExtrapolate.h.

Referenced by SubSteppingExtrapolate(), and v_SubStepAdvance().

int Nektar::SubSteppingExtrapolate::m_minsubsteps
protected

Definition at line 149 of file SubSteppingExtrapolate.h.

Referenced by SubSteppingExtrapolate(), and v_SubStepAdvance().

Array<OneD, Array<OneD, NekDouble> > Nektar::SubSteppingExtrapolate::m_previousVelFields
protected
LibUtilities::TimeIntegrationSchemeOperators Nektar::SubSteppingExtrapolate::m_subStepIntegrationOps
protected

Definition at line 143 of file SubSteppingExtrapolate.h.

Referenced by v_SubStepAdvance(), and v_SubSteppingTimeIntegration().

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