diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C index c7915338eefa422894d72530d09cedca4e28cee4..5a41fee6f69a493e83df17b4e9c145f7e6886c00 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C @@ -126,7 +126,8 @@ void Foam::timeControl::read(const dictionary& dict) case ocCpuTime: case ocAdjustableRunTime: { - interval_ = readScalar(dict.lookup(intervalName)); + const scalar userTime = readScalar(dict.lookup(intervalName)); + interval_ = time_.userTimeToTime(userTime); break; } diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C index 87f9da4c954ccada0f830bb0ded57566b1279005..344899ee93d84bc4464ffc553905209f3d42cbc2 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C @@ -43,8 +43,15 @@ namespace functionObjects void Foam::functionObjects::timeControl::readControls() { - dict_.readIfPresent("timeStart", timeStart_); - dict_.readIfPresent("timeEnd", timeEnd_); + if (dict_.readIfPresent("timeStart", timeStart_)) + { + timeStart_ = time_.userTimeToTime(timeStart_); + } + if (dict_.readIfPresent("timeEnd", timeEnd_)) + { + timeEnd_ = time_.userTimeToTime(timeEnd_); + } + dict_.readIfPresent("nStepsToStartTimeChange", nStepsToStartTimeChange_); } diff --git a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C index 02a7261bfa5ea65e11c021b1ac6698e7f216e397..92d7a3bb4412ac1eb1ca786702c4a5b96a4d353f 100644 --- a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C +++ b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C @@ -92,8 +92,8 @@ Foam::autoPtr<Foam::OFstream> Foam::functionObjects::writeFile::createFile if (Pstream::master() && writeToFile_) { - const word startTimeName = - fileObr_.time().timeName(fileObr_.time().startTime().value()); + const scalar timeNow = fileObr_.time().timeOutputValue() + const word startTimeName = Time::timeName(timeNow); fileName outputDir(baseFileDir()/prefix_/startTimeName); @@ -105,7 +105,7 @@ Foam::autoPtr<Foam::OFstream> Foam::functionObjects::writeFile::createFile IFstream is(outputDir/(fName + ".dat")); if (is.good()) { - fName = fName + "_" + fileObr_.time().timeName(); + fName = fName + "_" + startTimeName; } osPtr.set(new OFstream(outputDir/(fName + ".dat"))); @@ -258,7 +258,8 @@ void Foam::functionObjects::writeFile::writeHeader 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); } diff --git a/src/conversion/ensight/output/ensightOutputTemplates.C b/src/conversion/ensight/output/ensightOutputTemplates.C index 65ce0098af1b3522fc3838c9be254fe080aee437..2689c1266403f39034ec51ed20bfa1f8f2e41db2 100644 --- a/src/conversion/ensight/output/ensightOutputTemplates.C +++ b/src/conversion/ensight/output/ensightOutputTemplates.C @@ -254,7 +254,7 @@ bool Foam::ensightOutput::writeField forAll(patchIds, listi) { const label patchId = patchIds[listi]; - const word& patchName = patchLookup[listi]; + const word& patchName = patchLookup[patchId]; const ensightFaces& ensFaces = patchFaces[patchName]; writeFaceField diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H index 047d959f0fd9bd31bce30afb051f596bea1843ec..f311c7b60f0f380229779d30ee806ed29620e20a 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H @@ -44,6 +44,7 @@ Description 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 less than 1 and linearUpwind for Courant numbers greater than 10: \verbatim diff --git a/src/functionObjects/field/blendingFactor/blendingFactor.C b/src/functionObjects/field/blendingFactor/blendingFactor.C index 4c5bcc592b870596ea16f659c668f3c6f945f605..c6627b1130255f1eafdaa356cbdc21c90ccec799 100644 --- a/src/functionObjects/field/blendingFactor/blendingFactor.C +++ b/src/functionObjects/field/blendingFactor/blendingFactor.C @@ -176,8 +176,9 @@ bool Foam::functionObjects::blendingFactor::write() << " blended cells : " << nCellsBlended << nl << endl; + writeTime(file()); + file() - << time_.time().value() << token::TAB << nCellsScheme1 << token::TAB << nCellsScheme2 << token::TAB << nCellsBlended diff --git a/src/functionObjects/field/fieldAverage/fieldAverage.C b/src/functionObjects/field/fieldAverage/fieldAverage.C index ba00d299e71bd014733df0a501e82c3c3a8f0bbd..5ed8b6634b1a7a763a979c8bd16c2f32010d4ab9 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverage.C +++ b/src/functionObjects/field/fieldAverage/fieldAverage.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / 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 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; Log << endl; @@ -108,7 +108,8 @@ void Foam::functionObjects::fieldAverage::initialize() void Foam::functionObjects::fieldAverage::restart() { - Log << " Restarting averaging at time " << obr().time().timeName() + Log << " Restarting averaging at time " + << obr().time().timeOutputValue() << nl << endl; totalIter_.clear(); @@ -221,7 +222,8 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties() if (restartOnRestart_ || restartOnOutput_) { - Info<< " Starting averaging at time " << obr().time().timeName() + Info<< " Starting averaging at time " + << obr().time().timeOutputValue() << nl; } else @@ -240,15 +242,18 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties() totalIter_[fieldi] = readLabel(fieldDict.lookup("totalIter")); totalTime_[fieldi] = readScalar(fieldDict.lookup("totalTime")); + scalar userTotalTime = + obr().time().timeToUserTime(totalTime_[fieldi]); + Info<< " " << fieldName << " iters = " << totalIter_[fieldi] - << " time = " << totalTime_[fieldi] << nl; + << " time = " << userTotalTime << nl; } else { Info<< " " << fieldName << ": 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_) { - dict.lookup("restartPeriod") >> restartPeriod_; + scalar userRestartPeriod = readScalar(dict.lookup("restartPeriod")); + restartPeriod_ = obr().time().userTimeToTime(userRestartPeriod); if (restartPeriod_ > 0) { @@ -323,22 +329,25 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict) ++periodIndex_; } - Info<< " Restart period " << restartPeriod_ - << " - next restart at " << (restartPeriod_*periodIndex_) + Info<< " Restart period " << userRestartPeriod + << " - next restart at " << (userRestartPeriod*periodIndex_) << nl << endl; } else { periodicRestart_ = false; - Info<< " Restart period " << restartPeriod_ + Info<< " Restart period " << userRestartPeriod << " - ignored" << nl << endl; } } - if (dict.readIfPresent("restartTime", restartTime_)) + scalar userRestartTime = 0; + if (dict.readIfPresent("restartTime", userRestartTime)) { + restartTime_ = obr().time().userTimeToTime(userRestartTime); + if (currentTime > restartTime_) { // The restart time is already in the past - ignore @@ -346,7 +355,7 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict) } else { - Info<< " Restart scheduled at time " << restartTime_ + Info<< " Restart scheduled at time " << userRestartTime << nl << endl; } } diff --git a/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C b/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C index ad9e4d832c63ea1ab6b8c2434fc6c8e18f5ff7cb..8d4486fc9eb54b765960ce0e8de8bf8b318993c4 100644 --- a/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C +++ b/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C @@ -122,6 +122,8 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux mesh_.objectRegistry::store(wallHeatFluxPtr); read(dict); + + writeFileHeader(file()); } @@ -267,8 +269,9 @@ bool Foam::functionObjects::wallHeatFlux::write() if (Pstream::master()) { + writeTime(file()); + file() - << mesh_.time().value() << token::TAB << pp.name() << token::TAB << minHfp << token::TAB << maxHfp diff --git a/src/functionObjects/field/wallShearStress/wallShearStress.C b/src/functionObjects/field/wallShearStress/wallShearStress.C index 13911234410e4df35e54c11a9cd641d08d3ca1ee..c90a02ea03b9d88bf47ae3bb67c738780b81fba9 100644 --- a/src/functionObjects/field/wallShearStress/wallShearStress.C +++ b/src/functionObjects/field/wallShearStress/wallShearStress.C @@ -249,7 +249,9 @@ bool Foam::functionObjects::wallShearStress::write() if (Pstream::master()) { - file() << mesh_.time().value() + writeTime(file()); + + file() << token::TAB << pp.name() << token::TAB << minSsp << token::TAB << maxSsp diff --git a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C index f4abd527f7e957ba462250c62cf91a9dcb715398..d886256e24943da36f2084cf291ee3be9b0267a9 100644 --- a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / 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 This file is part of OpenFOAM. @@ -186,7 +186,7 @@ void Foam::functionObjects::forceCoeffs::writeBinData Ostream& os ) const { - os << obr_.time().value(); + writeTime(os); for (label bini = 0; bini < nBin_; bini++) { @@ -250,6 +250,14 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict) // Free stream velocity magnitude 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 dict.lookup("lRef") >> lRef_; dict.lookup("Aref") >> Aref_; diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index 669fa94d8506a6015b6c9e0761acc84f2ba5f880..eee66616e2a323a482ec0e34508e66b77c109e73 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -593,8 +593,9 @@ void Foam::functionObjects::forces::writeIntegratedForceMoment { Ostream& os = osPtr(); - os << obr_.time().value() - << tab << total + writeTime(os); + + os << tab << total << tab << pressure << tab << viscous; diff --git a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C index c92524b29eca004347bc792a0cecee2a7275ca45..a1199b2e3c8a2b45a6036a9bb95e0ad1d18f9339 100644 --- a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C +++ b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C @@ -38,7 +38,7 @@ void Foam::functionObjects::thermoCoupleProbes::sampleAndWrite probeStream << setw(w) - << vField.time().timeToUserTime(vField.time().value()); + << vField.time().timeOutputValue(); forAll(*this, probeI) { diff --git a/src/sampling/probes/patchProbesTemplates.C b/src/sampling/probes/patchProbesTemplates.C index c6991df35fb34aed1e8e88fc2c0a1ca8da5d42e0..d43444cb919c8fea2c0aa6c1fe05e2011d3dfadf 100644 --- a/src/sampling/probes/patchProbesTemplates.C +++ b/src/sampling/probes/patchProbesTemplates.C @@ -45,7 +45,7 @@ void Foam::patchProbes::sampleAndWrite probeStream << setw(w) - << vField.time().timeToUserTime(vField.time().value()); + << vField.time().timeOutputValue(); forAll(values, probei) { @@ -71,7 +71,7 @@ void Foam::patchProbes::sampleAndWrite probeStream << setw(w) - << sField.time().timeToUserTime(sField.time().value()); + << sField.time().timeOutputValue(); forAll(values, probei) { diff --git a/src/sampling/probes/probesTemplates.C b/src/sampling/probes/probesTemplates.C index 84d1ca2aa0597f38a2464974ef53fb7b96a3707f..3ac7b08379f0502ce0906a1908f7a4aa1a97200e 100644 --- a/src/sampling/probes/probesTemplates.C +++ b/src/sampling/probes/probesTemplates.C @@ -76,7 +76,7 @@ void Foam::probes::sampleAndWrite unsigned int w = IOstream::defaultPrecision() + 7; OFstream& os = *probeFilePtrs_[vField.name()]; - os << setw(w) << vField.time().timeToUserTime(vField.time().value()); + os << setw(w) << vField.time().timeOutputValue(); forAll(values, probei) { @@ -100,7 +100,7 @@ void Foam::probes::sampleAndWrite unsigned int w = IOstream::defaultPrecision() + 7; OFstream& os = *probeFilePtrs_[sField.name()]; - os << setw(w) << sField.time().timeToUserTime(sField.time().value()); + os << setw(w) << sField.time().timeOutputValue(); forAll(values, probei) { diff --git a/tutorials/compressible/sonicFoam/RAS/nacaAirfoil/system/controlDict b/tutorials/compressible/sonicFoam/RAS/nacaAirfoil/system/controlDict index 68d2573d4fa418509c7f6b5654da6be9b57fc885..53f7c61f2ca8658bbad9bcfec42aa4671cdb0651 100644 --- a/tutorials/compressible/sonicFoam/RAS/nacaAirfoil/system/controlDict +++ b/tutorials/compressible/sonicFoam/RAS/nacaAirfoil/system/controlDict @@ -51,16 +51,15 @@ functions { type forceCoeffs; libs ("libforces.so"); - writeControl timeStep; - writeInterval 1; + writeControl writeTime; patches ( - WALL10 + wall_4 ); - log true; rhoInf 1; + CofR (0 0 0); liftDir (-0.239733 0.970839 0); dragDir (0.970839 0.239733 0);