GIT: Resolved merge conflict when merging develop branch

This commit is contained in:
Andrew Heather
2017-05-24 12:30:09 +01:00
2762 changed files with 124329 additions and 53036 deletions

View File

@ -27,7 +27,7 @@ License
#include "volFields.H"
#include "dictionary.H"
#include "wordReListMatcher.H"
#include "wordRes.H"
#include "steadyStateDdtScheme.H"
#include "addToRunTimeSelectionTable.H"
@ -142,7 +142,7 @@ bool Foam::functionObjects::ddt2::read(const dictionary& dict)
return false;
}
selectFields_ = wordReListMatcher::uniq
selectFields_ = wordRes::uniq
(
wordReList(dict.lookup("fields"))
);
@ -178,7 +178,7 @@ bool Foam::functionObjects::ddt2::execute()
{
results_.clear();
wordHashSet candidates = subsetStrings(selectFields_, mesh_.names());
wordHashSet candidates(subsetStrings(selectFields_, mesh_.names()));
DynamicList<word> missing(selectFields_.size());
DynamicList<word> ignored(selectFields_.size());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -322,7 +322,7 @@ void Foam::functionObjects::externalCoupled::readColumns
// Get sizes for all processors
const globalIndex globalFaces(nRows);
PstreamBuffers pBufs(Pstream::nonBlocking);
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
if (Pstream::master())
{
string line;
@ -391,7 +391,7 @@ void Foam::functionObjects::externalCoupled::readLines
// Get sizes for all processors
const globalIndex globalFaces(nRows);
PstreamBuffers pBufs(Pstream::nonBlocking);
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
if (Pstream::master())
{

View File

@ -32,40 +32,52 @@ Description
application. Values are transferred as plain text files, where OpenFOAM
data is written as:
\verbatim
# Patch: \<patch name\>
\<magSf1\> \<value1\> \<qDot1\> \<htc1\>
\<magSf2\> \<value2\> \<qDot2\> \<htc2\>
\<magSf3\> \<value3\> \<qDot3\> \<htc2\>
...
\<magSfN\> \<valueN\> \<qDotN\> \<htcN\>
\endverbatim
and received as the constituent pieces of the `mixed' condition, i.e.
\verbatim
# Patch: \<patch name\>
\<value1\> \<gradient1\> \<valueFracion1\>
\<value2\> \<gradient2\> \<valueFracion2\>
\<value3\> \<gradient3\> \<valueFracion3\>
...
\<valueN\> \<gradientN\> \<valueFracionN\>
\endverbatim
Data is sent/received as a single file for all patches from the directory
\verbatim
$FOAM_CASE/\<commsDir\>
\endverbatim
At start-up, the boundary creates a lock file, i.e..
\verbatim
OpenFOAM.lock
\endverbatim
... to signal the external source to wait. During the boundary condition
update, boundary values are written to file, e.g.
\verbatim
\<fileName\>.out
\endverbatim
The lock file is then removed, instructing the external source to take
control of the program execution. When ready, the external program
should create the return values, e.g. to file
\verbatim
\<fileName\>.in
\endverbatim
... and then re-instate the lock file. The boundary condition will then
read the return values, and pass program execution back to OpenFOAM.

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -438,14 +438,24 @@ bool Foam::functionObjects::externalCoupled::writeData
for (label proci = 1; proci < Pstream::nProcs(); proci++)
{
IPstream fromSlave(Pstream::scheduled, proci);
IPstream fromSlave
(
Pstream::commsTypes::scheduled,
proci
);
string str(fromSlave);
masterFilePtr() << str.c_str();
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster << os.str();
}
}

View File

@ -71,7 +71,6 @@ SourceFiles
#include "surfaceFieldsFwd.H"
#include "vectorList.H"
#include "globalIndex.H"
#include "cachedRandom.H"
#include "eulerianParticle.H"
#include "IOdictionary.H"
#include "injectedParticleCloud.H"

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -67,6 +67,27 @@ void Foam::functionObjects::fieldAverage::resetFields()
void Foam::functionObjects::fieldAverage::initialize()
{
if (!totalIter_.size())
{
totalIter_.setSize(faItems_.size(), 1);
}
if (!totalTime_.size())
{
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
}
else
{
// Check if totalTime_ has been set otherwise initialize
forAll(totalTime_, fieldi)
{
if (totalTime_[fieldi] < 0)
{
totalTime_[fieldi] = obr_.time().deltaTValue();
}
}
}
resetFields();
Log << type() << " " << name() << ":" << nl;
@ -113,10 +134,7 @@ void Foam::functionObjects::fieldAverage::restart()
<< nl << endl;
totalIter_.clear();
totalIter_.setSize(faItems_.size(), 1);
totalTime_.clear();
totalTime_.setSize(faItems_.size(), obr().time().deltaTValue());
initialize();
}
@ -217,8 +235,10 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
totalIter_.clear();
totalIter_.setSize(faItems_.size(), 1);
// Initialize totalTime with negative values
// to indicate that it has not been set
totalTime_.clear();
totalTime_.setSize(faItems_.size(), obr().time().deltaTValue());
totalTime_.setSize(faItems_.size(), -1);
if (restartOnRestart_ || restartOnOutput_)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -35,7 +35,7 @@ Description
Fields are entered as a list of sub-dictionaries, which indicate the type of
averages to perform, and can be updated during the calculation. The current
options include:
- \c mean: arithmetic mean:
- \c mean: arithmetic mean
\f[
\overline{x} = \frac{1}{N}\displaystyle\sum\limits_{i=0}^N x_i
\f]
@ -44,14 +44,14 @@ Description
\overline{x'}^2 = \frac{1}{N}\displaystyle\sum\limits_{i=0}^N
(x_i - \overline{x})^2
\f]
- base: average over 'time', or 'iteration' (\f$N\f$ in the above)
- window: optional averaging window, specified in 'base' units
- \c base: average over 'time', or 'iteration' (\f$N\f$ in the above)
- \c window: optional averaging window, specified in 'base' units
Average field names are constructed by concatenating the base field with
the averaging type, e.g. when averaging field 'U', the resultant fields
are:
- arithmetic mean field, UMean
- prime-squared field, UPrime2Mean
- arithmetic mean field, \c UMean
- prime-squared field, \c UPrime2Mean
Information regarding the number of averaging steps, and total averaging
time are written on a per-field basis to the
@ -101,12 +101,12 @@ Usage
Where the entries comprise:
\table
Property | Description | Required | Default value
type | type name: fieldAverage | yes |
restartOnRestart | Restart the averaging on restart | no | no
restartOnOutput | Restart the averaging on output | no | no
periodicRestart | Periodically restart the averaging | no | no
restartPeriod | Periodic restart period | conditional |
Property | Description | Required | Default
type | type name: fieldAverage | yes |
restartOnRestart | Restart the averaging on restart | no | no
restartOnOutput | Restart the averaging on output | no | no
periodicRestart | Periodically restart the averaging | no | no
restartPeriod | Periodic restart period | conditional |
restartTime | One-shot reset of the averaging | no | great
fields | list of fields and averaging options | yes |
subRegion | name of a sub-region such as a surface name | no |

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -43,9 +43,7 @@ void Foam::functionObjects::fieldAverage::addMeanFieldType(const label fieldi)
Log << " Reading/initialising field " << meanFieldName << endl;
if (foundObject<Type>(meanFieldName))
{
// do nothing
}
{}
else if (obr().found(meanFieldName))
{
Log << " Cannot allocate average field " << meanFieldName
@ -120,9 +118,7 @@ void Foam::functionObjects::fieldAverage::addPrime2MeanFieldType
Log << " Reading/initialising field " << prime2MeanFieldName << nl;
if (foundObject<Type2>(prime2MeanFieldName))
{
// do nothing
}
{}
else if (obr().found(prime2MeanFieldName))
{
Log << " Cannot allocate average field " << prime2MeanFieldName

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,7 +56,7 @@ fieldCoordinateSystemTransform
:
fvMeshFunctionObject(name, runTime, dict),
fieldSet_(),
coordSys_(mesh_, dict)
coordSys_(mesh_, dict.subDict("coordinateSystem"))
{
read(dict);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -46,13 +46,16 @@ Usage
UMean
UPrime2Mean
);
origin (0.001 0 0);
coordinateRotation
coordinateSystem
{
type axesRotation;
e1 (1 0.15 0);
e3 (0 0 -1);
origin (0.001 0 0);
coordinateRotation
{
type axesRotation;
e1 (1 0.15 0);
e3 (0 0 -1);
}
}
}
\endverbatim
@ -62,9 +65,7 @@ Usage
Property | Description | Required | Default value
type | type name: fieldCoordinateSystemTransform | yes |
fields | list of fields to be transformed |yes |
origin | origin of local co-ordinate system | yes |
coordinateRotation | orientation of local co-ordinate system | yes |
log | Log to standard output | no | yes
coordinateSystem | local co-ordinate system | yes |
\endtable
See also
@ -108,9 +109,6 @@ protected:
//- Co-ordinate system to transform to
coordinateSystem coordSys_;
//- Switch to send output to Info as well as to file
Switch log_;
// Protected Member Functions

View File

@ -38,13 +38,15 @@ functions
UPrime2Mean
);
origin (0.001 0 0);
coordinateRotation
coordinateSystem
{
type axesRotation;
e1 (1 0.15 0);
e3 (0 0 -1);
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (1 0.15 0);
e3 (0 0 -1);
}
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -135,6 +135,8 @@ protected:
(
const word& fieldName,
const word& outputName,
const label minCell,
const label maxCell,
const vector& minC,
const vector& maxC,
const label minProci,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -33,6 +33,8 @@ void Foam::functionObjects::fieldMinMax::output
(
const word& fieldName,
const word& outputName,
const label minCell,
const label maxCell,
const vector& minC,
const vector& maxC,
const label minProci,
@ -68,6 +70,7 @@ void Foam::functionObjects::fieldMinMax::output
file<< endl;
Log << " min(" << outputName << ") = " << minValue
<< " in cell " << minCell
<< " at location " << minC;
if (Pstream::parRun())
@ -76,6 +79,7 @@ void Foam::functionObjects::fieldMinMax::output
}
Log << nl << " max(" << outputName << ") = " << maxValue
<< " in cell " << maxCell
<< " at location " << maxC;
if (Pstream::parRun())
@ -96,9 +100,11 @@ void Foam::functionObjects::fieldMinMax::output
// Write state/results information
word nameStr('(' + outputName + ')');
this->setResult("min" + nameStr, minValue);
this->setResult("min" + nameStr + "_cell", minCell);
this->setResult("min" + nameStr + "_position", minC);
this->setResult("min" + nameStr + "_processor", minProci);
this->setResult("max" + nameStr, maxValue);
this->setResult("max" + nameStr + "_cell", maxCell);
this->setResult("max" + nameStr + "_position", maxC);
this->setResult("max" + nameStr + "_processor", maxProci);
}
@ -131,17 +137,19 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
magField.boundaryField();
scalarList minVs(Pstream::nProcs());
labelList minCells(Pstream::nProcs());
List<vector> minCs(Pstream::nProcs());
label minProci = findMin(magField);
minVs[proci] = magField[minProci];
minCells[proci] = minProci;
minCs[proci] = mesh_.C()[minProci];
labelList maxIs(Pstream::nProcs());
scalarList maxVs(Pstream::nProcs());
labelList maxCells(Pstream::nProcs());
List<vector> maxCs(Pstream::nProcs());
label maxProci = findMax(magField);
maxVs[proci] = magField[maxProci];
maxCells[proci] = maxProci;
maxCs[proci] = mesh_.C()[maxProci];
forAll(magFieldBoundary, patchi)
@ -151,10 +159,14 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
{
const vectorField& Cfp = CfBoundary[patchi];
const labelList& faceCells =
magFieldBoundary[patchi].patch().faceCells();
label minPi = findMin(mfp);
if (mfp[minPi] < minVs[proci])
{
minVs[proci] = mfp[minPi];
minCells[proci] = faceCells[minPi];
minCs[proci] = Cfp[minPi];
}
@ -162,6 +174,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
if (mfp[maxPi] > maxVs[proci])
{
maxVs[proci] = mfp[maxPi];
maxCells[proci] = faceCells[maxPi];
maxCs[proci] = Cfp[maxPi];
}
}
@ -169,26 +182,34 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
Pstream::gatherList(minVs);
Pstream::scatterList(minVs);
Pstream::gatherList(minCells);
Pstream::scatterList(minCells);
Pstream::gatherList(minCs);
Pstream::scatterList(minCs);
Pstream::gatherList(maxVs);
Pstream::scatterList(maxVs);
Pstream::gatherList(maxCells);
Pstream::scatterList(maxCells);
Pstream::gatherList(maxCs);
Pstream::scatterList(maxCs);
label mini = findMin(minVs);
scalar minValue = minVs[mini];
const label minCell = minCells[mini];
const vector& minC = minCs[mini];
label maxi = findMax(maxVs);
scalar maxValue = maxVs[maxi];
const label maxCell = minCells[maxi];
const vector& maxC = maxCs[maxi];
output
(
fieldName,
word("mag(" + fieldName + ")"),
minCell,
maxCell,
minC,
maxC,
mini,
@ -204,31 +225,37 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
fieldBoundary = field.boundaryField();
List<Type> minVs(Pstream::nProcs());
labelList minCells(Pstream::nProcs());
List<vector> minCs(Pstream::nProcs());
label minProci = findMin(field);
minVs[proci] = field[minProci];
minCells[proci] = minProci;
minCs[proci] = mesh_.C()[minProci];
Pstream::gatherList(minVs);
Pstream::gatherList(minCs);
List<Type> maxVs(Pstream::nProcs());
labelList maxCells(Pstream::nProcs());
List<vector> maxCs(Pstream::nProcs());
label maxProci = findMax(field);
maxVs[proci] = field[maxProci];
maxCells[proci] = maxProci;
maxCs[proci] = mesh_.C()[maxProci];
forAll(fieldBoundary, patchi)
{
const Field<Type>& fp = fieldBoundary[patchi];
if (fp.size())
{
const vectorField& Cfp = CfBoundary[patchi];
const labelList& faceCells =
fieldBoundary[patchi].patch().faceCells();
label minPi = findMin(fp);
if (fp[minPi] < minVs[proci])
{
minVs[proci] = fp[minPi];
minCells[proci] = faceCells[minPi];
minCs[proci] = Cfp[minPi];
}
@ -236,6 +263,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
if (fp[maxPi] > maxVs[proci])
{
maxVs[proci] = fp[maxPi];
maxCells[proci] = faceCells[maxPi];
maxCs[proci] = Cfp[maxPi];
}
}
@ -243,26 +271,34 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
Pstream::gatherList(minVs);
Pstream::scatterList(minVs);
Pstream::gatherList(minCells);
Pstream::scatterList(minCells);
Pstream::gatherList(minCs);
Pstream::scatterList(minCs);
Pstream::gatherList(maxVs);
Pstream::scatterList(maxVs);
Pstream::gatherList(maxCells);
Pstream::scatterList(maxCells);
Pstream::gatherList(maxCs);
Pstream::scatterList(maxCs);
label mini = findMin(minVs);
Type minValue = minVs[mini];
const label minCell = minCells[mini];
const vector& minC = minCs[mini];
label maxi = findMax(maxVs);
Type maxValue = maxVs[maxi];
const label maxCell = maxCells[maxi];
const vector& maxC = maxCs[maxi];
output
(
fieldName,
fieldName,
minCell,
maxCell,
minC,
maxC,
mini,

View File

@ -46,7 +46,7 @@ Foam::functionObjects::fieldValue::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown " << typeName << " type "

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -71,8 +71,8 @@ const char* Foam::NamedEnum
{
"none",
"sum",
"sumMag",
"weightedSum",
"sumMag",
"sumDirection",
"sumDirectionBalance",
"average",

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -315,7 +315,7 @@ protected:
// Protected Member Functions
//- The volume mesh or surface registry being used
const objectRegistry& obr() const override;
const objectRegistry& obr() const;
//- Return the local list of face IDs
inline const labelList& faceId() const;
@ -458,10 +458,10 @@ public:
inline fileName outputDir() const;
//- Read from dictionary
virtual bool read(const dictionary& dict) override;
virtual bool read(const dictionary& dict);
//- Calculate and write
virtual bool write() override;
virtual bool write();
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -155,7 +155,7 @@ processSameTypeValues
}
else
{
tmp<scalarField> weight = weightingFactor(weightField);
tmp<scalarField> weight(weightingFactor(weightField));
result = gSum(weight*values);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -80,19 +80,19 @@ Usage
The \c operation is one of:
\plaintable
none | No operation
sum | Sum
weightedSum | Weighted sum
sumMag | Sum of component magnitudes
average | Ensemble average
weightedAverage | Weighted average
volAverage | Volume weighted average
weightedVolAverage | Weighted volume average
volIntegrate | Volume integral
none | No operation
sum | Sum
weightedSum | Weighted sum
sumMag | Sum of component magnitudes
average | Ensemble average
weightedAverage | Weighted average
volAverage | Volume weighted average
weightedVolAverage | Weighted volume average
volIntegrate | Volume integral
weightedVolIntegrate | Weighted volume integral
min | Minimum
max | Maximum
CoV | Coefficient of variation: standard deviation/mean
min | Minimum
max | Maximum
CoV | Coefficient of variation: standard deviation/mean
\endplaintable
See also
@ -163,7 +163,7 @@ protected:
//- Operation to apply to values
operationType operation_;
//- Weight field name - only used for opWeightedAverage mode
//- Weight field name - only used for weighted modes
word weightFieldName_;
@ -255,10 +255,10 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& dict) override;
virtual bool read(const dictionary& dict);
//- Calculate and write
virtual bool write() override;
virtual bool write();
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,23 +45,31 @@ void Foam::functionObjects::histogram::writeGraph
(
const coordSet& coords,
const word& fieldName,
const scalarField& values
const scalarField& normalizedValues,
const scalarField& absoluteValues
) const
{
const wordList fieldNames(1, fieldName);
fileName outputPath = baseTimeDir();
mkDir(outputPath);
OFstream graphFile
(
outputPath/formatterPtr_().getFileName(coords, fieldNames)
outputPath
/formatterPtr_().getFileName
(
coords,
wordList(1, fieldName)
)
);
Log << " Writing histogram of " << fieldName
<< " to " << graphFile.name() << endl;
List<const scalarField*> yPtrs(1);
yPtrs[0] = &values;
wordList fieldNames(2);
fieldNames[0] = fieldName;
fieldNames[1] = fieldName + "Count";
List<const scalarField*> yPtrs(2);
yPtrs[0] = &normalizedValues;
yPtrs[1] = &absoluteValues;
formatterPtr_().write(coords, fieldNames, yPtrs, graphFile);
}
@ -76,7 +84,9 @@ Foam::functionObjects::histogram::histogram
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name)
writeFile(obr_, name),
max_(-GREAT),
min_(GREAT)
{
read(dict);
}
@ -96,8 +106,9 @@ bool Foam::functionObjects::histogram::read(const dictionary& dict)
writeFile::read(dict);
dict.lookup("field") >> fieldName_;
dict.lookup("max") >> max_;
min_ = dict.lookupOrDefault<scalar>("min", 0);
max_ = dict.lookupOrDefault<scalar>("max", -GREAT);
min_ = dict.lookupOrDefault<scalar>("min", GREAT);
dict.lookup("nBins") >> nBins_;
word format(dict.lookup("setFormat"));
@ -149,38 +160,63 @@ bool Foam::functionObjects::histogram::write()
: obr_.lookupObject<volScalarField>(fieldName_)
);
scalar histMax = max_;
scalar histMin = min_;
if (max_ == -GREAT)
{
// Determine current min and max
histMax = max(field).value();
if (min_ == GREAT)
{
histMin = min(field).value();
}
Log << " Determined histogram bounds from field"
<< " min/max(" << fieldName_ << ") = "
<< histMin << ' ' << histMax << endl;
}
else if (min_ == GREAT)
{
histMin = 0;
}
// Calculate the mid-points of bins for the graph axis
pointField xBin(nBins_);
const scalar delta = (max_- min_)/nBins_;
const scalar delta = (histMax- histMin)/nBins_;
scalar x = min_ + 0.5*delta;
scalar x = histMin + 0.5*delta;
forAll(xBin, i)
{
xBin[i] = point(x, 0, 0);
x += delta;
}
scalarField data(nBins_, 0);
scalarField dataNormalized(nBins_, 0);
labelField dataCount(nBins_, 0);
const scalarField& V = mesh_.V();
forAll(field, celli)
{
const label bini = (field[celli] - min_)/delta;
const label bini = (field[celli] - histMin)/delta;
if (bini >= 0 && bini < nBins_)
{
data[bini] += V[celli];
dataNormalized[bini] += V[celli];
dataCount[bini]++;
}
}
Pstream::listCombineGather(data, plusEqOp<scalar>());
Pstream::listCombineGather(dataNormalized, plusEqOp<scalar>());
Pstream::listCombineGather(dataCount, plusEqOp<label>());
if (Pstream::master())
{
const scalar sumData = sum(data);
const scalar sumData = sum(dataNormalized);
if (sumData > SMALL)
{
data /= sumData;
dataNormalized /= sumData;
const coordSet coords
(
@ -190,7 +226,15 @@ bool Foam::functionObjects::histogram::write()
mag(xBin)
);
writeGraph(coords, fieldName_, data);
// Convert count field from labelField to scalarField
scalarField count(dataCount.size());
forAll(count, i)
{
count[i] = 1.0*dataCount[i];
}
writeGraph(coords, fieldName_, dataNormalized, count);
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,11 +53,17 @@ Usage
type | type name: histogram | yes |
field | Field to analyse | yes |
nBins | Number of bins for the histogram | yes|
max | Maximum value sampled | yes |
max | Maximum value sampled | no | field max
min | minimum value sampled | no | 0
setFormat | Output format | yes |
\endtable
Note
If max is not provided it will use the field's min and max as the bin
extremes. If max is provided but not min it will use 0. The set written
contains two columns, the first the volume averaged values, the second
the raw bin count.
See also
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
@ -115,7 +121,8 @@ class histogram
(
const coordSet& coords,
const word& valueName,
const scalarField& values
const scalarField& normalizedValues,
const scalarField& absoluteValues
) const;
//- Disallow default bitwise copy construct

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,8 +40,8 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
)
{
label nReq = Pstream::nRequests();
@ -64,7 +64,7 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking
&& Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
)
{
Pstream::waitRequests(nReq);
@ -84,7 +84,7 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
}
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{
const lduSchedule& patchSchedule =
fld.mesh().globalData().patchSchedule();
@ -102,11 +102,11 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
{
if (patchSchedule[patchEvali].init)
{
tgtField.initEvaluate(Pstream::scheduled);
tgtField.initEvaluate(Pstream::commsTypes::scheduled);
}
else
{
tgtField.evaluate(Pstream::scheduled);
tgtField.evaluate(Pstream::commsTypes::scheduled);
}
}
}

View File

@ -61,7 +61,7 @@ Foam::functionObjects::particleDistribution::particleDistribution
cloudName_("unknown-cloudName"),
nameVsBinWidth_(),
tagFieldName_("none"),
rndGen_(1234, -1),
rndGen_(),
writerPtr_(nullptr)
{
read(dict);

View File

@ -73,7 +73,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "scalarField.H"
#include "cachedRandom.H"
#include "Random.H"
#include "Tuple2.H"
#include "writer.H"
@ -107,7 +107,7 @@ protected:
word tagFieldName_;
//- Random number generator - used by distribution models
cachedRandom rndGen_;
Random rndGen_;
//- Writer
autoPtr<writer<scalar>> writerPtr_;

View File

@ -47,7 +47,7 @@ bool Foam::functionObjects::randomise::calcRandomised()
forAll(field, celli)
{
Type rndPert;
rand.randomise(rndPert);
rand.randomise01(rndPert);
rndPert = 2.0*rndPert - pTraits<Type>::one;
rndPert /= mag(rndPert);
rfield[celli] += magPerturbation_*rndPert;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -42,19 +42,22 @@ Usage
writeControl writeTime;
setFormat vtk;
U U;
trackForward yes;
fields
(
U
p
);
lifeTime 10000;
trackLength 1e-3;
nSubCycle 5;
bounds (0.2 -10 -10)(0.22 10 10);
cloudName particleTracks;
seedSampleSet uniform;
uniformCoeffs
seedSampleSet
{
type uniform;
axis x; //distance;
@ -70,7 +73,7 @@ Usage
Property | Description | Required | Default value
type | Type name: streamLine | yes |
setFormat | Output data type | yes |
U | Tracking velocity field name | yes |
U | Tracking velocity field name | no | U
fields | Fields to sample | yes |
lifetime | Maximum number of particle tracking steps | yes |
trackLength | Tracking segment length | no |
@ -80,7 +83,7 @@ Usage
seedSampleSet| Seeding method (see below)| yes |
\endtable
Where \c seedSampleSet is typically one of
Where \c seedSampleSet \c type is typically one of
\plaintable
uniform | uniform particle seeding
cloud | cloud of points

View File

@ -561,18 +561,15 @@ bool Foam::functionObjects::streamLineBase::read(const dictionary& dict)
//Info<< " using interpolation " << interpolationScheme_ << endl;
cloudName_ = dict.lookupOrDefault<word>("cloud", type());
dict.lookup("seedSampleSet") >> seedSet_;
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
sampledSetPtr_ = sampledSet::New
(
seedSet_,
"seedSampleSet",
mesh_,
meshSearchMeshObject::New(mesh_),
coeffsDict
dict.subDict("seedSampleSet")
);
coeffsDict.lookup("axis") >> sampledSetAxis_;
sampledSetAxis_ = sampledSetPtr_->axis();
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
@ -644,7 +641,7 @@ bool Foam::functionObjects::streamLineBase::write()
allTracks_.shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
Pstream::commsTypes::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -662,7 +659,7 @@ bool Foam::functionObjects::streamLineBase::write()
allScalars_[scalari].shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
Pstream::commsTypes::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -680,7 +677,7 @@ bool Foam::functionObjects::streamLineBase::write()
allVectors_[vectori].shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
Pstream::commsTypes::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -57,8 +57,7 @@ Usage
bounds (0.2 -10 -10)(0.22 10 10);
cloudName particleTracks;
seedSampleSet patchSeed;
patchSeedCoeffs
seedSampleSet
{
type patchSeed;
patches (wall);
@ -83,10 +82,10 @@ Usage
seedSampleSet| Seeding method (see below)| yes |
\endtable
Where \c seedSampleSet is typically one of
Where \c seedSampleSet \c type is typically one of
\plaintable
uniform | uniform particle seeding
cloud | cloud of points
uniform | uniform particle seeding
cloud | cloud of points
patchSeed | seeding via patch faces
triSurfaceMeshPointSet | points according to a tri-surface mesh
\endplaintable

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -75,11 +75,11 @@ void Foam::functionObjects::wallHeatFlux::calcHeatFlux
wallHeatFluxBf[patchi] = heatFluxBf[patchi];
}
if (foundObject<volScalarField>("Qr"))
if (foundObject<volScalarField>("qr"))
{
const volScalarField& Qr = lookupObject<volScalarField>("Qr");
const volScalarField& qr = lookupObject<volScalarField>("qr");
const volScalarField::Boundary& radHeatFluxBf = Qr.boundaryField();
const volScalarField::Boundary& radHeatFluxBf = qr.boundaryField();
forAll(wallHeatFluxBf, patchi)
{
@ -279,7 +279,7 @@ bool Foam::functionObjects::wallHeatFlux::write()
<< endl;
}
Log << " min/max(" << pp.name() << ") = "
Log << " min/max/integ(" << pp.name() << ") = "
<< minHfp << ", " << maxHfp << ", " << integralHfp << endl;
}

View File

@ -27,7 +27,7 @@ License
#include "volFields.H"
#include "dictionary.H"
#include "wordReListMatcher.H"
#include "wordRes.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -120,7 +120,7 @@ bool Foam::functionObjects::zeroGradient::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
selectFields_ = wordReListMatcher::uniq
selectFields_ = wordRes::uniq
(
wordReList(dict.lookup("fields"))
);
@ -135,7 +135,7 @@ bool Foam::functionObjects::zeroGradient::execute()
{
results_.clear();
wordHashSet candidates = subsetStrings(selectFields_, mesh_.names());
wordHashSet candidates(subsetStrings(selectFields_, mesh_.names()));
DynamicList<word> missing(selectFields_.size());
DynamicList<word> ignored(selectFields_.size());

View File

@ -1,13 +1,13 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfluidThermophysicalModels \
@ -17,6 +17,5 @@ LIB_LIBS = \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lspecie \
-lfileFormats \
-lfiniteVolume \
-lmeshTools

View File

@ -870,7 +870,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
// Reference density needed for incompressible calculations
if (rhoName_ == "rhoInf")
{
rhoRef_ = readScalar(dict.lookup("rhoInf"));
dict.lookup("rhoInf") >> rhoRef_;
}
// Reference pressure, 0 by default

View File

@ -13,7 +13,7 @@ endif()
include_directories(
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
$ENV{WM_PROJECT_DIR}/src/triSurface/lnInclude
$ENV{WM_PROJECT_DIR}/src/surfMesh/lnInclude
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
@ -21,7 +21,6 @@ include_directories(
link_directories(
$ENV{FOAM_LIBBIN}
$ENV{FOAM_EXT_LIBBIN}
)
add_definitions(
@ -71,7 +70,7 @@ file(GLOB SOURCE_FILES
set(OPENFOAM_LIBRARIES
OpenFOAM
triSurface
surfMesh
finiteVolume
)

View File

@ -480,8 +480,7 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
else
{
WarningInFunction
<< "Glyphs can only be added to " << pTraits<scalar>::typeName
<< " and " << pTraits<vector>::typeName << " fields. "
<< "Glyphs can only be added to scalar and vector fields."
<< " Field " << scaleFieldName << " has " << nComponents
<< " components" << endl;

View File

@ -195,7 +195,7 @@ Foam::functionObjects::runTimePostPro::pathline::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(pathlineType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown pathline type "

View File

@ -153,7 +153,7 @@ Foam::autoPtr<Foam::functionObjects::runTimePostPro::pointData> Foam::functionOb
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(pointDataType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown pointData type "

View File

@ -131,6 +131,21 @@ void Foam::functionObjects::runTimePostPro::scene::readColours
}
void Foam::functionObjects::runTimePostPro::scene::setActorVisibility
(
vtkRenderer* renderer,
const bool visible
) const
{
vtkActorCollection *actors = renderer->GetActors();
for (int i = 0; i < actors->GetNumberOfItems(); ++i)
{
vtkActor *actor = vtkActor::SafeDownCast(actors->GetItemAsObject(i));
actor->SetVisibility(visible);
}
}
void Foam::functionObjects::runTimePostPro::scene::initialise
(
vtkRenderer* renderer,
@ -239,9 +254,13 @@ void Foam::functionObjects::runTimePostPro::scene::setCamera
// to be done once on initialisation
if (!clipBox_.empty())
{
// Call ResetCamera() to fit clip box in view
setActorVisibility(renderer, false);
clipBoxActor_->VisibilityOn();
// Call ResetCamera() to fit clip box in view
renderer->ResetCamera();
setActorVisibility(renderer, true);
clipBoxActor_->VisibilityOff();
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -105,6 +105,13 @@ class scene
//- Read colour properties
void readColours(const dictionary& dict);
//- Set visibility of all actors on/off
void setActorVisibility
(
vtkRenderer* renderer,
const bool visible
) const;
//- Disallow default bitwise copy construct
scene(const scene&);

View File

@ -220,7 +220,7 @@ Foam::functionObjects::runTimePostPro::surface::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(surfaceType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown surface type "

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -139,7 +139,11 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
return tmp<volScalarField>
(
new volScalarField(Dname, model.nuEff())
new volScalarField
(
Dname,
alphaD_*model.nu() + alphaDt_*model.nut()
)
);
}
else if (foundObject<cmpModel>(turbulenceModel::propertiesName))
@ -151,7 +155,11 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
return tmp<volScalarField>
(
new volScalarField(Dname, model.muEff())
new volScalarField
(
Dname,
alphaD_*model.mu() + alphaDt_*model.mut()
)
);
}
else
@ -236,6 +244,8 @@ bool Foam::functionObjects::scalarTransport::read(const dictionary& dict)
schemesField_ = dict.lookupOrDefault("schemesField", fieldName_);
constantD_ = dict.readIfPresent("D", D_);
alphaD_ = dict.lookupOrDefault("alphaD", 1.0);
alphaDt_ = dict.lookupOrDefault("alphaDt", 1.0);
dict.readIfPresent("nCorr", nCorr_);
dict.readIfPresent("resetOnStartUp", resetOnStartUp_);
@ -358,7 +368,7 @@ bool Foam::functionObjects::scalarTransport::execute()
FatalErrorInFunction
<< "Incompatible dimensions for phi: " << phi.dimensions() << nl
<< "Dimensions should be " << dimMass/dimTime << " or "
<< dimVolume/dimTime << endl;
<< dimVolume/dimTime << exit(FatalError);
}
Log << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -30,18 +30,24 @@ Group
Description
Evolves a passive scalar transport equation.
- To specify the field name set the 'field' entry
- To specify the field name set the \c field entry
- To employ the same numerical schemes as another field set
the 'schemesField' entry,
the \c schemesField entry,
- The diffusivity can be set manually using the 'D' entry, retrieved
from the turbulence model or specified nut
- Alternatively if a turbulence model is available a turbulent diffusivity
may be constructed from the laminar and turbulent viscosities using the
optional diffusivity coefficients \c alphaD and \c alphaDt (which default
to 1):
\verbatim
D = alphaD*nu + alphaDt*nut
\endverbatim
- To specify a transport quantity within a phase enter phase.
- bounded01 bounds the transported scalar within 0 and 1.
Usage
Example of function object specification to solve a scalar transport
equation:
\verbatim
functions
{
scalar1
@ -181,6 +187,12 @@ class scalarTransport
//- Flag to indicate whether a constant, uniform D_ is specified
bool constantD_;
//- Laminar diffusion coefficient (optional)
scalar alphaD_;
//- Turbulent diffusion coefficient (optional)
scalar alphaDt_;
//- Number of corrector iterations (optional)
label nCorr_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -125,7 +125,7 @@ bool Foam::functionObjects::abort::read(const dictionary& dict)
action_ = nextWrite;
}
if (dict.readIfPresent("fileName", abortFile_))
if (dict.readIfPresent("file", abortFile_))
{
abortFile_.expand();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -291,6 +291,16 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
);
}
if(!dataPtr && !readPtr && !execPtr && !writePtr && !endPtr)
{
IOWarningInFunction
(
dict
) << "No critical \"code\" prefixed keywords were found."
<< " Please check the code documentation for more details."
<< nl << endl;
}
updateLibrary(name_);
return redirectFunctionObject().read(dict);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,16 +30,18 @@ Group
Description
Provides a general interface to enable dynamic code compilation.
The entries are
codeInclude : include files
codeOptions : include paths; inserted into EXE_INC in Make/options
codeLibs : link line; inserted into LIB_LIBS in Make/options
codeData : c++; local member data (null constructed);
localCode : c++; local static functions
codeRead : c++; upon functionObject::read();
codeExecute : c++;upon functionObject::execute();
codeWrite : c++; upon functionObject::write()
codeEnd : c++; upon functionObject::end();
The entries are:
\plaintable
codeInclude | include files
codeOptions | include paths; inserted into EXE_INC in Make/options
codeLibs | link line; inserted into LIB_LIBS in Make/options
codeData | c++; local member data (null constructed);
localCode | c++; local static functions;
codeRead | c++; upon functionObject::read();
codeExecute | c++; upon functionObject::execute();
codeWrite | c++; upon functionObject::write()
codeEnd | c++; upon functionObject::end();
\endplaintable
Usage
Example of function object specification:

View File

@ -246,7 +246,7 @@ bool Foam::functionObjects::ensightWrite::write()
ensCase().setTime(t.value(), t.timeIndex());
}
wordHashSet candidates = subsetStrings(selectFields_, mesh_.names());
wordHashSet candidates(subsetStrings(selectFields_, mesh_.names()));
DynamicList<word> missing(selectFields_.size());
DynamicList<word> ignored(selectFields_.size());

View File

@ -43,7 +43,7 @@ Foam::functionObjects::runTimeControls::runTimeCondition::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(conditionType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown runTimeCondition type "

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,11 +28,13 @@ Group
grpUtilitiesFunctionObjects
Description
This function object overrides the calculation time step. Can only be used
with solvers with adjustTimeStep control (e.g. pimpleFoam). It makes no
attempt to co-operate with other time step 'controllers', e.g. maxCo, other
functionObjects. Supports 'enabled' flag but none of the other options
'timeStart', 'timeEnd', 'writeControl' etc.
This function object overrides the calculation time step.
Can only be used with solvers with adjustTimeStep control (e.g.
pimpleFoam). It makes no attempt to co-operate with other time step
'controllers', e.g. maxCo, other functionObjects. Supports 'enabled'
flag but none of the other options 'timeStart', 'timeEnd', 'writeControl'
etc.
Usage
Example of function object specification to manipulate the time step:

View File

@ -48,11 +48,10 @@ namespace functionObjects
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::timeActivatedFileUpdate::updateFile
(
const bool checkFiles
)
void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
{
modified_ = false;
label i = lastIndex_;
while
(
@ -68,19 +67,15 @@ void Foam::functionObjects::timeActivatedFileUpdate::updateFile
Log << nl << type() << ": copying file" << nl << timeVsFile_[i].second()
<< nl << "to:" << nl << fileToUpdate_ << nl << endl;
fileName destFile(fileToUpdate_ + Foam::name(pid()));
cp(timeVsFile_[i].second(), destFile);
mv(destFile, fileToUpdate_);
lastIndex_ = i;
if (checkFiles)
if (Pstream::master() || time_.distributed())
{
// Do an early check to avoid an additional iteration before
// any changes are picked up (see Time::run : does readModified
// before executing FOs). Note we have to protect the read
// constructor of *this from triggering this behaviour.
const_cast<Time&>(time_).Time::readModifiedObjects();
// Slaves do not copy if running non-distributed
fileName destFile(fileToUpdate_ + Foam::name(pid()));
cp(timeVsFile_[i].second(), destFile);
mv(destFile, fileToUpdate_);
}
lastIndex_ = i;
modified_ = true;
}
}
@ -98,7 +93,8 @@ Foam::functionObjects::timeActivatedFileUpdate::timeActivatedFileUpdate
time_(runTime),
fileToUpdate_("unknown-fileToUpdate"),
timeVsFile_(),
lastIndex_(-1)
lastIndex_(-1),
modified_(false)
{
read(dict);
}
@ -142,8 +138,8 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
<< timeVsFile_[i].second() << endl;
}
// Copy starting files. Avoid recursion by not checking for modified files.
updateFile(false);
// Copy starting files
updateFile();
return true;
}
@ -151,7 +147,7 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
bool Foam::functionObjects::timeActivatedFileUpdate::execute()
{
updateFile(true);
updateFile();
return true;
}
@ -163,4 +159,10 @@ bool Foam::functionObjects::timeActivatedFileUpdate::write()
}
bool Foam::functionObjects::timeActivatedFileUpdate::filesModified() const
{
return modified_;
}
// ************************************************************************* //

View File

@ -106,11 +106,14 @@ class timeActivatedFileUpdate
//- Index of last file copied
label lastIndex_;
//- Has anything been copied?
bool modified_;
// Private Member Functions
//- Update file
void updateFile(const bool checkFiles);
void updateFile();
//- Disallow default bitwise copy construct
timeActivatedFileUpdate(const timeActivatedFileUpdate&);
@ -150,6 +153,9 @@ public:
//- Do nothing
virtual bool write();
//- Did any file get changed during execution?
virtual bool filesModified() const;
};