diff --git a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C index 841768636d..b2d5850262 100644 --- a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C +++ b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C @@ -103,7 +103,7 @@ void Foam::writeRegisteredObject::write() ( "Foam::writeRegisteredObject::read(const dictionary&)" ) << "Object " << objectNames_[i] << " not found in " - << "database. Available objects are:" << nl << obr_.toc() + << "database. Available objects:" << nl << obr_.sortedToc() << endl; } diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/controlDict b/src/postProcessing/functionObjects/field/fieldMinMax/controlDict new file mode 100644 index 0000000000..d90c5c84fe --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldMinMax/controlDict @@ -0,0 +1,75 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application XXX; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 0.1; + +deltaT 1e-05; + +writeControl timeStep; + +writeInterval 10; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +functions +{ + minMax + { + // Type of functionObject + type fieldMinMax; + + // Where to load it from (if not already in solver) + functionObjectLibs ("libfieldAverage.so"); + + // Function object enabled flag + enabled true; + + // Log to output (default: false) + log false; + + // Write information to file (default: true) + write true; + + // Fields to be monitored - runTime modifiable + fields + ( + U + p + ); + } +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index b013114ee7..eda5f7434f 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,6 +59,7 @@ Foam::fieldMinMax::fieldMinMax name_(name), obr_(obr), active_(true), + write_(true), log_(false), mode_(mdMag), fieldSet_(), @@ -92,9 +93,10 @@ void Foam::fieldMinMax::read(const dictionary& dict) { if (active_) { + write_ = dict.lookupOrDefault("write", true); log_ = dict.lookupOrDefault("log", false); - mode_ = modeTypeNames_[dict.lookup("mode")]; + mode_ = modeTypeNames_[dict.lookupOrDefault("mode", "magnitude")]; dict.lookup("fields") >> fieldSet_; } } @@ -171,7 +173,10 @@ void Foam::fieldMinMax::write() if (active_) { // Create the fieldMinMax file if not already created - makeFile(); + if (write_) + { + makeFile(); + } forAll(fieldSet_, fieldI) { @@ -195,13 +200,17 @@ void Foam::fieldMinMax::calcMinMaxFields { const volScalarField& field = obr_.lookupObject(fieldName); - scalar minValue = min(field).value(); - scalar maxValue = max(field).value(); + const scalar minValue = min(field).value(); + const scalar maxValue = max(field).value(); if (Pstream::master()) { - fieldMinMaxFilePtr_() << obr_.time().value() << tab - << fieldName << tab << minValue << tab << maxValue << endl; + if (write_) + { + fieldMinMaxFilePtr_() + << obr_.time().value() << tab + << fieldName << tab << minValue << tab << maxValue << endl; + } if (log_) { diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H index 84f9c59949..cc7b29c8ee 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,11 +74,13 @@ public: mdCmpt }; - protected: // Protected data + //- Mode type names + static const NamedEnum modeTypeNames_; + //- Name of this set of field min/max. // Also used as the name of the output directory. word name_; @@ -88,11 +90,11 @@ protected: //- on/off switch bool active_; - //- Switch to send output to Info as well as to file - Switch log_; + //- Switch to enable/disable writing to file + Switch write_; - //- Mode type names - static const NamedEnum modeTypeNames_; + //- Switch to send output to Info as well + Switch log_; //- Mode for min/max - only applicable for ranks > 0 modeType mode_; @@ -100,7 +102,6 @@ protected: //- Fields to assess min/max wordList fieldSet_; - //- Min/max file ptr autoPtr fieldMinMaxFilePtr_; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index d03a9af791..fc3b90b235 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,14 +42,18 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName) { case mdMag: { - scalar minValue = min(mag(field)).value(); - scalar maxValue = max(mag(field)).value(); + const scalar minValue = min(mag(field)).value(); + const scalar maxValue = max(mag(field)).value(); if (Pstream::master()) { - fieldMinMaxFilePtr_() << obr_.time().value() << tab - << fieldName << tab << minValue << tab << maxValue - << endl; + if (write_) + { + fieldMinMaxFilePtr_() + << obr_.time().value() << tab + << fieldName << tab << minValue << tab << maxValue + << endl; + } if (log_) { @@ -65,14 +69,18 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName) } case mdCmpt: { - Type minValue = min(field).value(); - Type maxValue = max(field).value(); + const Type minValue = min(field).value(); + const Type maxValue = max(field).value(); if (Pstream::master()) { - fieldMinMaxFilePtr_() << obr_.time().value() << tab - << fieldName << tab << minValue << tab << maxValue - << endl; + if (write_) + { + fieldMinMaxFilePtr_() + << obr_.time().value() << tab + << fieldName << tab << minValue << tab << maxValue + << endl; + } if (log_) { diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H index 66a03b571b..cc418e59a5 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H @@ -61,7 +61,7 @@ protected: // Protected data - //- Name of this fieldValue object + //- Name of this fieldValue object word name_; //- Database this class is registered to