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

@ -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;
}
}