mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
Rationalized the LTS solvers
This commit is contained in:
@ -53,9 +53,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMRF.H"
|
#include "createMRF.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "readTimeControls.H"
|
#include "createRDeltaT.H"
|
||||||
#include "compressibleCourantNo.H"
|
|
||||||
#include "setInitialrDeltaT.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -63,8 +61,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (runTime.run())
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
#include "readTimeControls.H"
|
|
||||||
|
|
||||||
runTime++;
|
runTime++;
|
||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
@ -76,6 +72,11 @@ int main(int argc, char *argv[])
|
|||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
while (pimple.loop())
|
while (pimple.loop())
|
||||||
{
|
{
|
||||||
|
if (pimple.turbCorr())
|
||||||
|
{
|
||||||
|
turbulence->correct();
|
||||||
|
}
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "YEqn.H"
|
#include "YEqn.H"
|
||||||
#include "EEqn.H"
|
#include "EEqn.H"
|
||||||
@ -85,11 +86,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pimple.turbCorr())
|
|
||||||
{
|
|
||||||
turbulence->correct();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -1,48 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2013 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/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// Maximum flow Courant number
|
|
||||||
scalar maxCo(readScalar(pimple.dict().lookup("maxCo")));
|
|
||||||
|
|
||||||
// Maximum time scale
|
|
||||||
scalar maxDeltaT(pimple.dict().lookupOrDefault<scalar>("maxDeltaT", GREAT));
|
|
||||||
|
|
||||||
// Smoothing parameter (0-1) when smoothing iterations > 0
|
|
||||||
scalar rDeltaTSmoothingCoeff
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Damping coefficient (1-0)
|
|
||||||
scalar rDeltaTDampingCoeff
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault<scalar>("rDeltaTDampingCoeff", 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Maximum change in cell temperature per iteration (relative to previous value)
|
|
||||||
scalar alphaTemp(pimple.dict().lookupOrDefault("alphaTemp", 0.05));
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,6 +24,31 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
{
|
{
|
||||||
|
const dictionary& pimpleDict = pimple.dict();
|
||||||
|
|
||||||
|
// Maximum flow Courant number
|
||||||
|
scalar maxCo(readScalar(pimpleDict.lookup("maxCo")));
|
||||||
|
|
||||||
|
// Maximum time scale
|
||||||
|
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));
|
||||||
|
|
||||||
|
// Smoothing parameter (0-1) when smoothing iterations > 0
|
||||||
|
scalar rDeltaTSmoothingCoeff
|
||||||
|
(
|
||||||
|
pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Damping coefficient (1-0)
|
||||||
|
scalar rDeltaTDampingCoeff
|
||||||
|
(
|
||||||
|
pimpleDict.lookupOrDefault<scalar>("rDeltaTDampingCoeff", 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Maximum change in cell temperature per iteration
|
||||||
|
// (relative to previous value)
|
||||||
|
scalar alphaTemp(pimpleDict.lookupOrDefault("alphaTemp", 0.05));
|
||||||
|
|
||||||
|
|
||||||
Info<< "Time scales min/max:" << endl;
|
Info<< "Time scales min/max:" << endl;
|
||||||
|
|
||||||
// Cache old reciprocal time scale field
|
// Cache old reciprocal time scale field
|
||||||
@ -94,4 +119,5 @@ License
|
|||||||
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
|
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -53,7 +53,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
pimpleControl pimple(mesh);
|
pimpleControl pimple(mesh);
|
||||||
|
|
||||||
#include "setInitialrDeltaT.H"
|
#include "createRDeltaT.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createMRF.H"
|
#include "createMRF.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
|
|||||||
@ -51,7 +51,6 @@ Description
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
|
|
||||||
@ -59,13 +58,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "readGravitationalAcceleration.H"
|
#include "readGravitationalAcceleration.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "readTimeControls.H"
|
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "createMRF.H"
|
#include "createMRF.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
#include "createClouds.H"
|
#include "createClouds.H"
|
||||||
#include "createRadiationModel.H"
|
#include "createRadiationModel.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -73,8 +71,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (runTime.run())
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
#include "readTimeControls.H"
|
|
||||||
|
|
||||||
runTime++;
|
runTime++;
|
||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
@ -83,10 +79,9 @@ int main(int argc, char *argv[])
|
|||||||
pDyn = 0.5*rho*magSqr(U);
|
pDyn = 0.5*rho*magSqr(U);
|
||||||
|
|
||||||
coalParcels.evolve();
|
coalParcels.evolve();
|
||||||
|
|
||||||
limestoneParcels.evolve();
|
limestoneParcels.evolve();
|
||||||
|
|
||||||
#include "timeScales.H"
|
#include "setrDeltaT.H"
|
||||||
|
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,134 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2015 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
{
|
||||||
|
const dictionary& pimpleDict = pimple.dict();
|
||||||
|
|
||||||
|
// Maximum flow Courant number
|
||||||
|
scalar maxCo(readScalar(pimpleDict.lookup("maxCo")));
|
||||||
|
|
||||||
|
// Maximum time scale
|
||||||
|
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));
|
||||||
|
|
||||||
|
// Smoothing parameter (0-1) when smoothing iterations > 0
|
||||||
|
scalar rDeltaTSmoothingCoeff
|
||||||
|
(
|
||||||
|
pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Damping coefficient (1-0)
|
||||||
|
scalar rDeltaTDampingCoeff
|
||||||
|
(
|
||||||
|
pimpleDict.lookupOrDefault<scalar>("rDeltaTDampingCoeff", 0.2)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Maximum change in cell temperature per iteration
|
||||||
|
// (relative to previous value)
|
||||||
|
scalar alphaTemp(pimpleDict.lookupOrDefault("alphaTemp", 0.05));
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Time scales min/max:" << endl;
|
||||||
|
|
||||||
|
// Cache old reciprocal time scale field
|
||||||
|
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
||||||
|
|
||||||
|
// Flow time scale
|
||||||
|
{
|
||||||
|
rDeltaT.dimensionedInternalField() =
|
||||||
|
(
|
||||||
|
fvc::surfaceSum(mag(phi))().dimensionedInternalField()
|
||||||
|
/((2*maxCo)*mesh.V()*rho.dimensionedInternalField())
|
||||||
|
);
|
||||||
|
|
||||||
|
// Limit the largest time scale
|
||||||
|
rDeltaT.max(1/maxDeltaT);
|
||||||
|
|
||||||
|
Info<< " Flow = "
|
||||||
|
<< gMin(1/rDeltaT.internalField()) << ", "
|
||||||
|
<< gMax(1/rDeltaT.internalField()) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reaction source time scale
|
||||||
|
if (alphaTemp < 1.0)
|
||||||
|
{
|
||||||
|
volScalarField::DimensionedInternalField rDeltaTT
|
||||||
|
(
|
||||||
|
mag
|
||||||
|
(
|
||||||
|
(coalParcels.hsTrans() + limestoneParcels.hsTrans())
|
||||||
|
/(mesh.V()*runTime.deltaT())
|
||||||
|
+ combustion->Sh()()
|
||||||
|
)
|
||||||
|
/(
|
||||||
|
alphaTemp
|
||||||
|
*rho.dimensionedInternalField()
|
||||||
|
*thermo.Cp()().dimensionedInternalField()
|
||||||
|
*T.dimensionedInternalField()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Temperature = "
|
||||||
|
<< gMin(1/(rDeltaTT.field() + VSMALL)) << ", "
|
||||||
|
<< gMax(1/(rDeltaTT.field() + VSMALL)) << endl;
|
||||||
|
|
||||||
|
rDeltaT.dimensionedInternalField() = max
|
||||||
|
(
|
||||||
|
rDeltaT.dimensionedInternalField(),
|
||||||
|
rDeltaTT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update tho boundary values of the reciprocal time-step
|
||||||
|
rDeltaT.correctBoundaryConditions();
|
||||||
|
|
||||||
|
// Spatially smooth the time scale field
|
||||||
|
if (rDeltaTSmoothingCoeff < 1.0)
|
||||||
|
{
|
||||||
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit rate of change of time scale
|
||||||
|
// - reduce as much as required
|
||||||
|
// - only increase at a fraction of old time scale
|
||||||
|
if
|
||||||
|
(
|
||||||
|
rDeltaTDampingCoeff < 1.0
|
||||||
|
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rDeltaT = max
|
||||||
|
(
|
||||||
|
rDeltaT,
|
||||||
|
(scalar(1.0) - rDeltaTDampingCoeff)*rDeltaT0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< " Overall = "
|
||||||
|
<< gMin(1/rDeltaT.internalField())
|
||||||
|
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1,114 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2015 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/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
Info<< "Time scales min/max:" << endl;
|
|
||||||
|
|
||||||
{
|
|
||||||
// Cache old time scale field
|
|
||||||
tmp<volScalarField> trDeltaT
|
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rDeltaT0",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
rDeltaT
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const volScalarField& rDeltaT0 = trDeltaT();
|
|
||||||
|
|
||||||
|
|
||||||
// Flow time scale
|
|
||||||
// ~~~~~~~~~~~~~~~
|
|
||||||
{
|
|
||||||
rDeltaT =
|
|
||||||
fvc::surfaceSum
|
|
||||||
(
|
|
||||||
mag(phi)*mesh.deltaCoeffs()/(maxCo*mesh.magSf())
|
|
||||||
)
|
|
||||||
/rho;
|
|
||||||
|
|
||||||
rDeltaT.max(1.0/maxDeltaT);
|
|
||||||
|
|
||||||
Info<< " Flow = "
|
|
||||||
<< gMin(1/rDeltaT.internalField()) << ", "
|
|
||||||
<< gMax(1/rDeltaT.internalField()) << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Temperature source time scale
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
{
|
|
||||||
scalarField tau
|
|
||||||
(
|
|
||||||
runTime.deltaTValue()
|
|
||||||
*mag
|
|
||||||
(
|
|
||||||
(coalParcels.hsTrans() + limestoneParcels.hsTrans())
|
|
||||||
/(mesh.V()*runTime.deltaT())
|
|
||||||
+ combustion->Sh()()
|
|
||||||
- fvc::div(phi, 0.5*magSqr(U), "div(phi,K)")()
|
|
||||||
)
|
|
||||||
/rho
|
|
||||||
);
|
|
||||||
|
|
||||||
tau = alphaTemp*thermo.Cp()*T/(tau + ROOTVSMALL);
|
|
||||||
|
|
||||||
Info<< " Temperature = " << min(maxDeltaT, gMin(tau)) << ", "
|
|
||||||
<< min(maxDeltaT, gMax(tau)) << endl;
|
|
||||||
|
|
||||||
rDeltaT.internalField() = max(rDeltaT.internalField(), 1/tau);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Limit rate of change of time scale
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// - reduce as much as required for flow, but limit source contributions
|
|
||||||
const dimensionedScalar deltaTRamp("deltaTRamp", dimless, 1/(1 + 0.2));
|
|
||||||
rDeltaT = max(rDeltaT, rDeltaT0*deltaTRamp);
|
|
||||||
|
|
||||||
|
|
||||||
// Limit the largest time scale
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
rDeltaT.max(1/maxDeltaT);
|
|
||||||
|
|
||||||
|
|
||||||
// Spatially smooth the time scale field
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
|
||||||
|
|
||||||
Info<< " Overall = " << min(1/rDeltaT).value()
|
|
||||||
<< ", " << max(1/rDeltaT).value() << nl << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -48,21 +48,19 @@ Description
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "readGravitationalAcceleration.H"
|
|
||||||
|
|
||||||
pimpleControl pimple(mesh);
|
pimpleControl pimple(mesh);
|
||||||
|
|
||||||
#include "readTimeControls.H"
|
#include "readGravitationalAcceleration.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createMRF.H"
|
#include "createMRF.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "createRadiationModel.H"
|
#include "createRadiationModel.H"
|
||||||
#include "createClouds.H"
|
#include "createClouds.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -70,22 +68,23 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (runTime.run())
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
#include "readTimeControls.H"
|
|
||||||
|
|
||||||
runTime++;
|
runTime++;
|
||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
parcels.evolve();
|
parcels.evolve();
|
||||||
|
|
||||||
#include "timeScales.H"
|
#include "setrDeltaT.H"
|
||||||
|
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
while (pimple.loop())
|
while (pimple.loop())
|
||||||
{
|
{
|
||||||
turbulence->correct();
|
if (pimple.turbCorr())
|
||||||
|
{
|
||||||
|
turbulence->correct();
|
||||||
|
}
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "YEqn.H"
|
#include "YEqn.H"
|
||||||
|
|||||||
@ -1,42 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// Maximum flow Courant number
|
|
||||||
scalar maxCo(readScalar(pimple.dict().lookup("maxCo")));
|
|
||||||
|
|
||||||
// Maximum time scale
|
|
||||||
scalar maxDeltaT(pimple.dict().lookupOrDefault<scalar>("maxDeltaT", GREAT));
|
|
||||||
|
|
||||||
// Smoothing parameter (0-1) when smoothing iterations > 0
|
|
||||||
scalar rDeltaTSmoothingCoeff
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Maximum change in cell temperature per iteration (relative to previous value)
|
|
||||||
scalar alphaTemp(pimple.dict().lookupOrDefault("alphaTemp", 0.05));
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2015 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
{
|
||||||
|
const dictionary& pimpleDict = pimple.dict();
|
||||||
|
|
||||||
|
// Maximum flow Courant number
|
||||||
|
scalar maxCo(readScalar(pimpleDict.lookup("maxCo")));
|
||||||
|
|
||||||
|
// Maximum time scale
|
||||||
|
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));
|
||||||
|
|
||||||
|
// Smoothing parameter (0-1) when smoothing iterations > 0
|
||||||
|
scalar rDeltaTSmoothingCoeff
|
||||||
|
(
|
||||||
|
pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Damping coefficient (1-0)
|
||||||
|
scalar rDeltaTDampingCoeff
|
||||||
|
(
|
||||||
|
pimpleDict.lookupOrDefault<scalar>("rDeltaTDampingCoeff", 0.2)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Maximum change in cell temperature per iteration
|
||||||
|
// (relative to previous value)
|
||||||
|
scalar alphaTemp(pimpleDict.lookupOrDefault("alphaTemp", 0.05));
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Time scales min/max:" << endl;
|
||||||
|
|
||||||
|
// Cache old reciprocal time scale field
|
||||||
|
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
||||||
|
|
||||||
|
// Flow time scale
|
||||||
|
{
|
||||||
|
rDeltaT.dimensionedInternalField() =
|
||||||
|
(
|
||||||
|
fvc::surfaceSum(mag(phi))().dimensionedInternalField()
|
||||||
|
/((2*maxCo)*mesh.V()*rho.dimensionedInternalField())
|
||||||
|
);
|
||||||
|
|
||||||
|
// Limit the largest time scale
|
||||||
|
rDeltaT.max(1/maxDeltaT);
|
||||||
|
|
||||||
|
Info<< " Flow = "
|
||||||
|
<< gMin(1/rDeltaT.internalField()) << ", "
|
||||||
|
<< gMax(1/rDeltaT.internalField()) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reaction source time scale
|
||||||
|
if (alphaTemp < 1.0)
|
||||||
|
{
|
||||||
|
volScalarField::DimensionedInternalField rDeltaTT
|
||||||
|
(
|
||||||
|
mag
|
||||||
|
(
|
||||||
|
parcels.hsTrans()/(mesh.V()*runTime.deltaT())
|
||||||
|
+ combustion->Sh()()
|
||||||
|
)
|
||||||
|
/(
|
||||||
|
alphaTemp
|
||||||
|
*rho.dimensionedInternalField()
|
||||||
|
*thermo.Cp()().dimensionedInternalField()
|
||||||
|
*T.dimensionedInternalField()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Temperature = "
|
||||||
|
<< gMin(1/(rDeltaTT.field() + VSMALL)) << ", "
|
||||||
|
<< gMax(1/(rDeltaTT.field() + VSMALL)) << endl;
|
||||||
|
|
||||||
|
rDeltaT.dimensionedInternalField() = max
|
||||||
|
(
|
||||||
|
rDeltaT.dimensionedInternalField(),
|
||||||
|
rDeltaTT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update tho boundary values of the reciprocal time-step
|
||||||
|
rDeltaT.correctBoundaryConditions();
|
||||||
|
|
||||||
|
// Spatially smooth the time scale field
|
||||||
|
if (rDeltaTSmoothingCoeff < 1.0)
|
||||||
|
{
|
||||||
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit rate of change of time scale
|
||||||
|
// - reduce as much as required
|
||||||
|
// - only increase at a fraction of old time scale
|
||||||
|
if
|
||||||
|
(
|
||||||
|
rDeltaTDampingCoeff < 1.0
|
||||||
|
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rDeltaT = max
|
||||||
|
(
|
||||||
|
rDeltaT,
|
||||||
|
(scalar(1.0) - rDeltaTDampingCoeff)*rDeltaT0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< " Overall = "
|
||||||
|
<< gMin(1/rDeltaT.internalField())
|
||||||
|
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1,115 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2013 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/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
Info<< "Time scales min/max:" << endl;
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
// Cache old time scale field
|
|
||||||
tmp<volScalarField> trDeltaT
|
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rDeltaT0",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
rDeltaT
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const volScalarField& rDeltaT0 = trDeltaT();
|
|
||||||
|
|
||||||
|
|
||||||
// Flow time scale
|
|
||||||
// ~~~~~~~~~~~~~~~
|
|
||||||
{
|
|
||||||
rDeltaT =
|
|
||||||
fvc::surfaceSum
|
|
||||||
(
|
|
||||||
mag(phi)*mesh.deltaCoeffs()/(maxCo*mesh.magSf())
|
|
||||||
)
|
|
||||||
/rho;
|
|
||||||
|
|
||||||
rDeltaT.max(1.0/maxDeltaT);
|
|
||||||
|
|
||||||
Info<< " Flow = "
|
|
||||||
<< gMin(1/rDeltaT.internalField()) << ", "
|
|
||||||
<< gMax(1/rDeltaT.internalField()) << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Temperature source time scale
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
{
|
|
||||||
scalarField tau
|
|
||||||
(
|
|
||||||
runTime.deltaTValue()
|
|
||||||
*mag
|
|
||||||
(
|
|
||||||
parcels.hsTrans()/(mesh.V()*runTime.deltaT())
|
|
||||||
// + fvOptions(rho, hs)
|
|
||||||
+ combustion->Sh()()
|
|
||||||
- fvc::div(phi, 0.5*magSqr(U), "div(phi,K)")()
|
|
||||||
)
|
|
||||||
/rho
|
|
||||||
);
|
|
||||||
|
|
||||||
tau = alphaTemp*thermo.Cp()*T/(tau + ROOTVSMALL);
|
|
||||||
|
|
||||||
Info<< " Temperature = " << min(maxDeltaT, gMin(tau)) << ", "
|
|
||||||
<< min(maxDeltaT, gMax(tau)) << endl;
|
|
||||||
|
|
||||||
rDeltaT.internalField() = max(rDeltaT.internalField(), 1/tau);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Limit rate of change of time scale
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// - reduce as much as required for flow, but limit source contributions
|
|
||||||
const dimensionedScalar deltaTRamp("deltaTRamp", dimless, 1/(1 + 0.2));
|
|
||||||
rDeltaT = max(rDeltaT, rDeltaT0*deltaTRamp);
|
|
||||||
|
|
||||||
|
|
||||||
// Limit the largest time scale
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
rDeltaT.max(1/maxDeltaT);
|
|
||||||
|
|
||||||
|
|
||||||
// Spatially smooth the time scale field
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
|
||||||
|
|
||||||
Info<< " Overall = " << min(1/rDeltaT).value()
|
|
||||||
<< ", " << max(1/rDeltaT).value() << nl << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
#include "correctPhi.H"
|
#include "correctPhi.H"
|
||||||
#include "CourantNo.H"
|
#include "CourantNo.H"
|
||||||
#include "setInitialrDeltaT.H"
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
application LTSReactingParcelFoam;
|
application LTSReactingParcelFoam;
|
||||||
|
|
||||||
startFoam latestTime;
|
startFrom latestTime;
|
||||||
|
|
||||||
startTime 0;
|
startTime 0;
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ PIMPLE
|
|||||||
rhoMin 0.1;
|
rhoMin 0.1;
|
||||||
rhoMax 1.5;
|
rhoMax 1.5;
|
||||||
|
|
||||||
maxCo 5;
|
maxCo 2.5;
|
||||||
rDeltaTSmoothingCoeff 1;
|
rDeltaTSmoothingCoeff 1;
|
||||||
alphaTemp 1;
|
alphaTemp 1;
|
||||||
maxDeltaT 1;
|
maxDeltaT 1;
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
application reactingParcelFoam;
|
application reactingParcelFoam;
|
||||||
|
|
||||||
startFoam startTime;
|
startFrom startTime;
|
||||||
|
|
||||||
startTime 0;
|
startTime 0;
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
application reactingParcelFoam;
|
application reactingParcelFoam;
|
||||||
|
|
||||||
startFoam latestTime;
|
startFrom latestTime;
|
||||||
|
|
||||||
startTime 0;
|
startTime 0;
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
application simpleReactingParcelFoam;
|
application simpleReactingParcelFoam;
|
||||||
|
|
||||||
startFoam latestTime;
|
startFrom latestTime;
|
||||||
|
|
||||||
startTime 0;
|
startTime 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user