Commit 33894bf8 authored by sergio's avatar sergio Committed by Andrew Heather
Browse files

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

parents c787edc8 71e6e104
Info<< "Mean pressure:" << p.weightedAverage(mesh.V()).value() << endl;
Info<< "Mean temperature:" << thermo.T().weightedAverage(mesh.V()).value()
<< endl;
Info<< "Mean u':"
<< (sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value()
<< endl;
{
const scalar meanP = p.weightedAverage(mesh.V()).value();
const scalar meanT = thermo.T().weightedAverage(mesh.V()).value();
const scalar meanUp =
(sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value();
const scalar meanB = b.weightedAverage(mesh.V()).value();
logSummaryFile()
<< runTime.theta() << tab
<< p.weightedAverage(mesh.V()).value() << tab
<< thermo.T().weightedAverage(mesh.V()).value() << tab
<< (sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value()
<< tab
<< 1 - b.weightedAverage(mesh.V()).value()
<< endl;
Info<< "Mean pressure:" << meanP << nl
<< "Mean temperature:" << meanT << nl
<< "Mean u':" << meanUp << endl;
if (Pstream::master())
{
logSummaryFile()
<< runTime.theta() << tab
<< meanP << tab
<< meanT << tab
<< meanUp << tab
<< 1 - meanB
<< endl;
}
}
......@@ -53,11 +53,10 @@ regions
}
// Coefficients for the decomposition method are either as a
// general "coeffs" dictionary or method-specific "<method>Coeffs".
// Coefficients for the decomposition method are either as a general
// "coeffs" dictionary or method-specific "<method>Coeffs".
// For multiLevel, using multiLevelCoeffs only.
multiLevelCoeffs
{
// multiLevel decomposition methods to apply in turn.
......@@ -70,12 +69,12 @@ multiLevelCoeffs
level0
{
numberOfSubdomains 16;
method scotch;
method scotch;
}
level1
{
numberOfSubdomains 2;
method scotch;
method scotch;
coeffs
{
n (2 1 1);
......@@ -85,8 +84,8 @@ multiLevelCoeffs
level2
{
numberOfSubdomains 8;
// method simple;
method scotch;
// method simple;
method scotch;
}
}
......@@ -107,17 +106,22 @@ multiLevelCoeffs
// Other example coefficients
coeffs
{
n (2 1 1);
}
simpleCoeffs
{
n (2 1 1);
// delta 0.001; //< default value = 0.001
n (2 1 1);
// delta 0.001; //< default value = 0.001
}
hierarchicalCoeffs
{
n (1 2 1);
// delta 0.001; //< default value = 0.001
// order xyz; //< default order = xyz
n (1 2 1);
// delta 0.001; //< default value = 0.001
// order xyz; //< default order = xyz
}
metisCoeffs
......
......@@ -104,51 +104,51 @@ Foam::instantList Foam::fileOperation::sortTimes
)
{
// Initialise instant list
instantList Times(dirEntries.size() + 1);
instantList times(dirEntries.size() + 1);
label nTimes = 0;
// Check for "constant"
bool haveConstant = false;
forAll(dirEntries, i)
for (const fileName& dirName : dirEntries)
{
if (dirEntries[i] == constantName)
if (dirName == constantName)
{
Times[nTimes].value() = 0;
Times[nTimes].name() = dirEntries[i];
nTimes++;
haveConstant = true;
times[nTimes].value() = 0;
times[nTimes].name() = constantName;
++nTimes;
break;
}
}
// Read and parse all the entries in the directory
forAll(dirEntries, i)
for (const fileName& dirName : dirEntries)
{
scalar timeValue;
if (readScalar(dirEntries[i], timeValue))
if (readScalar(dirName, timeValue))
{
Times[nTimes].value() = timeValue;
Times[nTimes].name() = dirEntries[i];
nTimes++;
times[nTimes].value() = timeValue;
times[nTimes].name() = dirName;
++nTimes;
}
}
// Reset the length of the times list
Times.setSize(nTimes);
times.setSize(nTimes);
if (haveConstant)
{
if (nTimes > 2)
{
std::sort(&Times[1], Times.end(), instant::less());
std::sort(&times[1], times.end(), instant::less());
}
}
else if (nTimes > 1)
{
std::sort(&Times[0], Times.end(), instant::less());
std::sort(&times[0], times.end(), instant::less());
}
return Times;
return times;
}
......@@ -161,15 +161,15 @@ void Foam::fileOperation::mergeTimes
{
if (extraTimes.size())
{
bool haveConstant =
const bool haveConstant =
(
times.size() > 0
times.size()
&& times[0].name() == constantName
);
bool haveExtraConstant =
const bool haveExtraConstant =
(
extraTimes.size() > 0
extraTimes.size()
&& extraTimes[0].name() == constantName
);
......@@ -228,9 +228,7 @@ void Foam::fileOperation::mergeTimes
bool Foam::fileOperation::isFileOrDir(const bool isFile, const fileName& f)
{
return
(isFile && Foam::isFile(f))
|| (!isFile && Foam::isDir(f));
return (isFile ? Foam::isFile(f) : Foam::isDir(f));
}
......@@ -431,10 +429,8 @@ Foam::autoPtr<Foam::fileOperation> Foam::fileOperation::New
bool verbose
)
{
if (debug)
{
InfoInFunction << "Constructing fileHandler" << endl;
}
DebugInFunction
<< "Constructing fileHandler" << endl;
auto cstrIter = wordConstructorTablePtr_->cfind(handlerType);
......@@ -570,14 +566,12 @@ Foam::fileName Foam::fileOperation::filePath(const fileName& fName) const
}
return fName;
}
else
if (debug)
{
if (debug)
{
Pout<< "fileOperation::filePath : Not found" << endl;
}
return fileName::null;
Pout<< "fileOperation::filePath : Not found" << endl;
}
return fileName::null;
}
......@@ -755,13 +749,10 @@ Foam::IOobject Foam::fileOperation::findInstance
if (exists(io))
{
if (debug)
{
InfoInFunction
<< "Found exact match for \"" << io.name()
<< "\" in " << io.instance()/io.local()
<< endl;
}
DebugInFunction
<< "Found exact match for \"" << io.name()
<< "\" in " << io.instance()/io.local()
<< endl;
return io;
}
......@@ -770,9 +761,9 @@ Foam::IOobject Foam::fileOperation::findInstance
// closest to and lower than current time
instantList ts = time.times();
label instanceI;
label instanceI = ts.size()-1;
for (instanceI = ts.size()-1; instanceI >= 0; --instanceI)
for (; instanceI >= 0; --instanceI)
{
if (ts[instanceI].value() <= startValue)
{
......@@ -780,7 +771,7 @@ Foam::IOobject Foam::fileOperation::findInstance
}
}
// continue searching from here
// Continue searching from here
for (; instanceI >= 0; --instanceI)
{
// Shortcut: if actual directory is the timeName we've already tested it
......@@ -796,13 +787,10 @@ Foam::IOobject Foam::fileOperation::findInstance
io.instance() = ts[instanceI].name();
if (exists(io))
{
if (debug)
{
InfoInFunction
<< "Found exact match for \"" << io.name()
<< "\" in " << io.instance()/io.local()
<< endl;
}
DebugInFunction
<< "Found exact match for \"" << io.name()
<< "\" in " << io.instance()/io.local()
<< endl;
return io;
}
......@@ -810,11 +798,8 @@ Foam::IOobject Foam::fileOperation::findInstance
// Check if hit minimum instance
if (ts[instanceI].name() == stopInstance)
{
if (debug)
{
InfoInFunction
<< "Hit stopInstance " << stopInstance << endl;
}
DebugInFunction
<< "Hit stopInstance " << stopInstance << endl;
if
(
......@@ -845,27 +830,30 @@ Foam::IOobject Foam::fileOperation::findInstance
}
}
// times() usually already includes the constant() so would have been
// checked above. Re-test if
// - times() is empty. Sometimes this can happen (e.g. decomposePar with
// collated)
// - times()[0] is not constant
if (!ts.size() || ts[0].name() != time.constant())
{
// Note. This needs to be a hard-coded constant, rather than the
// constant function of the time, because the latter points to
// the case constant directory in parallel cases
// Times usually already includes 'constant' so would have been checked
// above.
// However, re-test under these conditions:
// - Times is empty.
// Sometimes this can happen (eg, decomposePar with collated)
// - Times[0] is not constant
// - The startValue is negative (eg, kivaTest).
// This plays havoc with the reverse search, causing it to miss 'constant'
if
(
ts.empty()
|| ts.first().name() != time.constant()
|| startValue < 0
)
{
io.instance() = time.constant();
if (exists(io))
{
if (debug)
{
InfoInFunction
<< "Found constant match for \"" << io.name()
<< "\" in " << io.instance()/io.local()
<< endl;
}
DebugInFunction
<< "Found constant match for \"" << io.name()
<< "\" in " << io.instance()/io.local()
<< endl;
return io;
}
}
......
......@@ -104,6 +104,12 @@ public:
//- Return i,j,k addressing sizes for modification
inline labelVector& sizes();
//- The field size
using Field<Type>::size;
//- The addressing dimension in the given direction
inline const label& size(const vector::components cmpt) const;
// Edit
......
......@@ -157,6 +157,16 @@ inline Foam::labelVector& Foam::IjkField<Type>::sizes()
}
template<class Type>
inline const Foam::label& Foam::IjkField<Type>::size
(
const vector::components cmpt
) const
{
return ijk_.size(cmpt);
}
template<class Type>
inline void Foam::IjkField<Type>::clear()
{
......
......@@ -36,6 +36,7 @@ SourceFiles
#define ijkAddressing_H
#include "labelVector.H"
#include "vector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -72,17 +73,20 @@ public:
// Access
//- Return the i,j,k addressing sizes
//- Addressing is considered empty if any component is zero
inline bool empty() const;
//- The (i,j,k) addressing dimensions
inline const labelVector& sizes() const;
//- Return the i,j,k addressing sizes for modification
//- Return the (i,j,k) dimensions for modification
inline labelVector& sizes();
//- Return the total i*j*k size
inline label size() const;
//- Addressing is considered empty if any component is zero
inline bool empty() const;
//- The addressing dimension in the given direction
inline const label& size(const vector::components cmpt) const;
//- Reset to (0,0,0) sizing
inline void clear();
......@@ -93,13 +97,13 @@ public:
//- Change the sizing parameters
inline void reset(const labelVector& newSizes);
//- Linear addressing index (offset) for an i,j,k position.
//- Linear addressing index (offset) for an (i,j,k) position.
inline label index(const label i, const label j, const label k) const;
//- Linear addressing index (offset) for an i,j,k position.
//- Linear addressing index (offset) for an (i,j,k) position.
inline label index(const labelVector& ijk) const;
//- The i,j,k indexing from linear addressing.
//- The (i,j,k) indexing from linear addressing.
inline labelVector index(const label idx) const;
......
......@@ -58,6 +58,12 @@ inline Foam::ijkAddressing::ijkAddressing
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline bool Foam::ijkAddressing::empty() const
{
return (!sizes_.x() || !sizes_.y() || !sizes_.z());
}
inline const Foam::labelVector& Foam::ijkAddressing::sizes() const
{
return sizes_;
......@@ -77,9 +83,12 @@ inline Foam::label Foam::ijkAddressing::size() const
}
inline bool Foam::ijkAddressing::empty() const
inline const Foam::label& Foam::ijkAddressing::size
(
const vector::components cmpt
) const
{
return (!sizes_.x() || !sizes_.y() || !sizes_.z());
return sizes_[cmpt];
}
......
......@@ -143,13 +143,13 @@ inline Foam::label Foam::ijkMesh::nBoundaryFaces
return n.y()*n.z();
break;
// Face 2, 3 == y-min, y-max
// Face 2,3 == y-min, y-max
case 2:
case 3:
return n.z()*n.x();
break;
// Face 4, 5 == z-min, z-max
// Face 4,5 == z-min, z-max
case 4:
case 5:
return n.x()*n.y();
......
......@@ -62,7 +62,7 @@ class TableBase
{
protected:
// Protected data
// Protected Data
//- Table name
const word name_;
......@@ -93,9 +93,6 @@ protected:
//- Return (demand driven) interpolator
const interpolationWeights& interpolator() const;
private:
//- No copy assignment
void operator=(const TableBase<Type>&) = delete;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -37,12 +37,12 @@ Foam::Function1Types::TableFile<Type>::TableFile
)
:
TableBase<Type>(entryName, dict),
fName_("none")
fName_()
{
dict.readEntry("file", fName_);
fileName expandedFile(fName_);
//IFstream is(expandedFile.expand());
autoPtr<ISstream> isPtr(fileHandler().NewIFstream(expandedFile.expand()));
ISstream& is = isPtr();
......@@ -66,13 +66,6 @@ Foam::Function1Types::TableFile<Type>::TableFile(const TableFile<Type>& tbl)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Function1Types::TableFile<Type>::~TableFile()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -27,7 +27,7 @@ Class
Foam::Function1Types::TableFile
Description
Templated table container function where data is read from file.
Templated table container function where data are read from file.
Usage:
\verbatim
......@@ -40,8 +40,8 @@ Description
}
\endverbatim
Data is stored as a list of Tuple2's. First column is always stored as
scalar entries. Data is read in the form, e.g. for an entry \<entryName\>
Data are stored as a list of Tuple2's. First column is always stored as
scalar entries. Data are read in the form, e.g. for an entry \<entryName\>
that is (scalar, vector):
\verbatim
(
......@@ -77,7 +77,7 @@ class TableFile
:
public TableBase<Type>
{
// Private data
// Private Data
//- File name for csv table (optional)
fileName fName_;
......@@ -97,7 +97,7 @@ public:
// Constructors
//- Construct from entry name and Istream
//- Construct from entry name and "file" found in dictionary
TableFile(const word& entryName, const dictionary& dict);
//- Copy constructor
......@@ -105,7 +105,7 @@ public:
//- Destructor
virtual ~TableFile();
virtual ~TableFile() = default;
// I/O
......
......@@ -87,7 +87,7 @@ Usage
componentColumns 1(1);
separator ",";
mergeSeparators no;
file "<constant>/pressureVsU";
file "<constant>/UvsPressure";
}
value uniform 0;
}
......
......@@ -107,7 +107,6 @@ void Foam::swirlFanVelocityFvPatchField::calcFanJump()
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //