Commit 2ffa5b51 authored by Bastien Jordi's avatar Bastien Jordi
Browse files

New Advection::Advec function with the time as input parameter

parent c15edd95
......@@ -61,7 +61,18 @@ namespace Nektar
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)
{
v_Advect(nConvectiveFields, fields, advVel, inarray, outarray);
v_Advect(nConvectiveFields, fields, advVel, inarray, outarray, 0.0);
}
void Advection::Advect(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time)
{
v_Advect(nConvectiveFields, fields, advVel, inarray, outarray, time);
}
void Advection::v_InitObject(
......
......@@ -55,92 +55,108 @@ namespace Nektar
typedef boost::function<void (
const Array<OneD, Array<OneD, NekDouble> >&,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&)>
AdvectionFluxVecCB;
/**
* @brief An abstract base class encapsulating the concept of advection
* of a vector field.
*
* Subclasses override the Advection::v_InitObject function to
* initialise the object and the Advection::v_Advect function to
* evaluate the advection of the vector field.
*/
class Advection
{
public:
SOLVER_UTILS_EXPORT void InitObject(
LibUtilities::SessionReaderSharedPtr pSession,
Array<OneD, MultiRegions::ExpListSharedPtr> pFields);
SOLVER_UTILS_EXPORT void Advect(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray);
/**
* @brief Set the flux vector callback function.
*
* This routine is a utility function to avoid the explicit use of
* boost::bind. A function and object can be passed to this function
* instead.
*/
template<typename FuncPointerT, typename ObjectPointerT>
void SetFluxVector(FuncPointerT func, ObjectPointerT obj)
{
m_fluxVector = boost::bind(func, obj, _1, _2);
}
/**
* @brief Set a Riemann solver object for this advection object.
*
* @param riemann The RiemannSolver object.
*/
inline void SetRiemannSolver(RiemannSolverSharedPtr riemann)
{
m_riemann = riemann;
}
AdvectionFluxVecCB;
/**
* @brief Set the flux vector callback function.
* @brief An abstract base class encapsulating the concept of advection
* of a vector field.
*
* @param fluxVector The callback function to override.
* Subclasses override the Advection::v_InitObject function to
* initialise the object and the Advection::v_Advect function to
* evaluate the advection of the vector field.
*/
inline void SetFluxVector(AdvectionFluxVecCB fluxVector)
class Advection
{
m_fluxVector = fluxVector;
}
protected:
virtual void v_InitObject(
LibUtilities::SessionReaderSharedPtr pSession,
Array<OneD, MultiRegions::ExpListSharedPtr> pFields);
virtual void v_Advect(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)=0;
/// Callback function to the flux vector (set when advection is in
/// conservative form).
AdvectionFluxVecCB m_fluxVector;
/// Riemann solver for DG-type schemes.
RiemannSolverSharedPtr m_riemann;
/// Storage for space dimension. Used for homogeneous extension.
int m_spaceDim;
};
/// A shared pointer to an Advection object.
typedef boost::shared_ptr<Advection> AdvectionSharedPtr;
/// Datatype of the NekFactory used to instantiate classes derived
/// from the Advection class.
typedef LibUtilities::NekFactory<std::string, Advection,
public:
SOLVER_UTILS_EXPORT void InitObject(
LibUtilities::SessionReaderSharedPtr pSession,
Array<OneD, MultiRegions::ExpListSharedPtr> pFields);
SOLVER_UTILS_EXPORT void Advect(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray);
SOLVER_UTILS_EXPORT void Advect(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time);
/**
* @brief Set the flux vector callback function.
*
* This routine is a utility function to avoid the explicit use of
* boost::bind. A function and object can be passed to this function
* instead.
*/
template<typename FuncPointerT, typename ObjectPointerT>
void SetFluxVector(FuncPointerT func, ObjectPointerT obj)
{
m_fluxVector = boost::bind(func, obj, _1, _2);
}
/**
* @brief Set a Riemann solver object for this advection object.
*
* @param riemann The RiemannSolver object.
*/
inline void SetRiemannSolver(RiemannSolverSharedPtr riemann)
{
m_riemann = riemann;
}
/**
* @brief Set the flux vector callback function.
*
* @param fluxVector The callback function to override.
*/
inline void SetFluxVector(AdvectionFluxVecCB fluxVector)
{
m_fluxVector = fluxVector;
}
protected:
virtual void v_InitObject(
LibUtilities::SessionReaderSharedPtr pSession,
Array<OneD, MultiRegions::ExpListSharedPtr> pFields);
// virtual void v_Advect(
// const int nConvectiveFields,
// const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
// const Array<OneD, Array<OneD, NekDouble> > &advVel,
// const Array<OneD, Array<OneD, NekDouble> > &inarray,
// Array<OneD, Array<OneD, NekDouble> > &outarray)=0;
virtual void v_Advect(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time)=0;
/// Callback function to the flux vector (set when advection is in
/// conservative form).
AdvectionFluxVecCB m_fluxVector;
/// Riemann solver for DG-type schemes.
RiemannSolverSharedPtr m_riemann;
/// Storage for space dimension. Used for homogeneous extension.
int m_spaceDim;
};
/// A shared pointer to an Advection object.
typedef boost::shared_ptr<Advection> AdvectionSharedPtr;
/// Datatype of the NekFactory used to instantiate classes derived
/// from the Advection class.
typedef LibUtilities::NekFactory<std::string, Advection,
std::string> AdvectionFactory;
SOLVER_UTILS_EXPORT AdvectionFactory& GetAdvectionFactory();
SOLVER_UTILS_EXPORT AdvectionFactory& GetAdvectionFactory();
}
}
......
......@@ -191,7 +191,8 @@ namespace Nektar
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time)
{
Array<OneD, NekDouble> tmp(m_numPoints), tmp2;
int nVel = advVel.num_elements();
......
......@@ -84,7 +84,8 @@ namespace Nektar
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray);
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time);
private:
void ModifiedFluxVector(
......
......@@ -799,7 +799,8 @@ namespace Nektar
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time)
{
int i, j, n;
int phys_offset;
......
......@@ -88,7 +88,8 @@ namespace Nektar
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray);
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time);
virtual void v_SetupMetrics(
LibUtilities::SessionReaderSharedPtr pSession,
......
......@@ -67,7 +67,8 @@ namespace Nektar
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time)
{
int nDim = advVel.num_elements();
int nPointsTot = fields[0]->GetNpoints();
......
......@@ -65,7 +65,8 @@ namespace Nektar
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray);
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time);
};
}
}
......
......@@ -78,7 +78,8 @@ namespace Nektar
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time)
{
int nDim = fields[0]->GetCoordim(0);
int nPointsTot = fields[0]->GetTotPoints();
......
......@@ -65,7 +65,8 @@ namespace Nektar
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray);
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time);
};
}
}
......
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