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

Boundary condition in terms of pressure, Mach number and temperature. P should be defined in the "rho" entry, T in the "E" entry and the Mach number in each direction in the corresponding momentum variable. This state is converted to conserved variables and a Dirichlet condition is applied. More...

#include <PressureMachTemperatureBC.h>

Inheritance diagram for Nektar::PressureMachTemperatureBC:
[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...
 
virtual void v_ApplyBwdWeight ()
 

Private Member Functions

 PressureMachTemperatureBC (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)
 
virtual ~PressureMachTemperatureBC (void)
 

Private Attributes

Array< OneD, Array< OneD, NekDouble > > m_bcStorage
 

Friends

class MemoryManager< PressureMachTemperatureBC >
 

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...
 
void ApplyBwdWeight ()
 Apply the Weight of 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_diffusionAveWeight
 Weight for average calculation of diffusion term. More...
 
NekDouble m_gamma
 Parameters of the flow. More...
 
NekDouble m_rhoInf
 
NekDouble m_pInf
 
NekDouble m_pOut
 
Array< OneD, NekDoublem_velInf
 
int m_bcRegion
 Id of the boundary region. More...
 
int m_offset
 Offset. More...
 

Detailed Description

Boundary condition in terms of pressure, Mach number and temperature. P should be defined in the "rho" entry, T in the "E" entry and the Mach number in each direction in the corresponding momentum variable. This state is converted to conserved variables and a Dirichlet condition is applied.

Definition at line 51 of file PressureMachTemperatureBC.h.

Constructor & Destructor Documentation

◆ PressureMachTemperatureBC()

Nektar::PressureMachTemperatureBC::PressureMachTemperatureBC ( 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 50 of file PressureMachTemperatureBC.cpp.

55  : CFSBndCond(pSession, pFields, pTraceNormals, pSpaceDim, bcRegion, cnt)
56 {
57  int nvariables = m_fields.size();
58  int numBCPts =
59  m_fields[0]->GetBndCondExpansions()[m_bcRegion]->GetNpoints();
60 
61  // Array for storing conserved variables on the boundary
62  m_bcStorage = Array<OneD, Array<OneD, NekDouble>>(nvariables);
63  for (int i = 0; i < nvariables; ++i)
64  {
65  m_bcStorage[i] = Array<OneD, NekDouble>(numBCPts, 0.0);
66  }
67 
68  // We assume that the pressure is given in entry [0] of
69  // the BC ("rho" position) and the temperature in entry m_spacedim+1
70  // ("E" position)
71  const Array<OneD, const NekDouble> pressure =
72  m_fields[0]->GetBndCondExpansions()[m_bcRegion]->GetPhys();
73  const Array<OneD, const NekDouble> temperature =
74  m_fields[m_spacedim + 1]->GetBndCondExpansions()[m_bcRegion]->GetPhys();
75 
76  // Calculate density
77  m_varConv->GetRhoFromPT(pressure, temperature, m_bcStorage[0]);
78  // Calculate the internal energy times density
79  m_varConv->GetEFromRhoP(m_bcStorage[0], pressure,
80  m_bcStorage[m_spacedim + 1]);
81  Vmath::Vmul(numBCPts, m_bcStorage[m_spacedim + 1], 1, m_bcStorage[0], 1,
82  m_bcStorage[m_spacedim + 1], 1);
83  // We can now obtain the sound speed at this (rho,e) condition
84  Array<OneD, NekDouble> soundSpeed(numBCPts);
85  m_varConv->GetSoundSpeed(m_bcStorage, soundSpeed);
86 
87  // Now update momentum and add kinetic energy to E
88  Array<OneD, NekDouble> tmp(numBCPts);
89  for (int i = 0; i < m_spacedim; ++i)
90  {
91  // tmp = velocity in i direction
93  numBCPts,
94  m_fields[i + 1]->GetBndCondExpansions()[m_bcRegion]->GetPhys(), 1,
95  soundSpeed, 1, tmp, 1);
96  // rho*u
97  Vmath::Vmul(numBCPts, m_bcStorage[0], 1, tmp, 1, m_bcStorage[i + 1], 1);
98  // tmp = 0.5 * rho *(rhou) in vel
99  Vmath::Vmul(numBCPts, m_bcStorage[i + 1], 1, tmp, 1, tmp, 1);
100  Vmath::Smul(numBCPts, 0.5, tmp, 1, tmp, 1);
101  // Add to E
102  Vmath::Vadd(numBCPts, m_bcStorage[m_spacedim + 1], 1, tmp, 1,
103  m_bcStorage[m_spacedim + 1], 1);
104  }
105 
106  // Copy to boundary condition
107  for (int i = 0; i < nvariables; ++i)
108  {
109  Vmath::Vcopy(
110  numBCPts, m_bcStorage[i], 1,
111  m_fields[i]->GetBndCondExpansions()[m_bcRegion]->UpdatePhys(), 1);
112  }
113 }
int m_spacedim
Space dimension.
Definition: CFSBndCond.h:95
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
int m_bcRegion
Id of the boundary region.
Definition: CFSBndCond.h:109
VariableConverterSharedPtr m_varConv
Auxiliary object to convert variables.
Definition: CFSBndCond.h:97
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array of fields.
Definition: CFSBndCond.h:91
Array< OneD, Array< OneD, NekDouble > > m_bcStorage
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:209
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:359
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:248
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1255

References Nektar::CFSBndCond::m_bcRegion, m_bcStorage, Nektar::CFSBndCond::m_fields, Nektar::CFSBndCond::m_spacedim, Nektar::CFSBndCond::m_varConv, CG_Iterations::pressure, Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), and Vmath::Vmul().

◆ ~PressureMachTemperatureBC()

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

Definition at line 84 of file PressureMachTemperatureBC.h.

84 {};

Member Function Documentation

◆ create()

static CFSBndCondSharedPtr Nektar::PressureMachTemperatureBC::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 57 of file PressureMachTemperatureBC.h.

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

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

◆ v_Apply()

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

Implements Nektar::CFSBndCond.

Definition at line 115 of file PressureMachTemperatureBC.cpp.

118 {
119  boost::ignore_unused(Fwd, physarray, time);
120 
121  int nvariables = m_fields.size();
122  int numBCPts =
123  m_fields[0]->GetBndCondExpansions()[m_bcRegion]->GetNpoints();
124  // Copy conserved variables to boundary condition
125  for (int i = 0; i < nvariables; ++i)
126  {
127  Vmath::Vcopy(
128  numBCPts, m_bcStorage[i], 1,
129  m_fields[i]->GetBndCondExpansions()[m_bcRegion]->UpdatePhys(), 1);
130  }
131 }

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

Friends And Related Function Documentation

◆ MemoryManager< PressureMachTemperatureBC >

friend class MemoryManager< PressureMachTemperatureBC >
friend

Definition at line 1 of file PressureMachTemperatureBC.h.

Member Data Documentation

◆ className

std::string Nektar::PressureMachTemperatureBC::className
static
Initial value:
=
"PressureMachTemperature", PressureMachTemperatureBC::create,
"BC prescribed in terms of p, Ma and T.")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:198
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.
CFSBndCondFactory & GetCFSBndCondFactory()
Declaration of the boundary condition factory singleton.
Definition: CFSBndCond.cpp:41

Name of the class.

Definition at line 70 of file PressureMachTemperatureBC.h.

◆ m_bcStorage

Array<OneD, Array<OneD, NekDouble> > Nektar::PressureMachTemperatureBC::m_bcStorage
private

Definition at line 87 of file PressureMachTemperatureBC.h.

Referenced by PressureMachTemperatureBC(), and v_Apply().