Commit 83d33e42 authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/hunt2/OpenFOAM/OpenFOAM-dev

parents 7d56dcf4 f8aa06d1
......@@ -151,18 +151,20 @@ public:
const IOobject& fieldIoObject
);
//- Reconstruct and write all volume fields
//- Reconstruct and write all/selected volume fields
template<class Type>
void reconstructFvVolumeFields
(
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
);
//- Reconstruct and write all volume fields
//- Reconstruct and write all/selected volume fields
template<class Type>
void reconstructFvSurfaceFields
(
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
);
};
......
......@@ -131,7 +131,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
forAll(cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
// face direction.
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
}
......@@ -151,7 +151,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
forAll(cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
// face direction.
label curF = cp[faceI] - 1;
// Is the face on the boundary?
......@@ -282,7 +282,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
// It is necessary to create a copy of the addressing array to
// take care of the face direction offset trick.
//
//
{
labelList curAddr(faceProcAddressing_[procI]);
......@@ -342,7 +342,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
forAll(cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
// face direction.
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
}
......@@ -452,11 +452,12 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
}
// Reconstruct and write all volume fields
// Reconstruct and write all/selected volume fields
template<class Type>
void Foam::fvFieldReconstructor::reconstructFvVolumeFields
(
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
)
{
const word& fieldClassName =
......@@ -468,27 +469,29 @@ void Foam::fvFieldReconstructor::reconstructFvVolumeFields
{
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
for
(
IOobjectList::const_iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
if
(
!selectedFields.size()
|| selectedFields.found(fieldIter()->name())
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructFvVolumeField<Type>(*fieldIter())().write();
reconstructFvVolumeField<Type>(*fieldIter())().write();
}
}
Info<< endl;
}
}
// Reconstruct and write all surface fields
// Reconstruct and write all/selected surface fields
template<class Type>
void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
(
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
)
{
const word& fieldClassName =
......@@ -500,18 +503,19 @@ void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
{
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
for
(
IOobjectList::const_iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
if
(
!selectedFields.size()
|| selectedFields.found(fieldIter()->name())
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructFvSurfaceField<Type>(*fieldIter())().write();
reconstructFvSurfaceField<Type>(*fieldIter())().write();
}
}
Info<< endl;
}
}
......
......@@ -48,9 +48,17 @@ int main(int argc, char *argv[])
argList::noParallel();
timeSelector::addOptions();
# include "addRegionOption.H"
argList::validOptions.insert("fields", "\"(list of fields)\"");
# include "setRootCase.H"
# include "createTime.H"
HashSet<word> selectedFields;
if (args.options().found("fields"))
{
IStringStream(args.options()["fields"])() >> selectedFields;
}
// determine the processor count directly
label nProcs = 0;
while (dir(args.path()/(word("processor") + name(nProcs))))
......@@ -184,13 +192,37 @@ int main(int argc, char *argv[])
procMeshes.boundaryProcAddressing()
);
fvReconstructor.reconstructFvVolumeFields<scalar>(objects);
fvReconstructor.reconstructFvVolumeFields<vector>(objects);
fvReconstructor.reconstructFvVolumeFields<sphericalTensor>(objects);
fvReconstructor.reconstructFvVolumeFields<symmTensor>(objects);
fvReconstructor.reconstructFvVolumeFields<tensor>(objects);
fvReconstructor.reconstructFvVolumeFields<scalar>
(
objects,
selectedFields
);
fvReconstructor.reconstructFvVolumeFields<vector>
(
objects,
selectedFields
);
fvReconstructor.reconstructFvVolumeFields<sphericalTensor>
(
objects,
selectedFields
);
fvReconstructor.reconstructFvVolumeFields<symmTensor>
(
objects,
selectedFields
);
fvReconstructor.reconstructFvVolumeFields<tensor>
(
objects,
selectedFields
);
fvReconstructor.reconstructFvSurfaceFields<scalar>(objects);
fvReconstructor.reconstructFvSurfaceFields<scalar>
(
objects,
selectedFields
);
}
else
{
......
......@@ -139,7 +139,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
IOobject LESPropertiesHeader
(
"RASProperties",
"LESProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
......
......@@ -34,7 +34,7 @@ Description
#define ODE_H
#include "scalarField.H"
#include "Matrix.H"
#include "scalarMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -80,7 +80,7 @@ public:
const scalar x,
const scalarField& y,
scalarField& dfdx,
Matrix<scalar>& dfdy
scalarSquareMatrix& dfdy
) const = 0;
};
......
......@@ -25,7 +25,6 @@ License
\*---------------------------------------------------------------------------*/
#include "KRR4.H"
#include "simpleMatrix.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -36,11 +35,11 @@ namespace Foam
{
addToRunTimeSelectionTable(ODESolver, KRR4, ODE);
const scalar
const scalar
KRR4::safety = 0.9, KRR4::grow = 1.5, KRR4::pgrow = -0.25,
KRR4::shrink = 0.5, KRR4::pshrink = (-1.0/3.0), KRR4::errcon = 0.1296;
const scalar
const scalar
KRR4::gamma = 1.0/2.0,
KRR4::a21 = 2.0, KRR4::a31 = 48.0/25.0, KRR4::a32 = 6.0/25.0,
KRR4::c21 = -8.0, KRR4::c31 = 372.0/25.0, KRR4::c32 = 12.0/5.0,
......@@ -81,8 +80,8 @@ void Foam::KRR4::solve
const ODE& ode,
scalar& x,
scalarField& y,
scalarField& dydx,
const scalar eps,
scalarField& dydx,
const scalar eps,
const scalarField& yScale,
const scalar hTry,
scalar& hDid,
......@@ -109,14 +108,14 @@ void Foam::KRR4::solve
a_[i][i] += 1.0/(gamma*h);
}
simpleMatrix<scalar>::LUDecompose(a_, pivotIndices_);
LUDecompose(a_, pivotIndices_);
for (register label i=0; i<n_; i++)
{
g1_[i] = dydxTemp_[i] + h*c1X*dfdx_[i];
}
simpleMatrix<scalar>::LUBacksubstitute(a_, pivotIndices_, g1_);
LUBacksubstitute(a_, pivotIndices_, g1_);
for (register label i=0; i<n_; i++)
{
......@@ -131,7 +130,7 @@ void Foam::KRR4::solve
g2_[i] = dydx_[i] + h*c2X*dfdx_[i] + c21*g1_[i]/h;
}
simpleMatrix<scalar>::LUBacksubstitute(a_, pivotIndices_, g2_);
LUBacksubstitute(a_, pivotIndices_, g2_);
for (register label i=0; i<n_; i++)
{
......@@ -146,7 +145,7 @@ void Foam::KRR4::solve
g3_[i] = dydx[i] + h*c3X*dfdx_[i] + (c31*g1_[i] + c32*g2_[i])/h;
}
simpleMatrix<scalar>::LUBacksubstitute(a_, pivotIndices_, g3_);
LUBacksubstitute(a_, pivotIndices_, g3_);
for (register label i=0; i<n_; i++)
{
......@@ -154,7 +153,7 @@ void Foam::KRR4::solve
+ (c41*g1_[i] + c42*g2_[i] + c43*g3_[i])/h;
}
simpleMatrix<scalar>::LUBacksubstitute(a_, pivotIndices_, g4_);
LUBacksubstitute(a_, pivotIndices_, g4_);
for (register label i=0; i<n_; i++)
{
......
......@@ -62,15 +62,15 @@ class KRR4
mutable scalarField g4_;
mutable scalarField yErr_;
mutable scalarField dfdx_;
mutable Matrix<scalar> dfdy_;
mutable Matrix<scalar> a_;
mutable scalarSquareMatrix dfdy_;
mutable scalarSquareMatrix a_;
mutable labelList pivotIndices_;
static const int maxtry = 40;
static const scalar safety, grow, pgrow, shrink, pshrink, errcon;
static const scalar
static const scalar
gamma,
a21, a31, a32,
c21, c31, c32, c41, c42, c43,
......
......@@ -60,8 +60,8 @@ class SIBS
static const scalar safe1, safe2, redMax, redMin, scaleMX;
mutable scalarField a_;
mutable Matrix<scalar> alpha_;
mutable Matrix<scalar> d_p_;
mutable scalarSquareMatrix alpha_;
mutable scalarSquareMatrix d_p_;
mutable scalarField x_p_;
mutable scalarField err_;
......@@ -69,7 +69,7 @@ class SIBS
mutable scalarField ySeq_;
mutable scalarField yErr_;
mutable scalarField dfdx_;
mutable Matrix<scalar> dfdy_;
mutable scalarSquareMatrix dfdy_;
mutable label first_, kMax_, kOpt_;
mutable scalar epsOld_, xNew_;
......@@ -82,7 +82,7 @@ void SIMPR
const scalarField& y,
const scalarField& dydx,
const scalarField& dfdx,
const Matrix<scalar>& dfdy,
const scalarSquareMatrix& dfdy,
const scalar deltaX,
const label nSteps,
scalarField& yEnd
......@@ -97,7 +97,7 @@ void polyExtrapolate
scalarField& yz,
scalarField& dy,
scalarField& x_p,
Matrix<scalar>& d_p
scalarSquareMatrix& d_p
) const;
......
......@@ -25,7 +25,6 @@ License
\*---------------------------------------------------------------------------*/
#include "SIBS.H"
#include "simpleMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -36,7 +35,7 @@ void Foam::SIBS::SIMPR
const scalarField& y,
const scalarField& dydx,
const scalarField& dfdx,
const Matrix<scalar>& dfdy,
const scalarSquareMatrix& dfdy,
const scalar deltaX,
const label nSteps,
scalarField& yEnd
......@@ -44,7 +43,7 @@ void Foam::SIBS::SIMPR
{
scalar h = deltaX/nSteps;
Matrix<scalar> a(n_, n_);
scalarSquareMatrix a(n_);
for (register label i=0; i<n_; i++)
{
for (register label j=0; j<n_; j++)
......@@ -55,14 +54,14 @@ void Foam::SIBS::SIMPR
}
labelList pivotIndices(n_);
simpleMatrix<scalar>::LUDecompose(a, pivotIndices);
LUDecompose(a, pivotIndices);
for (register label i=0; i<n_; i++)
{
yEnd[i] = h*(dydx[i] + h*dfdx[i]);
}
simpleMatrix<scalar>::LUBacksubstitute(a, pivotIndices, yEnd);
LUBacksubstitute(a, pivotIndices, yEnd);
scalarField del(yEnd);
scalarField ytemp(n_);
......@@ -83,7 +82,7 @@ void Foam::SIBS::SIMPR
yEnd[i] = h*yEnd[i] - del[i];
}
simpleMatrix<scalar>::LUBacksubstitute(a, pivotIndices, yEnd);
LUBacksubstitute(a, pivotIndices, yEnd);
for (register label i=0; i<n_; i++)
{
......@@ -99,7 +98,7 @@ void Foam::SIBS::SIMPR
yEnd[i] = h*yEnd[i] - del[i];
}
simpleMatrix<scalar>::LUBacksubstitute(a, pivotIndices, yEnd);
LUBacksubstitute(a, pivotIndices, yEnd);
for (register label i=0; i<n_; i++)
{
......
......@@ -36,7 +36,7 @@ void Foam::SIBS::polyExtrapolate
scalarField& yz,
scalarField& dy,
scalarField& x,
Matrix<scalar>& d
scalarSquareMatrix& d
) const
{
label n = yz.size();
......
......@@ -177,9 +177,9 @@ dimensionedTypes/dimensionedTensor/dimensionedTensor.C
matrices/solution/solution.C
scalarMatrix = matrices/scalarMatrix
$(scalarMatrix)/scalarMatrix.C
$(scalarMatrix)/SVD/SVD.C
scalarMatrices = matrices/scalarMatrices
$(scalarMatrices)/scalarMatrices.C
$(scalarMatrices)/SVD/SVD.C
LUscalarMatrix = matrices/LUscalarMatrix
$(LUscalarMatrix)/LUscalarMatrix.C
......
......@@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "Pstream.H"
......
......@@ -29,7 +29,8 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::DiagonalMatrix<Type>::DiagonalMatrix(const Matrix<Type>& a)
template<class Form>
Foam::DiagonalMatrix<Type>::DiagonalMatrix(const Matrix<Form, Type>& a)
:
List<Type>(min(a.n(), a.m()))
{
......
......@@ -46,7 +46,7 @@ namespace Foam
// * * * * * * * * * * * * Class Forward declaration * * * * * * * * * * * //
template<class Type> class Matrix;
template<class Form, class Type> class Matrix;
/*---------------------------------------------------------------------------*\
Class DiagonalMatrix Declaration
......@@ -62,7 +62,8 @@ public:
// Constructors
//- Construct from diagonal component of a Matrix
DiagonalMatrix<Type>(const Matrix<Type>&);
template<class Form>
DiagonalMatrix<Type>(const Matrix<Form, Type>&);
//- Construct empty from size
DiagonalMatrix<Type>(const label size);
......
......@@ -31,9 +31,9 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::LUscalarMatrix::LUscalarMatrix(const Matrix<scalar>& matrix)
Foam::LUscalarMatrix::LUscalarMatrix(const scalarSquareMatrix& matrix)
:
scalarMatrix(matrix),
scalarSquareMatrix(matrix),
pivotIndices_(n())
{
LUDecompose(*this, pivotIndices_);
......@@ -101,7 +101,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
nCells += lduMatrices[i].size();
}
Matrix<scalar> m(nCells, nCells, 0.0);
scalarSquareMatrix m(nCells, nCells, 0.0);
transfer(m);
convert(lduMatrices);
}
......@@ -109,7 +109,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
else
{
label nCells = ldum.lduAddr().size();
Matrix<scalar> m(nCells, nCells, 0.0);
scalarSquareMatrix m(nCells, nCells, 0.0);
transfer(m);
convert(ldum, interfaceCoeffs, interfaces);
}
......
......@@ -36,7 +36,7 @@ SourceFiles
#ifndef LUscalarMatrix_H
#define LUscalarMatrix_H
#include "scalarMatrix.H"
#include "scalarMatrices.H"
#include "labelList.H"
#include "FieldField.H"
#include "lduInterfaceFieldPtrsList.H"
......@@ -55,7 +55,7 @@ class procLduMatrix;
class LUscalarMatrix
:
public scalarMatrix
public scalarSquareMatrix
{
// Private data
......@@ -78,7 +78,7 @@ class LUscalarMatrix
void convert(const PtrList<procLduMatrix>& lduMatrices);
//- Print the ratio of the mag-sum of the off-diagonal coefficients
//- Print the ratio of the mag-sum of the off-diagonal coefficients
// to the mag-diagonal
void printDiagonalDominance() const;
......@@ -87,8 +87,8 @@ public:
// Constructors
//- Construct from Matrix<scalar> and perform LU decomposition
LUscalarMatrix(const Matrix<scalar>&);
//- Construct from scalarSquareMatrix and perform LU decomposition
LUscalarMatrix(const scalarSquareMatrix&);
//- Construct from lduMatrix and perform LU decomposition
LUscalarMatrix
......
......@@ -28,8 +28,8 @@ License
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class Type>
void Foam::Matrix<Type>::allocate()
template<class Form, class Type>
void Foam::Matrix<Form, Type>::allocate()
{
if (n_ && m_)
{
......@@ -46,8 +46,8 @@ void Foam::Matrix<Type>::allocate()
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::Matrix<Type>::~Matrix()
template<class Form, class Type>
Foam::Matrix<Form, Type>::~Matrix()
{
if (v_)
{
......@@ -59,16 +59,16 @@ Foam::Matrix<Type>::~Matrix()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
const Foam::Matrix<Type>& Foam::Matrix<Type>::null()
template<class Form, class Type>
const Foam::Matrix<Form, Type>& Foam::Matrix<Form, Type>::null()
{
Matrix<Type>* nullPtr = reinterpret_cast<Matrix<Type>*>(NULL);
Matrix<Form, Type>* nullPtr = reinterpret_cast<Matrix<Form, Type>*>(NULL);
return *nullPtr;
}
template<class Type>
Foam::Matrix<Type>::Matrix(const label n, const label m)
template<class Form, class Type>
Foam::Matrix<Form, Type>::Matrix(const label n, const label m)
:
n_(n),
m_(m),
......@@ -76,7 +76,7 @@ Foam::Matrix<Type>::Matrix(const label n, const label m)