Commit c4b9406c authored by David Moxey's avatar David Moxey

Update to use external interface

parent 3f5ff6f0
......@@ -1470,33 +1470,6 @@ namespace Nektar
return null;
}
void EquationSystem::v_GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure)
{
ASSERTL0(false, "This function is not valid for the Base class");
}
void EquationSystem::v_GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density)
{
ASSERTL0(false, "This function is not valid for the Base class");
}
bool EquationSystem::v_HasConstantDensity()
{
ASSERTL0(false, "This function is not valid for the Base class");
return false;
}
void EquationSystem::v_GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity)
{
ASSERTL0(false, "This function is not valid for the Base class");
}
void EquationSystem::v_ExtraFldOutput(
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables)
......
......@@ -130,23 +130,6 @@ class Interpolator;
/// Get pressure field if available
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure();
/// Extract array with pressure from physfield
SOLVER_UTILS_EXPORT void GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure);
/// Extract array with density from physfield
SOLVER_UTILS_EXPORT void GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density);
SOLVER_UTILS_EXPORT bool HasConstantDensity();
/// Extract array with velocity from physfield
SOLVER_UTILS_EXPORT void GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity);
SOLVER_UTILS_EXPORT inline void ExtraFldOutput(
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables);
......@@ -484,23 +467,6 @@ class Interpolator;
// Get pressure field if available
SOLVER_UTILS_EXPORT virtual MultiRegions::ExpListSharedPtr v_GetPressure(void);
// Extract array with pressure from physfield
SOLVER_UTILS_EXPORT virtual void v_GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure);
// Extract array with density from physfield
SOLVER_UTILS_EXPORT virtual void v_GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density);
SOLVER_UTILS_EXPORT virtual bool v_HasConstantDensity();
// Extract array with velocity from physfield
SOLVER_UTILS_EXPORT virtual void v_GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity);
SOLVER_UTILS_EXPORT virtual void v_ExtraFldOutput(
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables);
......@@ -606,41 +572,6 @@ class Interpolator;
return v_GetPressure();
}
/**
* Extract array with pressure from physfield
*/
inline void EquationSystem::GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure)
{
v_GetPressure(physfield,pressure);
}
/**
* Extract array with density from physfield
*/
inline void EquationSystem::GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density)
{
v_GetDensity(physfield, density);
}
inline bool EquationSystem::HasConstantDensity()
{
return v_HasConstantDensity();
}
/**
* Extract array with velocity from physfield
*/
inline void EquationSystem::GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity)
{
v_GetVelocity(physfield, velocity);
}
/**
* Append the coefficients and name of variables with solver specific
* extra variables
......
......@@ -43,6 +43,7 @@
#include <MultiRegions/ExpList3D.h>
#include <MultiRegions/ExpList3DHomogeneous1D.h>
#include <SolverUtils/Filters/FilterAeroForces.h>
#include <SolverUtils/Filters/FilterInterfaces.hpp>
#include <LibUtilities/BasicUtils/ParseUtils.h>
using namespace std;
......@@ -589,6 +590,9 @@ void FilterAeroForces::CalculateForces(
auto equ = m_equ.lock();
ASSERTL0(equ, "Weak pointer expired");
auto fluidEqu = std::dynamic_pointer_cast<FluidInterface>(equ);
ASSERTL0(fluidEqu, "Aero forces filter is incompatible with this solver.");
int i, j, k, n, cnt, elmtid, nq, offset, boundary, plane;
// Get number of quadrature points and dimensions
int physTot = pFields[0]->GetNpoints();
......@@ -720,8 +724,8 @@ void FilterAeroForces::CalculateForces(
velocity[n] = Array<OneD, NekDouble>(fields[n]->GetTotPoints());
}
pressure = Array<OneD, NekDouble>(fields[0]->GetTotPoints());
equ->GetVelocity(physfields, velocity);
equ->GetPressure(physfields, pressure);
fluidEqu->GetVelocity(physfields, velocity);
fluidEqu->GetPressure(physfields, pressure);
//Loop all the Boundary Regions
for( cnt = n = 0; n < BndConds.num_elements(); n++)
......@@ -857,7 +861,7 @@ void FilterAeroForces::CalculateForces(
fv[j], 1,
fv[j], 1);
}
if(!equ->HasConstantDensity())
if(!fluidEqu->HasConstantDensity())
{
// Add gradient term
Vmath::Vvtvp (nbc, div, 1,
......
......@@ -36,6 +36,7 @@
#include <iomanip>
#include <SolverUtils/Filters/FilterEnergy.h>
#include <SolverUtils/Filters/FilterInterfaces.hpp>
using namespace std;
......@@ -48,7 +49,7 @@ std::string FilterEnergy::className = SolverUtils::GetFilterFactory().
FilterEnergy::FilterEnergy(
const LibUtilities::SessionReaderSharedPtr &pSession,
const std::weak_ptr<EquationSystem> &pEquation,
const std::weak_ptr<EquationSystem> &pEquation,
const ParamMap &pParams)
: Filter (pSession, pEquation),
m_index (-1),
......@@ -153,6 +154,9 @@ void FilterEnergy::v_Update(
auto equ = m_equ.lock();
ASSERTL0(equ, "Weak pointer expired");
auto fluidEqu = std::dynamic_pointer_cast<FluidInterface>(equ);
ASSERTL0(fluidEqu, "Energy filter is incompatible with this solver.");
// Store physical values in an array
Array<OneD, Array<OneD, NekDouble> > physfields(pFields.num_elements());
for(i = 0; i < pFields.num_elements(); ++i)
......@@ -169,7 +173,7 @@ void FilterEnergy::v_Update(
{
u[i] = Array<OneD, NekDouble>(nPoints);
}
equ->GetVelocity(physfields, u);
fluidEqu->GetVelocity(physfields, u);
for (i = 0; i < 3; ++i)
{
......@@ -181,10 +185,10 @@ void FilterEnergy::v_Update(
Vmath::Vvtvp(nPoints, u[i], 1, u[i], 1, tmp, 1, tmp, 1);
}
if (!equ->HasConstantDensity())
if (!fluidEqu->HasConstantDensity())
{
density = Array<OneD, NekDouble>(nPoints);
equ->GetDensity(physfields, density);
fluidEqu->GetDensity(physfields, density);
Vmath::Vmul(nPoints, density, 1, tmp, 1, tmp, 1);
}
......@@ -234,7 +238,7 @@ void FilterEnergy::v_Update(
Vmath::Vvtvp(nPoints, tmp2, 1, tmp2, 1, tmp, 1, tmp, 1);
}
if (!equ->HasConstantDensity())
if (!fluidEqu->HasConstantDensity())
{
Vmath::Vmul(nPoints, density, 1, tmp, 1, tmp, 1);
}
......
#ifndef NEKTAR_SOLVERUTILS_FILTERS_FILTERINTERFACES_HPP
#define NEKTAR_SOLVERUTILS_FILTERS_FILTERINTERFACES_HPP
#include <LibUtilities/BasicUtils/SharedArray.hpp>
namespace Nektar
{
namespace SolverUtils
{
class FluidInterface
{
public:
/// Extract array with velocity from physfield
SOLVER_UTILS_EXPORT virtual void GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity) = 0;
SOLVER_UTILS_EXPORT virtual bool HasConstantDensity() = 0;
/// Extract array with density from physfield
SOLVER_UTILS_EXPORT virtual void GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density) = 0;
/// Extract array with pressure from physfield
SOLVER_UTILS_EXPORT virtual void GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure) = 0;
};
}
}
#endif
......@@ -894,7 +894,7 @@ namespace Nektar
/**
*
*/
void CompressibleFlowSystem::v_GetPressure(
void CompressibleFlowSystem::GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure)
{
......@@ -904,7 +904,7 @@ namespace Nektar
/**
*
*/
void CompressibleFlowSystem::v_GetDensity(
void CompressibleFlowSystem::GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density)
{
......@@ -914,7 +914,7 @@ namespace Nektar
/**
*
*/
void CompressibleFlowSystem::v_GetVelocity(
void CompressibleFlowSystem::GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity)
{
......
......@@ -45,13 +45,15 @@
#include <SolverUtils/AdvectionSystem.h>
#include <SolverUtils/Diffusion/Diffusion.h>
#include <SolverUtils/Forcing/Forcing.h>
#include <SolverUtils/Filters/FilterInterfaces.hpp>
namespace Nektar
{
/**
*
*/
class CompressibleFlowSystem: public SolverUtils::AdvectionSystem
class CompressibleFlowSystem: public SolverUtils::AdvectionSystem,
public SolverUtils::FluidInterface
{
public:
......@@ -67,6 +69,23 @@ namespace Nektar
Array<OneD, NekDouble> GetStabilityLimitVector(
const Array<OneD,int> &ExpOrder);
virtual void GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure);
virtual void GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density);
virtual bool HasConstantDensity()
{
return false;
}
virtual void GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity);
protected:
SolverUtils::DiffusionSharedPtr m_diffusion;
ArtificialDiffusionSharedPtr m_artificialDiffusion;
......@@ -174,23 +193,6 @@ namespace Nektar
// Do nothing by default
}
virtual void v_GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure);
virtual void v_GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density);
virtual bool v_HasConstantDensity()
{
return false;
}
virtual void v_GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity);
virtual Array<OneD, NekDouble> v_GetMaxStdVelocity();
};
......
......@@ -806,7 +806,7 @@ namespace Nektar
/**
*
*/
void IncNavierStokes::v_GetPressure(
void IncNavierStokes::GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure)
{
......@@ -816,7 +816,7 @@ namespace Nektar
/**
*
*/
void IncNavierStokes::v_GetDensity(
void IncNavierStokes::GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density)
{
......@@ -827,7 +827,7 @@ namespace Nektar
/**
*
*/
void IncNavierStokes::v_GetVelocity(
void IncNavierStokes::GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity)
{
......
......@@ -42,6 +42,7 @@
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <IncNavierStokesSolver/EquationSystems/Extrapolate.h>
#include <SolverUtils/Forcing/Forcing.h>
#include <SolverUtils/Filters/FilterInterfaces.hpp>
namespace Nektar
{
......@@ -127,7 +128,8 @@ namespace Nektar
* \brief This class is the base class for Navier Stokes problems
*
*/
class IncNavierStokes: public SolverUtils::AdvectionSystem
class IncNavierStokes: public SolverUtils::AdvectionSystem,
public SolverUtils::FluidInterface
{
public:
// Destructor
......@@ -147,6 +149,23 @@ namespace Nektar
void AddForcing(const SolverUtils::ForcingSharedPtr& pForce);
virtual void GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure);
virtual void GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density);
virtual bool HasConstantDensity()
{
return true;
}
virtual void GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity);
protected:
// pointer to the extrapolation class for sub-stepping and HOPBS
......@@ -227,23 +246,6 @@ namespace Nektar
return m_pressure;
}
virtual void v_GetPressure(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &pressure);
virtual void v_GetDensity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, NekDouble> &density);
virtual bool v_HasConstantDensity()
{
return true;
}
virtual void v_GetVelocity(
const Array<OneD, const Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &velocity);
virtual void v_TransCoeffToPhys(void)
{
ASSERTL0(false,"This method is not defined in this class");
......
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