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

Wall boundary conditions for compressible flow problems. More...

#include <IsentropicVortexBC.h>

Inheritance diagram for Nektar::IsentropicVortexBC:
[legend]

Static Public Member Functions

static CFSBndCondSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &pTraceNormals, const int pSpaceDim, const int bcRegion, const int cnt)
 Creates an instance of this class. More...
 

Static Public Attributes

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

Protected Member Functions

virtual void v_Apply (Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray, const NekDouble &time)
 
- Protected Member Functions inherited from Nektar::CFSBndCond
 CFSBndCond (const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &pTraceNormals, const int pSpaceDim, const int bcRegion, const int cnt)
 Constructor. More...
 

Private Member Functions

 IsentropicVortexBC (const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &pTraceNormals, const int pSpaceDim, const int bcRegion, const int cnt)
 
void EvaluateIsentropicVortex (const Array< OneD, NekDouble > &x, const Array< OneD, NekDouble > &y, const Array< OneD, NekDouble > &z, Array< OneD, Array< OneD, NekDouble > > &u, NekDouble time, const int o=0)
 
virtual ~IsentropicVortexBC (void)
 

Friends

class MemoryManager< IsentropicVortexBC >
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::CFSBndCond
virtual ~CFSBndCond ()
 
void Apply (Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray, const NekDouble &time=0)
 Apply the boundary condition. More...
 
- Protected Attributes inherited from Nektar::CFSBndCond
LibUtilities::SessionReaderSharedPtr m_session
 Session reader. More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Array of fields. More...
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 Trace normals. More...
 
int m_spacedim
 Space dimension. More...
 
VariableConverterSharedPtr m_varConv
 Auxiliary object to convert variables. More...
 
NekDouble m_gamma
 Parameters of the flow. More...
 
NekDouble m_rhoInf
 
NekDouble m_pInf
 
Array< OneD, NekDoublem_velInf
 
int m_bcRegion
 Id of the boundary region. More...
 
int m_offset
 Offset. More...
 

Detailed Description

Wall boundary conditions for compressible flow problems.

Definition at line 47 of file IsentropicVortexBC.h.

Constructor & Destructor Documentation

◆ IsentropicVortexBC()

Nektar::IsentropicVortexBC::IsentropicVortexBC ( const LibUtilities::SessionReaderSharedPtr pSession,
const Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields,
const Array< OneD, Array< OneD, NekDouble > > &  pTraceNormals,
const int  pSpaceDim,
const int  bcRegion,
const int  cnt 
)
private

Definition at line 49 of file IsentropicVortexBC.cpp.

55  : CFSBndCond(pSession, pFields, pTraceNormals, pSpaceDim, bcRegion, cnt)
56 {
57 }
CFSBndCond(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &pTraceNormals, const int pSpaceDim, const int bcRegion, const int cnt)
Constructor.
Definition: CFSBndCond.cpp:47

◆ ~IsentropicVortexBC()

virtual Nektar::IsentropicVortexBC::~IsentropicVortexBC ( void  )
inlineprivatevirtual

Definition at line 92 of file IsentropicVortexBC.h.

92 {};

Member Function Documentation

◆ create()

static CFSBndCondSharedPtr Nektar::IsentropicVortexBC::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields,
const Array< OneD, Array< OneD, NekDouble > > &  pTraceNormals,
const int  pSpaceDim,
const int  bcRegion,
const int  cnt 
)
inlinestatic

Creates an instance of this class.

Definition at line 54 of file IsentropicVortexBC.h.

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

59  {
61  AllocateSharedPtr(pSession, pFields,
62  pTraceNormals, pSpaceDim, bcRegion, cnt);
63  return p;
64  }
std::shared_ptr< CFSBndCond > CFSBndCondSharedPtr
A shared pointer to a boundary condition object.
Definition: CFSBndCond.h:48
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ EvaluateIsentropicVortex()

void Nektar::IsentropicVortexBC::EvaluateIsentropicVortex ( const Array< OneD, NekDouble > &  x,
const Array< OneD, NekDouble > &  y,
const Array< OneD, NekDouble > &  z,
Array< OneD, Array< OneD, NekDouble > > &  u,
NekDouble  time,
const int  o = 0 
)
private

Definition at line 98 of file IsentropicVortexBC.cpp.

References Nektar::CFSBndCond::m_gamma, Nektar::CFSBndCond::m_spacedim, and Vmath::Zero().

Referenced by v_Apply().

105 {
106  boost::ignore_unused(z);
107 
108  int nq = x.num_elements();
109 
110  // Flow parameters
111  const NekDouble x0 = 5.0;
112  const NekDouble y0 = 0.0;
113  const NekDouble beta = 5.0;
114  const NekDouble u0 = 1.0;
115  const NekDouble v0 = 0.5;
116  const NekDouble gamma = m_gamma;
117  NekDouble r, xbar, ybar, tmp;
118  NekDouble fac = 1.0/(16.0*gamma*M_PI*M_PI);
119 
120  // In 3D zero rhow field.
121  if (m_spacedim == 3)
122  {
123  Vmath::Zero(nq, &u[3][o], 1);
124  }
125 
126  // Fill storage
127  for (int i = 0; i < nq; ++i)
128  {
129  xbar = x[i] - u0*time - x0;
130  ybar = y[i] - v0*time - y0;
131  r = sqrt(xbar*xbar + ybar*ybar);
132  tmp = beta*exp(1-r*r);
133  u[0][i+o] = pow(1.0 - (gamma-1.0)*tmp*tmp*fac, 1.0/(gamma-1.0));
134  u[1][i+o] = u[0][i+o]*(u0 - tmp*ybar/(2*M_PI));
135  u[2][i+o] = u[0][i+o]*(v0 + tmp*xbar/(2*M_PI));
136  u[m_spacedim+1][i+o] = pow(u[0][i+o], gamma)/(gamma-1.0) +
137  0.5*(u[1][i+o]*u[1][i+o] + u[2][i+o]*u[2][i+o]) / u[0][i+o];
138  }
139 }
int m_spacedim
Space dimension.
Definition: CFSBndCond.h:89
double NekDouble
NekDouble m_gamma
Parameters of the flow.
Definition: CFSBndCond.h:94
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:376

◆ v_Apply()

void Nektar::IsentropicVortexBC::v_Apply ( Array< OneD, Array< OneD, NekDouble > > &  Fwd,
Array< OneD, Array< OneD, NekDouble > > &  physarray,
const NekDouble time 
)
protectedvirtual

Implements Nektar::CFSBndCond.

Definition at line 59 of file IsentropicVortexBC.cpp.

References EvaluateIsentropicVortex(), Nektar::CFSBndCond::m_bcRegion, Nektar::CFSBndCond::m_fields, Nektar::CFSBndCond::m_offset, and Vmath::Vcopy().

63 {
64  int nvariables = physarray.num_elements();
65 
66  const Array<OneD, const int> &bndTraceMap = m_fields[0]->GetTraceBndMap();
67  // loop over Boundary Regions
68  int npoints, id1, id2, e_max;
69 
70  e_max = m_fields[0]->GetBndCondExpansions()[m_bcRegion]->GetExpSize();
71 
72  for(int e = 0; e < e_max; ++e)
73  {
74  npoints = m_fields[0]->
75  GetBndCondExpansions()[m_bcRegion]->GetExp(e)->GetTotPoints();
76  id1 = m_fields[0]->
77  GetBndCondExpansions()[m_bcRegion]->GetPhys_Offset(e);
78  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(bndTraceMap[m_offset+e]);
79 
80  Array<OneD,NekDouble> x(npoints, 0.0);
81  Array<OneD,NekDouble> y(npoints, 0.0);
82  Array<OneD,NekDouble> z(npoints, 0.0);
83 
84  m_fields[0]->GetBndCondExpansions()[m_bcRegion]->
85  GetExp(e)->GetCoords(x, y, z);
86 
87  EvaluateIsentropicVortex(x, y, z, Fwd, time, id2);
88 
89  for (int i = 0; i < nvariables; ++i)
90  {
91  Vmath::Vcopy(npoints, &Fwd[i][id2], 1,
92  &(m_fields[i]->GetBndCondExpansions()[m_bcRegion]->
93  UpdatePhys())[id1], 1);
94  }
95  }
96 }
void EvaluateIsentropicVortex(const Array< OneD, NekDouble > &x, const Array< OneD, NekDouble > &y, const Array< OneD, NekDouble > &z, Array< OneD, Array< OneD, NekDouble > > &u, NekDouble time, const int o=0)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array of fields.
Definition: CFSBndCond.h:85
int m_offset
Offset.
Definition: CFSBndCond.h:102
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
int m_bcRegion
Id of the boundary region.
Definition: CFSBndCond.h:100

Friends And Related Function Documentation

◆ MemoryManager< IsentropicVortexBC >

friend class MemoryManager< IsentropicVortexBC >
friend

Definition at line 51 of file IsentropicVortexBC.h.

Member Data Documentation

◆ className

std::string Nektar::IsentropicVortexBC::className
static
Initial value:
RegisterCreatorFunction("IsentropicVortex",
"Isentropic vortex boundary condition.")

Name of the class.

Definition at line 67 of file IsentropicVortexBC.h.