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 forces
wmake libso fieldAverage wmake libso fieldAverage
wmake libso foamCalcFunctions wmake libso foamCalcFunctions
wmake libso minMaxFields
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- 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 tmp<volScalarField> autoCreateMut
( (
const word& fieldName, const word& fieldName,
@ -93,20 +66,23 @@ tmp<volScalarField> autoCreateMut
Info<< "--> Upgrading " << fieldName << " to employ run-time " Info<< "--> Upgrading " << fieldName << " to employ run-time "
<< "selectable wall functions" << endl; << "selectable wall functions" << endl;
wordList mutBoundaryTypes = replaceWallBoundaryTypes const fvBoundaryMesh& bm = mesh.boundary();
(
mesh, wordList mutBoundaryTypes(bm.size());
wordList
( forAll(bm, patchI)
mesh.boundary().size(), {
calculatedFvPatchField<scalar>::typeName if (isType<wallFvPatch>(bm[patchI]))
), {
wordList mutBoundaryTypes[patchI] =
( RASModels::mutWallFunctionFvPatchScalarField::typeName;
mesh.boundary().size(), }
RASModels::mutWallFunctionFvPatchScalarField::typeName else
) {
); mutBoundaryTypes[patchI] =
calculatedFvPatchField<scalar>::typeName;
}
}
tmp<volScalarField> mut tmp<volScalarField> mut
( (
@ -141,12 +117,16 @@ tmp<volScalarField> autoCreateEpsilon
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<scalar> return
( autoCreateWallFunctionField
fieldName, <
mesh, scalar,
RASModels::epsilonWallFunctionFvPatchScalarField::typeName RASModels::epsilonWallFunctionFvPatchScalarField
); >
(
fieldName,
mesh
);
} }
@ -156,12 +136,16 @@ tmp<volScalarField> autoCreateOmega
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<scalar> return
( autoCreateWallFunctionField
fieldName, <
mesh, scalar,
RASModels::omegaWallFunctionFvPatchScalarField::typeName RASModels::omegaWallFunctionFvPatchScalarField
); >
(
fieldName,
mesh
);
} }
@ -171,12 +155,16 @@ tmp<volScalarField> autoCreateK
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<scalar> return
( autoCreateWallFunctionField
fieldName, <
mesh, scalar,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName RASModels::kQRWallFunctionFvPatchField<scalar>
); >
(
fieldName,
mesh
);
} }
@ -186,12 +174,16 @@ tmp<volScalarField> autoCreateQ
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<scalar> return
( autoCreateWallFunctionField
fieldName, <
mesh, scalar,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName RASModels::kQRWallFunctionFvPatchField<scalar>
); >
(
fieldName,
mesh
);
} }
@ -201,12 +193,16 @@ tmp<volSymmTensorField> autoCreateR
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<symmTensor> return
( autoCreateWallFunctionField
fieldName, <
mesh, symmTensor,
RASModels::kQRWallFunctionFvPatchField<symmTensor>::typeName RASModels::kQRWallFunctionFvPatchField<symmTensor>
); >
(
fieldName,
mesh
);
} }

View File

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

View File

@ -27,6 +27,8 @@ License
#include "backwardsCompatibilityWallFunctions.H" #include "backwardsCompatibilityWallFunctions.H"
#include "Time.H" #include "Time.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -36,13 +38,12 @@ namespace compressible
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type, class PatchType>
tmp<GeometricField<Type, fvPatchField, volMesh> > tmp<GeometricField<Type, fvPatchField, volMesh> >
autoCreateWallFunctionField autoCreateWallFunctionField
( (
const word& fieldName, const word& fieldName,
const fvMesh& mesh, const fvMesh& mesh
const word& wallFunctionName
) )
{ {
IOobject mutHeader IOobject mutHeader
@ -97,16 +98,32 @@ autoCreateWallFunctionField
) )
); );
wordList fieldBoundaryTypes = replaceWallBoundaryTypes PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
(
mesh, forAll(newPatchFields, patchI)
fieldOrig().boundaryField().types(), {
wordList if (isType<wallPolyPatch>(mesh.boundaryMesh()[patchI]))
( {
fieldOrig().boundaryField().types().size(), newPatchFields.set
wallFunctionName (
) patchI,
); new PatchType
(
mesh.boundary()[patchI],
fieldOrig().dimensionedInternalField()
)
);
newPatchFields[patchI] == fieldOrig().boundaryField()[patchI];
}
else
{
newPatchFields.set
(
patchI,
fieldOrig().boundaryField()[patchI].clone()
);
}
}
tmp<fieldType> fieldNew tmp<fieldType> fieldNew
( (
@ -122,18 +139,12 @@ autoCreateWallFunctionField
false false
), ),
mesh, mesh,
dimensioned<Type> fieldOrig().dimensions(),
( fieldOrig().internalField(),
"zero", newPatchFields
fieldOrig().dimensions(),
pTraits<Type>::zero
),
fieldBoundaryTypes
) )
); );
fieldNew() == fieldOrig();
Info<< " Writing backup of original " << fieldName << " to " Info<< " Writing backup of original " << fieldName << " to "
<< fieldName << ".old" << endl; << fieldName << ".old" << endl;
fieldOrig().rename(fieldName + ".old"); 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 tmp<volScalarField> autoCreateNut
( (
const word& fieldName, const word& fieldName,
@ -93,20 +66,23 @@ tmp<volScalarField> autoCreateNut
Info<< "--> Upgrading " << fieldName << " to employ run-time " Info<< "--> Upgrading " << fieldName << " to employ run-time "
<< "selectable wall functions" << endl; << "selectable wall functions" << endl;
wordList nutBoundaryTypes = replaceWallBoundaryTypes const fvBoundaryMesh& bm = mesh.boundary();
(
mesh, wordList nutBoundaryTypes(bm.size());
wordList
( forAll(bm, patchI)
mesh.boundary().size(), {
calculatedFvPatchField<scalar>::typeName if (isType<wallFvPatch>(bm[patchI]))
), {
wordList nutBoundaryTypes[patchI] =
( RASModels::nutWallFunctionFvPatchScalarField::typeName;
mesh.boundary().size(), }
RASModels::nutWallFunctionFvPatchScalarField::typeName else
) {
); nutBoundaryTypes[patchI] =
calculatedFvPatchField<scalar>::typeName;
}
}
tmp<volScalarField> nut tmp<volScalarField> nut
( (
@ -141,12 +117,16 @@ tmp<volScalarField> autoCreateEpsilon
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<scalar> return
( autoCreateWallFunctionField
fieldName, <
mesh, scalar,
RASModels::epsilonWallFunctionFvPatchScalarField::typeName RASModels::epsilonWallFunctionFvPatchScalarField
); >
(
fieldName,
mesh
);
} }
@ -156,12 +136,16 @@ tmp<volScalarField> autoCreateOmega
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<scalar> return
( autoCreateWallFunctionField
fieldName, <
mesh, scalar,
RASModels::omegaWallFunctionFvPatchScalarField::typeName RASModels::omegaWallFunctionFvPatchScalarField
); >
(
fieldName,
mesh
);
} }
@ -171,12 +155,16 @@ tmp<volScalarField> autoCreateK
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<scalar> return
( autoCreateWallFunctionField
fieldName, <
mesh, scalar,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName RASModels::kQRWallFunctionFvPatchField<scalar>
); >
(
fieldName,
mesh
);
} }
@ -186,12 +174,16 @@ tmp<volScalarField> autoCreateQ
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<scalar> return
( autoCreateWallFunctionField
fieldName, <
mesh, scalar,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName RASModels::kQRWallFunctionFvPatchField<scalar>
); >
(
fieldName,
mesh
);
} }
@ -201,12 +193,16 @@ tmp<volSymmTensorField> autoCreateR
const fvMesh& mesh const fvMesh& mesh
) )
{ {
return autoCreateWallFunctionField<symmTensor> return
( autoCreateWallFunctionField
fieldName, <
mesh, symmTensor,
RASModels::kQRWallFunctionFvPatchField<symmTensor>::typeName RASModels::kQRWallFunctionFvPatchField<symmTensor>
); >
(
fieldName,
mesh
);
} }

View File

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

View File

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