MRG: Integrated Foundation code to commit ba4dbed
This commit is contained in:
@ -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
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,11 +182,15 @@ 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);
|
||||
|
||||
@ -189,6 +206,8 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
|
||||
(
|
||||
fieldName,
|
||||
word("mag(" + fieldName + ")"),
|
||||
minCell,
|
||||
maxCell,
|
||||
minC,
|
||||
maxC,
|
||||
mini,
|
||||
@ -204,31 +223,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 +261,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 +269,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,
|
||||
|
||||
@ -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,17 +42,21 @@ 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
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user