Commit bac0538a authored by Douglas Serson's avatar Douglas Serson

Move isentropic vortex and ringleb BCs to new framework

parent 226985e9
///////////////////////////////////////////////////////////////////////////////
//
// File: IsentropicVortexBC.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: Isentropic vortex boundary condition
//
///////////////////////////////////////////////////////////////////////////////
#include "IsentropicVortexBC.h"
using namespace std;
namespace Nektar
{
std::string IsentropicVortexBC::className = GetCFSBndCondFactory().
RegisterCreatorFunction("IsentropicVortex",
IsentropicVortexBC::create,
"Isentropic vortex boundary condition.");
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)
: CFSBndCond(pSession, pFields, pTraceNormals, pSpaceDim, bcRegion)
{
}
void IsentropicVortexBC::v_Apply(
int bcRegion,
int cnt,
Array<OneD, Array<OneD, NekDouble> > &Fwd,
Array<OneD, Array<OneD, NekDouble> > &physarray,
const NekDouble &time)
{
int nvariables = physarray.num_elements();
const Array<OneD, const int> &bndTraceMap = m_fields[0]->GetTraceBndMap();
// loop over Boundary Regions
int npoints, id1, id2, e_max;
e_max = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
for(int e = 0; e < e_max; ++e)
{
npoints = m_fields[0]->
GetBndCondExpansions()[bcRegion]->GetExp(e)->GetTotPoints();
id1 = m_fields[0]->
GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e);
id2 = m_fields[0]->GetTrace()->GetPhys_Offset(bndTraceMap[cnt+e]);
Array<OneD,NekDouble> x(npoints, 0.0);
Array<OneD,NekDouble> y(npoints, 0.0);
Array<OneD,NekDouble> z(npoints, 0.0);
m_fields[0]->GetBndCondExpansions()[bcRegion]->
GetExp(e)->GetCoords(x, y, z);
EvaluateIsentropicVortex(x, y, z, Fwd, time, id2);
for (int i = 0; i < nvariables; ++i)
{
Vmath::Vcopy(npoints, &Fwd[i][id2], 1,
&(m_fields[i]->GetBndCondExpansions()[bcRegion]->
UpdatePhys())[id1], 1);
}
}
}
void 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)
{
int nq = x.num_elements();
// Flow parameters
const NekDouble x0 = 5.0;
const NekDouble y0 = 0.0;
const NekDouble beta = 5.0;
const NekDouble u0 = 1.0;
const NekDouble v0 = 0.5;
const NekDouble gamma = m_gamma;
NekDouble r, xbar, ybar, tmp;
NekDouble fac = 1.0/(16.0*gamma*M_PI*M_PI);
// In 3D zero rhow field.
if (m_spacedim == 3)
{
Vmath::Zero(nq, &u[3][o], 1);
}
// Fill storage
for (int i = 0; i < nq; ++i)
{
xbar = x[i] - u0*time - x0;
ybar = y[i] - v0*time - y0;
r = sqrt(xbar*xbar + ybar*ybar);
tmp = beta*exp(1-r*r);
u[0][i+o] = pow(1.0 - (gamma-1.0)*tmp*tmp*fac, 1.0/(gamma-1.0));
u[1][i+o] = u[0][i+o]*(u0 - tmp*ybar/(2*M_PI));
u[2][i+o] = u[0][i+o]*(v0 + tmp*xbar/(2*M_PI));
u[m_spacedim+1][i+o] = pow(u[0][i+o], gamma)/(gamma-1.0) +
0.5*(u[1][i+o]*u[1][i+o] + u[2][i+o]*u[2][i+o]) / u[0][i+o];
}
}
}
///////////////////////////////////////////////////////////////////////////////
//
// File: IsentropicVortexBC.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: Isentropic vortex boundary condition
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_BNDCOND_ISENTROPICVORTEXBC
#define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_BNDCOND_ISENTROPICVORTEXBC
#include "CFSBndCond.h"
namespace Nektar
{
/**
* @brief Wall boundary conditions for compressible flow problems.
*/
class IsentropicVortexBC : public CFSBndCond
{
public:
friend class MemoryManager<IsentropicVortexBC>;
/// 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)
{
CFSBndCondSharedPtr p = MemoryManager<IsentropicVortexBC>::
AllocateSharedPtr(pSession, pFields,
pTraceNormals, pSpaceDim, bcRegion);
return p;
}
///Name of the class
static std::string className;
protected:
virtual void v_Apply(
int bcRegion,
int cnt,
Array<OneD, Array<OneD, NekDouble> > &Fwd,
Array<OneD, Array<OneD, NekDouble> > &physarray,
const NekDouble &time);
private:
IsentropicVortexBC(const LibUtilities::SessionReaderSharedPtr& pSession,
const Array<OneD, MultiRegions::ExpListSharedPtr>& pFields,
const Array<OneD, Array<OneD, NekDouble> >& pTraceNormals,
const int pSpaceDim,
const int bcRegion);
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){};
};
}
#endif
///////////////////////////////////////////////////////////////////////////////
//
// File: RinglebFlowBC.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: Ringleb flow boundary condition
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_BNDCOND_RINGLEBFLOWBC
#define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_BNDCOND_RINGLEBFLOWBC
#include "CFSBndCond.h"
namespace Nektar
{
/**
* @brief Wall boundary conditions for compressible flow problems.
*/
class RinglebFlowBC : public CFSBndCond
{
public:
friend class MemoryManager<RinglebFlowBC>;
/// 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)
{
CFSBndCondSharedPtr p = MemoryManager<RinglebFlowBC>::
AllocateSharedPtr(pSession, pFields,
pTraceNormals, pSpaceDim, bcRegion);
return p;
}
///Name of the class
static std::string className;
protected:
virtual void v_Apply(
int bcRegion,
int cnt,
Array<OneD, Array<OneD, NekDouble> > &Fwd,
Array<OneD, Array<OneD, NekDouble> > &physarray,
const NekDouble &time);
private:
RinglebFlowBC(const LibUtilities::SessionReaderSharedPtr& pSession,
const Array<OneD, MultiRegions::ExpListSharedPtr>& pFields,
const Array<OneD, Array<OneD, NekDouble> >& pTraceNormals,
const int pSpaceDim,
const int bcRegion);
virtual ~RinglebFlowBC(void){};
int m_expdim;
bool m_homo1D;
};
}
#endif
......@@ -6,11 +6,13 @@ IF( NEKTAR_SOLVER_COMPRESSIBLE_FLOW )
SET(CompressibleFlowSolverSource
./BoundaryConditions/CFSBndCond.cpp
./BoundaryConditions/ExtrapOrder0BC.cpp
./BoundaryConditions/IsentropicVortexBC.cpp
./BoundaryConditions/PressureInflowFileBC.cpp
./BoundaryConditions/PressureOutflowBC.cpp
./BoundaryConditions/PressureOutflowFileBC.cpp
./BoundaryConditions/PressureOutflowNonReflectiveBC.cpp
./BoundaryConditions/RiemannInvariantBC.cpp
./BoundaryConditions/RinglebFlowBC.cpp
./BoundaryConditions/SymmetryBC.cpp
./BoundaryConditions/TimeDependentBC.cpp
./BoundaryConditions/WallBC.cpp
......
......@@ -134,58 +134,6 @@ namespace Nektar
Vmath::Vcopy(nTotQuadPoints, u[field], 1, outfield, 1);
}
/**
* @brief Set the boundary conditions for the isentropic vortex problem.
*/
void IsentropicVortex::v_SetBoundaryConditions(
Array<OneD, Array<OneD, NekDouble> > &physarray,
NekDouble time)
{
int cnt = 0;
int nTracePts = GetTraceTotPoints();
int nvariables = physarray.num_elements();
Array<OneD, Array<OneD, NekDouble> > Fwd(nvariables);
for (int i = 0; i < nvariables; ++i)
{
Fwd[i] = Array<OneD, NekDouble>(nTracePts);
m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]);
}
const Array<OneD, const int> &bndTraceMap = m_fields[0]->GetTraceBndMap();
// loop over Boundary Regions
int id2, e_max;
for (int n = 0; n < m_fields[0]->GetBndConditions().num_elements(); ++n)
{
e_max = m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
for(int e = 0; e < e_max; ++e)
{
int npoints = m_fields[0]->
GetBndCondExpansions()[n]->GetExp(e)->GetTotPoints();
int id1 = m_fields[0]->
GetBndCondExpansions()[n]->GetPhys_Offset(e);
id2 = m_fields[0]->GetTrace()->GetPhys_Offset(bndTraceMap[cnt++]);
Array<OneD,NekDouble> x(npoints, 0.0);
Array<OneD,NekDouble> y(npoints, 0.0);
Array<OneD,NekDouble> z(npoints, 0.0);
m_fields[0]->GetBndCondExpansions()[n]->
GetExp(e)->GetCoords(x, y, z);
EvaluateIsentropicVortex(x, y, z, Fwd, time, id2);
for (int i = 0; i < nvariables; ++i)
{
Vmath::Vcopy(npoints, &Fwd[i][id2], 1,
&(m_fields[i]->GetBndCondExpansions()[n]->
UpdatePhys())[id1], 1);
}
}
}
}
void IsentropicVortex::EvaluateIsentropicVortex(
const Array<OneD, NekDouble> &x,
const Array<OneD, NekDouble> &y,
......
......@@ -76,10 +76,6 @@ namespace Nektar
Array<OneD, NekDouble> &outfield,
const NekDouble time = 0.0);
virtual void v_SetBoundaryConditions(
Array<OneD, Array<OneD, NekDouble> > &physarray,
NekDouble time);
private:
/// Isentropic Vortex Test Case.
void EvaluateIsentropicVortex(
......
......@@ -71,21 +71,11 @@ namespace Nektar
Array<OneD, NekDouble> &outfield,
const NekDouble time = 0.0);
virtual void v_SetBoundaryConditions(
Array<OneD, Array<OneD, NekDouble> > &physarray,
NekDouble time);
private:
/// Ringleb Flow Test Case.
void GetExactRinglebFlow(
int field,
Array<OneD, NekDouble> &outarray);
void SetBoundaryRinglebFlow(
int bcRegion,
NekDouble time,
int cnt,
Array<OneD, Array<OneD, NekDouble> > &Fwd,
Array<OneD, Array<OneD, NekDouble> > &physarray);
};
}
#endif
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