Commit 889f48ba authored by henry's avatar henry
Browse files
parents 7ee02116 076be919
......@@ -16,6 +16,7 @@
*.la
*.so
*.jar
lex.yy.c
# Corefiles
core
......@@ -27,10 +28,13 @@ core
lnInclude
# linux build folder(s) - anywhere
linux*Gcc*[SD]POpt*
linux*Gcc*
# reinstate wmake/rules that look like build folders
!wmake/rules/linux*
# but do ignore the derived files in there
wmake/rules/linux*/dirToString
wmake/rules/linux*/wmkdep
# doxygen generated documentation
doc/[Dd]oxygen/html
......
......@@ -140,6 +140,7 @@ buildParaView ()
{
# set general options
addCMakeVariable "BUILD_SHARED_LIBS:BOOL=ON"
addCMakeVariable "CMAKE_BUILD_TYPE:STRING=Release"
# set paraview environment
unset PARAVIEW_SRC_DIR
......
......@@ -27,8 +27,6 @@ License
#include "treeBoundBox.H"
#include "ListOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::treeBoundBox Foam::treeBoundBox::greatBox
......@@ -50,6 +48,7 @@ const Foam::label facesArray[6][4] =
};
//! @endcond
const Foam::faceList Foam::treeBoundBox::faces
(
initListList<face, label, 6, 4>(facesArray)
......@@ -74,12 +73,28 @@ const Foam::label edgesArray[12][2] =
};
//! @endcond
const Foam::edgeList Foam::treeBoundBox::edges
const Foam::FixedList<Foam::vector, 6> Foam::treeBoundBox::faceNormals
(
initListList<edge, label, 12, 2>(edgesArray)
calcFaceNormals()
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::FixedList<Foam::vector, 6> Foam::treeBoundBox::calcFaceNormals()
{
FixedList<vector, 6> normals;
normals[LEFT] = vector(-1, 0, 0);
normals[RIGHT] = vector( 1, 0, 0);
normals[BOTTOM] = vector( 0, -1, 0);
normals[TOP] = vector( 0, 1, 0);
normals[BACK] = vector( 0, 0, -1);
normals[FRONT] = vector( 0, 0, 1);
return normals;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct as the bounding box of the given pointField
......
......@@ -78,6 +78,11 @@ class treeBoundBox
public boundBox
{
private:
//- To initialise faceNormals.
static FixedList<vector, 6> calcFaceNormals();
public:
// Static data members
......@@ -142,6 +147,9 @@ public:
//- Edge to point addressing
static const edgeList edges;
//- Per face the unit normal
static const FixedList<vector, 6> faceNormals;
//- Face on which neighbour is
static direction neighbourFaceBits(const label&);
......
......@@ -85,23 +85,23 @@ void Foam::fieldAverage::initialise()
const word fieldName = faItems_[i].fieldName();
if (obr_.foundObject<volScalarField>(fieldName))
{
addMeanFields<scalar>(i, meanScalarFields_);
addMeanField<scalar>(i, meanScalarFields_);
}
else if (obr_.foundObject<volVectorField>(fieldName))
{
addMeanFields<vector>(i, meanVectorFields_);
addMeanField<vector>(i, meanVectorFields_);
}
else if (obr_.foundObject<volSphericalTensorField>(fieldName))
{
addMeanFields<sphericalTensor>(i, meanSphericalTensorFields_);
addMeanField<sphericalTensor>(i, meanSphericalTensorFields_);
}
else if (obr_.foundObject<volSymmTensorField>(fieldName))
{
addMeanFields<symmTensor>(i, meanSymmTensorFields_);
addMeanField<symmTensor>(i, meanSymmTensorFields_);
}
else if (obr_.foundObject<volTensorField>(fieldName))
{
addMeanFields<tensor>(i, meanTensorFields_);
addMeanField<tensor>(i, meanTensorFields_);
}
else
{
......@@ -118,29 +118,29 @@ void Foam::fieldAverage::initialise()
if (faItems_[i].prime2Mean())
{
const word fieldName = faItems_[i].fieldName();
if (!faItems_[i].mean())
{
FatalErrorIn("Foam::fieldAverage::initialise()")
<< "To calculate the prime-squared average, the "
<< "mean average must also be selected for field "
<< fieldName << nl << exit(FatalError);
}
if (obr_.foundObject<volScalarField>(fieldName))
{
if (!faItems_[i].mean())
{
FatalErrorIn("Foam::fieldAverage::initialise()")
<< "To calculate the prime-squared average, the "
<< "mean average must also be selected for field "
<< fieldName << nl << exit(FatalError);
}
addPrime2MeanFields<scalar>(i, prime2MeanScalarFields_);
addPrime2MeanField<scalar>
(
i,
meanScalarFields_,
prime2MeanScalarFields_
);
}
else if (obr_.foundObject<volVectorField>(fieldName))
{
if (!faItems_[i].mean())
{
FatalErrorIn("Foam::fieldAverage::initialise()")
<< "To calculate the prime-squared average, the "
<< "mean average must also be selected for field "
<< fieldName << nl << exit(FatalError);
}
addPrime2MeanFields<vector>
addPrime2MeanField<vector>
(
i,
meanVectorFields_,
prime2MeanSymmTensorFields_
);
}
......@@ -251,8 +251,16 @@ void Foam::fieldAverage::calcAverages()
totalTime_[i] += obr_.time().deltaT().value();
}
addMeanSqrToPrime2Mean<scalar>(prime2MeanScalarFields_);
addMeanSqrToPrime2Mean<vector>(prime2MeanSymmTensorFields_);
addMeanSqrToPrime2Mean<scalar>
(
meanScalarFields_,
prime2MeanScalarFields_
);
addMeanSqrToPrime2Mean<vector>
(
meanVectorFields_,
prime2MeanSymmTensorFields_
);
calculateMeanFields<scalar>(meanScalarFields_);
calculateMeanFields<vector>(meanVectorFields_);
......@@ -260,8 +268,16 @@ void Foam::fieldAverage::calcAverages()
calculateMeanFields<symmTensor>(meanSymmTensorFields_);
calculateMeanFields<tensor>(meanTensorFields_);
calculatePrime2MeanFields<scalar>(prime2MeanScalarFields_);
calculatePrime2MeanFields<vector>(prime2MeanSymmTensorFields_);
calculatePrime2MeanFields<scalar>
(
meanScalarFields_,
prime2MeanScalarFields_
);
calculatePrime2MeanFields<vector>
(
meanVectorFields_,
prime2MeanSymmTensorFields_
);
}
......
......@@ -161,22 +161,21 @@ protected:
// valid, and populate field lists
void initialise();
//- Add mean average fields to PtrLists
//- Add mean average field to PtrList
template<class Type>
void addMeanFields
void addMeanField
(
const label fieldi,
const label,
PtrList<GeometricField<Type, fvPatchField, volMesh> >&
fieldList
);
//- Add prime-squared average fields to PtrLists
//- Add prime-squared average field to PtrList
template<class Type1, class Type2>
void addPrime2MeanFields
void addPrime2MeanField
(
const label fieldi,
const label,
PtrList<GeometricField<Type1, fvPatchField, volMesh> >&,
PtrList<GeometricField<Type2, fvPatchField, volMesh> >&
fieldList
);
......@@ -190,23 +189,22 @@ protected:
void calculateMeanFields
(
PtrList<GeometricField<Type, fvPatchField, volMesh> >&
fieldList
);
//- Add mean-squared field value to prime-squared mean field
template<class Type1, class Type2>
void addMeanSqrToPrime2Mean
(
PtrList<GeometricField<Type1, fvPatchField, volMesh> >&,
PtrList<GeometricField<Type2, fvPatchField, volMesh> >&
fieldList
);
//- Calculate prime-squared average fields
template<class Type1, class Type2>
void calculatePrime2MeanFields
(
PtrList<GeometricField<Type1, fvPatchField, volMesh> >&,
PtrList<GeometricField<Type2, fvPatchField, volMesh> >&
fieldList
);
......
......@@ -31,23 +31,22 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::fieldAverage::addMeanFields
void Foam::fieldAverage::addMeanField
(
const label fieldi,
PtrList<GeometricField<Type, fvPatchField, volMesh> >& fieldList
PtrList<GeometricField<Type, fvPatchField, volMesh> >& meanFieldList
)
{
if (faItems_[fieldi].mean())
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const word& fieldName = faItems_[fieldi].fieldName();
const fieldType& baseField = mesh.lookupObject<fieldType>(fieldName);
const word meanFieldName = fieldName + EXT_MEAN;
const fieldType& baseField = obr_.lookupObject<fieldType>(fieldName);
const word meanFieldName = fieldName + EXT_MEAN;
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
fieldList.set
meanFieldList.set
(
fieldi,
new fieldType
......@@ -55,8 +54,8 @@ void Foam::fieldAverage::addMeanFields
IOobject
(
meanFieldName,
mesh.time().timeName(),
mesh,
obr_.time().timeName(),
obr_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
......@@ -68,10 +67,11 @@ void Foam::fieldAverage::addMeanFields
template<class Type1, class Type2>
void Foam::fieldAverage::addPrime2MeanFields
void Foam::fieldAverage::addPrime2MeanField
(
const label fieldi,
PtrList<GeometricField<Type2, fvPatchField, volMesh> >& fieldList
PtrList<GeometricField<Type1, fvPatchField, volMesh> >& meanFieldList,
PtrList<GeometricField<Type2, fvPatchField, volMesh> >& prime2MeanFieldList
)
{
if (faItems_[fieldi].mean())
......@@ -79,15 +79,13 @@ void Foam::fieldAverage::addPrime2MeanFields
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const word& fieldName = faItems_[fieldi].fieldName();
const fieldType1& baseField = mesh.lookupObject<fieldType1>(fieldName);
const fieldType1& meanField =
mesh.lookupObject<fieldType1>(fieldName + EXT_MEAN);
const word meanFieldName = fieldName + EXT_PRIME2MEAN;
const fieldType1& baseField = obr_.lookupObject<fieldType1>(fieldName);
const fieldType1& meanField = meanFieldList[fieldi];
const word meanFieldName = fieldName + EXT_PRIME2MEAN;
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
fieldList.set
prime2MeanFieldList.set
(
fieldi,
new fieldType2
......@@ -95,8 +93,8 @@ void Foam::fieldAverage::addPrime2MeanFields
IOobject
(
meanFieldName,
mesh.time().timeName(),
mesh,
obr_.time().timeName(),
obr_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
......@@ -110,7 +108,7 @@ void Foam::fieldAverage::addPrime2MeanFields
template<class Type>
void Foam::fieldAverage::calculateMeanFields
(
PtrList<GeometricField<Type, fvPatchField, volMesh> >& fieldList
PtrList<GeometricField<Type, fvPatchField, volMesh> >& meanFieldList
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
......@@ -119,15 +117,14 @@ void Foam::fieldAverage::calculateMeanFields
forAll(faItems_, i)
{
if (fieldList.set(i))
if (meanFieldList.set(i))
{
if (faItems_[i].mean())
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const word& fieldName = faItems_[i].fieldName();
const fieldType& baseField =
mesh.lookupObject<fieldType>(fieldName);
fieldType& meanField = fieldList[i];
obr_.lookupObject<fieldType>(fieldName);
fieldType& meanField = meanFieldList[i];
scalar alpha = 0.0;
scalar beta = 0.0;
......@@ -152,7 +149,8 @@ void Foam::fieldAverage::calculateMeanFields
template<class Type1, class Type2>
void Foam::fieldAverage::calculatePrime2MeanFields
(
PtrList<GeometricField<Type2, fvPatchField, volMesh> >& fieldList
PtrList<GeometricField<Type1, fvPatchField, volMesh> >& meanFieldList,
PtrList<GeometricField<Type2, fvPatchField, volMesh> >& prime2MeanFieldList
)
{
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
......@@ -162,17 +160,15 @@ void Foam::fieldAverage::calculatePrime2MeanFields
forAll(faItems_, i)
{
if (fieldList.set(i))
if (prime2MeanFieldList.set(i))
{
if (faItems_[i].prime2Mean())
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const word& fieldName = faItems_[i].fieldName();
const fieldType1& baseField =
mesh.lookupObject<fieldType1>(fieldName);
const fieldType1& meanField =
mesh.lookupObject<fieldType1>(fieldName + EXT_MEAN);
fieldType2& prime2MeanField = fieldList[i];
obr_.lookupObject<fieldType1>(fieldName);
const fieldType1& meanField = meanFieldList[i];
fieldType2& prime2MeanField = prime2MeanFieldList[i];
scalar alpha = 0.0;
scalar beta = 0.0;
......@@ -200,7 +196,8 @@ void Foam::fieldAverage::calculatePrime2MeanFields
template<class Type1, class Type2>
void Foam::fieldAverage::addMeanSqrToPrime2Mean
(
PtrList<GeometricField<Type2, fvPatchField, volMesh> >& fieldList
PtrList<GeometricField<Type1, fvPatchField, volMesh> >& meanFieldList,
PtrList<GeometricField<Type2, fvPatchField, volMesh> >& prime2MeanFieldList
)
{
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
......@@ -208,15 +205,12 @@ void Foam::fieldAverage::addMeanSqrToPrime2Mean
forAll(faItems_, i)
{
if (fieldList.set(i))
if (prime2MeanFieldList.set(i))
{
if (faItems_[i].prime2Mean())
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const word& fieldName = faItems_[i].fieldName();
const fieldType1& meanField =
mesh.lookupObject<fieldType1>(fieldName + EXT_MEAN);
fieldType2& prime2MeanField = fieldList[i];
const fieldType1& meanField = meanFieldList[i];
fieldType2& prime2MeanField = prime2MeanFieldList[i];
prime2MeanField += sqr(meanField);
}
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type zeroGradient;
value uniform (0 0 0);
}
outlet
{
type zeroGradient;
value uniform (0 0 0);
}
walls
{
type fixedValue;
value uniform (0 0 0);
}
frontBack
{
type fixedValue;
value uniform (0 0 0);
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object gamma;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value uniform 0;
}
walls
{
type calculated;
value uniform 0;
}
frontBack
{
type calculated;
value uniform 0;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0];
internalField uniform 10.0;
boundaryField
{
inlet
{
type fixedValue;
value uniform 0.5;
}
outlet
{
type zeroGradient;
}
walls
{
type zeroGradient;
}
frontBack
{
type zeroGradient;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volScalarField;
object nuSgs;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 1e-11;
boundaryField
{
inlet
{