Commit 627991bf authored by andy's avatar andy
Browse files

ENH: deprecated dieselSpray library and related solvers/deps

parent 6400a2a4
dieselEngineFoam.C
EXE = $(FOAM_APPBIN)/dieselEngineFoam
EXE_INC = \
-I../engineFoam \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/lagrangian/dieselSpray/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I$(LIB_SRC)/../applications/solvers/reactionThermo/XiFoam \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude
EXE_LIBS = \
-lengine \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lreactionThermophysicalModels \
-lfiniteVolume \
-llagrangian \
-lmeshTools \
-ldieselSpray \
-lliquidProperties \
-lliquidMixtureProperties \
-lthermophysicalFunctions \
-lspecie \
-lbasicThermophysicalModels \
-llaminarFlameSpeedModels \
-lchemistryModel \
-lODE \
-ldistributionModels \
-lcombustionModels
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
==
rho*g
+ dieselSpray.momentumSource()
);
if (pimple.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
}
tmp<fv::convectionScheme<scalar> > mvConvection
(
fv::convectionScheme<scalar>::New
(
mesh,
fields,
phi,
mesh.divScheme("div(phi,Yi_h)")
)
);
{
combustion->correct();
dQ = combustion->dQ();
label inertIndex = -1;
volScalarField Yt(0.0*Y[0]);
forAll(Y, i)
{
if (Y[i].name() != inertSpecie)
{
volScalarField& Yi = Y[i];
fvScalarMatrix YiEqn
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(turbulence->muEff(), Yi)
==
dieselSpray.evaporationSource(i)
+ combustion->R(Yi)
);
YiEqn.relax();
YiEqn.solve(mesh.solver("Yi"));
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0);
}
Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::psiChemistryCombustionModel> combustion
(
combustionModels::psiChemistryCombustionModel::New
(
mesh
)
);
psiChemistryModel& chemistry = combustion->pChemistry();
hsCombustionThermo& thermo = chemistry.thermo();
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
{
FatalErrorIn(args.executable())
<< "Specified inert specie '" << inertSpecie << "' not found in "
<< "species list. Available species:" << composition.species()
<< exit(FatalError);
}
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh
),
thermo.rho()
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
volScalarField& p = thermo.p();
const volScalarField& psi = thermo.psi();
const volScalarField& T = thermo.T();
volScalarField& hs = thermo.hs();
#include "compressibleCreatePhi.H"
Info << "Creating turbulence model.\n" << nl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo
)
);
// Set the turbulence into the combustion model
combustion->setTurbulence(turbulence());
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt
(
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
forAll(Y, i)
{
fields.add(Y[i]);
}
fields.add(hs);
volScalarField dQ
(
IOobject
(
"dQ",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("dQ", dimEnergy/dimTime, 0.0)
);
Info << "Constructing Spray" << endl;
PtrList<gasThermoPhysics> gasProperties(Y.size());
forAll(gasProperties, i)
{
gasProperties.set
(
i,
new gasThermoPhysics
(
dynamic_cast<const reactingMixture<gasThermoPhysics>&>
(thermo).speciesData()[i]
)
);
}
spray dieselSpray
(
U,
rho,
p,
T,
composition,
gasProperties,
thermo,
g
);
scalar gasMass0 = fvc::domainIntegrate(rho).value();
if (dieselSpray.twoD())
{
gasMass0 *= constant::mathematical::twoPi/dieselSpray.angleOfWedge();
}
gasMass0 -=
dieselSpray.injectedMass(runTime.value()) - dieselSpray.liquidMass();
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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
dieselEngineFoam
Description
Solver for diesel engine spray and combustion.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "engineTime.H"
#include "engineMesh.H"
#include "turbulenceModel.H"
#include "psiChemistryCombustionModel.H"
#include "spray.H"
#include "psiChemistryModel.H"
#include "chemistrySolver.H"
#include "multivariateScheme.H"
#include "Switch.H"
#include "OFstream.H"
#include "volPointInterpolation.H"
#include "thermoPhysicsTypes.H"
#include "mathematicalConstants.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createEngineTime.H"
#include "createEngineMesh.H"
#include "createFields.H"
#include "readGravitationalAcceleration.H"
#include "createSpray.H"
#include "initContinuityErrs.H"
#include "readEngineTimeControls.H"
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
#include "startSummary.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readEngineTimeControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;
mesh.move();
dieselSpray.evolve();
#include "rhoEqn.H"
while (pimple.loop())
{
#include "UEqn.H"
#include "YEqn.H"
#include "hsEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
turbulence->correct();
}
}
#include "logSummary.H"
#include "spraySummary.H"
rho = thermo.rho();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //
{
fvScalarMatrix hsEqn
(
fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs)
- fvm::laplacian(turbulence->alphaEff(), hs)
==
DpDt
+ combustion->Sh()
+ dieselSpray.heatTransferSource()()
);
hsEqn.relax();
hsEqn.solve();
thermo.correct();
Info<< "min/max(T) = "
<< min(T).value() << ", " << max(T).value() << endl;
}
Info<< "Mean pressure:" << p.weightedAverage(mesh.V()).value() << endl;
Info<< "Mean temperature:" << T.weightedAverage(mesh.V()).value() << endl;
Info<< "Mean u':"
<< (sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value()
<< endl;
logSummaryFile
<< runTime.theta() << tab
<< p.weightedAverage(mesh.V()).value() << tab
<< T.weightedAverage(mesh.V()).value() << tab
<< (sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value()
<< endl;
rho = thermo.rho();
volScalarField A(UEqn.A());
U = UEqn.H()/A;
if (pimple.transonic())
{
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)
*((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U))
);
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho/A, p)
==
Sevap
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi == pEqn.flux();
}
}
}
else
{
phi = fvc::interpolate(rho)
*((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U));
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
- fvm::laplacian(rho/A, p)
==
Sevap
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi += pEqn.flux();
}
}
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U -= fvc::grad(p)/A;
U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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/>.
Global
rhoEqn
Description
Solve the continuity for density.
\*---------------------------------------------------------------------------*/
volScalarField Sevap
(
IOobject
(
"Sevap",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimensionSet(1, -3, -1, 0, 0), 0.0)
);
forAll(Y, i)
{
if (dieselSpray.isLiquidFuel()[i])
{
Sevap += dieselSpray.evaporationSource(i);
}
}
{
solve
(
fvm::ddt(rho)
+ fvc::div(phi)
==
Sevap
);
}
// ************************************************************************* //
label Nparcels = dieselSpray.size();
reduce(Nparcels, sumOp<label>());
Info<< "\nNumber of parcels in system.... | "
<< Nparcels << endl
<< "Injected liquid mass........... | "
<< 1e6*dieselSpray.injectedMass(runTime.value()) << " mg" << endl
<< "Liquid Mass in system.......... | "
<< 1e6*dieselSpray.liquidMass() << " mg" << endl
<< "SMD, Dmax...................... | "
<< dieselSpray.smd()*1e6 << " mu, "
<< dieselSpray.maxD()*1e6 << " mu"
<< endl;
scalar evapMass =
dieselSpray.injectedMass(runTime.value())
- dieselSpray.liquidMass();
scalar gasMass = fvc::domainIntegrate(rho).value();
if (dieselSpray.twoD())
{
gasMass *= constant::mathematical::twoPi/dieselSpray.angleOfWedge();
}
scalar addedMass = gasMass - gasMass0;
Info<< "Added gas mass................. | " << 1e6*addedMass << " mg"
<< nl << "Evaporation Continuity Error... | "
<< 1e6*(addedMass - evapMass) << " mg" << endl;
Info<< "Total cylinder mass: " << fvc::domainIntegrate(rho).value() << endl;
//Info<< "Total fuel mass: "
// << fvc::domainIntegrate(rho*compostion.ft()).value() << endl;
OFstream logSummaryFile
(
runTime.path()/("logSummary." + runTime.timeName() + ".dat")
);
logSummaryFile
<< "# CA" << " p" << " T" << " u'" << endl;
dieselFoam.C
EXE = $(FOAM_APPBIN)/dieselFoam
EXE_INC = \
-I../dieselEngineFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \