mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
INT: Integration of rhoPimpleAdiabaticFoam
Solver for low Mach no. flows with adiabatic thermodynamics and updated
pressure-velocity coupling given by the RCM interpolation procedure
described in
\verbatim
Knacke, T. (2013).
Potential effects of Rhie & Chow type interpolations in airframe
noise simulations. In: Schram, C., Dénos, R., Lecomte E. (ed):
Accurate and efficient aeroacoustic prediction approaches for
airframe noise, VKI LS 2013-03.
\endverbatim
Original code supplied by Thilo Knacke, CFD E+F GmbH
contact: info@cfd-berlin.com
Integrated into OpenFOAM by OpenCFD Ltd.
This commit is contained in:
@ -0,0 +1,50 @@
|
||||
{
|
||||
volScalarField& he = thermo.he();
|
||||
|
||||
const tmp<volScalarField>& tCp = thermo.Cp();
|
||||
const tmp<volScalarField>& tCv = thermo.Cv();
|
||||
|
||||
const volScalarField& Cp = tCp();
|
||||
const volScalarField& Cv = tCv();
|
||||
const scalar gamma = max(Cp/Cv).value();
|
||||
|
||||
if (mag(gamma - min(Cp/Cv).value()) > VSMALL)
|
||||
{
|
||||
notImplemented("gamma not constant in space");
|
||||
}
|
||||
|
||||
const dictionary& thermoDict = thermo.subDict("mixture");
|
||||
|
||||
const dictionary& eosDict = thermoDict.subDict("equationOfState");
|
||||
|
||||
bool local = eosDict.lookupOrDefault<bool>("local", false);
|
||||
|
||||
// Evolve T as:
|
||||
//
|
||||
// T_1 = T_0 \frac{p}{p_0}^{\frac{\gamma - 1}{\gamma}}
|
||||
|
||||
if (!local)
|
||||
{
|
||||
const scalar T0 = readScalar(eosDict.lookup("T0"));
|
||||
const scalar p0 = readScalar(eosDict.lookup("p0"));
|
||||
|
||||
he = thermo.he(p, pow(p/p0, (gamma - scalar(1))/gamma)*T0);
|
||||
}
|
||||
else
|
||||
{
|
||||
const volScalarField& T0 = T.oldTime();
|
||||
const volScalarField& p0 = p.oldTime();
|
||||
|
||||
he = thermo.he(p, pow(p/p0, (gamma - scalar(1))/gamma)*T0);
|
||||
}
|
||||
|
||||
thermo.correct();
|
||||
|
||||
psi = 1.0/((Cp - Cv)*T);
|
||||
|
||||
rho = thermo.rho();
|
||||
rho.relax();
|
||||
|
||||
rho.writeMinMax(Info);
|
||||
}
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
rhoPimpleAdiabaticFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/rhoPimpleAdiabaticFoam
|
||||
@ -0,0 +1,20 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lcompressibleTransportModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
-lturbulenceModels \
|
||||
-lcompressibleTurbulenceModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-lfvOptions
|
||||
@ -0,0 +1,24 @@
|
||||
// Solve the Momentum equation
|
||||
|
||||
MRF.correctBoundaryVelocity(U);
|
||||
|
||||
tmp<fvVectorMatrix> tUEqn
|
||||
(
|
||||
fvm::ddt(rho, U) + fvm::div(phi, U)
|
||||
+ MRF.DDt(rho, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
==
|
||||
fvOptions(rho, U)
|
||||
);
|
||||
fvVectorMatrix& UEqn = tUEqn.ref();
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
fvOptions.constrain(UEqn);
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<fluidThermo> pThermo
|
||||
(
|
||||
fluidThermo::New(mesh)
|
||||
);
|
||||
fluidThermo& thermo = pThermo();
|
||||
thermo.validate(args.executable(), "h", "e");
|
||||
|
||||
volScalarField& p = thermo.p();
|
||||
volScalarField& T = thermo.T();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo.rho()
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Calculating face flux field phi\n" << endl;
|
||||
|
||||
surfaceScalarField phi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rho)*linearInterpolate(U) & mesh.Sf()
|
||||
);
|
||||
|
||||
Info<< "Calculating face flux field phiByRho\n" << endl;
|
||||
|
||||
surfaceScalarField phiByRho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiByRho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
phi/linearInterpolate(rho)
|
||||
);
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
mesh.setFluxRequired(p.name());
|
||||
|
||||
Info<< "Creating field dpdt\n" << endl;
|
||||
volScalarField dpdt
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dpdt",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
|
||||
);
|
||||
|
||||
#include "createMRF.H"
|
||||
|
||||
Info<< "Creating compressibility field psi\n" << endl;
|
||||
volScalarField psi("psi", 1.0/((thermo.Cp() - thermo.Cv())*T));
|
||||
psi.oldTime() = 1.0/((thermo.Cp() - thermo.Cv())*T.oldTime());
|
||||
psi.oldTime().oldTime() = 1.0/((thermo.Cp()-thermo.Cv())*T.oldTime().oldTime());
|
||||
@ -0,0 +1,95 @@
|
||||
{
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = rAU*UEqn.H();
|
||||
|
||||
|
||||
// Define coefficients and pseudo-velocities for RCM interpolation
|
||||
// M[U] = AU - H = -grad(p)
|
||||
// U = H/A - 1/A grad(p)
|
||||
// H/A = U + 1/A grad(p)
|
||||
surfaceScalarField rhorAUf
|
||||
(
|
||||
"rhorAUf",
|
||||
fvc::interpolate(rho)/fvc::interpolate(UEqn.A())
|
||||
);
|
||||
|
||||
surfaceVectorField rhoHbyAf
|
||||
(
|
||||
"rhoHbyAf",
|
||||
fvc::interpolate(rho)*fvc::interpolate(U)
|
||||
+ rhorAUf*fvc::interpolate(fvc::grad(p))
|
||||
);
|
||||
|
||||
#include "resetBoundaries.H"
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
if (pimple.transonic())
|
||||
{
|
||||
FatalError
|
||||
<< "\nTransonic option not available for " << args.executable()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rhie & Chow interpolation (part 1)
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
(
|
||||
(rhoHbyAf & mesh.Sf())
|
||||
+ rhorAUf*fvc::interpolate(rho)*fvc::ddtCorr(U, phiByRho)
|
||||
+ fvc::interpolate(rho)
|
||||
* fvc::alphaCorr(U, phiByRho, pimple.finalInnerIter())
|
||||
)
|
||||
);
|
||||
|
||||
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
|
||||
|
||||
// Non-orthogonal pressure corrector loop
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
// Pressure corrector
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rhorAUf, p)
|
||||
==
|
||||
fvOptions(psi, p, rho.name())
|
||||
);
|
||||
|
||||
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
|
||||
|
||||
// Rhie & Chow interpolation (part 2)
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA + pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
phiByRho = phi/fvc::interpolate(rho);
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
U = HbyA - rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
if (thermo.dpdt())
|
||||
{
|
||||
dpdt = fvc::ddt(p);
|
||||
}
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
{
|
||||
// Keep standard formulation on domain boundaries to ensure compatibility
|
||||
// with existing boundary conditions
|
||||
const Foam::FieldField<Foam::fvsPatchField, scalar> rhorAUf_orig
|
||||
(
|
||||
fvc::interpolate(rho.boundaryField()*rAU.boundaryField())
|
||||
);
|
||||
|
||||
const Foam::FieldField<Foam::fvsPatchField, vector> rhoHbyA_orig
|
||||
(
|
||||
fvc::interpolate(rho.boundaryField()*HbyA.boundaryField())
|
||||
);
|
||||
|
||||
surfaceScalarField::Boundary& rhorAUfbf = rhorAUf.boundaryFieldRef();
|
||||
surfaceVectorField::Boundary& rhoHbyAfbf = rhoHbyAf.boundaryFieldRef();
|
||||
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
if (!U.boundaryField()[patchi].coupled())
|
||||
{
|
||||
rhorAUfbf[patchi] = rhorAUf_orig[patchi];
|
||||
rhoHbyAfbf[patchi] = rhoHbyA_orig[patchi];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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.
|
||||
|
||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
rhoPimpleAdiabaticFoam
|
||||
|
||||
Description
|
||||
Transient solver for laminar or turbulent flow of weakly compressible
|
||||
fluids for low Mach number aeroacoustic applications.
|
||||
|
||||
Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
|
||||
pseudo-transient simulations. The RCM interpolation is used as in
|
||||
|
||||
\verbatim
|
||||
Knacke, T. (2013).
|
||||
Potential effects of Rhie & Chow type interpolations in airframe
|
||||
noise simulations. In: Schram, C., Dénos, R., Lecomte E. (ed):
|
||||
Accurate and efficient aeroacoustic prediction approaches for
|
||||
airframe noise, VKI LS 2013-03.
|
||||
\endverbatim
|
||||
|
||||
|
||||
Contact: info@cfd-berlin.com
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "fluidThermo.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "bound.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
|
||||
#include "ddtScheme.H"
|
||||
#include "fvcCorrectAlpha.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "postProcess.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createControl.H"
|
||||
#include "createTimeControls.H"
|
||||
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
if (pimple.nCorrPIMPLE() <= 1)
|
||||
{
|
||||
#include "rhoEqn.H"
|
||||
}
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
U.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
phi.storePrevIter();
|
||||
phiByRho.storePrevIter();
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
#include "EEqn.H"
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -401,6 +401,7 @@ finiteVolume/fvc/fvcFlux.C
|
||||
finiteVolume/fvc/fvcMeshPhi.C
|
||||
finiteVolume/fvc/fvcSmooth/fvcSmooth.C
|
||||
finiteVolume/fvc/fvcReconstructMag.C
|
||||
finiteVolume/fvc/fvcCorrectAlpha.C
|
||||
|
||||
general = cfdTools/general
|
||||
$(general)/findRefCell/findRefCell.C
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -98,7 +98,19 @@ public:
|
||||
backwardDdtScheme(const fvMesh& mesh, Istream& is)
|
||||
:
|
||||
ddtScheme<Type>(mesh, is)
|
||||
{}
|
||||
{
|
||||
if (is.good() && !is.eof())
|
||||
{
|
||||
this->ddtPhiCoeff_ = readScalar(is);
|
||||
}
|
||||
|
||||
// Ensure the old-old-time cell volumes are available
|
||||
// for moving meshes
|
||||
if (mesh.moving())
|
||||
{
|
||||
mesh.V00();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -156,13 +156,36 @@ tmp<surfaceScalarField> ddtScheme<Type>::fvcDdtPhiCoeff
|
||||
const fluxFieldType& phiCorr
|
||||
)
|
||||
{
|
||||
tmp<surfaceScalarField> tddtCouplingCoeff = scalar(1)
|
||||
- min
|
||||
tmp<surfaceScalarField> tddtCouplingCoeff
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"ddtCouplingCoeff",
|
||||
U.mesh().time().timeName(),
|
||||
U.mesh()
|
||||
),
|
||||
U.mesh(),
|
||||
dimensionedScalar("one", dimless, 1.0)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if (ddtPhiCoeff_ < 0)
|
||||
{
|
||||
tddtCouplingCoeff.ref() =- min
|
||||
(
|
||||
mag(phiCorr)
|
||||
/(mag(phi) + dimensionedScalar("small", phi.dimensions(), SMALL)),
|
||||
scalar(1)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
tddtCouplingCoeff.ref() =
|
||||
dimensionedScalar("ddtPhiCoeff", dimless, ddtPhiCoeff_);
|
||||
}
|
||||
|
||||
surfaceScalarField& ddtCouplingCoeff = tddtCouplingCoeff.ref();
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,7 @@ Group
|
||||
Description
|
||||
Abstract base class for ddt schemes.
|
||||
|
||||
|
||||
SourceFiles
|
||||
ddtScheme.C
|
||||
|
||||
@ -76,6 +77,9 @@ protected:
|
||||
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Input for fvcDdtPhiCoeff (-1 default)
|
||||
scalar ddtPhiCoeff_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -109,13 +113,15 @@ public:
|
||||
//- Construct from mesh
|
||||
ddtScheme(const fvMesh& mesh)
|
||||
:
|
||||
mesh_(mesh)
|
||||
mesh_(mesh),
|
||||
ddtPhiCoeff_(-1)
|
||||
{}
|
||||
|
||||
//- Construct from mesh and Istream
|
||||
ddtScheme(const fvMesh& mesh, Istream&)
|
||||
ddtScheme(const fvMesh& mesh, Istream& is)
|
||||
:
|
||||
mesh_(mesh)
|
||||
mesh_(mesh),
|
||||
ddtPhiCoeff_(-1)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
80
src/finiteVolume/finiteVolume/fvc/fvcCorrectAlpha.C
Normal file
80
src/finiteVolume/finiteVolume/fvc/fvcCorrectAlpha.C
Normal file
@ -0,0 +1,80 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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.
|
||||
|
||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
InNamespace
|
||||
Foam::fvc
|
||||
|
||||
Description
|
||||
Correct flux-U difference in the internal loop using relaxation factor
|
||||
|
||||
SourceFiles
|
||||
fvcCorrectAlpha.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvcCorrectAlpha.H"
|
||||
#include "fvMesh.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace fvc
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
tmp<GeometricField<scalar, fvsPatchField, surfaceMesh>> alphaCorr
|
||||
(
|
||||
const GeometricField<vector, fvPatchField, volMesh>& U,
|
||||
const GeometricField<scalar, fvsPatchField, surfaceMesh>& phiU,
|
||||
const bool finalIter
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = U.mesh();
|
||||
const word fieldName = U.select(finalIter);
|
||||
|
||||
scalar alpha = 1;
|
||||
if (mesh.relaxEquation(fieldName))
|
||||
{
|
||||
alpha = mesh.equationRelaxationFactor(fieldName);
|
||||
}
|
||||
|
||||
return
|
||||
(1 - alpha)
|
||||
*(phiU.prevIter() - (fvc::interpolate(U.prevIter()) & mesh.Sf()));
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fvc
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
71
src/finiteVolume/finiteVolume/fvc/fvcCorrectAlpha.H
Normal file
71
src/finiteVolume/finiteVolume/fvc/fvcCorrectAlpha.H
Normal file
@ -0,0 +1,71 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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.
|
||||
|
||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
InNamespace
|
||||
Foam::fvc
|
||||
|
||||
Description
|
||||
Correct flux-U difference in the internal loop using relaxation factor
|
||||
|
||||
SourceFiles
|
||||
fvcCorrectAlpha.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef fvcCorrectAlpha_H
|
||||
#define fvcCorrectAlpha_H
|
||||
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Namespace fvc functions Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
namespace fvc
|
||||
{
|
||||
tmp<GeometricField<scalar, fvsPatchField, surfaceMesh>> alphaCorr
|
||||
(
|
||||
const GeometricField<vector, fvPatchField, volMesh>& U,
|
||||
const GeometricField<scalar, fvsPatchField, surfaceMesh>& phiU,
|
||||
const bool finalIter
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object T;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 1 0 0 0];
|
||||
|
||||
internalField uniform 224;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
top
|
||||
{
|
||||
type slip;
|
||||
}
|
||||
|
||||
bottom
|
||||
{
|
||||
type slip;
|
||||
}
|
||||
|
||||
left
|
||||
{
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
right
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volVectorField;
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform (50 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
top
|
||||
{
|
||||
type slip;
|
||||
}
|
||||
|
||||
bottom
|
||||
{
|
||||
type slip;
|
||||
}
|
||||
|
||||
left
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform (50 0 0);
|
||||
}
|
||||
|
||||
right
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue uniform (0 0 0);
|
||||
value uniform (50 0 0);
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,65 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object p;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
|
||||
internalField uniform 101325;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
top
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
bottom
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
left
|
||||
{
|
||||
type waveTransmissive;
|
||||
field p;
|
||||
phi phi;
|
||||
rho rho;
|
||||
psi thermo:psi;
|
||||
gamma 1.4;
|
||||
fieldInf 101325;
|
||||
lInf 5.0;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
right
|
||||
{
|
||||
type waveTransmissive;
|
||||
field p;
|
||||
phi phi;
|
||||
rho rho;
|
||||
psi thermo:psi;
|
||||
gamma 1.4;
|
||||
fieldInf 101325;
|
||||
lInf 5.0;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
9
tutorials/compressible/rhoPimpleAdiabaticFoam/rutlandVortex2D/Allclean
Executable file
9
tutorials/compressible/rhoPimpleAdiabaticFoam/rutlandVortex2D/Allclean
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
# Source tutorial clean functions
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||
|
||||
cleanCase
|
||||
\rm -rf 0
|
||||
|
||||
11
tutorials/compressible/rhoPimpleAdiabaticFoam/rutlandVortex2D/Allrun
Executable file
11
tutorials/compressible/rhoPimpleAdiabaticFoam/rutlandVortex2D/Allrun
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
restore0Dir
|
||||
runApplication blockMesh
|
||||
runApplication -s preProcess $(getApplication) -postProcess -dict system/preProcess
|
||||
runApplication decomposePar
|
||||
runParallel $(getApplication)
|
||||
@ -0,0 +1,53 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object thermophysicalProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
thermoType
|
||||
{
|
||||
type hePsiThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo hConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleEnthalpy;
|
||||
}
|
||||
|
||||
mixture
|
||||
{
|
||||
equationOfState
|
||||
{
|
||||
p0 103308.85730683322;
|
||||
T0 225.24440406165331;
|
||||
}
|
||||
specie
|
||||
{
|
||||
molWeight 28.970278977370906;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Cp 1004.5;
|
||||
Hf 0;
|
||||
}
|
||||
transport
|
||||
{
|
||||
mu 1.4585464649816414e-05;
|
||||
Pr 0.7179;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,20 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType laminar;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,123 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// D = 0.57
|
||||
convertToMeters 0.57;
|
||||
|
||||
x0 -3.5;
|
||||
x1 1.8;
|
||||
x2 15.7;
|
||||
x3 21;
|
||||
y0 -5.2;
|
||||
y1 5.2;
|
||||
|
||||
vertices
|
||||
(
|
||||
($x0 $y0 0)
|
||||
($x1 $y0 0)
|
||||
($x2 $y0 0)
|
||||
($x3 $y0 0)
|
||||
|
||||
($x3 $y1 0)
|
||||
($x2 $y1 0)
|
||||
($x1 $y1 0)
|
||||
($x0 $y1 0)
|
||||
|
||||
($x0 $y0 0.1)
|
||||
($x1 $y0 0.1)
|
||||
($x2 $y0 0.1)
|
||||
($x3 $y0 0.1)
|
||||
|
||||
($x3 $y1 0.1)
|
||||
($x2 $y1 0.1)
|
||||
($x1 $y1 0.1)
|
||||
($x0 $y1 0.1)
|
||||
);
|
||||
|
||||
xSpacing ((0.5 0.5 5)(0.5 0.5 0.2));
|
||||
ySpacing ((1 0.5 0.25)(1 1 1)(1 0.5 4));
|
||||
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 6 7 8 9 14 15) (150 200 1) simpleGrading (1 $ySpacing 1)
|
||||
hex (1 2 5 6 9 10 13 14) (150 200 1) simpleGrading ($xSpacing $ySpacing 1)
|
||||
hex (2 3 4 5 10 11 12 13) (150 200 1) simpleGrading (1 $ySpacing 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
top
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(7 15 14 6)
|
||||
(6 14 13 5)
|
||||
(5 13 12 4)
|
||||
);
|
||||
}
|
||||
bottom
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(1 9 8 0)
|
||||
(2 10 9 1)
|
||||
(3 11 10 2)
|
||||
);
|
||||
}
|
||||
left
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(0 8 15 7)
|
||||
);
|
||||
}
|
||||
right
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(4 12 11 3)
|
||||
);
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
faces
|
||||
(
|
||||
(0 7 6 1)
|
||||
(1 6 5 2)
|
||||
(2 5 4 3)
|
||||
|
||||
(8 9 14 15)
|
||||
(9 10 13 14)
|
||||
(10 11 12 13)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
mergePatchPairs
|
||||
(
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,69 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application rhoPimpleAdiabaticFoam;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 0.22528;
|
||||
|
||||
deltaT 3.2e-05;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 100;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat binary;
|
||||
|
||||
writePrecision 10;
|
||||
|
||||
writeCompression uncompressed;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
functions
|
||||
{
|
||||
probes
|
||||
{
|
||||
type probes;
|
||||
|
||||
functionObjectLibs ("libsampling.so");
|
||||
|
||||
probeLocations
|
||||
(
|
||||
(3.0 2.0 0.0)
|
||||
(3.0 -2.0 0.0)
|
||||
);
|
||||
|
||||
fields
|
||||
(
|
||||
p
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,29 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 3;
|
||||
|
||||
method hierarchical;
|
||||
|
||||
hierarchicalCoeffs
|
||||
{
|
||||
n (3 1 1);
|
||||
delta 0.001;
|
||||
order xyz;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,54 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
// Note: setting coefficient to 1 for the rhoPimpleAdiabaticFoam solver
|
||||
default backward 1;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) Gauss LUST grad(U);
|
||||
div(phi,h) Gauss LUST grad(h);
|
||||
div(phi,K) Gauss linear;
|
||||
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,59 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
"(p|rho)"
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-9;
|
||||
relTol 0.01;
|
||||
minIter 1;
|
||||
}
|
||||
|
||||
"(p|rho)Final"
|
||||
{
|
||||
$p;
|
||||
relTol 0;
|
||||
}
|
||||
|
||||
"(U|e|h)"
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother symGaussSeidel;
|
||||
tolerance 1e-9;
|
||||
relTol 0.01;
|
||||
}
|
||||
|
||||
"(U|e|h)Final"
|
||||
{
|
||||
$U;
|
||||
relTol 0;
|
||||
}
|
||||
}
|
||||
|
||||
PIMPLE
|
||||
{
|
||||
momentumPredictor yes;
|
||||
nOuterCorrectors 1;
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,91 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location system;
|
||||
object preProcess;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
functions
|
||||
{
|
||||
createVortex
|
||||
{
|
||||
type coded;
|
||||
functionObjectLibs ("libutilityFunctionObjects.so");
|
||||
redirectType createVortices;
|
||||
enabled yes;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
#include "volFields.H"
|
||||
#};
|
||||
|
||||
codeWrite
|
||||
#{
|
||||
scalar D = 0.57;
|
||||
scalar UInf = 50;
|
||||
scalar pInf = 101325;
|
||||
scalar TInf = 224;
|
||||
scalar gamma = 1.4;
|
||||
scalar A = 0.3*D*UInf;
|
||||
const dimensionedScalar rhoRef("rhoRef", dimDensity, 1);
|
||||
const volScalarField& rho =
|
||||
mesh().lookupObject<volScalarField>("rho");
|
||||
|
||||
const vectorField& C = mesh().C();
|
||||
const scalarField x(C.component(0));
|
||||
const scalarField y(C.component(1));
|
||||
const scalar r2 = sqr(0.5*D/(Foam::sqrt(Foam::log(10.0))));
|
||||
const scalarField Psi(A*exp(-0.5/r2*(sqr(x) + sqr(y))));
|
||||
|
||||
volVectorField* Uptr =
|
||||
mesh().lookupObjectRefPtr<volVectorField>("U");
|
||||
volScalarField* pPtr =
|
||||
mesh().lookupObjectRefPtr<volScalarField>("p");
|
||||
volScalarField* TPtr =
|
||||
mesh().lookupObjectRefPtr<volScalarField>("T");
|
||||
|
||||
|
||||
if (Uptr && pPtr && TPtr)
|
||||
{
|
||||
volVectorField& U = *Uptr;
|
||||
volScalarField& p = *pPtr;
|
||||
volScalarField& T = *TPtr;
|
||||
|
||||
vectorField& Uc = U.primitiveFieldRef();
|
||||
Uc.replace(0, UInf - rhoRef/rho()*Psi/r2*y);
|
||||
Uc.replace(1, rhoRef/rho()*Psi/r2*x);
|
||||
U.correctBoundaryConditions();
|
||||
U.write();
|
||||
|
||||
scalarField& pc = p.primitiveFieldRef();
|
||||
pc = pInf - 0.5*sqr(rhoRef)/rho()*sqr(Psi)/r2;
|
||||
p.correctBoundaryConditions();
|
||||
p.write();
|
||||
|
||||
scalarField& Tc = T.primitiveFieldRef();
|
||||
Tc = pow(pc/pInf, (gamma - 1)/gamma)*TInf;
|
||||
T.correctBoundaryConditions();
|
||||
T.write();
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unable to find pressure, velocity and temperature"
|
||||
<< " fields" << exit(FatalError);
|
||||
}
|
||||
#};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user