Merge Request #32: Runtime-selectable flux & limiters in DBNS. Author: Henrik Rusche. Merge: Henrik Rusche
https://sourceforge.net/p/foam-extend/foam-extend-3.2/merge-requests/32/
This commit is contained in:
commit
9007084567
15 changed files with 471 additions and 64 deletions
|
@ -70,14 +70,14 @@
|
||||||
|
|
||||||
|
|
||||||
// Create numeric flux
|
// Create numeric flux
|
||||||
// numericFlux<roeFlux, BarthJespersenLimiter> dbnsFlux
|
autoPtr<basicNumericFlux> dbnsFluxPtr = basicNumericFlux::New
|
||||||
numericFlux<rusanovFlux, BarthJespersenLimiter> dbnsFlux
|
|
||||||
(
|
(
|
||||||
p,
|
p,
|
||||||
U,
|
U,
|
||||||
T,
|
T,
|
||||||
thermo()
|
thermo()
|
||||||
);
|
);
|
||||||
|
basicNumericFlux& dbnsFlux = dbnsFluxPtr();
|
||||||
|
|
||||||
// Create mass flux alias for easier coupling with other code components
|
// Create mass flux alias for easier coupling with other code components
|
||||||
const surfaceScalarField& phi = dbnsFlux.rhoFlux();
|
const surfaceScalarField& phi = dbnsFlux.rhoFlux();
|
||||||
|
|
|
@ -70,13 +70,14 @@
|
||||||
|
|
||||||
|
|
||||||
// Create numeric flux
|
// Create numeric flux
|
||||||
numericFlux<rusanovFlux, BarthJespersenLimiter> dbnsFlux
|
autoPtr<basicNumericFlux> dbnsFluxPtr = basicNumericFlux::New
|
||||||
(
|
(
|
||||||
p,
|
p,
|
||||||
U,
|
U,
|
||||||
T,
|
T,
|
||||||
thermo()
|
thermo()
|
||||||
);
|
);
|
||||||
|
basicNumericFlux& dbnsFlux = dbnsFluxPtr();
|
||||||
|
|
||||||
// Create mass flux alias for easier coupling with other code components
|
// Create mass flux alias for easier coupling with other code components
|
||||||
const surfaceScalarField& phi = dbnsFlux.rhoFlux();
|
const surfaceScalarField& phi = dbnsFlux.rhoFlux();
|
||||||
|
|
|
@ -4,6 +4,10 @@ dbnsFlux/betaFlux/betaFlux.C
|
||||||
dbnsFlux/hllcFlux/hllcFlux.C
|
dbnsFlux/hllcFlux/hllcFlux.C
|
||||||
dbnsFlux/hllcALEFlux/hllcALEFlux.C
|
dbnsFlux/hllcALEFlux/hllcALEFlux.C
|
||||||
|
|
||||||
|
basicNumericFlux/basicNumericFlux.C
|
||||||
|
basicNumericFlux/newBasicNumericFlux.C
|
||||||
|
numericFlux/numericFluxes.C
|
||||||
|
|
||||||
multigrid/mgMeshLevel/mgMeshLevel.C
|
multigrid/mgMeshLevel/mgMeshLevel.C
|
||||||
multigrid/mgMeshLevel/fineMgMeshLevel.C
|
multigrid/mgMeshLevel/fineMgMeshLevel.C
|
||||||
multigrid/mgMeshLevel/coarseMgMeshLevel.C
|
multigrid/mgMeshLevel/coarseMgMeshLevel.C
|
||||||
|
|
51
src/dbns/basicNumericFlux/basicNumericFlux.C
Normal file
51
src/dbns/basicNumericFlux/basicNumericFlux.C
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 3.2
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "basicNumericFlux.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(basicNumericFlux, 0);
|
||||||
|
defineRunTimeSelectionTable(basicNumericFlux, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::basicNumericFlux::basicNumericFlux(const fvMesh& mesh)
|
||||||
|
:
|
||||||
|
mesh_(mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::basicNumericFlux::~basicNumericFlux()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
179
src/dbns/basicNumericFlux/basicNumericFlux.H
Normal file
179
src/dbns/basicNumericFlux/basicNumericFlux.H
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 3.2
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::basicNumericFlux
|
||||||
|
|
||||||
|
Description
|
||||||
|
Base class for runtime-selectable flux and limiters
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
basicNumericFlux.C
|
||||||
|
newBasicPsiThermo.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef basicNumericFlux_H
|
||||||
|
#define basicNumericFlux_H
|
||||||
|
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "basicThermo.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class basicNumericFlux Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class basicNumericFlux
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to mesh
|
||||||
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
|
||||||
|
//- Construct as copy (not implemented)
|
||||||
|
basicNumericFlux(const basicNumericFlux&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("basicNumericFlux");
|
||||||
|
|
||||||
|
|
||||||
|
//- Declare run-time constructor selection table
|
||||||
|
|
||||||
|
#ifndef SWIG
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
basicNumericFlux,
|
||||||
|
state,
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volVectorField& U,
|
||||||
|
const volScalarField& T,
|
||||||
|
basicThermo& thermo
|
||||||
|
),
|
||||||
|
(p, U, T, thermo)
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
basicNumericFlux
|
||||||
|
(
|
||||||
|
const fvMesh& mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Selector
|
||||||
|
static autoPtr<basicNumericFlux> New
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volVectorField& U,
|
||||||
|
const volScalarField& T,
|
||||||
|
basicThermo& thermo
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~basicNumericFlux();
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Return mesh reference
|
||||||
|
const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return mesh_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return fluxes
|
||||||
|
|
||||||
|
//- Return density flux
|
||||||
|
virtual const surfaceScalarField& rhoFlux() const = 0;
|
||||||
|
|
||||||
|
//- Return velocity flux
|
||||||
|
virtual const surfaceVectorField& rhoUFlux() const = 0;
|
||||||
|
|
||||||
|
//- Return energy flux
|
||||||
|
virtual const surfaceScalarField& rhoEFlux() const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Return residuals
|
||||||
|
|
||||||
|
//- Return density equation residual
|
||||||
|
virtual tmp<scalarField> rhoResidual() const = 0;
|
||||||
|
|
||||||
|
//- Return momentum equation flux
|
||||||
|
virtual tmp<vectorField> rhoUResidual() const = 0;
|
||||||
|
|
||||||
|
//- Return energy equation flux
|
||||||
|
virtual tmp<scalarField> rhoEResidual() const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Return Gradients
|
||||||
|
|
||||||
|
//- Return pressure gradient
|
||||||
|
virtual const volVectorField& gradP() const = 0;
|
||||||
|
|
||||||
|
//- Return pressure gradient
|
||||||
|
virtual const volTensorField& gradU() const = 0;
|
||||||
|
|
||||||
|
//- Return Temperature gradient
|
||||||
|
virtual const volVectorField& gradT() const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Update fluxes based on current state
|
||||||
|
|
||||||
|
//- Compute flux
|
||||||
|
virtual void computeFlux() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
64
src/dbns/basicNumericFlux/makeBasicNumericFlux.H
Normal file
64
src/dbns/basicNumericFlux/makeBasicNumericFlux.H
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 3.2
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
InClass
|
||||||
|
Foam::basicNumericFlux
|
||||||
|
|
||||||
|
Description
|
||||||
|
Macros for creating fluxes (including limiters) for DBNS solver
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef makeBasicPsiThermo_H
|
||||||
|
#define makeBasicPsiThermo_H
|
||||||
|
|
||||||
|
#include "numericFlux.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#define makeBasicNumericFlux(Flux,Limiter) \
|
||||||
|
\
|
||||||
|
typedef numericFlux<Flux,Limiter> \
|
||||||
|
Flux##Limiter; \
|
||||||
|
\
|
||||||
|
defineTemplateTypeNameAndDebugWithName \
|
||||||
|
( \
|
||||||
|
Flux##Limiter, \
|
||||||
|
#Flux#Limiter, \
|
||||||
|
0 \
|
||||||
|
); \
|
||||||
|
\
|
||||||
|
addToRunTimeSelectionTable \
|
||||||
|
( \
|
||||||
|
basicNumericFlux, \
|
||||||
|
Flux##Limiter, \
|
||||||
|
state \
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
62
src/dbns/basicNumericFlux/newBasicNumericFlux.C
Normal file
62
src/dbns/basicNumericFlux/newBasicNumericFlux.C
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 3.2
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "basicNumericFlux.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::basicNumericFlux> Foam::basicNumericFlux::New
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volVectorField& U,
|
||||||
|
const volScalarField& T,
|
||||||
|
basicThermo& thermo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const dictionary& subDict =
|
||||||
|
p.mesh().schemesDict().subDict("divSchemes").subDict("dbns");
|
||||||
|
|
||||||
|
word name = word(subDict.lookup("flux")) + "Flux"
|
||||||
|
+ word(subDict.lookup("limiter")) + "Limiter";
|
||||||
|
|
||||||
|
Info<< "Selecting numericFlux " << name << endl;
|
||||||
|
|
||||||
|
stateConstructorTable::iterator cstrIter =
|
||||||
|
stateConstructorTablePtr_->find(name);
|
||||||
|
|
||||||
|
if (cstrIter == stateConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn("basicNumericFlux::New(const fvMesh&)")
|
||||||
|
<< "Unknown basicNumericFlux type " << name << nl << nl
|
||||||
|
<< "Valid basicNumericFlux types are:" << nl
|
||||||
|
<< stateConstructorTablePtr_->sortedToc() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<basicNumericFlux>(cstrIter()(p, U, T, thermo));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -24,6 +24,7 @@ License
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "numericFlux.H"
|
#include "numericFlux.H"
|
||||||
|
#include "MDLimiter.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -37,8 +38,7 @@ Foam::numericFlux<Flux, Limiter>::numericFlux
|
||||||
basicThermo& thermo
|
basicThermo& thermo
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
numericFluxBase<Flux>(),
|
numericFluxBase<Flux>(p.mesh()),
|
||||||
mesh_(p.mesh()),
|
|
||||||
p_(p),
|
p_(p),
|
||||||
U_(U),
|
U_(U),
|
||||||
T_(T),
|
T_(T),
|
||||||
|
@ -48,20 +48,20 @@ Foam::numericFlux<Flux, Limiter>::numericFlux
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"phi",
|
"phi",
|
||||||
mesh_.time().timeName(),
|
this->mesh().time().timeName(),
|
||||||
mesh_,
|
this->mesh(),
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
(linearInterpolate(thermo_.rho()*U_) & mesh_.Sf())
|
(linearInterpolate(thermo_.rho()*U_) & this->mesh().Sf())
|
||||||
),
|
),
|
||||||
rhoUFlux_
|
rhoUFlux_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"rhoUFlux",
|
"rhoUFlux",
|
||||||
mesh_.time().timeName(),
|
this->mesh().time().timeName(),
|
||||||
mesh_,
|
this->mesh(),
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
|
@ -72,8 +72,8 @@ Foam::numericFlux<Flux, Limiter>::numericFlux
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"rhoEFlux",
|
"rhoEFlux",
|
||||||
mesh_.time().timeName(),
|
this->mesh().time().timeName(),
|
||||||
mesh_,
|
this->mesh(),
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
|
@ -88,15 +88,15 @@ template<class Flux, class Limiter>
|
||||||
void Foam::numericFlux<Flux, Limiter>::computeFlux()
|
void Foam::numericFlux<Flux, Limiter>::computeFlux()
|
||||||
{
|
{
|
||||||
// Get face-to-cell addressing: face area point from owner to neighbour
|
// Get face-to-cell addressing: face area point from owner to neighbour
|
||||||
const unallocLabelList& owner = mesh_.owner();
|
const unallocLabelList& owner = this->mesh().owner();
|
||||||
const unallocLabelList& neighbour = mesh_.neighbour();
|
const unallocLabelList& neighbour = this->mesh().neighbour();
|
||||||
|
|
||||||
// Get the face area vector
|
// Get the face area vector
|
||||||
const surfaceVectorField& Sf = mesh_.Sf();
|
const surfaceVectorField& Sf = this->mesh().Sf();
|
||||||
const surfaceScalarField& magSf = mesh_.magSf();
|
const surfaceScalarField& magSf = this->mesh().magSf();
|
||||||
|
|
||||||
const volVectorField& cellCentre = mesh_.C();
|
const volVectorField& cellCentre = this->mesh().C();
|
||||||
const surfaceVectorField& faceCentre = mesh_.Cf();
|
const surfaceVectorField& faceCentre = this->mesh().Cf();
|
||||||
|
|
||||||
// Thermodynamics
|
// Thermodynamics
|
||||||
const volScalarField Cv = thermo_.Cv();
|
const volScalarField Cv = thermo_.Cv();
|
||||||
|
|
|
@ -42,6 +42,7 @@ SourceFiles
|
||||||
|
|
||||||
#include "numericFluxBase.H"
|
#include "numericFluxBase.H"
|
||||||
#include "basicThermo.H"
|
#include "basicThermo.H"
|
||||||
|
#include "fvc.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -59,10 +60,6 @@ class numericFlux
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to mesh
|
|
||||||
const fvMesh& mesh_;
|
|
||||||
|
|
||||||
|
|
||||||
// Reference to primitive fields
|
// Reference to primitive fields
|
||||||
|
|
||||||
//- Static pressure
|
//- Static pressure
|
||||||
|
@ -141,6 +138,9 @@ class numericFlux
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("numericFlux");
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
|
@ -160,13 +160,6 @@ public:
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return mesh reference
|
|
||||||
const fvMesh& mesh() const
|
|
||||||
{
|
|
||||||
return mesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Return fluxes
|
// Return fluxes
|
||||||
|
|
||||||
//- Return density flux
|
//- Return density flux
|
||||||
|
|
|
@ -40,6 +40,7 @@ SourceFiles
|
||||||
#ifndef numericFluxBase_H
|
#ifndef numericFluxBase_H
|
||||||
#define numericFluxBase_H
|
#define numericFluxBase_H
|
||||||
|
|
||||||
|
#include "basicNumericFlux.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
|
|
||||||
|
@ -55,50 +56,23 @@ namespace Foam
|
||||||
template<class Flux>
|
template<class Flux>
|
||||||
class numericFluxBase
|
class numericFluxBase
|
||||||
:
|
:
|
||||||
|
public basicNumericFlux,
|
||||||
public Flux
|
public Flux
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct from mesh
|
||||||
numericFluxBase()
|
numericFluxBase(const fvMesh& mesh)
|
||||||
|
:
|
||||||
|
basicNumericFlux(mesh)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~numericFluxBase()
|
virtual ~numericFluxBase()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Memeber functions
|
|
||||||
|
|
||||||
// Return fluxes
|
|
||||||
|
|
||||||
//- Return continuity equation flux
|
|
||||||
virtual const surfaceScalarField& rhoFlux() const = 0;
|
|
||||||
|
|
||||||
//- Return momentum equation flux
|
|
||||||
virtual const surfaceVectorField& rhoUFlux() const = 0;
|
|
||||||
|
|
||||||
//- Return energy equation flux
|
|
||||||
virtual const surfaceScalarField& rhoEFlux() const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Return residuals
|
|
||||||
|
|
||||||
//- Return mass residual
|
|
||||||
virtual tmp<scalarField> rhoResidual() const = 0;
|
|
||||||
|
|
||||||
//- Return momentum residual
|
|
||||||
virtual tmp<vectorField> rhoUResidual() const = 0;
|
|
||||||
|
|
||||||
//- Return energy residual
|
|
||||||
virtual tmp<scalarField> rhoEResidual() const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//- Update fluxes based on current state
|
|
||||||
virtual void computeFlux() = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
59
src/dbns/numericFlux/numericFluxes.C
Normal file
59
src/dbns/numericFlux/numericFluxes.C
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 3.2
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "makeBasicNumericFlux.H"
|
||||||
|
|
||||||
|
#include "rusanovFlux.H"
|
||||||
|
#include "roeFlux.H"
|
||||||
|
#include "betaFlux.H"
|
||||||
|
#include "hllcFlux.H"
|
||||||
|
#include "hllcALEFlux.H"
|
||||||
|
|
||||||
|
#include "firstOrderLimiter.H"
|
||||||
|
#include "BarthJespersenLimiter.H"
|
||||||
|
#include "VenkatakrishnanLimiter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/* * * * * * * * * * * * * * * Private Static Data * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
#define makeBasicNumericFluxForAllLimiters(Flux) \
|
||||||
|
makeBasicNumericFlux(Flux, firstOrderLimiter); \
|
||||||
|
makeBasicNumericFlux(Flux, BarthJespersenLimiter); \
|
||||||
|
makeBasicNumericFlux(Flux, VenkatakrishnanLimiter);
|
||||||
|
|
||||||
|
makeBasicNumericFluxForAllLimiters(rusanovFlux);
|
||||||
|
makeBasicNumericFluxForAllLimiters(betaFlux);
|
||||||
|
makeBasicNumericFluxForAllLimiters(roeFlux);
|
||||||
|
makeBasicNumericFluxForAllLimiters(hllcFlux);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -20,7 +20,7 @@ startTime 0;
|
||||||
|
|
||||||
stopAt endTime;
|
stopAt endTime;
|
||||||
|
|
||||||
endTime 3;
|
endTime 1;
|
||||||
|
|
||||||
deltaT 0.001;
|
deltaT 0.001;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,13 @@ gradSchemes
|
||||||
}
|
}
|
||||||
|
|
||||||
divSchemes
|
divSchemes
|
||||||
{}
|
{
|
||||||
|
dbns
|
||||||
|
{
|
||||||
|
flux rusanov;
|
||||||
|
limiter BarthJespersen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
laplacianSchemes
|
laplacianSchemes
|
||||||
{}
|
{}
|
||||||
|
@ -42,4 +48,5 @@ snGradSchemes
|
||||||
fluxRequired
|
fluxRequired
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -25,7 +25,13 @@ gradSchemes
|
||||||
}
|
}
|
||||||
|
|
||||||
divSchemes
|
divSchemes
|
||||||
{}
|
{
|
||||||
|
dbns
|
||||||
|
{
|
||||||
|
flux rusanov;
|
||||||
|
limiter BarthJespersen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
laplacianSchemes
|
laplacianSchemes
|
||||||
{}
|
{}
|
||||||
|
@ -42,4 +48,5 @@ snGradSchemes
|
||||||
fluxRequired
|
fluxRequired
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -27,6 +27,12 @@ gradSchemes
|
||||||
|
|
||||||
divSchemes
|
divSchemes
|
||||||
{
|
{
|
||||||
|
dbns
|
||||||
|
{
|
||||||
|
flux rusanov;
|
||||||
|
limiter BarthJespersen;
|
||||||
|
}
|
||||||
|
|
||||||
default none;
|
default none;
|
||||||
div(phi,k) Gauss upwind;
|
div(phi,k) Gauss upwind;
|
||||||
div(phi,epsilon) Gauss upwind;
|
div(phi,epsilon) Gauss upwind;
|
||||||
|
|
Reference in a new issue