Commit 08fefa85 authored by Gianmarco Mengaldo's avatar Gianmarco Mengaldo
Browse files

Added 2 folders into SolverUtils for implementing Advection and Diffusion terms separately.

Added a new Diffusion factory identical to the Advection one.
parent 605d02a8
......@@ -33,7 +33,7 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <SolverUtils/Advection.h>
#include <SolverUtils/Advection/Advection.h>
namespace Nektar
{
......
......@@ -33,7 +33,7 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <SolverUtils/AdvectionFR.h>
#include <SolverUtils/Advection/AdvectionFR.h>
#include <LibUtilities/Foundations/ManagerAccess.h>
#include <LibUtilities/Foundations/Basis.h>
#include <LibUtilities/Foundations/Points.h>
......
......@@ -36,7 +36,7 @@
#ifndef NEKTAR_SOLVERUTILS_ADVECTIONFR
#define NEKTAR_SOLVERUTILS_ADVECTIONFR
#include <SolverUtils/Advection.h>
#include <SolverUtils/Advection/Advection.h>
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
......
......@@ -33,7 +33,7 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <SolverUtils/AdvectionNonConservative.h>
#include <SolverUtils/Advection/AdvectionNonConservative.h>
namespace Nektar
{
......
......@@ -36,7 +36,7 @@
#ifndef NEKTAR_SOLVERUTILS_ADVECTIONNONCONSERVATIVE
#define NEKTAR_SOLVERUTILS_ADVECTIONNONCONSERVATIVE
#include <SolverUtils/Advection.h>
#include <SolverUtils/Advection/Advection.h>
namespace Nektar
{
......
......@@ -33,7 +33,7 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <SolverUtils/AdvectionWeakDG.h>
#include <SolverUtils/Advection/AdvectionWeakDG.h>
namespace Nektar
{
......@@ -75,7 +75,7 @@ namespace Nektar
{
tmp[i] = Array<OneD,NekDouble>(nCoeffs, 0.0);
// Get the ith component of the flux vector in (physical space)
// Get the ith component of the flux vector in physical space
m_fluxVector(i, inarray, fluxvector);
for (j = 0; j < nVelDim; ++j)
......
......@@ -29,14 +29,14 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Upwind Riemann solver.
// Description: Weak DG advection class.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERUTILS_ADVECTIONWEAKDG
#define NEKTAR_SOLVERUTILS_ADVECTIONWEAKDG
#include <SolverUtils/Advection.h>
#include <SolverUtils/Advection/Advection.h>
namespace Nektar
{
......
SET(SOLVER_UTILS_SOURCES
Advection.cpp
AdvectionFR.cpp
AdvectionNonConservative.cpp
AdvectionWeakDG.cpp
Advection/Advection.cpp
Advection/AdvectionFR.cpp
Advection/AdvectionNonConservative.cpp
Advection/AdvectionWeakDG.cpp
Diffusion/Diffusion.cpp
Diffusion/DiffusionWeakDG.cpp
Driver.cpp
DriverArnoldi.cpp
DriverModifiedArnoldi.cpp
......@@ -19,10 +21,12 @@ SET(SOLVER_UTILS_SOURCES
)
SET(SOLVER_UTILS_HEADERS
Advection.h
AdvectionFR.h
AdvectionNonConservative.h
AdvectionWeakDG.h
Advection/Advection.h
Advection/AdvectionFR.h
Advection/AdvectionNonConservative.h
Advection/AdvectionWeakDG.h
Diffusion/Diffusion.h
Diffusion/DiffusionWeakDG.h
Driver.h
DriverArnoldi.h
DriverModifiedArnoldi.h
......
///////////////////////////////////////////////////////////////////////////////
//
// File: Diffusion.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: Abstract base class for diffusion.
//
///////////////////////////////////////////////////////////////////////////////
#include <SolverUtils/Diffusion/Diffusion.h>
namespace Nektar
{
namespace SolverUtils
{
DiffusionFactory& GetDiffusionFactory()
{
typedef Loki::SingletonHolder<DiffusionFactory,
Loki::CreateUsingNew,
Loki::NoDestroy > Type;
return Type::Instance();
}
void Diffusion::InitObject(
const LibUtilities::SessionReaderSharedPtr pSession)
{
v_InitObject(pSession);
}
void Diffusion::Diffuse(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)
{
v_Diffuse(nConvectiveFields, fields, inarray, outarray);
}
void Diffusion::NumFluxforScalar(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&uflux)
{
v_NumFluxforScalar(fields, ufield, uflux);
}
void Diffusion::NumFluxforVector(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&qfield,
Array<OneD, Array<OneD, NekDouble> > &qflux)
{
v_NumFluxforVector(fields, ufield, qfield, qflux);
}
void Diffusion::WeakPenaltyforScalar(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const int var,
const Array<OneD, const NekDouble> &physfield,
Array<OneD, NekDouble> &penaltyflux,
NekDouble time)
{
v_WeakPenaltyforScalar(fields, var, physfield, penaltyflux, time);
}
void Diffusion::WeakPenaltyforVector(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const int var,
const int dir,
const Array<OneD, const NekDouble> &physfield,
Array<OneD, NekDouble> &penaltyflux,
NekDouble C11,
NekDouble time)
{
v_WeakPenaltyforVector(fields, var, dir, physfield,
penaltyflux, C11, time);
}
void Diffusion::WeakAdvectionGreensDivergenceForm(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &F,
Array<OneD, NekDouble> &outarray)
{
v_WeakAdvectionGreensDivergenceForm(fields, F, outarray);
}
}
}
///////////////////////////////////////////////////////////////////////////////
//
// File: Diffusion.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: Abstract base class for diffusion.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERUTILS_DIFFUSION
#define NEKTAR_SOLVERUTILS_DIFFUSION
#include <string>
#include <boost/function.hpp>
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <MultiRegions/AssemblyMap/AssemblyMapDG.h>
#include <MultiRegions/ExpList.h>
#include <SolverUtils/SolverUtilsDeclspec.h>
#include <SolverUtils/RiemannSolvers/RiemannSolver.h>
namespace Nektar
{
namespace SolverUtils
{
typedef boost::function<void (
const int,
const int,
const Array<OneD, Array<OneD, NekDouble> >&,
Array<OneD, Array<OneD, NekDouble> >&)> DiffusionFluxVecCB;
class Diffusion
{
public:
SOLVER_UTILS_EXPORT void InitObject(
LibUtilities::SessionReaderSharedPtr pSession);
SOLVER_UTILS_EXPORT void Diffuse(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray);
SOLVER_UTILS_EXPORT void NumFluxforScalar(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&uflux);
SOLVER_UTILS_EXPORT void NumFluxforVector(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&qfield,
Array<OneD, Array<OneD, NekDouble> > &qflux);
SOLVER_UTILS_EXPORT void WeakPenaltyforScalar(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const int var,
const Array<OneD, const NekDouble> &physfield,
Array<OneD, NekDouble> &penaltyflux,
NekDouble time);
SOLVER_UTILS_EXPORT void WeakPenaltyforVector(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const int var,
const int dir,
const Array<OneD, const NekDouble> &physfield,
Array<OneD, NekDouble> &penaltyflux,
NekDouble C11,
NekDouble time);
SOLVER_UTILS_EXPORT void WeakAdvectionGreensDivergenceForm(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &F,
Array<OneD, NekDouble> &outarray);
template<typename FuncPointerT, typename ObjectPointerT>
void SetFluxVector(FuncPointerT func, ObjectPointerT obj)
{
m_fluxVector = boost::bind(func, obj, _1, _2, _3, _4);
}
inline void SetRiemannSolver(RiemannSolverSharedPtr riemann)
{
m_riemann = riemann;
}
protected:
virtual void v_InitObject(
LibUtilities::SessionReaderSharedPtr pSession)
{
};
virtual void v_Diffuse(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)=0;
virtual void v_NumFluxforScalar(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&uflux)
{
};
virtual void v_NumFluxforVector(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&qfield,
Array<OneD, Array<OneD, NekDouble> > &qflux)
{
};
virtual void v_WeakPenaltyforScalar(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const int var,
const Array<OneD, const NekDouble> &physfield,
Array<OneD, NekDouble> &penaltyflux,
NekDouble time)
{
};
virtual void v_WeakPenaltyforVector(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const int var,
const int dir,
const Array<OneD, const NekDouble> &physfield,
Array<OneD, NekDouble> &penaltyflux,
NekDouble C11,
NekDouble time)
{
};
void v_WeakAdvectionGreensDivergenceForm(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &F,
Array<OneD, NekDouble> &outarray)
{
};
DiffusionFluxVecCB m_fluxVector;
RiemannSolverSharedPtr m_riemann;
};
/// A shared pointer to an EquationSystem object
typedef boost::shared_ptr<Diffusion> DiffusionSharedPtr;
/// Datatype of the NekFactory used to instantiate classes derived
/// from the Diffusion class.
typedef LibUtilities::NekFactory<std::string, Diffusion, std::string> DiffusionFactory;
SOLVER_UTILS_EXPORT DiffusionFactory& GetDiffusionFactory();
}
}
#endif
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////
//
// File: DiffusionWeakDG.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: Weak DG diffusion class.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERUTILS_DIFFUSIONWEAKDG
#define NEKTAR_SOLVERUTILS_DIFFUSIONWEAKDG
#include <SolverUtils/Diffusion/Diffusion.h>
namespace Nektar
{
namespace SolverUtils
{
class DiffusionWeakDG : public Diffusion
{
public:
static DiffusionSharedPtr create(std::string diffType)
{
return DiffusionSharedPtr(new DiffusionWeakDG());
}
static std::string type;
protected:
DiffusionWeakDG();
Array<OneD, Array<OneD, NekDouble> > m_traceNormals;
Array<OneD, Array<OneD, Array<OneD,NekDouble> > > m_tanbasis;
LibUtilities::SessionReaderSharedPtr m_session;
virtual void v_InitObject(
LibUtilities::SessionReaderSharedPtr pSession);
virtual void v_Diffuse(
const int nConvective,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray);
virtual void v_NumFluxforScalar(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&uflux);
virtual void v_NumFluxforVector(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&qfield,
Array<OneD, Array<OneD, NekDouble> > &qflux);
virtual void v_WeakPenaltyforScalar(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const int var,
const Array<OneD, const NekDouble> &physfield,
Array<OneD, NekDouble> &penaltyflux,
NekDouble time);
virtual void v_WeakPenaltyforVector(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const int var,
const int dir,
const Array<OneD, const NekDouble> &physfield,
Array<OneD, NekDouble> &penaltyflux,
NekDouble C11,
NekDouble time);
virtual void v_WeakAdvectionGreensDivergenceForm(
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &F,
Array<OneD, NekDouble> &outarray);
};
}
}
#endif
......@@ -2236,7 +2236,7 @@ namespace Nektar
}
void EquationSystem::v_NumFluxforScalar(
Array<OneD, Array<OneD, NekDouble> > &ufield,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &uflux)
{
ASSERTL0(false, "v_NumFluxforScalar: This function is not valid "
......@@ -2244,9 +2244,9 @@ namespace Nektar
}
void EquationSystem::v_NumFluxforVector(
Array<OneD, Array<OneD, NekDouble> > &ufield,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &qfield,
Array<OneD, Array<OneD, NekDouble > > &qflux)
Array<OneD, Array<OneD, NekDouble > > &qflux)
{
ASSERTL0(false, "v_NumFluxforVector: This function is not valid "
"for the Base class");
......
......@@ -368,13 +368,13 @@ namespace Nektar
Array<OneD, Array<OneD, NekDouble> > &numfluxY);
SOLVER_UTILS_EXPORT inline void NumFluxforScalar(
Array<OneD, Array<OneD, NekDouble> > &ufield,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &uflux);
SOLVER_UTILS_EXPORT inline void NumFluxforVector(
Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &qfield,
Array<OneD, Array<OneD, NekDouble> > &qflux);
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &qfield,
Array<OneD, Array<OneD, NekDouble> > &qflux);
SOLVER_UTILS_EXPORT inline void SetModifiedBasis(
const bool modbasis);
......@@ -570,13 +570,13 @@ namespace Nektar
Array<OneD, Array<OneD, NekDouble> > &numfluxY);
SOLVER_UTILS_EXPORT virtual void v_NumFluxforScalar(
Array<OneD, Array<OneD, NekDouble> > &ufield,
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &uflux);
SOLVER_UTILS_EXPORT virtual void v_NumFluxforVector(
Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &qfield,
Array<OneD, Array<OneD, NekDouble > > &qflux);
const Array<OneD, Array<OneD, NekDouble> > &ufield,
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &qfield,
Array<OneD, Array<OneD, NekDouble > > &qflux);
};
......@@ -865,17 +865,19 @@ namespace Nektar
v_NumericalFlux(physfield, numfluxX, numfluxY);
}