Commit e889c975 authored by Douglas Serson's avatar Douglas Serson

Create bc for inflow stagnation conditions

parent 10521d0f
///////////////////////////////////////////////////////////////////////////////
//
// File: StagnationInflowBC.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Stagnation conditions inflow boundary condition
//
///////////////////////////////////////////////////////////////////////////////
#include "StagnationInflowBC.h"
using namespace std;
namespace Nektar
{
std::string StagnationInflowBC::className = GetCFSBndCondFactory().
RegisterCreatorFunction("StagnationInflow",
StagnationInflowBC::create,
"Stagnation conditions inflow boundary condition.");
StagnationInflowBC::StagnationInflowBC(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)
: CFSBndCond(pSession, pFields, pTraceNormals, pSpaceDim, bcRegion, cnt)
{
int nvariables = m_fields.num_elements();
// Loop over Boundary Regions for StagnationInflowBC
m_fieldStorage = Array<OneD, Array<OneD, NekDouble> > (nvariables);
int numBCPts = m_fields[0]->
GetBndCondExpansions()[m_bcRegion]->GetNpoints();
for (int i = 0; i < nvariables; ++i)
{
m_fieldStorage[i] = Array<OneD, NekDouble>(numBCPts, 0.0);
Vmath::Vcopy(
numBCPts,
m_fields[i]->GetBndCondExpansions()[m_bcRegion]->GetPhys(), 1,
m_fieldStorage[i], 1);
}
}
void StagnationInflowBC::v_Apply(
Array<OneD, Array<OneD, NekDouble> > &Fwd,
Array<OneD, Array<OneD, NekDouble> > &physarray,
const NekDouble &time)
{
int i, j;
int nTracePts = m_fields[0]->GetTrace()->GetNpoints();
int nVariables = physarray.num_elements();
const Array<OneD, const int> &traceBndMap
= m_fields[0]->GetTraceBndMap();
NekDouble gammaInv = 1.0 / m_gamma;
// Get pressure
Array<OneD, NekDouble > pressure (nTracePts);
Array<OneD, NekDouble > pRef (nTracePts);
m_varConv->GetPressure(Fwd, pressure);
m_varConv->GetPressure(m_fieldStorage, pRef);
// Auxiliary variables
int e, id1, id2, npts, pnt;
NekDouble rho;
// Loop on the m_bcRegions
for (e = 0; e < m_fields[0]->GetBndCondExpansions()[m_bcRegion]->
GetExpSize(); ++e)
{
npts = m_fields[0]->GetBndCondExpansions()[m_bcRegion]->
GetExp(e)->GetTotPoints();
id1 = m_fields[0]->GetBndCondExpansions()[m_bcRegion]->
GetPhys_Offset(e);
id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[m_offset+e]);
// Loop on points of m_bcRegion 'e'
for (i = 0; i < npts; i++)
{
pnt = id2 + i;
// Density from isentropic relation: rho = rhoRef *(p/pRef)^1/Gamma
rho = m_fieldStorage[0][id1+i] *
pow(pressure[pnt]/pRef[pnt],gammaInv);
(m_fields[0]->GetBndCondExpansions()[m_bcRegion]->
UpdatePhys())[id1+i] = rho;
// Extrapolation for velocity
for (j = 1; j < nVariables-1; ++j)
{
(m_fields[j]->GetBndCondExpansions()[m_bcRegion]->
UpdatePhys())[id1+i] = Fwd[j][pnt];
}
// Prescribed energy
(m_fields[nVariables-1]->GetBndCondExpansions()[m_bcRegion]->
UpdatePhys())[id1+i] = m_fieldStorage[nVariables-1][id1+i];
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
//
// File: StagnationInflowBC.h
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Stagnation conditions inflow boundary condition
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_BNDCOND_STAGINFLOWBC
#define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_BNDCOND_STAGINFLOWBC
#include "CFSBndCond.h"
namespace Nektar
{
/**
* @brief Stagnation conditions inflow boundary conditions
* for compressible flow problems where the energy and density are prescribed
*/
class StagnationInflowBC : public CFSBndCond
{
public:
friend class MemoryManager<StagnationInflowBC>;
/// Creates an instance of this class
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)
{
CFSBndCondSharedPtr p = MemoryManager<StagnationInflowBC>::
AllocateSharedPtr(pSession, pFields,
pTraceNormals, pSpaceDim, bcRegion, cnt);
return p;
}
///Name of the class
static std::string className;
protected:
virtual void v_Apply(
Array<OneD, Array<OneD, NekDouble> > &Fwd,
Array<OneD, Array<OneD, NekDouble> > &physarray,
const NekDouble &time);
private:
StagnationInflowBC(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 ~StagnationInflowBC(void){};
// Field storage for StagnationInflowBC
Array<OneD, Array<OneD, NekDouble> > m_fieldStorage;
};
}
#endif
......@@ -16,6 +16,7 @@ IF( NEKTAR_SOLVER_COMPRESSIBLE_FLOW )
./BoundaryConditions/PressureOutflowNonReflectiveBC.cpp
./BoundaryConditions/RiemannInvariantBC.cpp
./BoundaryConditions/RinglebFlowBC.cpp
./BoundaryConditions/StagnationInflowBC.cpp
./BoundaryConditions/SymmetryBC.cpp
./BoundaryConditions/TimeDependentBC.cpp
./BoundaryConditions/WallBC.cpp
......
......@@ -59,7 +59,8 @@ void ForcingNozzle::v_InitObject(
m_varConv = MemoryManager<VariableConverter>::AllocateSharedPtr(
m_session, 1);
ASSERTL0( pNumForcingFields == 3, "NozzleForcing requires a 1D problem.");
ASSERTL0( pFields[0]->GetGraph()->GetSpaceDimension() == 1,
"NozzleForcing requires a 1D problem.");
const TiXmlElement* funcNameElmt = pForce->FirstChildElement("AREAFCN");
if(!funcNameElmt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment