Merge branch 'master' into develop

This commit is contained in:
Andrew Heather
2017-03-21 13:36:26 +00:00
15 changed files with 69 additions and 36 deletions

View File

@ -126,7 +126,8 @@ void Foam::timeControl::read(const dictionary& dict)
case ocCpuTime: case ocCpuTime:
case ocAdjustableRunTime: case ocAdjustableRunTime:
{ {
interval_ = readScalar(dict.lookup(intervalName)); const scalar userTime = readScalar(dict.lookup(intervalName));
interval_ = time_.userTimeToTime(userTime);
break; break;
} }

View File

@ -43,8 +43,15 @@ namespace functionObjects
void Foam::functionObjects::timeControl::readControls() void Foam::functionObjects::timeControl::readControls()
{ {
dict_.readIfPresent("timeStart", timeStart_); if (dict_.readIfPresent("timeStart", timeStart_))
dict_.readIfPresent("timeEnd", timeEnd_); {
timeStart_ = time_.userTimeToTime(timeStart_);
}
if (dict_.readIfPresent("timeEnd", timeEnd_))
{
timeEnd_ = time_.userTimeToTime(timeEnd_);
}
dict_.readIfPresent("nStepsToStartTimeChange", nStepsToStartTimeChange_); dict_.readIfPresent("nStepsToStartTimeChange", nStepsToStartTimeChange_);
} }

View File

@ -92,8 +92,8 @@ Foam::autoPtr<Foam::OFstream> Foam::functionObjects::writeFile::createFile
if (Pstream::master() && writeToFile_) if (Pstream::master() && writeToFile_)
{ {
const word startTimeName = const scalar timeNow = fileObr_.time().timeOutputValue()
fileObr_.time().timeName(fileObr_.time().startTime().value()); const word startTimeName = Time::timeName(timeNow);
fileName outputDir(baseFileDir()/prefix_/startTimeName); fileName outputDir(baseFileDir()/prefix_/startTimeName);
@ -105,7 +105,7 @@ Foam::autoPtr<Foam::OFstream> Foam::functionObjects::writeFile::createFile
IFstream is(outputDir/(fName + ".dat")); IFstream is(outputDir/(fName + ".dat"));
if (is.good()) if (is.good())
{ {
fName = fName + "_" + fileObr_.time().timeName(); fName = fName + "_" + startTimeName;
} }
osPtr.set(new OFstream(outputDir/(fName + ".dat"))); osPtr.set(new OFstream(outputDir/(fName + ".dat")));
@ -258,7 +258,8 @@ void Foam::functionObjects::writeFile::writeHeader
void Foam::functionObjects::writeFile::writeTime(Ostream& os) const void Foam::functionObjects::writeFile::writeTime(Ostream& os) const
{ {
os << setw(charWidth()) << fileObr_.time().timeName(); const scalar timeNow = fileObr_.time().timeOutputValue()
os << setw(charWidth()) << Time::timeName(timeNow);
} }

View File

@ -254,7 +254,7 @@ bool Foam::ensightOutput::writeField
forAll(patchIds, listi) forAll(patchIds, listi)
{ {
const label patchId = patchIds[listi]; const label patchId = patchIds[listi];
const word& patchName = patchLookup[listi]; const word& patchName = patchLookup[patchId];
const ensightFaces& ensFaces = patchFaces[patchName]; const ensightFaces& ensFaces = patchFaces[patchName];
writeFaceField writeFaceField

View File

@ -44,6 +44,7 @@ Description
The weight applies to the first scheme and 1-weight to the second scheme. The weight applies to the first scheme and 1-weight to the second scheme.
Usage
Example of the CoBlended scheme specification using LUST for Courant numbers Example of the CoBlended scheme specification using LUST for Courant numbers
less than 1 and linearUpwind for Courant numbers greater than 10: less than 1 and linearUpwind for Courant numbers greater than 10:
\verbatim \verbatim

View File

@ -176,8 +176,9 @@ bool Foam::functionObjects::blendingFactor::write()
<< " blended cells : " << nCellsBlended << nl << " blended cells : " << nCellsBlended << nl
<< endl; << endl;
writeTime(file());
file() file()
<< time_.time().value()
<< token::TAB << nCellsScheme1 << token::TAB << nCellsScheme1
<< token::TAB << nCellsScheme2 << token::TAB << nCellsScheme2
<< token::TAB << nCellsBlended << token::TAB << nCellsBlended

View File

@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -98,7 +98,7 @@ void Foam::functionObjects::fieldAverage::initialize()
} }
} }
// ensure first averaging works unconditionally // Ensure first averaging works unconditionally
prevTimeIndex_ = -1; prevTimeIndex_ = -1;
Log << endl; Log << endl;
@ -108,7 +108,8 @@ void Foam::functionObjects::fieldAverage::initialize()
void Foam::functionObjects::fieldAverage::restart() void Foam::functionObjects::fieldAverage::restart()
{ {
Log << " Restarting averaging at time " << obr().time().timeName() Log << " Restarting averaging at time "
<< obr().time().timeOutputValue()
<< nl << endl; << nl << endl;
totalIter_.clear(); totalIter_.clear();
@ -221,7 +222,8 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
if (restartOnRestart_ || restartOnOutput_) if (restartOnRestart_ || restartOnOutput_)
{ {
Info<< " Starting averaging at time " << obr().time().timeName() Info<< " Starting averaging at time "
<< obr().time().timeOutputValue()
<< nl; << nl;
} }
else else
@ -240,15 +242,18 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
totalIter_[fieldi] = readLabel(fieldDict.lookup("totalIter")); totalIter_[fieldi] = readLabel(fieldDict.lookup("totalIter"));
totalTime_[fieldi] = readScalar(fieldDict.lookup("totalTime")); totalTime_[fieldi] = readScalar(fieldDict.lookup("totalTime"));
scalar userTotalTime =
obr().time().timeToUserTime(totalTime_[fieldi]);
Info<< " " << fieldName Info<< " " << fieldName
<< " iters = " << totalIter_[fieldi] << " iters = " << totalIter_[fieldi]
<< " time = " << totalTime_[fieldi] << nl; << " time = " << userTotalTime << nl;
} }
else else
{ {
Info<< " " << fieldName Info<< " " << fieldName
<< ": starting averaging at time " << ": starting averaging at time "
<< obr().time().timeName() << endl; << obr().time().timeOutputValue() << endl;
} }
} }
} }
@ -312,7 +317,8 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
if (periodicRestart_) if (periodicRestart_)
{ {
dict.lookup("restartPeriod") >> restartPeriod_; scalar userRestartPeriod = readScalar(dict.lookup("restartPeriod"));
restartPeriod_ = obr().time().userTimeToTime(userRestartPeriod);
if (restartPeriod_ > 0) if (restartPeriod_ > 0)
{ {
@ -323,22 +329,25 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
++periodIndex_; ++periodIndex_;
} }
Info<< " Restart period " << restartPeriod_ Info<< " Restart period " << userRestartPeriod
<< " - next restart at " << (restartPeriod_*periodIndex_) << " - next restart at " << (userRestartPeriod*periodIndex_)
<< nl << endl; << nl << endl;
} }
else else
{ {
periodicRestart_ = false; periodicRestart_ = false;
Info<< " Restart period " << restartPeriod_ Info<< " Restart period " << userRestartPeriod
<< " - ignored" << " - ignored"
<< nl << endl; << nl << endl;
} }
} }
if (dict.readIfPresent("restartTime", restartTime_)) scalar userRestartTime = 0;
if (dict.readIfPresent("restartTime", userRestartTime))
{ {
restartTime_ = obr().time().userTimeToTime(userRestartTime);
if (currentTime > restartTime_) if (currentTime > restartTime_)
{ {
// The restart time is already in the past - ignore // The restart time is already in the past - ignore
@ -346,7 +355,7 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
} }
else else
{ {
Info<< " Restart scheduled at time " << restartTime_ Info<< " Restart scheduled at time " << userRestartTime
<< nl << endl; << nl << endl;
} }
} }

View File

@ -122,6 +122,8 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
mesh_.objectRegistry::store(wallHeatFluxPtr); mesh_.objectRegistry::store(wallHeatFluxPtr);
read(dict); read(dict);
writeFileHeader(file());
} }
@ -267,8 +269,9 @@ bool Foam::functionObjects::wallHeatFlux::write()
if (Pstream::master()) if (Pstream::master())
{ {
writeTime(file());
file() file()
<< mesh_.time().value()
<< token::TAB << pp.name() << token::TAB << pp.name()
<< token::TAB << minHfp << token::TAB << minHfp
<< token::TAB << maxHfp << token::TAB << maxHfp

View File

@ -249,7 +249,9 @@ bool Foam::functionObjects::wallShearStress::write()
if (Pstream::master()) if (Pstream::master())
{ {
file() << mesh_.time().value() writeTime(file());
file()
<< token::TAB << pp.name() << token::TAB << pp.name()
<< token::TAB << minSsp << token::TAB << minSsp
<< token::TAB << maxSsp << token::TAB << maxSsp

View File

@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -186,7 +186,7 @@ void Foam::functionObjects::forceCoeffs::writeBinData
Ostream& os Ostream& os
) const ) const
{ {
os << obr_.time().value(); writeTime(os);
for (label bini = 0; bini < nBin_; bini++) for (label bini = 0; bini < nBin_; bini++)
{ {
@ -250,6 +250,14 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
// Free stream velocity magnitude // Free stream velocity magnitude
dict.lookup("magUInf") >> magUInf_; dict.lookup("magUInf") >> magUInf_;
// If case is compressible we must read rhoInf (store in rhoRef_) to
// calculate the reference dynamic pressure
// - note: for incompressible, rhoRef_ is already initialised
if (rhoName_ != "rhoInf")
{
dict.lookup("rhoInf") >> rhoRef_;
}
// Reference length and area scales // Reference length and area scales
dict.lookup("lRef") >> lRef_; dict.lookup("lRef") >> lRef_;
dict.lookup("Aref") >> Aref_; dict.lookup("Aref") >> Aref_;

View File

@ -593,8 +593,9 @@ void Foam::functionObjects::forces::writeIntegratedForceMoment
{ {
Ostream& os = osPtr(); Ostream& os = osPtr();
os << obr_.time().value() writeTime(os);
<< tab << total
os << tab << total
<< tab << pressure << tab << pressure
<< tab << viscous; << tab << viscous;

View File

@ -38,7 +38,7 @@ void Foam::functionObjects::thermoCoupleProbes::sampleAndWrite
probeStream probeStream
<< setw(w) << setw(w)
<< vField.time().timeToUserTime(vField.time().value()); << vField.time().timeOutputValue();
forAll(*this, probeI) forAll(*this, probeI)
{ {

View File

@ -45,7 +45,7 @@ void Foam::patchProbes::sampleAndWrite
probeStream probeStream
<< setw(w) << setw(w)
<< vField.time().timeToUserTime(vField.time().value()); << vField.time().timeOutputValue();
forAll(values, probei) forAll(values, probei)
{ {
@ -71,7 +71,7 @@ void Foam::patchProbes::sampleAndWrite
probeStream probeStream
<< setw(w) << setw(w)
<< sField.time().timeToUserTime(sField.time().value()); << sField.time().timeOutputValue();
forAll(values, probei) forAll(values, probei)
{ {

View File

@ -76,7 +76,7 @@ void Foam::probes::sampleAndWrite
unsigned int w = IOstream::defaultPrecision() + 7; unsigned int w = IOstream::defaultPrecision() + 7;
OFstream& os = *probeFilePtrs_[vField.name()]; OFstream& os = *probeFilePtrs_[vField.name()];
os << setw(w) << vField.time().timeToUserTime(vField.time().value()); os << setw(w) << vField.time().timeOutputValue();
forAll(values, probei) forAll(values, probei)
{ {
@ -100,7 +100,7 @@ void Foam::probes::sampleAndWrite
unsigned int w = IOstream::defaultPrecision() + 7; unsigned int w = IOstream::defaultPrecision() + 7;
OFstream& os = *probeFilePtrs_[sField.name()]; OFstream& os = *probeFilePtrs_[sField.name()];
os << setw(w) << sField.time().timeToUserTime(sField.time().value()); os << setw(w) << sField.time().timeOutputValue();
forAll(values, probei) forAll(values, probei)
{ {

View File

@ -51,16 +51,15 @@ functions
{ {
type forceCoeffs; type forceCoeffs;
libs ("libforces.so"); libs ("libforces.so");
writeControl timeStep; writeControl writeTime;
writeInterval 1;
patches patches
( (
WALL10 wall_4
); );
log true;
rhoInf 1; rhoInf 1;
CofR (0 0 0); CofR (0 0 0);
liftDir (-0.239733 0.970839 0); liftDir (-0.239733 0.970839 0);
dragDir (0.970839 0.239733 0); dragDir (0.970839 0.239733 0);