Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
Andrew Heather
2017-06-01 17:28:21 +01:00
2387 changed files with 119977 additions and 41187 deletions

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

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

@ -40,11 +40,7 @@ Foam::functionObjects::fieldAverageItem::fieldAverageItem(Istream& is)
base_(ITER),
window_(-1.0)
{
is.check
(
"Foam::functionObjects::fieldAverageItem::fieldAverageItem"
"(Foam::Istream&)"
);
is.check(FUNCTION_NAME);
const dictionaryEntry entry(dictionary::null, is);
@ -73,11 +69,7 @@ Foam::Istream& Foam::functionObjects::operator>>
fieldAverageItem& faItem
)
{
is.check
(
"Foam::Istream& Foam::operator>>"
"(Foam::Istream&, Foam::functionObjects::fieldAverageItem&)"
);
is.check(FUNCTION_NAME);
const dictionaryEntry entry(dictionary::null, is);
@ -111,11 +103,7 @@ Foam::Ostream& Foam::functionObjects::operator<<
const fieldAverageItem& faItem
)
{
os.check
(
"Foam::Ostream& Foam::operator<<"
"(Foam::Ostream&, const Foam::functionObjects::fieldAverageItem&)"
);
os.check(FUNCTION_NAME);
os << faItem.fieldName_ << nl << token::BEGIN_BLOCK << nl;
os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl;
@ -138,12 +126,7 @@ Foam::Ostream& Foam::functionObjects::operator<<
os << token::END_BLOCK << nl;
os.check
(
"Foam::Ostream& Foam::operator<<"
"(Foam::Ostream&, const Foam::functionObjects::fieldAverageItem&)"
);
os.check(FUNCTION_NAME);
return os;
}

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

@ -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",
@ -154,7 +154,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
DynamicList<label> faceIds(fZone.size());
DynamicList<label> facePatchIds(fZone.size());
DynamicList<bool> faceFlip(fZone.size());
DynamicList<bool> faceFlip(fZone.size());
forAll(fZone, i)
{
@ -459,7 +459,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
}
else
{
totalArea = gSum(filterField(mesh_.magSf(), false));
totalArea = gSum(filterField(mesh_.magSf()));
}
return totalArea;
@ -479,10 +479,13 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::needsSf() const
case opAverage:
case opMin:
case opMax:
{
return false;
}
default:
{
return true;
}
}
}
@ -496,10 +499,13 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::needsWeight() const
case opWeightedAverage:
case opWeightedAreaAverage:
case opWeightedAreaIntegrate:
{
return true;
}
default:
{
return false;
}
}
}
@ -558,9 +564,10 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):"
<< int(regionType_) << "(" << regionName_ << "):"
<< nl << " Unknown region type. Valid region types are:"
<< regionTypeNames_.sortedToc() << nl << exit(FatalError);
<< regionTypeNames_ << nl
<< exit(FatalError);
}
}
@ -596,7 +603,6 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
weightFieldName_ = "none";
orientWeightField_ = false;
if (needsWeight())
{
if (dict.readIfPresent("weightField", weightFieldName_))
@ -610,41 +616,21 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
Info<< " weight field = " << weightFieldName_ << nl;
}
if (dict.found("orientedWeightField"))
{
if (regionType_ == stSurface || regionType_ == stSampledSurface)
{
FatalIOErrorInFunction(dict)
<< "Cannot use orientedWeightField "
<< "for surface/sampledSurface"
<< exit(FatalIOError);
}
if (weightFieldName_ == "none")
{
dict.lookup("orientedWeightField") >> weightFieldName_;
orientWeightField_ = true;
Info<< " weight field = " << weightFieldName_ << nl;
}
else
{
FatalIOErrorInFunction(dict)
<< "Cannot specify both weightField and orientedWeightField"
<< exit(FatalIOError);
}
}
}
// Backwards compatibility for v1612+ and older
List<word> orientedFields;
orientedFieldsStart_ = labelMax;
if (dict.readIfPresent("orientedFields", orientedFields))
{
orientedFieldsStart_ = fields_.size();
WarningInFunction
<< "The 'orientedFields' option is deprecated. These fields can "
<< "and have been added to the standard 'fields' list."
<< endl;
fields_.append(orientedFields);
}
surfaceWriterPtr_.clear();
if (writeFields_)
{
@ -854,8 +840,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
[dict.lookupOrDefault<word>("postOperation", "none")]
),
weightFieldName_("none"),
orientWeightField_(false),
orientedFieldsStart_(labelMax),
writeArea_(dict.lookupOrDefault("writeArea", false)),
nFaces_(0),
faceId_(),
@ -883,8 +867,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
[dict.lookupOrDefault<word>("postOperation", "none")]
),
weightFieldName_("none"),
orientWeightField_(false),
orientedFieldsStart_(labelMax),
writeArea_(dict.lookupOrDefault("writeArea", false)),
nFaces_(0),
faceId_(),
@ -959,7 +941,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
}
else
{
Sf = filterField(mesh_.Sf(), true); // Oriented Sf
Sf = filterField(mesh_.Sf());
}
}
@ -988,12 +970,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
{
scalarField weightField
(
getFieldValues<scalar>
(
weightFieldName_,
true,
orientWeightField_
)
getFieldValues<scalar>(weightFieldName_, true)
);
// Process the fields
@ -1003,12 +980,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
{
vectorField weightField
(
getFieldValues<vector>
(
weightFieldName_,
true,
orientWeightField_
)
getFieldValues<vector>(weightFieldName_, true)
);
// Process the fields

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
@ -91,7 +91,6 @@ Usage
orientedWeightField | name of oriented field to apply weighting | no |
scaleFactor | scale factor | no | 1
fields | list of fields to operate on | yes |
orientedFields | list of oriented fields to operate on | no |
\endtable
Where \c regionType is defined by
@ -130,8 +129,6 @@ Note
- faces on empty patches get ignored
- if the field is a volField the \c faceZone can only consist of boundary
faces
- the `oriented' entries relate to mesh-oriented fields, such as the
flux, phi. These fields will be oriented according to the face normals.
- Using \c surface:
- The keyword %subRegion should not be used to select surfaces.
Specify instead the regionType 'surface' and provide the surface name.
@ -285,12 +282,6 @@ protected:
//- Weight field name - optional
word weightFieldName_;
//- Flag to indicate if flipMap should be applied to the weight field
bool orientWeightField_;
//- Start index of fields that require application of flipMap
label orientedFieldsStart_;
//- Total area of the surfaceFieldValue
scalar totalArea_;
@ -353,8 +344,7 @@ protected:
tmp<Field<Type>> getFieldValues
(
const word& fieldName,
const bool mustGet = false,
const bool applyOrientation = false
const bool mustGet = false
) const;
//- Apply the 'operation' to the values. Operation must preserve Type.
@ -380,16 +370,14 @@ protected:
template<class Type>
tmp<Field<Type>> filterField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
const bool applyOrientation
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
) const;
//- Filter a volume field according to faceIds
template<class Type>
tmp<Field<Type>> filterField
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const bool applyOrientation
const GeometricField<Type, fvPatchField, volMesh>& field
) const;
//- Weighting factor
@ -424,7 +412,6 @@ protected:
const word& fieldName,
const vectorField& Sf,
const Field<WeightType>& weightField,
const bool orient,
const meshedSurf& surfToWrite
);

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 @@ Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
(
const word& fieldName,
const bool mustGet,
const bool applyOrientation
const bool mustGet
) const
{
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
@ -71,7 +70,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
}
else if (regionType_ != stSampledSurface && foundObject<sf>(fieldName))
{
return filterField(lookupObject<sf>(fieldName), applyOrientation);
return filterField(lookupObject<sf>(fieldName));
}
else if (foundObject<vf>(fieldName))
{
@ -112,7 +111,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
}
else
{
return filterField(fld, applyOrientation);
return filterField(fld);
}
}
@ -140,7 +139,9 @@ processSameTypeValues
switch (operation_)
{
case opNone:
{
break;
}
case opSum:
{
result = gSum(values);
@ -154,7 +155,7 @@ processSameTypeValues
}
else
{
tmp<scalarField> weight = weightingFactor(weightField);
tmp<scalarField> weight(weightingFactor(weightField));
result = gSum(weight*values);
}
@ -258,8 +259,10 @@ processSameTypeValues
case opAreaNormalAverage:
case opAreaNormalIntegrate:
// handled in specializations only
{
// Handled in specializations only
break;
}
}
return result;
@ -302,30 +305,17 @@ Foam::label Foam::functionObjects::fieldValues::surfaceFieldValue::writeAll
forAll(fields_, i)
{
const word& fieldName = fields_[i];
const bool orient = (i >= orientedFieldsStart_);
if
(
writeValues<scalar>
(
fieldName, Sf, weightField, orient, surfToWrite
)
|| writeValues<vector>
(
fieldName, Sf, weightField, orient, surfToWrite
)
writeValues<scalar>(fieldName, Sf, weightField, surfToWrite)
|| writeValues<vector>(fieldName, Sf, weightField, surfToWrite)
|| writeValues<sphericalTensor>
(
fieldName, Sf, weightField, orient, surfToWrite
)
|| writeValues<symmTensor>
(
fieldName, Sf, weightField, orient, surfToWrite
)
|| writeValues<tensor>
(
fieldName, Sf, weightField, orient, surfToWrite
fieldName, Sf, weightField, surfToWrite
)
|| writeValues<symmTensor>(fieldName, Sf, weightField, surfToWrite)
|| writeValues<tensor>(fieldName, Sf, weightField, surfToWrite)
)
{
++nProcessed;
@ -349,7 +339,6 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
const word& fieldName,
const vectorField& Sf,
const Field<WeightType>& weightField,
const bool orient,
const meshedSurf& surfToWrite
)
{
@ -357,7 +346,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
if (ok)
{
Field<Type> values(getFieldValues<Type>(fieldName, true, orient));
Field<Type> values(getFieldValues<Type>(fieldName, true));
// Write raw values on surface if specified
if (surfaceWriterPtr_.valid())
@ -389,7 +378,9 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
switch (postOperation_)
{
case postOpNone:
{
break;
}
case postOpSqrt:
{
// sqrt: component-wise - doesn't change the type
@ -438,8 +429,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const bool applyOrientation
const GeometricField<Type, fvPatchField, volMesh>& field
) const
{
tmp<Field<Type>> tvalues(new Field<Type>(faceId_.size()));
@ -464,16 +454,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
}
}
if (applyOrientation)
{
forAll(values, i)
{
if (faceFlip_[i])
{
values[i] *= -1;
}
}
}
// No need to flip values - all boundary faces point outwards
return tvalues;
}
@ -483,8 +464,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
const bool applyOrientation
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
) const
{
tmp<Field<Type>> tvalues(new Field<Type>(faceId_.size()));
@ -504,7 +484,13 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
}
}
if (applyOrientation)
if (debug)
{
Pout<< "field " << field.name() << " oriented: "
<< field.oriented()() << endl;
}
if (field.oriented()())
{
forAll(values, i)
{

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_;

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

@ -71,14 +71,14 @@ void Foam::functionObjects::mapFields::createInterpolation
)
);
const fvMesh& mapRegion = mapRegionPtr_();
word mapMethodName(dict.lookup("mapMethod"));
if (!meshToMesh::interpolationMethodNames_.found(mapMethodName))
const word mapMethodName(dict.lookup("mapMethod"));
if (!meshToMesh::interpolationMethodNames_.hasEnum(mapMethodName))
{
FatalErrorInFunction
<< type() << " " << name() << ": unknown map method "
<< mapMethodName << nl
<< "Available methods include: "
<< meshToMesh::interpolationMethodNames_.sortedToc()
<< meshToMesh::interpolationMethodNames_
<< exit(FatalError);
}

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

@ -70,12 +70,7 @@ Foam::findCellParticle::findCellParticle
}
}
// Check state of Istream
is.check
(
"findCellParticle::findCellParticle"
"(const Cloud<findCellParticle>&, Istream&, bool)"
);
is.check(FUNCTION_NAME);
}
@ -227,9 +222,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const findCellParticle& p)
);
}
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const findCellParticle&)");
os.check(FUNCTION_NAME);
return os;
}

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

@ -148,12 +148,7 @@ Foam::streamLineParticle::streamLineParticle
}
}
// Check state of Istream
is.check
(
"streamLineParticle::streamLineParticle"
"(const Cloud<streamLineParticle>&, Istream&, bool)"
);
is.check(FUNCTION_NAME);
}
@ -497,9 +492,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const streamLineParticle& p)
<< token::SPACE << p.sampledScalars_
<< token::SPACE << p.sampledVectors_;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const streamLineParticle&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -331,12 +331,7 @@ Foam::wallBoundedParticle::wallBoundedParticle
}
}
// Check state of Istream
is.check
(
"wallBoundedParticle::wallBoundedParticle"
"(const Cloud<wallBoundedParticle>&, Istream&, bool)"
);
is.check(FUNCTION_NAME);
}

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

@ -185,12 +185,7 @@ Foam::wallBoundedStreamLineParticle::wallBoundedStreamLineParticle
}
}
// Check state of Istream
is.check
(
"wallBoundedStreamLineParticle::wallBoundedStreamLineParticle"
"(const Cloud<wallBoundedStreamLineParticle>&, Istream&, bool)"
);
is.check(FUNCTION_NAME);
}
@ -422,12 +417,7 @@ Foam::Ostream& Foam::operator<<
<< token::SPACE << p.sampledScalars_
<< token::SPACE << p.sampledVectors_;
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const wallBoundedStreamLineParticle&)"
);
os.check(FUNCTION_NAME);
return os;
}

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

@ -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}
@ -70,7 +70,7 @@ file(GLOB SOURCE_FILES
set(OPENFOAM_LIBRARIES
OpenFOAM
triSurface
surfMesh
finiteVolume
)

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

@ -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
@ -26,6 +26,7 @@ License
#include "ensightWrite.H"
#include "Time.H"
#include "polyMesh.H"
#include "wordRes.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -47,25 +48,6 @@ namespace functionObjects
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::ensightWrite::uniqWords(wordReList& lst)
{
boolList retain(lst.size());
wordHashSet uniq;
forAll(lst, i)
{
const wordRe& select = lst[i];
retain[i] =
(
select.isPattern()
|| uniq.insert(static_cast<const word&>(select))
);
}
inplaceSubset(retain, lst);
}
int Foam::functionObjects::ensightWrite::process(const word& fieldName)
{
int state = 0;
@ -140,7 +122,7 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
if (dict.found("patches"))
{
wordReList lst(dict.lookup("patches"));
uniqWords(lst);
wordRes::inplaceUniq(lst);
writeOpts_.patchSelection(lst);
}
@ -148,7 +130,7 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
if (dict.found("faceZones"))
{
wordReList lst(dict.lookup("faceZones"));
uniqWords(lst);
wordRes::inplaceUniq(lst);
writeOpts_.faceZoneSelection(lst);
}
@ -174,7 +156,7 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
// output fields
//
dict.lookup("fields") >> selectFields_;
uniqWords(selectFields_);
wordRes::inplaceUniq(selectFields_);
return true;
}

View File

@ -135,9 +135,6 @@ class ensightWrite
// Private Member Functions
//- Eliminate duplicate 'word' entries
static void uniqWords(wordReList&);
//- Ensight case handler
ensightCase& ensCase()
{

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

@ -196,7 +196,8 @@ bool Foam::functionObjects::writeObjects::write()
FatalErrorInFunction
<< "Unknown writeOption "
<< writeOptionNames_[writeOption_]
<< ". Valid writeOption types are" << writeOptionNames_
<< ". Valid writeOption types are "
<< writeOptionNames_
<< exit(FatalError);
}
}