Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Nektar::PressureOutflowFileBC Class Reference

Pressure outflow boundary conditions for compressible flow problems. More...

#include <PressureOutflowFileBC.h>

Inheritance diagram for Nektar::PressureOutflowFileBC:
Inheritance graph
[legend]
Collaboration diagram for Nektar::PressureOutflowFileBC:
Collaboration graph
[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

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

Private Attributes

Array< OneD, NekDoublem_pressureStorage
 

Friends

class MemoryManager< PressureOutflowFileBC >
 

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::ExpListSharedPtr
m_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

Pressure outflow boundary conditions for compressible flow problems.

Definition at line 49 of file PressureOutflowFileBC.h.

Constructor & Destructor Documentation

Nektar::PressureOutflowFileBC::PressureOutflowFileBC ( 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 48 of file PressureOutflowFileBC.cpp.

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

55  : CFSBndCond(pSession, pFields, pTraceNormals, pSpaceDim, bcRegion, cnt)
56 {
57  int nvariables = m_fields.num_elements();
58  // Loop over Boundary Regions for PressureOutflowFileBC
59 
60  Array<OneD, Array<OneD, NekDouble> > tmpStorage(nvariables);
61 
62  int numBCPts = m_fields[0]->
63  GetBndCondExpansions()[m_bcRegion]->GetNpoints();
64  m_pressureStorage = Array<OneD, NekDouble>(numBCPts, 0.0);
65  for (int i = 0; i < nvariables; ++i)
66  {
67  tmpStorage[i] = Array<OneD, NekDouble>(numBCPts, 0.0);
68 
70  numBCPts,
71  m_fields[i]->GetBndCondExpansions()[m_bcRegion]->GetPhys(), 1,
72  tmpStorage[i], 1);
73  }
74 
75  // Get Pressure
76  m_pressureStorage = Array<OneD, NekDouble> (numBCPts, 0.0);
77  m_varConv->GetPressure(tmpStorage, m_pressureStorage);
78 }
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:51
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array of fields.
Definition: CFSBndCond.h:86
Array< OneD, NekDouble > m_pressureStorage
VariableConverterSharedPtr m_varConv
Auxiliary object to convert variables.
Definition: CFSBndCond.h:92
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
int m_bcRegion
Id of the boundary region.
Definition: CFSBndCond.h:101
virtual Nektar::PressureOutflowFileBC::~PressureOutflowFileBC ( void  )
inlineprivatevirtual

Definition at line 86 of file PressureOutflowFileBC.h.

86 {};

Member Function Documentation

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

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

61  {
63  AllocateSharedPtr(pSession, pFields,
64  pTraceNormals, pSpaceDim, bcRegion, cnt);
65  return p;
66  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< CFSBndCond > CFSBndCondSharedPtr
A shared pointer to a boundary condition object.
Definition: CFSBndCond.h:49
void Nektar::PressureOutflowFileBC::v_Apply ( Array< OneD, Array< OneD, NekDouble > > &  Fwd,
Array< OneD, Array< OneD, NekDouble > > &  physarray,
const NekDouble time 
)
protectedvirtual

Implements Nektar::CFSBndCond.

Definition at line 80 of file PressureOutflowFileBC.cpp.

References Nektar::CFSBndCond::m_bcRegion, Nektar::CFSBndCond::m_fields, Nektar::CFSBndCond::m_gamma, Nektar::CFSBndCond::m_offset, m_pressureStorage, Nektar::CFSBndCond::m_spacedim, Nektar::CFSBndCond::m_traceNormals, Nektar::CFSBndCond::m_varConv, npts, Vmath::Vabs(), Vmath::Vdiv(), and Vmath::Vvtvp().

84 {
85  int i, j;
86  int nTracePts = m_fields[0]->GetTrace()->GetNpoints();
87  int nVariables = physarray.num_elements();
88  int nDimensions = m_spacedim;
89 
90  const Array<OneD, const int> &traceBndMap
91  = m_fields[0]->GetTraceBndMap();
92 
93  NekDouble gammaMinusOne = m_gamma - 1.0;
94  NekDouble gammaMinusOneInv = 1.0 / gammaMinusOne;
95 
96  // Computing the normal velocity for characteristics coming
97  // from inside the computational domain
98  Array<OneD, NekDouble > Vn (nTracePts, 0.0);
99  Array<OneD, NekDouble > Vel(nTracePts, 0.0);
100  for (i = 0; i < nDimensions; ++i)
101  {
102  Vmath::Vdiv(nTracePts, Fwd[i+1], 1, Fwd[0], 1, Vel, 1);
103  Vmath::Vvtvp(nTracePts, m_traceNormals[i], 1, Vel, 1, Vn, 1, Vn, 1);
104  }
105 
106  // Computing the absolute value of the velocity in order to compute the
107  // Mach number to decide whether supersonic or subsonic
108  Array<OneD, NekDouble > absVel(nTracePts, 0.0);
109  m_varConv->GetAbsoluteVelocity(Fwd, absVel);
110 
111  // Get speed of sound
112  Array<OneD, NekDouble > pressure (nTracePts);
113  Array<OneD, NekDouble > soundSpeed(nTracePts);
114 
115  m_varConv->GetPressure(Fwd, pressure);
116  m_varConv->GetSoundSpeed(Fwd, pressure, soundSpeed);
117 
118  // Get Mach
119  Array<OneD, NekDouble > Mach(nTracePts, 0.0);
120  Vmath::Vdiv(nTracePts, Vn, 1, soundSpeed, 1, Mach, 1);
121  Vmath::Vabs(nTracePts, Mach, 1, Mach, 1);
122 
123  // Auxiliary variables
124  int e, id1, id2, npts, pnt;
125  NekDouble rhoeb;
126 
127  // Loop on the m_bcRegions
128  for (e = 0; e < m_fields[0]->GetBndCondExpansions()[m_bcRegion]->
129  GetExpSize(); ++e)
130  {
131  npts = m_fields[0]->GetBndCondExpansions()[m_bcRegion]->
132  GetExp(e)->GetTotPoints();
133  id1 = m_fields[0]->GetBndCondExpansions()[m_bcRegion]->
134  GetPhys_Offset(e);
135  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[m_offset+e]);
136 
137  // Loop on points of m_bcRegion 'e'
138  for (i = 0; i < npts; i++)
139  {
140  pnt = id2+i;
141 
142  // Subsonic flows
143  if (Mach[pnt] < 0.99)
144  {
145  // Kinetic energy calculation
146  NekDouble Ek = 0.0;
147  for (j = 1; j < nVariables-1; ++j)
148  {
149  Ek += 0.5 * (Fwd[j][pnt] * Fwd[j][pnt]) / Fwd[0][pnt];
150  }
151 
152  rhoeb = m_pressureStorage[id1+i] * gammaMinusOneInv + Ek;
153 
154  // Partial extrapolation for subsonic cases
155  for (j = 0; j < nVariables-1; ++j)
156  {
157  (m_fields[j]->GetBndCondExpansions()[m_bcRegion]->
158  UpdatePhys())[id1+i] = Fwd[j][pnt];
159  }
160 
161  (m_fields[nVariables-1]->GetBndCondExpansions()[m_bcRegion]->
162  UpdatePhys())[id1+i] = rhoeb;
163  }
164  // Supersonic flows
165  else
166  {
167  for (j = 0; j < nVariables; ++j)
168  {
169  // Extrapolation for supersonic cases
170  (m_fields[j]->GetBndCondExpansions()[m_bcRegion]->
171  UpdatePhys())[id1+i] = Fwd[j][pnt];
172  }
173  }
174  }
175  }
176 }
int m_spacedim
Space dimension.
Definition: CFSBndCond.h:90
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:442
void Vdiv(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:241
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array of fields.
Definition: CFSBndCond.h:86
void Vabs(int n, const T *x, const int incx, T *y, const int incy)
vabs: y = |x|
Definition: Vmath.cpp:424
Array< OneD, NekDouble > m_pressureStorage
static std::string npts
Definition: InputFld.cpp:43
double NekDouble
NekDouble m_gamma
Parameters of the flow.
Definition: CFSBndCond.h:95
VariableConverterSharedPtr m_varConv
Auxiliary object to convert variables.
Definition: CFSBndCond.h:92
int m_offset
Offset.
Definition: CFSBndCond.h:103
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Trace normals.
Definition: CFSBndCond.h:88
int m_bcRegion
Id of the boundary region.
Definition: CFSBndCond.h:101

Friends And Related Function Documentation

friend class MemoryManager< PressureOutflowFileBC >
friend

Definition at line 53 of file PressureOutflowFileBC.h.

Member Data Documentation

std::string Nektar::PressureOutflowFileBC::className
static
Initial value:
RegisterCreatorFunction("PressureOutflowFile",
"Pressure outflow (file) boundary condition.")

Name of the class.

Definition at line 69 of file PressureOutflowFileBC.h.

Array<OneD, NekDouble> Nektar::PressureOutflowFileBC::m_pressureStorage
private

Definition at line 86 of file PressureOutflowFileBC.h.

Referenced by PressureOutflowFileBC(), and v_Apply().