XiFluid, PDRFoam: Updated so that coefficients can be specified without dimensions

All associated combustion tutorials have been simplified using this functionality.
This commit is contained in:
Henry Weller
2023-07-26 14:44:10 +01:00
parent a9a75605cb
commit 66188fac7a
14 changed files with 124 additions and 65 deletions

View File

@ -116,30 +116,18 @@ Foam::solvers::XiFluid::XiFluid(fvMesh& mesh)
combustionProperties.lookup("SuModel")
),
sigmaExt
(
combustionProperties.lookup("sigmaExt")
),
sigmaExt("sigmaExt", dimless/dimTime, combustionProperties),
XiModel
(
combustionProperties.lookup("XiModel")
),
XiCoef
(
combustionProperties.lookup("XiCoef")
),
XiCoef("XiCoef", dimless, combustionProperties),
XiShapeCoef
(
combustionProperties.lookup("XiShapeCoef")
),
XiShapeCoef("XiShapeCoef", dimless, combustionProperties),
uPrimeCoef
(
combustionProperties.lookup("uPrimeCoef")
),
uPrimeCoef("uPrimeCoef", dimless, combustionProperties),
ign(combustionProperties, runTime, mesh),

View File

@ -59,21 +59,22 @@ Description
Where:
\table
Property | Description | Required | Default value
type | Type of functionObject | yes |
libs | Libraries containing implementation | yes |
region | Name of region for multi-region cases | no |
enabled | On/off switch | no | yes
log | Log information to standard output | no | no
startTime| Start time | no |
endTime | End time | no |
executeAtStart | Execute at start time switch | no | yes
executeControl | See time controls below | no | timeStep
executeInterval | Steps between each execution | no |
executeTimes | List of execution times | no |
writeControl | See time controls below | no | timeStep
writeInterval | Steps between each write | no |
writeTimes | List of write times | no |
Property | Description | Required | Default value
type | Type of functionObject | yes |
libs | Shared libraries | no |
region | Name of region | no |
enabled | On/off switch | no | yes
log | Print data to log | no | no
startTime | Start time | no |
endTime | End time | no |
executeAtStart | Execute at start time switch | no | yes
executeControl | See time controls below | no | timeStep
executeInterval | Steps between each execution | no |
executeTimes | List of execution times | no |
writeControl | See time controls below | no | timeStep
writeInterval | Steps between each write | no |
writeTimes | List of write times | no |
writeFrequencies | List of write frequencies | no |
\endtable
Time controls:

View File

@ -83,7 +83,6 @@ void Foam::timeControl::read(const dictionary& dict)
{
word controlName(prefix_ + "Control");
word intervalName(prefix_ + "Interval");
const word timesName(prefix_ + "Times");
// For backward compatibility support the deprecated 'outputControl' option
// now superseded by 'writeControl' for compatibility with Time
@ -147,8 +146,69 @@ void Foam::timeControl::read(const dictionary& dict)
case timeControls::runTimes:
{
times_ = dict.lookup<scalarList>(timesName);
timeDelta_ = dict.lookupOrDefault("timeDelta", 1e-6);
const word timesName(prefix_ + "Times");
const word frequenciesName(prefix_ + "Frequencies");
const bool repeat = dict.lookupOrDefault("writeRepeat", false);
timeDelta_ = dict.lookupOrDefault
(
"timeDelta",
1e-3*time_.deltaTValue()
);
if (dict.found(timesName))
{
times_ = dict.lookup<scalarList>(timesName);
}
else if (dict.found(frequenciesName))
{
List<Pair<scalar>> frequencies
(
dict.lookup(frequenciesName)
);
if (!repeat)
{
frequencies.append
(
{time_.endTime().value(), frequencies.last().second()}
);
}
const scalar frequenciesDuration =
frequencies.last().first() - frequencies.first().first();
DynamicList<scalar> times(1, frequencies[0].first());
label i = 0;
label repeati = 0;
while (times[i] < time_.endTime().value())
{
for(label pi=0; pi<frequencies.size()-1; pi++)
{
while
(
times[i]
< frequencies[pi + 1].first()
+ repeati*frequenciesDuration - timeDelta_
)
{
times(i + 1) = times[i] + frequencies[pi].second();
i++;
}
}
repeati++;
}
times_ = times;
}
else
{
FatalErrorInFunction
<< "Undefined " << timesName
<< " or " << frequenciesName << " for output control: "
<< timeControlNames_[timeControl_] << nl
<< exit(FatalError);
}
forAll(times_, i)
{
@ -265,7 +325,7 @@ bool Foam::timeControl::execute()
FatalErrorInFunction
<< "Undefined output control: "
<< timeControlNames_[timeControl_] << nl
<< abort(FatalError);
<< exit(FatalError);
break;
}
}
@ -328,7 +388,7 @@ Foam::scalar Foam::timeControl::timeToNextAction()
FatalErrorInFunction
<< "Undefined output control: "
<< timeControlNames_[timeControl_] << nl
<< abort(FatalError);
<< exit(FatalError);
break;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,7 +50,7 @@ Foam::laminarFlameSpeed::laminarFlameSpeed
if (!psiuMulticomponentThermo_.composition().contains("ft"))
{
equivalenceRatio_ =
dimensionedScalar(dict.lookup("equivalenceRatio")).value();
dimensionedScalar("equivalenceRatio", dimless, dict).value();
}
}

View File

@ -49,7 +49,7 @@ Foam::egrMixture<ThermoType>::egrMixture
phaseName
),
stoicRatio_(thermoDict.lookup("stoichiometricAirFuelMassRatio")),
stoicRatio_("stoichiometricAirFuelMassRatio", dimless, thermoDict),
fuel_("fuel", thermoDict.subDict("fuel")),
oxidant_("oxidant", thermoDict.subDict("oxidant")),
@ -100,7 +100,12 @@ const ThermoType& Foam::egrMixture<ThermoType>::mixture
template<class ThermoType>
void Foam::egrMixture<ThermoType>::read(const dictionary& thermoDict)
{
stoicRatio_ = thermoDict.lookup("stoichiometricAirFuelMassRatio");
stoicRatio_ = dimensionedScalar
(
"stoichiometricAirFuelMassRatio",
dimless,
thermoDict
);
fuel_ = ThermoType("fuel", thermoDict.subDict("fuel"));
oxidant_ = ThermoType("oxidant", thermoDict.subDict("oxidant"));

View File

@ -54,7 +54,7 @@ Foam::inhomogeneousMixture<ThermoType>::inhomogeneousMixture
phaseName
),
stoicRatio_(thermoDict.lookup("stoichiometricAirFuelMassRatio")),
stoicRatio_("stoichiometricAirFuelMassRatio", dimless, thermoDict),
fuel_("fuel", thermoDict.subDict("fuel")),
oxidant_("oxidant", thermoDict.subDict("oxidant")),
@ -98,7 +98,12 @@ const ThermoType& Foam::inhomogeneousMixture<ThermoType>::mixture
template<class ThermoType>
void Foam::inhomogeneousMixture<ThermoType>::read(const dictionary& thermoDict)
{
stoicRatio_ = thermoDict.lookup("stoichiometricAirFuelMassRatio");
stoicRatio_ = dimensionedScalar
(
"stoichiometricAirFuelMassRatio",
dimless,
thermoDict
);
fuel_ = ThermoType("fuel", thermoDict.subDict("fuel"));
oxidant_ = ThermoType("oxidant", thermoDict.subDict("oxidant"));

View File

@ -55,7 +55,7 @@ Foam::veryInhomogeneousMixture<ThermoType>::veryInhomogeneousMixture
phaseName
),
stoicRatio_(thermoDict.lookup("stoichiometricAirFuelMassRatio")),
stoicRatio_("stoichiometricAirFuelMassRatio", dimless, thermoDict),
fuel_("fuel", thermoDict.subDict("fuel")),
oxidant_("oxidant", thermoDict.subDict("oxidant")),

View File

@ -18,21 +18,21 @@ laminarFlameSpeedCorrelation Gulders;
fuel IsoOctane;
Su Su [0 1 -1 0 0 0 0] 0;
Su 0;
SuModel unstrained;
equivalenceRatio equivalenceRatio [0 0 0 0 0 0 0] 1;
equivalenceRatio 1;
sigmaExt sigmaExt [0 0 -1 0 0 0 0] 100000;
sigmaExt 100000;
XiModel transport;
XiCoef XiCoef [0 0 0 0 0 0 0] 0.62;
XiCoef 0.62;
XiShapeCoef XiShapeCoef [0 0 0 0 0 0 0] 1;
XiShapeCoef 1;
uPrimeCoef uPrimeCoef [0 0 0 0 0 0 0] 1;
uPrimeCoef 1;
GuldersCoeffs
{

View File

@ -26,7 +26,7 @@ thermoType
// energy absoluteInternalEnergy;
}
stoichiometricAirFuelMassRatio stoichiometricAirFuelMassRatio [0 0 0 0 0 0 0] 15.0336;
stoichiometricAirFuelMassRatio 15.0336;
fuel
{

View File

@ -16,21 +16,21 @@ FoamFile
#include "combustionPropertiesInclude"
Su Su [0 1 -1 0 0 0 0] 0.434;
Su 0.434;
SuModel unstrained;
equivalenceRatio equivalenceRatio [0 0 0 0 0 0 0] 1;
equivalenceRatio 1;
sigmaExt sigmaExt [0 0 -1 0 0 0 0] 100000;
sigmaExt 100000;
XiModel transport;
XiCoef XiCoef [0 0 0 0 0 0 0] 0.62;
XiCoef 0.62;
XiShapeCoef XiShapeCoef [0 0 0 0 0 0 0] 1;
XiShapeCoef 1;
uPrimeCoef uPrimeCoef [0 0 0 0 0 0 0] 1;
uPrimeCoef 1;
GuldersCoeffs
{

View File

@ -25,7 +25,7 @@ thermoType
energy absoluteEnthalpy;
}
stoichiometricAirFuelMassRatio stoichiometricAirFuelMassRatio [0 0 0 0 0 0 0] 15.675;
stoichiometricAirFuelMassRatio 15.675;
reactants
{

View File

@ -25,7 +25,7 @@ thermoType
energy absoluteEnthalpy;
}
stoichiometricAirFuelMassRatio stoichiometricAirFuelMassRatio [0 0 0 0 0 0 0] 34.074;
stoichiometricAirFuelMassRatio 34.074;
reactants
{

View File

@ -14,16 +14,16 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
strike [0 1 0 0 0 0 0] 40;
strike 40;
r [0 0 -1 0 0 0 0] 0.1;
r 0.1;
sigma [0 0 -0.5 0 0 0 0] 0.2;
sigma 0.2;
s [0 0 -1 0 0 0 0] 0;
s 0;
xi [0 0 -0.5 0 0 0 0] 0.1;
xi 0.1;
eta [0 0 0 0 0 0 0] 0;
eta 0;
// ************************************************************************* //

View File

@ -25,7 +25,7 @@ thermoType
energy absoluteEnthalpy;
}
stoichiometricAirFuelMassRatio stoichiometricAirFuelMassRatio [0 0 0 0 0 0 0] 15.5776;
stoichiometricAirFuelMassRatio 15.5776;
fuel
{