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

This commit is contained in:
mattijs
2008-09-26 15:00:48 +01:00
7 changed files with 205 additions and 210 deletions

View File

@ -6,5 +6,6 @@ wmake libo postCalc
wmake libso forces
wmake libso fieldAverage
wmake libso foamCalcFunctions
wmake libso minMaxFields
# ----------------------------------------------------------------- end-of-file

View File

@ -41,33 +41,6 @@ namespace compressible
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
)
{
const fvBoundaryMesh& bm = mesh.boundary();
wordList boundaryTypes(bm.size());
forAll(bm, patchI)
{
if (isType<wallFvPatch>(bm[patchI]))
{
boundaryTypes[patchI] = newTypeNames[patchI];
}
else
{
boundaryTypes[patchI] = oldTypeNames[patchI];
}
}
return boundaryTypes;
}
tmp<volScalarField> autoCreateMut
(
const word& fieldName,
@ -93,20 +66,23 @@ tmp<volScalarField> autoCreateMut
Info<< "--> Upgrading " << fieldName << " to employ run-time "
<< "selectable wall functions" << endl;
wordList mutBoundaryTypes = replaceWallBoundaryTypes
(
mesh,
wordList
(
mesh.boundary().size(),
calculatedFvPatchField<scalar>::typeName
),
wordList
(
mesh.boundary().size(),
RASModels::mutWallFunctionFvPatchScalarField::typeName
)
);
const fvBoundaryMesh& bm = mesh.boundary();
wordList mutBoundaryTypes(bm.size());
forAll(bm, patchI)
{
if (isType<wallFvPatch>(bm[patchI]))
{
mutBoundaryTypes[patchI] =
RASModels::mutWallFunctionFvPatchScalarField::typeName;
}
else
{
mutBoundaryTypes[patchI] =
calculatedFvPatchField<scalar>::typeName;
}
}
tmp<volScalarField> mut
(
@ -141,12 +117,16 @@ tmp<volScalarField> autoCreateEpsilon
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::epsilonWallFunctionFvPatchScalarField::typeName
);
return
autoCreateWallFunctionField
<
scalar,
RASModels::epsilonWallFunctionFvPatchScalarField
>
(
fieldName,
mesh
);
}
@ -156,12 +136,16 @@ tmp<volScalarField> autoCreateOmega
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::omegaWallFunctionFvPatchScalarField::typeName
);
return
autoCreateWallFunctionField
<
scalar,
RASModels::omegaWallFunctionFvPatchScalarField
>
(
fieldName,
mesh
);
}
@ -171,12 +155,16 @@ tmp<volScalarField> autoCreateK
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
);
return
autoCreateWallFunctionField
<
scalar,
RASModels::kQRWallFunctionFvPatchField<scalar>
>
(
fieldName,
mesh
);
}
@ -186,12 +174,16 @@ tmp<volScalarField> autoCreateQ
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
);
return
autoCreateWallFunctionField
<
scalar,
RASModels::kQRWallFunctionFvPatchField<scalar>
>
(
fieldName,
mesh
);
}
@ -201,12 +193,16 @@ tmp<volSymmTensorField> autoCreateR
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<symmTensor>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<symmTensor>::typeName
);
return
autoCreateWallFunctionField
<
symmTensor,
RASModels::kQRWallFunctionFvPatchField<symmTensor>
>
(
fieldName,
mesh
);
}

View File

@ -46,15 +46,6 @@ namespace Foam
{
namespace compressible
{
//- Replace old wall BCs with new wall function BCs
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
);
//- mut
tmp<volScalarField> autoCreateMut
(
@ -98,13 +89,12 @@ namespace compressible
);
//- Helper function to create the new field
template<class Type>
template<class Type, class PatchType>
tmp<GeometricField<Type, fvPatchField, volMesh> >
autoCreateWallFunctionField
(
const word& fieldName,
const fvMesh& mesh,
const word& wallFunctionName
const fvMesh& mesh
);

View File

@ -27,6 +27,8 @@ License
#include "backwardsCompatibilityWallFunctions.H"
#include "Time.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -36,13 +38,12 @@ namespace compressible
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
template<class Type, class PatchType>
tmp<GeometricField<Type, fvPatchField, volMesh> >
autoCreateWallFunctionField
(
const word& fieldName,
const fvMesh& mesh,
const word& wallFunctionName
const fvMesh& mesh
)
{
IOobject mutHeader
@ -97,16 +98,32 @@ autoCreateWallFunctionField
)
);
wordList fieldBoundaryTypes = replaceWallBoundaryTypes
(
mesh,
fieldOrig().boundaryField().types(),
wordList
(
fieldOrig().boundaryField().types().size(),
wallFunctionName
)
);
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
forAll(newPatchFields, patchI)
{
if (isType<wallPolyPatch>(mesh.boundaryMesh()[patchI]))
{
newPatchFields.set
(
patchI,
new PatchType
(
mesh.boundary()[patchI],
fieldOrig().dimensionedInternalField()
)
);
newPatchFields[patchI] == fieldOrig().boundaryField()[patchI];
}
else
{
newPatchFields.set
(
patchI,
fieldOrig().boundaryField()[patchI].clone()
);
}
}
tmp<fieldType> fieldNew
(
@ -122,18 +139,12 @@ autoCreateWallFunctionField
false
),
mesh,
dimensioned<Type>
(
"zero",
fieldOrig().dimensions(),
pTraits<Type>::zero
),
fieldBoundaryTypes
fieldOrig().dimensions(),
fieldOrig().internalField(),
newPatchFields
)
);
fieldNew() == fieldOrig();
Info<< " Writing backup of original " << fieldName << " to "
<< fieldName << ".old" << endl;
fieldOrig().rename(fieldName + ".old");

View File

@ -41,33 +41,6 @@ namespace incompressible
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
)
{
const fvBoundaryMesh& bm = mesh.boundary();
wordList boundaryTypes(bm.size());
forAll(bm, patchI)
{
if (isType<wallFvPatch>(bm[patchI]))
{
boundaryTypes[patchI] = newTypeNames[patchI];
}
else
{
boundaryTypes[patchI] = oldTypeNames[patchI];
}
}
return boundaryTypes;
}
tmp<volScalarField> autoCreateNut
(
const word& fieldName,
@ -93,20 +66,23 @@ tmp<volScalarField> autoCreateNut
Info<< "--> Upgrading " << fieldName << " to employ run-time "
<< "selectable wall functions" << endl;
wordList nutBoundaryTypes = replaceWallBoundaryTypes
(
mesh,
wordList
(
mesh.boundary().size(),
calculatedFvPatchField<scalar>::typeName
),
wordList
(
mesh.boundary().size(),
RASModels::nutWallFunctionFvPatchScalarField::typeName
)
);
const fvBoundaryMesh& bm = mesh.boundary();
wordList nutBoundaryTypes(bm.size());
forAll(bm, patchI)
{
if (isType<wallFvPatch>(bm[patchI]))
{
nutBoundaryTypes[patchI] =
RASModels::nutWallFunctionFvPatchScalarField::typeName;
}
else
{
nutBoundaryTypes[patchI] =
calculatedFvPatchField<scalar>::typeName;
}
}
tmp<volScalarField> nut
(
@ -141,12 +117,16 @@ tmp<volScalarField> autoCreateEpsilon
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::epsilonWallFunctionFvPatchScalarField::typeName
);
return
autoCreateWallFunctionField
<
scalar,
RASModels::epsilonWallFunctionFvPatchScalarField
>
(
fieldName,
mesh
);
}
@ -156,12 +136,16 @@ tmp<volScalarField> autoCreateOmega
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::omegaWallFunctionFvPatchScalarField::typeName
);
return
autoCreateWallFunctionField
<
scalar,
RASModels::omegaWallFunctionFvPatchScalarField
>
(
fieldName,
mesh
);
}
@ -171,12 +155,16 @@ tmp<volScalarField> autoCreateK
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
);
return
autoCreateWallFunctionField
<
scalar,
RASModels::kQRWallFunctionFvPatchField<scalar>
>
(
fieldName,
mesh
);
}
@ -186,12 +174,16 @@ tmp<volScalarField> autoCreateQ
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
);
return
autoCreateWallFunctionField
<
scalar,
RASModels::kQRWallFunctionFvPatchField<scalar>
>
(
fieldName,
mesh
);
}
@ -201,12 +193,16 @@ tmp<volSymmTensorField> autoCreateR
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<symmTensor>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<symmTensor>::typeName
);
return
autoCreateWallFunctionField
<
symmTensor,
RASModels::kQRWallFunctionFvPatchField<symmTensor>
>
(
fieldName,
mesh
);
}

View File

@ -46,15 +46,6 @@ namespace Foam
{
namespace incompressible
{
//- Replace old wall BCs with new wall function BCs
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
);
//- nut
tmp<volScalarField> autoCreateNut
(
@ -98,13 +89,12 @@ namespace incompressible
);
//- Helper function to create the new field
template<class Type>
template<class Type, class PatchType>
tmp<GeometricField<Type, fvPatchField, volMesh> >
autoCreateWallFunctionField
(
const word& fieldName,
const fvMesh& mesh,
const word& wallFunctionName
const fvMesh& mesh
);

View File

@ -27,6 +27,8 @@ License
#include "backwardsCompatibilityWallFunctions.H"
#include "Time.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -36,13 +38,12 @@ namespace incompressible
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
template<class Type, class PatchType>
tmp<GeometricField<Type, fvPatchField, volMesh> >
autoCreateWallFunctionField
(
const word& fieldName,
const fvMesh& mesh,
const word& wallFunctionName
const fvMesh& mesh
)
{
IOobject nutHeader
@ -97,16 +98,32 @@ autoCreateWallFunctionField
)
);
wordList fieldBoundaryTypes = replaceWallBoundaryTypes
(
mesh,
fieldOrig().boundaryField().types(),
wordList
(
fieldOrig().boundaryField().types().size(),
wallFunctionName
)
);
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
forAll(newPatchFields, patchI)
{
if (isType<wallPolyPatch>(mesh.boundaryMesh()[patchI]))
{
newPatchFields.set
(
patchI,
new PatchType
(
mesh.boundary()[patchI],
fieldOrig().dimensionedInternalField()
)
);
newPatchFields[patchI] == fieldOrig().boundaryField()[patchI];
}
else
{
newPatchFields.set
(
patchI,
fieldOrig().boundaryField()[patchI].clone()
);
}
}
tmp<fieldType> fieldNew
(
@ -122,18 +139,12 @@ autoCreateWallFunctionField
false
),
mesh,
dimensioned<Type>
(
"zero",
fieldOrig().dimensions(),
pTraits<Type>::zero
),
fieldBoundaryTypes
fieldOrig().dimensions(),
fieldOrig().internalField(),
newPatchFields
)
);
fieldNew() == fieldOrig();
Info<< " Writing backup of original " << fieldName << " to "
<< fieldName << ".old" << endl;
fieldOrig().rename(fieldName + ".old");