diff --git a/src/postProcessing/Allwmake b/src/postProcessing/Allwmake index f67ba57aa1..1d889e8b76 100755 --- a/src/postProcessing/Allwmake +++ b/src/postProcessing/Allwmake @@ -6,5 +6,6 @@ wmake libo postCalc wmake libso forces wmake libso fieldAverage wmake libso foamCalcFunctions +wmake libso minMaxFields # ----------------------------------------------------------------- end-of-file diff --git a/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C b/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C index 12cec378a2..a7c93d4ad6 100644 --- a/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C +++ b/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C @@ -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(bm[patchI])) - { - boundaryTypes[patchI] = newTypeNames[patchI]; - } - else - { - boundaryTypes[patchI] = oldTypeNames[patchI]; - } - } - - return boundaryTypes; -} - - tmp autoCreateMut ( const word& fieldName, @@ -93,20 +66,23 @@ tmp autoCreateMut Info<< "--> Upgrading " << fieldName << " to employ run-time " << "selectable wall functions" << endl; - wordList mutBoundaryTypes = replaceWallBoundaryTypes - ( - mesh, - wordList - ( - mesh.boundary().size(), - calculatedFvPatchField::typeName - ), - wordList - ( - mesh.boundary().size(), - RASModels::mutWallFunctionFvPatchScalarField::typeName - ) - ); + const fvBoundaryMesh& bm = mesh.boundary(); + + wordList mutBoundaryTypes(bm.size()); + + forAll(bm, patchI) + { + if (isType(bm[patchI])) + { + mutBoundaryTypes[patchI] = + RASModels::mutWallFunctionFvPatchScalarField::typeName; + } + else + { + mutBoundaryTypes[patchI] = + calculatedFvPatchField::typeName; + } + } tmp mut ( @@ -141,12 +117,16 @@ tmp autoCreateEpsilon const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::epsilonWallFunctionFvPatchScalarField::typeName - ); + return + autoCreateWallFunctionField + < + scalar, + RASModels::epsilonWallFunctionFvPatchScalarField + > + ( + fieldName, + mesh + ); } @@ -156,12 +136,16 @@ tmp autoCreateOmega const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::omegaWallFunctionFvPatchScalarField::typeName - ); + return + autoCreateWallFunctionField + < + scalar, + RASModels::omegaWallFunctionFvPatchScalarField + > + ( + fieldName, + mesh + ); } @@ -171,12 +155,16 @@ tmp autoCreateK const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::kQRWallFunctionFvPatchField::typeName - ); + return + autoCreateWallFunctionField + < + scalar, + RASModels::kQRWallFunctionFvPatchField + > + ( + fieldName, + mesh + ); } @@ -186,12 +174,16 @@ tmp autoCreateQ const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::kQRWallFunctionFvPatchField::typeName - ); + return + autoCreateWallFunctionField + < + scalar, + RASModels::kQRWallFunctionFvPatchField + > + ( + fieldName, + mesh + ); } @@ -201,12 +193,16 @@ tmp autoCreateR const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::kQRWallFunctionFvPatchField::typeName - ); + return + autoCreateWallFunctionField + < + symmTensor, + RASModels::kQRWallFunctionFvPatchField + > + ( + fieldName, + mesh + ); } diff --git a/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H b/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H index 6650b79832..a97b3090cd 100644 --- a/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H +++ b/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H @@ -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 autoCreateMut ( @@ -98,13 +89,12 @@ namespace compressible ); //- Helper function to create the new field - template + template tmp > autoCreateWallFunctionField ( const word& fieldName, - const fvMesh& mesh, - const word& wallFunctionName + const fvMesh& mesh ); diff --git a/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C b/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C index 0f93c40155..d6b489ffea 100644 --- a/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C +++ b/src/turbulenceModels/RAS/compressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C @@ -27,6 +27,8 @@ License #include "backwardsCompatibilityWallFunctions.H" #include "Time.H" +#include "wallPolyPatch.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -36,13 +38,12 @@ namespace compressible // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template +template tmp > 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 > newPatchFields(mesh.boundary().size()); + + forAll(newPatchFields, patchI) + { + if (isType(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 fieldNew ( @@ -122,18 +139,12 @@ autoCreateWallFunctionField false ), mesh, - dimensioned - ( - "zero", - fieldOrig().dimensions(), - pTraits::zero - ), - fieldBoundaryTypes + fieldOrig().dimensions(), + fieldOrig().internalField(), + newPatchFields ) ); - fieldNew() == fieldOrig(); - Info<< " Writing backup of original " << fieldName << " to " << fieldName << ".old" << endl; fieldOrig().rename(fieldName + ".old"); diff --git a/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C b/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C index fe4fa56179..4e8352414d 100644 --- a/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C +++ b/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C @@ -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(bm[patchI])) - { - boundaryTypes[patchI] = newTypeNames[patchI]; - } - else - { - boundaryTypes[patchI] = oldTypeNames[patchI]; - } - } - - return boundaryTypes; -} - - tmp autoCreateNut ( const word& fieldName, @@ -93,20 +66,23 @@ tmp autoCreateNut Info<< "--> Upgrading " << fieldName << " to employ run-time " << "selectable wall functions" << endl; - wordList nutBoundaryTypes = replaceWallBoundaryTypes - ( - mesh, - wordList - ( - mesh.boundary().size(), - calculatedFvPatchField::typeName - ), - wordList - ( - mesh.boundary().size(), - RASModels::nutWallFunctionFvPatchScalarField::typeName - ) - ); + const fvBoundaryMesh& bm = mesh.boundary(); + + wordList nutBoundaryTypes(bm.size()); + + forAll(bm, patchI) + { + if (isType(bm[patchI])) + { + nutBoundaryTypes[patchI] = + RASModels::nutWallFunctionFvPatchScalarField::typeName; + } + else + { + nutBoundaryTypes[patchI] = + calculatedFvPatchField::typeName; + } + } tmp nut ( @@ -141,12 +117,16 @@ tmp autoCreateEpsilon const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::epsilonWallFunctionFvPatchScalarField::typeName - ); + return + autoCreateWallFunctionField + < + scalar, + RASModels::epsilonWallFunctionFvPatchScalarField + > + ( + fieldName, + mesh + ); } @@ -156,12 +136,16 @@ tmp autoCreateOmega const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::omegaWallFunctionFvPatchScalarField::typeName - ); + return + autoCreateWallFunctionField + < + scalar, + RASModels::omegaWallFunctionFvPatchScalarField + > + ( + fieldName, + mesh + ); } @@ -171,12 +155,16 @@ tmp autoCreateK const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::kQRWallFunctionFvPatchField::typeName - ); + return + autoCreateWallFunctionField + < + scalar, + RASModels::kQRWallFunctionFvPatchField + > + ( + fieldName, + mesh + ); } @@ -186,12 +174,16 @@ tmp autoCreateQ const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::kQRWallFunctionFvPatchField::typeName - ); + return + autoCreateWallFunctionField + < + scalar, + RASModels::kQRWallFunctionFvPatchField + > + ( + fieldName, + mesh + ); } @@ -201,12 +193,16 @@ tmp autoCreateR const fvMesh& mesh ) { - return autoCreateWallFunctionField - ( - fieldName, - mesh, - RASModels::kQRWallFunctionFvPatchField::typeName - ); + return + autoCreateWallFunctionField + < + symmTensor, + RASModels::kQRWallFunctionFvPatchField + > + ( + fieldName, + mesh + ); } diff --git a/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H b/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H index 73c60014e0..28ba065214 100644 --- a/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H +++ b/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H @@ -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 autoCreateNut ( @@ -98,13 +89,12 @@ namespace incompressible ); //- Helper function to create the new field - template + template tmp > autoCreateWallFunctionField ( const word& fieldName, - const fvMesh& mesh, - const word& wallFunctionName + const fvMesh& mesh ); diff --git a/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C b/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C index 8f3b2889c8..9b6850bc94 100644 --- a/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C +++ b/src/turbulenceModels/RAS/incompressible/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C @@ -27,6 +27,8 @@ License #include "backwardsCompatibilityWallFunctions.H" #include "Time.H" +#include "wallPolyPatch.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -36,13 +38,12 @@ namespace incompressible // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template +template tmp > 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 > newPatchFields(mesh.boundary().size()); + + forAll(newPatchFields, patchI) + { + if (isType(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 fieldNew ( @@ -122,18 +139,12 @@ autoCreateWallFunctionField false ), mesh, - dimensioned - ( - "zero", - fieldOrig().dimensions(), - pTraits::zero - ), - fieldBoundaryTypes + fieldOrig().dimensions(), + fieldOrig().internalField(), + newPatchFields ) ); - fieldNew() == fieldOrig(); - Info<< " Writing backup of original " << fieldName << " to " << fieldName << ".old" << endl; fieldOrig().rename(fieldName + ".old");