From 456a74c9f6641a498ab8cf0e077835be4f049f20 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 5 Apr 2013 17:21:58 +0100 Subject: [PATCH 01/59] Incompressible heatTransfer: Rename kappa->alpha and move turbulentHeatFluxTemperature BC to turbulence base class --- .../heatTransfer/buoyantBoussinesqPimpleFoam/TEqn.H | 8 ++++---- .../buoyantBoussinesqPimpleFoam/createFields.H | 7 +++---- .../heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H | 8 ++++---- .../buoyantBoussinesqSimpleFoam/createFields.H | 6 +++--- .../chtMultiRegionFoam/solid/setRegionSolidFields.H | 6 +++--- .../turbulentHeatFluxTemperatureFvPatchScalarField.C | 2 -- src/turbulenceModels/incompressible/RAS/Make/files | 1 - .../incompressible/turbulenceModel/Make/files | 1 + .../turbulentHeatFluxTemperatureFvPatchScalarField.C | 2 -- .../turbulentHeatFluxTemperatureFvPatchScalarField.H | 2 +- 10 files changed, 19 insertions(+), 24 deletions(-) rename src/turbulenceModels/incompressible/{RAS => turbulenceModel}/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C (99%) rename src/turbulenceModels/incompressible/{RAS => turbulenceModel}/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H (99%) diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/TEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/TEqn.H index 708d968d6c..65c92dab51 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/TEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/TEqn.H @@ -1,14 +1,14 @@ { - kappat = turbulence->nut()/Prt; - kappat.correctBoundaryConditions(); + alphat = turbulence->nut()/Prt; + alphat.correctBoundaryConditions(); - volScalarField kappaEff("kappaEff", turbulence->nu()/Pr + kappat); + volScalarField alphaEff("alphaEff", turbulence->nu()/Pr + alphat); fvScalarMatrix TEqn ( fvm::ddt(T) + fvm::div(phi, T) - - fvm::laplacian(kappaEff, T) + - fvm::laplacian(alphaEff, T) == radiation->ST(rhoCpRef, T) ); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H index 342af079d8..3609fe66fa 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H @@ -65,12 +65,12 @@ ); // kinematic turbulent thermal thermal conductivity m2/s - Info<< "Reading field kappat\n" << endl; - volScalarField kappat + Info<< "Reading field alphat\n" << endl; + volScalarField alphat ( IOobject ( - "kappat", + "alphat", runTime.timeName(), mesh, IOobject::MUST_READ, @@ -116,4 +116,3 @@ pRefValue - getRefCellValue(p, pRefCell) ); } - diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H index 76adf004cb..a0c5d24b2b 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H @@ -1,13 +1,13 @@ { - kappat = turbulence->nut()/Prt; - kappat.correctBoundaryConditions(); + alphat = turbulence->nut()/Prt; + alphat.correctBoundaryConditions(); - volScalarField kappaEff("kappaEff", turbulence->nu()/Pr + kappat); + volScalarField alphaEff("alphaEff", turbulence->nu()/Pr + alphat); fvScalarMatrix TEqn ( fvm::div(phi, T) - - fvm::laplacian(kappaEff, T) + - fvm::laplacian(alphaEff, T) ); TEqn.relax(); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H index 477a322833..6d7fd8d823 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H @@ -65,12 +65,12 @@ ); // kinematic turbulent thermal thermal conductivity m2/s - Info<< "Reading field kappat\n" << endl; - volScalarField kappat + Info<< "Reading field alphat\n" << endl; + volScalarField alphat ( IOobject ( - "kappat", + "alphat", runTime.timeName(), mesh, IOobject::MUST_READ, diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H index a36fa7e98f..37eea84e92 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H @@ -12,7 +12,7 @@ if (!thermo.isotropic()) { - tmp tkappaCp = thermo.Kappa()/cp; + tmp tkappaByCp = thermo.Kappa()/cp; const coordinateSystem& coodSys = coordinates[i]; tAnialpha = @@ -29,13 +29,13 @@ IOobject::NO_WRITE ), mesh, - tkappaCp().dimensions(), + tkappaByCp().dimensions(), zeroGradientFvPatchVectorField::typeName ) ); volSymmTensorField& Anialpha = tAnialpha(); - Anialpha.internalField() = coodSys.R().transformVector(tkappaCp()); + Anialpha.internalField() = coodSys.R().transformVector(tkappaByCp()); Anialpha.correctBoundaryConditions(); } diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index fbae992c25..d22a75d980 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -45,7 +45,6 @@ namespace Foam "power", "flux" }; - } @@ -254,4 +253,3 @@ makePatchTypeField // ************************************************************************* // - diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index 9ad68d8c76..6fe1b3e3e7 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -56,7 +56,6 @@ v2WallFunctions = $(wallFunctions)/v2WallFunctions $(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C /* Patch fields */ -derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C diff --git a/src/turbulenceModels/incompressible/turbulenceModel/Make/files b/src/turbulenceModels/incompressible/turbulenceModel/Make/files index a77efed2ab..a44faf2238 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/Make/files +++ b/src/turbulenceModels/incompressible/turbulenceModel/Make/files @@ -1,4 +1,5 @@ turbulenceModel.C laminar/laminar.C +derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C LIB = $(FOAM_LIBBIN)/libincompressibleTurbulenceModel diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C similarity index 99% rename from src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C rename to src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index 52d39a366f..88ea21538b 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -245,6 +245,4 @@ makePatchTypeField } // End namespace incompressible } // End namespace Foam - // ************************************************************************* // - diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H similarity index 99% rename from src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H rename to src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H index 59b8106d15..68b6b2c08b 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H @@ -57,7 +57,7 @@ Note - it is assumed that the units of \c alphaEff are [kg/m/s] - the specific heat capcaity is read from the transport dictionary entry \c Cp0 - + SourceFiles turbulentHeatFluxTemperatureFvPatchScalarField.C From 7768c142e454a9e2ad5b7dcd28cb00562dad4a86 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 5 Apr 2013 17:22:31 +0100 Subject: [PATCH 02/59] Update Headers --- .../turbulentHeatFluxTemperatureFvPatchScalarField.C | 2 +- .../turbulentHeatFluxTemperatureFvPatchScalarField.C | 2 +- .../turbulentHeatFluxTemperatureFvPatchScalarField.H | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index d22a75d980..5ee38ffba1 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index 88ea21538b..9637f140eb 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H index 68b6b2c08b..3a7e1d849e 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From 0d1dde0deacd6d0ea48235d01449e34c0e241360 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 5 Apr 2013 17:33:30 +0100 Subject: [PATCH 03/59] tutorials/heatTransfer: update incompressible tutorials for kappa->alpha --- .../buoyantBoussinesqPimpleFoam/hotRoom/0/kappat | 8 ++++---- .../buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes | 2 +- .../buoyantBoussinesqSimpleFoam/hotRoom/0/kappat | 8 ++++---- .../buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes | 2 +- .../buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat | 4 ++-- .../iglooWithFridges/system/fvSchemes | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/kappat b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/kappat index ed10b70f1b..d743d3dfbb 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/kappat +++ b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/kappat @@ -11,7 +11,7 @@ FoamFile format ascii; class volScalarField; location "0"; - object kappat; + object alphat; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -23,19 +23,19 @@ boundaryField { floor { - type kappatJayatillekeWallFunction; + type alphatJayatillekeWallFunction; Prt 0.85; value uniform 0; } ceiling { - type kappatJayatillekeWallFunction; + type alphatJayatillekeWallFunction; Prt 0.85; value uniform 0; } fixedWalls { - type kappatJayatillekeWallFunction; + type alphatJayatillekeWallFunction; Prt 0.85; value uniform 0; } diff --git a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes index b7ff9739c1..4a18c080d1 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes @@ -42,7 +42,7 @@ laplacianSchemes default none; laplacian(nuEff,U) Gauss linear uncorrected; laplacian(Dp,p_rgh) Gauss linear uncorrected; - laplacian(kappaEff,T) Gauss linear uncorrected; + laplacian(alphaEff,T) Gauss linear uncorrected; laplacian(DkEff,k) Gauss linear uncorrected; laplacian(DepsilonEff,epsilon) Gauss linear uncorrected; laplacian(DREff,R) Gauss linear uncorrected; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/kappat b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/kappat index ed10b70f1b..d743d3dfbb 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/kappat +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/kappat @@ -11,7 +11,7 @@ FoamFile format ascii; class volScalarField; location "0"; - object kappat; + object alphat; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -23,19 +23,19 @@ boundaryField { floor { - type kappatJayatillekeWallFunction; + type alphatJayatillekeWallFunction; Prt 0.85; value uniform 0; } ceiling { - type kappatJayatillekeWallFunction; + type alphatJayatillekeWallFunction; Prt 0.85; value uniform 0; } fixedWalls { - type kappatJayatillekeWallFunction; + type alphatJayatillekeWallFunction; Prt 0.85; value uniform 0; } diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes index 4db877838c..44dc6e2a70 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes @@ -40,7 +40,7 @@ laplacianSchemes default none; laplacian(nuEff,U) Gauss linear corrected; laplacian(Dp,p_rgh) Gauss linear corrected; - laplacian(kappaEff,T) Gauss linear corrected; + laplacian(alphaEff,T) Gauss linear corrected; laplacian(DkEff,k) Gauss linear corrected; laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DREff,R) Gauss linear corrected; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat index 44f2524e7f..653366fac4 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat @@ -11,7 +11,7 @@ FoamFile format ascii; class volScalarField; location "0"; - object kappat; + object alphat; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -26,7 +26,7 @@ boundaryField wall { - type kappatJayatillekeWallFunction; + type alphatJayatillekeWallFunction; Prt 0.85; value uniform 0; } diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes index 52d63773c0..3d626150a0 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes @@ -42,7 +42,7 @@ laplacianSchemes default none; laplacian(nuEff,U) Gauss linear limited corrected 0.333; laplacian(Dp,p_rgh) Gauss linear limited corrected 0.333; - laplacian(kappaEff,T) Gauss linear limited corrected 0.333; + laplacian(alphaEff,T) Gauss linear limited corrected 0.333; laplacian(DkEff,k) Gauss linear limited corrected 0.333; laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.333; laplacian(DREff,R) Gauss linear limited corrected 0.333; From 2c4d3a79c9189706ebb99c21678be3b0ba5434d0 Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 6 Apr 2013 16:29:43 +0100 Subject: [PATCH 04/59] Completed rename kappat->alphat for incompressible heat transfer --- .../incompressible/RAS/Make/files | 4 +- ...yatillekeWallFunctionFvPatchScalarField.C} | 54 +++++++++---------- ...yatillekeWallFunctionFvPatchScalarField.H} | 38 ++++++------- .../hotRoom/0/alphat | 11 ++-- .../hotRoom/0/kappat | 45 ---------------- .../hotRoom/0/alphat | 11 ++-- .../hotRoom/0/kappat | 45 ---------------- .../iglooWithFridges/0/{kappat => alphat} | 0 8 files changed, 62 insertions(+), 146 deletions(-) rename src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/{kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C => alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C} (80%) rename src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/{kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H => alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H} (81%) delete mode 100644 tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/kappat delete mode 100644 tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/kappat rename tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/{kappat => alphat} (100%) diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index 6fe1b3e3e7..1f248358c7 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -49,8 +49,8 @@ kqRWallFunctions = $(wallFunctions)/kqRWallFunctions $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C $(kqRWallFunctions)/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C -kappatWallFunctions = $(wallFunctions)/kappatWallFunctions -$(kappatWallFunctions)/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C +alphatWallFunctions = $(wallFunctions)/alphatWallFunctions +$(alphatWallFunctions)/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C v2WallFunctions = $(wallFunctions)/v2WallFunctions $(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C similarity index 80% rename from src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C rename to src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index ac3855632a..eed678e279 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "kappatJayatillekeWallFunctionFvPatchScalarField.H" +#include "alphatJayatillekeWallFunctionFvPatchScalarField.H" #include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" @@ -39,18 +39,18 @@ namespace incompressible // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -scalar kappatJayatillekeWallFunctionFvPatchScalarField::tolerance_ = 0.01; -label kappatJayatillekeWallFunctionFvPatchScalarField::maxIters_ = 10; +scalar alphatJayatillekeWallFunctionFvPatchScalarField::tolerance_ = 0.01; +label alphatJayatillekeWallFunctionFvPatchScalarField::maxIters_ = 10; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void kappatJayatillekeWallFunctionFvPatchScalarField::checkType() +void alphatJayatillekeWallFunctionFvPatchScalarField::checkType() { if (!isA(patch())) { FatalErrorIn ( - "kappatJayatillekeWallFunctionFvPatchScalarField::checkType()" + "alphatJayatillekeWallFunctionFvPatchScalarField::checkType()" ) << "Invalid wall function specification" << nl << " Patch type for patch " << patch().name() << " must be wall" << nl @@ -60,7 +60,7 @@ void kappatJayatillekeWallFunctionFvPatchScalarField::checkType() } -scalar kappatJayatillekeWallFunctionFvPatchScalarField::Psmooth +scalar alphatJayatillekeWallFunctionFvPatchScalarField::Psmooth ( const scalar Prat ) const @@ -69,7 +69,7 @@ scalar kappatJayatillekeWallFunctionFvPatchScalarField::Psmooth } -scalar kappatJayatillekeWallFunctionFvPatchScalarField::yPlusTherm +scalar alphatJayatillekeWallFunctionFvPatchScalarField::yPlusTherm ( const scalar P, const scalar Prat @@ -103,8 +103,8 @@ scalar kappatJayatillekeWallFunctionFvPatchScalarField::yPlusTherm // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -kappatJayatillekeWallFunctionFvPatchScalarField:: -kappatJayatillekeWallFunctionFvPatchScalarField +alphatJayatillekeWallFunctionFvPatchScalarField:: +alphatJayatillekeWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF @@ -120,10 +120,10 @@ kappatJayatillekeWallFunctionFvPatchScalarField } -kappatJayatillekeWallFunctionFvPatchScalarField:: -kappatJayatillekeWallFunctionFvPatchScalarField +alphatJayatillekeWallFunctionFvPatchScalarField:: +alphatJayatillekeWallFunctionFvPatchScalarField ( - const kappatJayatillekeWallFunctionFvPatchScalarField& ptf, + const alphatJayatillekeWallFunctionFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper @@ -139,8 +139,8 @@ kappatJayatillekeWallFunctionFvPatchScalarField } -kappatJayatillekeWallFunctionFvPatchScalarField:: -kappatJayatillekeWallFunctionFvPatchScalarField +alphatJayatillekeWallFunctionFvPatchScalarField:: +alphatJayatillekeWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -157,10 +157,10 @@ kappatJayatillekeWallFunctionFvPatchScalarField } -kappatJayatillekeWallFunctionFvPatchScalarField:: -kappatJayatillekeWallFunctionFvPatchScalarField +alphatJayatillekeWallFunctionFvPatchScalarField:: +alphatJayatillekeWallFunctionFvPatchScalarField ( - const kappatJayatillekeWallFunctionFvPatchScalarField& wfpsf + const alphatJayatillekeWallFunctionFvPatchScalarField& wfpsf ) : fixedValueFvPatchScalarField(wfpsf), @@ -173,10 +173,10 @@ kappatJayatillekeWallFunctionFvPatchScalarField } -kappatJayatillekeWallFunctionFvPatchScalarField:: -kappatJayatillekeWallFunctionFvPatchScalarField +alphatJayatillekeWallFunctionFvPatchScalarField:: +alphatJayatillekeWallFunctionFvPatchScalarField ( - const kappatJayatillekeWallFunctionFvPatchScalarField& wfpsf, + const alphatJayatillekeWallFunctionFvPatchScalarField& wfpsf, const DimensionedField& iF ) : @@ -192,7 +192,7 @@ kappatJayatillekeWallFunctionFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void kappatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() +void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -217,8 +217,8 @@ void kappatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() Pr(dimensionedScalar(turbModel.transport().lookup("Pr")).value()); // Populate boundary values - scalarField& kappatw = *this; - forAll(kappatw, faceI) + scalarField& alphatw = *this; + forAll(alphatw, faceI) { label faceCellI = patch().faceCells()[faceI]; @@ -237,11 +237,11 @@ void kappatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() { scalar nu = nuw[faceI]; scalar kt = nu*(yPlus/(Prt_*(log(E_*yPlus)/kappa_ + P)) - 1/Pr); - kappatw[faceI] = max(0.0, kt); + alphatw[faceI] = max(0.0, kt); } else { - kappatw[faceI] = 0.0; + alphatw[faceI] = 0.0; } } @@ -249,7 +249,7 @@ void kappatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() } -void kappatJayatillekeWallFunctionFvPatchScalarField::write(Ostream& os) const +void alphatJayatillekeWallFunctionFvPatchScalarField::write(Ostream& os) const { fvPatchField::write(os); os.writeKeyword("Prt") << Prt_ << token::END_STATEMENT << nl; @@ -265,7 +265,7 @@ void kappatJayatillekeWallFunctionFvPatchScalarField::write(Ostream& os) const makePatchTypeField ( fvPatchScalarField, - kappatJayatillekeWallFunctionFvPatchScalarField + alphatJayatillekeWallFunctionFvPatchScalarField ); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H similarity index 81% rename from src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H rename to src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H index 6f2beff440..f4064c4efa 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::incompressible::kappatJayatillekeWallFunctionFvPatchScalarField + Foam::incompressible::alphatJayatillekeWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -45,7 +45,7 @@ Description \verbatim myPatch { - type kappatJayatillekeWallFunction; + type alphatJayatillekeWallFunction; } \endverbatim @@ -56,12 +56,12 @@ SeeAlso Foam::fixedValueFvPatchField SourceFiles - kappatJayatillekeWallFunctionFvPatchScalarField.C + alphatJayatillekeWallFunctionFvPatchScalarField.C \*---------------------------------------------------------------------------*/ -#ifndef kappatJayatillekeWallFunctionFvPatchScalarField_H -#define kappatJayatillekeWallFunctionFvPatchScalarField_H +#ifndef alphatJayatillekeWallFunctionFvPatchScalarField_H +#define alphatJayatillekeWallFunctionFvPatchScalarField_H #include "fixedValueFvPatchFields.H" @@ -73,10 +73,10 @@ namespace incompressible { /*---------------------------------------------------------------------------*\ - Class kappatJayatillekeWallFunctionFvPatchScalarField Declaration + Class alphatJayatillekeWallFunctionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ -class kappatJayatillekeWallFunctionFvPatchScalarField +class alphatJayatillekeWallFunctionFvPatchScalarField : public fixedValueFvPatchScalarField { @@ -122,20 +122,20 @@ protected: public: //- Runtime type information - TypeName("kappatJayatillekeWallFunction"); + TypeName("alphatJayatillekeWallFunction"); // Constructors //- Construct from patch and internal field - kappatJayatillekeWallFunctionFvPatchScalarField + alphatJayatillekeWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField& ); //- Construct from patch, internal field and dictionary - kappatJayatillekeWallFunctionFvPatchScalarField + alphatJayatillekeWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField&, @@ -143,20 +143,20 @@ public: ); //- Construct by mapping given - // kappatJayatillekeWallFunctionFvPatchScalarField + // alphatJayatillekeWallFunctionFvPatchScalarField // onto a new patch - kappatJayatillekeWallFunctionFvPatchScalarField + alphatJayatillekeWallFunctionFvPatchScalarField ( - const kappatJayatillekeWallFunctionFvPatchScalarField&, + const alphatJayatillekeWallFunctionFvPatchScalarField&, const fvPatch&, const DimensionedField&, const fvPatchFieldMapper& ); //- Construct as copy - kappatJayatillekeWallFunctionFvPatchScalarField + alphatJayatillekeWallFunctionFvPatchScalarField ( - const kappatJayatillekeWallFunctionFvPatchScalarField& + const alphatJayatillekeWallFunctionFvPatchScalarField& ); //- Construct and return a clone @@ -164,14 +164,14 @@ public: { return tmp ( - new kappatJayatillekeWallFunctionFvPatchScalarField(*this) + new alphatJayatillekeWallFunctionFvPatchScalarField(*this) ); } //- Construct as copy setting internal field reference - kappatJayatillekeWallFunctionFvPatchScalarField + alphatJayatillekeWallFunctionFvPatchScalarField ( - const kappatJayatillekeWallFunctionFvPatchScalarField&, + const alphatJayatillekeWallFunctionFvPatchScalarField&, const DimensionedField& ); @@ -183,7 +183,7 @@ public: { return tmp ( - new kappatJayatillekeWallFunctionFvPatchScalarField(*this, iF) + new alphatJayatillekeWallFunctionFvPatchScalarField(*this, iF) ); } diff --git a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/alphat b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/alphat index 55b5477236..d743d3dfbb 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/alphat +++ b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/alphat @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [1 -1 -1 0 0 0 0]; +dimensions [0 2 -1 0 0 0 0]; internalField uniform 0; @@ -23,17 +23,20 @@ boundaryField { floor { - type alphatWallFunction; + type alphatJayatillekeWallFunction; + Prt 0.85; value uniform 0; } ceiling { - type alphatWallFunction; + type alphatJayatillekeWallFunction; + Prt 0.85; value uniform 0; } fixedWalls { - type alphatWallFunction; + type alphatJayatillekeWallFunction; + Prt 0.85; value uniform 0; } } diff --git a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/kappat b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/kappat deleted file mode 100644 index d743d3dfbb..0000000000 --- a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/0/kappat +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object alphat; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -1 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ - floor - { - type alphatJayatillekeWallFunction; - Prt 0.85; - value uniform 0; - } - ceiling - { - type alphatJayatillekeWallFunction; - Prt 0.85; - value uniform 0; - } - fixedWalls - { - type alphatJayatillekeWallFunction; - Prt 0.85; - value uniform 0; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/alphat b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/alphat index 55b5477236..d743d3dfbb 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/alphat +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/alphat @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [1 -1 -1 0 0 0 0]; +dimensions [0 2 -1 0 0 0 0]; internalField uniform 0; @@ -23,17 +23,20 @@ boundaryField { floor { - type alphatWallFunction; + type alphatJayatillekeWallFunction; + Prt 0.85; value uniform 0; } ceiling { - type alphatWallFunction; + type alphatJayatillekeWallFunction; + Prt 0.85; value uniform 0; } fixedWalls { - type alphatWallFunction; + type alphatJayatillekeWallFunction; + Prt 0.85; value uniform 0; } } diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/kappat b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/kappat deleted file mode 100644 index d743d3dfbb..0000000000 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/kappat +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object alphat; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -1 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ - floor - { - type alphatJayatillekeWallFunction; - Prt 0.85; - value uniform 0; - } - ceiling - { - type alphatJayatillekeWallFunction; - Prt 0.85; - value uniform 0; - } - fixedWalls - { - type alphatJayatillekeWallFunction; - Prt 0.85; - value uniform 0; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/alphat similarity index 100% rename from tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat rename to tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/alphat From d81d35bbc03a520a3eb869e4694d3d00cdc9c154 Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 6 Apr 2013 16:29:53 +0100 Subject: [PATCH 05/59] Updated header --- .../alphatJayatillekeWallFunctionFvPatchScalarField.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index eed678e279..b09127c39b 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From 4ceb548dff5f1fddbbca8f69f6746154be99251a Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 8 Apr 2013 15:30:54 +0100 Subject: [PATCH 06/59] ENH: wordRe - made conversion to word an explicit constructor --- src/OpenFOAM/primitives/strings/wordRe/wordRe.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H index 587e67108c..e45044c997 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -123,7 +123,7 @@ public: inline wordRe(const keyType&, const compOption=LITERAL); //- Construct as copy of word - inline wordRe(const word&); + inline explicit wordRe(const word&); //- Construct as copy of character array // Optionally specify how it should be treated. From b1aae691416a5a25cd805c1edf9c229334c00f94 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 8 Apr 2013 15:31:45 +0100 Subject: [PATCH 07/59] ENH: Updated wordRe handling in IOobjectList and objectRegistry --- src/OpenFOAM/db/IOobjectList/IOobjectList.C | 25 +++++++- src/OpenFOAM/db/IOobjectList/IOobjectList.H | 6 +- .../db/objectRegistry/objectRegistry.H | 13 ++-- .../objectRegistry/objectRegistryTemplates.C | 61 +++++++++++-------- 4 files changed, 73 insertions(+), 32 deletions(-) diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.C b/src/OpenFOAM/db/IOobjectList/IOobjectList.C index 128de963c7..4c15c59ebd 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.C +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.C @@ -148,7 +148,7 @@ Foam::IOobject* Foam::IOobjectList::lookup(const word& name) const } -Foam::IOobjectList Foam::IOobjectList::lookupRe(const wordRe& name) const +Foam::IOobjectList Foam::IOobjectList::lookup(const wordRe& name) const { IOobjectList objectsOfName(size()); @@ -169,6 +169,29 @@ Foam::IOobjectList Foam::IOobjectList::lookupRe(const wordRe& name) const } +Foam::IOobjectList Foam::IOobjectList::lookup(const wordReList& patterns) const +{ + wordReListMatcher names(patterns); + + IOobjectList objectsOfName(size()); + + forAllConstIter(HashPtrTable, *this, iter) + { + if (names.match(iter()->name())) + { + if (IOobject::debug) + { + Info<< "IOobjectList::lookupRe : found " << iter.key() << endl; + } + + objectsOfName.insert(iter.key(), new IOobject(*iter())); + } + } + + return objectsOfName; +} + + Foam::IOobjectList Foam::IOobjectList::lookupClass(const word& ClassName) const { IOobjectList objectsOfClass(size()); diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.H b/src/OpenFOAM/db/IOobjectList/IOobjectList.H index 945042b728..76edfe4f67 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.H +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.H @@ -37,6 +37,7 @@ SourceFiles #include "HashPtrTable.H" #include "IOobject.H" +#include "wordReList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -92,7 +93,10 @@ public: IOobject* lookup(const word& name) const; //- Return the list for all IOobects whose name matches name - IOobjectList lookupRe(const wordRe& name) const; + IOobjectList lookup(const wordRe& name) const; + + //- Return the list for all IOobects whose name matches name + IOobjectList lookup(const wordReList& patterns) const; //- Return the list for all IOobjects of a given class IOobjectList lookupClass(const word& className) const; diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index 535dffe3bd..babb8a5890 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -37,6 +37,7 @@ SourceFiles #include "HashTable.H" #include "regIOobject.H" +#include "wordReList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -147,6 +148,14 @@ public: template wordList names() const; + //- Return the list of objects whose name matches the input regExp + template + wordList names(const wordRe& name) const; + + //- Return the list of objects whose name matches the input regExp + template + wordList names(const wordReList& name) const; + //- Lookup and return a const sub-objectRegistry. Optionally create // it if it does not exist. const objectRegistry& subRegistry @@ -163,10 +172,6 @@ public: template HashTable lookupClass(const bool strict = false); - //- Return the list of objects whose name matches the input regExp - template - wordList foundObjectRe(const wordRe& name) const; - //- Is the named Type found? template bool foundObject(const word& name) const; diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C index 1b3e9ef701..b5b555485f 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "objectRegistry.H" - +#include "stringListOps.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -48,6 +48,40 @@ Foam::wordList Foam::objectRegistry::names() const } +template +Foam::wordList Foam::objectRegistry::names(const wordRe& name) const +{ + wordList objectNames(size()); + + label count = 0; + forAllConstIter(HashTable, *this, iter) + { + if (isA(*iter())) + { + const word& objectName = iter()->name(); + + if (name.match(objectName)) + { + objectNames[count++] = objectName; + } + } + } + + objectNames.setSize(count); + + return objectNames; +} + + +template +Foam::wordList Foam::objectRegistry::names(const wordReList& patterns) const +{ + wordList names(this->names()); + + return wordList(names, findStrings(patterns, names)); +} + + template Foam::HashTable Foam::objectRegistry::lookupClass ( @@ -127,31 +161,6 @@ bool Foam::objectRegistry::foundObject(const word& name) const } -template -Foam::wordList Foam::objectRegistry::foundObjectRe(const wordRe& name) const -{ - wordList objectNames(size()); - - label count = 0; - forAllConstIter(HashTable, *this, iter) - { - if (isA(*iter())) - { - const word& objectName = iter()->name(); - - if (name.match(objectName)) - { - objectNames[count++] = objectName; - } - } - } - - objectNames.setSize(count); - - return objectNames; -} - - template const Type& Foam::objectRegistry::lookupObject(const word& name) const { From 347c5dabe9ffcfd6854a9511640264676319a6be Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 8 Apr 2013 15:32:16 +0100 Subject: [PATCH 08/59] BUG: should use wordRe, not word --- .../meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index c17e54be53..7be8181211 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -737,7 +737,7 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet forAll(patchNames, i) { - const word& patchName = patchNames[i]; + const wordRe& patchName = patchNames[i]; // Treat the given patch names as wild-cards and search the set // of all patch names for matches From 34ac08a93113da3fe9a15a5855cd59741824500b Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 8 Apr 2013 15:33:02 +0100 Subject: [PATCH 09/59] ENH: Code updates following changed to IOobjectList --- .../decomposePar/decomposePar.C | 4 ++-- .../reconstructPar/reconstructPar.C | 6 ++---- .../foamToEnsight/foamToEnsight.C | 16 ++++++++-------- .../foamToEnsightParts/foamToEnsightParts.C | 19 ++++++++++--------- .../dataConversion/foamToVTK/foamToVTK.C | 6 +++--- .../vtkPV398Foam/vtkPV398FoamMeshLagrangian.C | 2 +- .../vtkPV3Foam/vtkPV3FoamMeshLagrangian.C | 4 ++-- .../preProcessing/mapFields/mapLagrangian.C | 4 ++-- 8 files changed, 30 insertions(+), 31 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 257c31df53..6fb8e69b96 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -539,7 +539,7 @@ int main(int argc, char *argv[]) cloud::prefix/cloudDirs[i] ); - IOobject* positionsPtr = sprayObjs.lookup("positions"); + IOobject* positionsPtr = sprayObjs.lookup(word("positions")); if (positionsPtr) { diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index c774d5012c..c4a15f97b6 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -529,10 +529,8 @@ int main(int argc, char *argv[]) cloud::prefix/cloudDirs[i] ); - IOobject* positionsPtr = sprayObjs.lookup - ( - "positions" - ); + IOobject* positionsPtr = + sprayObjs.lookup(word("positions")); if (positionsPtr) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index 53ee48b894..edb29d3998 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -98,7 +98,7 @@ bool inFileNameList int main(int argc, char *argv[]) { timeSelector::addOptions(); -# include "addRegionOption.H" + #include "addRegionOption.H" argList::addBoolOption ( @@ -129,17 +129,17 @@ int main(int argc, char *argv[]) "specify faceZones to write - eg '( slice \"mfp-.*\" )'." ); -# include "setRootCase.H" + #include "setRootCase.H" // Check options const bool binary = !args.optionFound("ascii"); const bool nodeValues = args.optionFound("nodeValues"); -# include "createTime.H" + #include "createTime.H" instantList Times = timeSelector::select0(runTime, args); -# include "createNamedMesh.H" + #include "createNamedMesh.H" // Mesh instance (region0 gets filtered out) fileName regionPrefix = ""; @@ -228,7 +228,7 @@ int main(int argc, char *argv[]) IOobjectList objects(mesh, runTime.timeName()); -# include "checkMeshMoving.H" + #include "checkMeshMoving.H" if (meshMoving) { @@ -275,7 +275,7 @@ int main(int argc, char *argv[]) cloud::prefix/cloudDirs[cloudI] ); - IOobject* positionsPtr = cloudObjs.lookup("positions"); + IOobject* positionsPtr = cloudObjs.lookup(word("positions")); if (positionsPtr) { @@ -388,7 +388,7 @@ int main(int argc, char *argv[]) { const word& fieldName = fieldNames[j]; -# include "checkData.H" + #include "checkData.H" if (!variableGood) { @@ -551,7 +551,7 @@ int main(int argc, char *argv[]) } } -# include "ensightCaseTail.H" + #include "ensightCaseTail.H" if (Pstream::master()) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 2b15f61a59..c58a008c50 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -131,8 +131,8 @@ int main(int argc, char *argv[]) const char* geometryName = "geometry"; -# include "setRootCase.H" -# include "createTime.H" + #include "setRootCase.H" + #include "createTime.H" // get times list instantList timeDirs = timeSelector::select0(runTime, args); @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) mkDir(ensightDir); mkDir(dataDir); -# include "createNamedMesh.H" + #include "createNamedMesh.H" // Mesh instance (region0 gets filtered out) fileName regionPrefix; @@ -203,8 +203,8 @@ int main(int argc, char *argv[]) partsList.writeSummary(partsInfoFile); } -# include "checkHasMovingMesh.H" -# include "findFields.H" + #include "checkHasMovingMesh.H" + #include "findFields.H" if (hasMovingMesh && optNoMesh) { @@ -233,7 +233,7 @@ int main(int argc, char *argv[]) { runTime.setTime(timeDirs[timeI], timeI); -# include "getTimeIndex.H" + #include "getTimeIndex.H" // remember the time index fieldTimesUsed.append(timeIndex); @@ -250,7 +250,7 @@ int main(int argc, char *argv[]) << subDir.c_str() << " " << runTime.timeName() << nl; } -# include "moveMesh.H" + #include "moveMesh.H" if (timeI == 0 || mesh.moving()) { @@ -380,7 +380,8 @@ int main(int argc, char *argv[]) ); // check that the positions field is present for this time - if (cloudObjs.lookup("positions")) + IOobject* positionPtr = cloudObjs.lookup(word("positions")); + if (positionPtr != NULL) { ensightParticlePositions ( @@ -459,7 +460,7 @@ int main(int argc, char *argv[]) } } -# include "ensightOutputCase.H" + #include "ensightOutputCase.H" Info<< "\nEnd\n"<< endl; diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index d74211866e..d29bfeca1a 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -386,7 +386,7 @@ int main(int argc, char *argv[]) instantList timeDirs = timeSelector::select0(runTime, args); -# include "createNamedMesh.H" + #include "createNamedMesh.H" // VTK/ directory in the case fileName fvPath(runTime.path()/"VTK"); @@ -448,7 +448,7 @@ int main(int argc, char *argv[]) cloud::prefix/cloudDirs[i] ); - IOobject* positionsPtr = sprayObjs.lookup("positions"); + IOobject* positionsPtr = sprayObjs.lookup(word("positions")); if (positionsPtr) { @@ -1094,7 +1094,7 @@ int main(int argc, char *argv[]) cloud::prefix/cloudName ); - IOobject* positionsPtr = sprayObjs.lookup("positions"); + IOobject* positionsPtr = sprayObjs.lookup(word("positions")); if (positionsPtr) { diff --git a/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMeshLagrangian.C index 7c4aa8f680..294c5422af 100644 --- a/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMeshLagrangian.C @@ -63,7 +63,7 @@ vtkPolyData* Foam::vtkPV398Foam::lagrangianVTKMesh cloud::prefix/cloudName ); - IOobject* positionsPtr = sprayObjs.lookup("positions"); + IOobject* positionsPtr = sprayObjs.lookup(word("positions")); if (positionsPtr) { Cloud parcels(mesh, cloudName, false); diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C index f9b283a8f1..d90a5162de 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,7 +63,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh cloud::prefix/cloudName ); - IOobject* positionsPtr = sprayObjs.lookup("positions"); + IOobject* positionsPtr = sprayObjs.lookup(word("positions")); if (positionsPtr) { Cloud parcels(mesh, cloudName, false); diff --git a/applications/utilities/preProcessing/mapFields/mapLagrangian.C b/applications/utilities/preProcessing/mapFields/mapLagrangian.C index 37ad7c26c2..562990dffd 100644 --- a/applications/utilities/preProcessing/mapFields/mapLagrangian.C +++ b/applications/utilities/preProcessing/mapFields/mapLagrangian.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -120,7 +120,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp) cloud::prefix/cloudDirs[cloudI] ); - IOobject* positionsPtr = objects.lookup("positions"); + IOobject* positionsPtr = objects.lookup(word("positions")); if (positionsPtr) { From 1aa09612e5a1eaa31dd41d39a3064006e2b4ed45 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 8 Apr 2013 15:38:22 +0100 Subject: [PATCH 10/59] wallGradU: Calculate patch gradient only on wall patches --- .../postProcessing/wall/wallGradU/wallGradU.C | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C b/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C index 8ea4dadafc..6491f2b1f9 100644 --- a/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C +++ b/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C @@ -30,6 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "wallFvPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -37,9 +38,9 @@ int main(int argc, char *argv[]) { timeSelector::addOptions(); #include "setRootCase.H" -# include "createTime.H" + #include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); -# include "createMesh.H" + #include "createMesh.H" forAll(timeDirs, timeI) { @@ -83,10 +84,17 @@ int main(int argc, char *argv[]) ) ); + const fvPatchList& patches = mesh.boundary(); + forAll(wallGradU.boundaryField(), patchi) { - wallGradU.boundaryField()[patchi] = - -U.boundaryField()[patchi].snGrad(); + const fvPatch& currPatch = patches[patchi]; + + if (isA(currPatch)) + { + wallGradU.boundaryField()[patchi] = + -U.boundaryField()[patchi].snGrad(); + } } wallGradU.write(); From ccb38822ea566887eb5e783c8020feccbf25c161 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 8 Apr 2013 16:29:45 +0100 Subject: [PATCH 11/59] BUG: foamToEnsight: using 3 digit extension --- .../postProcessing/dataConversion/foamToEnsight/ensightMesh.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index df6fe4da41..c90e2319e8 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -1026,7 +1026,7 @@ void Foam::ensightMesh::write if (timeIndex == 0) { - timeFile += "000."; + timeFile += "0000."; } else if (meshMoving) { From 3382bd825c70003bfc9aa792585e2695bb4a9685 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 8 Apr 2013 17:33:10 +0100 Subject: [PATCH 12/59] ENH: Updated sampledSurfaces output --- .../sampledSurfacesTemplates.C | 79 +++++++++---------- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index da612afa44..e6ba8d42f1 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -27,6 +27,7 @@ License #include "volFields.H" #include "surfaceFields.H" #include "ListListOps.H" +#include "stringListOps.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -146,7 +147,6 @@ void Foam::sampledSurfaces::sampleAndWrite } - template void Foam::sampledSurfaces::sampleAndWrite ( @@ -172,61 +172,54 @@ void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& objects) { IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); - forAll(fieldSelection_, fieldI) + wordList names(fieldObjects.names()); + + labelList fieldNames(findStrings(fieldSelection_, names)); + + forAll(fieldNames, fieldI) { - const wordRe fieldNameRe = fieldSelection_[fieldI]; - IOobjectList fieldIO = fieldObjects.lookupRe(fieldNameRe); + const word& fieldName = names[fieldNames[fieldI]]; - forAllConstIter(IOobjectList, fieldIO, iter) - { - const word& fieldName = iter()->name(); - - const GeoField fld + const GeoField fld + ( + IOobject ( - IOobject - ( - fieldName, - mesh_.time().timeName(), - mesh_, - IOobject::MUST_READ - ), - mesh_ - ); + fieldName, + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ + ), + mesh_ + ); - if ((Pstream::master()) && verbose_) - { - Pout<< "sampleAndWrite: " << fieldName << endl; - } - - sampleAndWrite(fld); + if ((Pstream::master()) && verbose_) + { + Pout<< "sampleAndWrite: " << fieldName << endl; } + + sampleAndWrite(fld); } } else { - forAll(fieldSelection_, fieldI) + const wordList fieldNames + ( + mesh_.thisDb().names(fieldSelection_) + ); + + forAll(fieldNames, i) { - const wordRe& fieldNameRe = fieldSelection_[fieldI]; + const word& fieldName = fieldNames[i]; - const wordList dbFields - ( - mesh_.thisDb().foundObjectRe(fieldNameRe) - ); - - forAll(dbFields, i) + if ((Pstream::master()) && verbose_) { - const word& fieldName = dbFields[i]; - - if ((Pstream::master()) && verbose_) - { - Pout<< "sampleAndWrite: " << fieldName << endl; - } - - sampleAndWrite - ( - mesh_.thisDb().lookupObject(fieldName) - ); + Pout<< "sampleAndWrite: " << fieldName << endl; } + + sampleAndWrite + ( + mesh_.thisDb().lookupObject(fieldName) + ); } } } From 126b96221287541b6ea3a5033399955dc1934cce Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 8 Apr 2013 17:33:42 +0100 Subject: [PATCH 13/59] ENH: Updated external heat flux BC --- .../externalWallHeatFluxTemperatureFvPatchScalarField.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index 8446d56e1b..47bc69aeb6 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -229,7 +229,8 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() scalarField q(size(), 0.0); const scalarField Tc(patchInternalField()); - const scalarField KWall(kappa(*this)); + const scalarField Tp(*this); + const scalarField KWall(kappa(Tp)); const scalarField KDelta(KWall*patch().deltaCoeffs()); switch (mode_) @@ -241,7 +242,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() } case fixedHeatTransferCoeff: { - q = (Ta_ - Tc)*h_; + q = (Ta_ - Tp)*h_; break; } default: From 6f2e475ba7cf2f2345f32519b2a124d513305704 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Tue, 9 Apr 2013 09:45:38 +0100 Subject: [PATCH 14/59] BUG: Adding entry to the table for solidChemistryModels and correcting chemistryThermo entry in chemistryProperties for pyrolisis --- .../basicSolidChemistryModelNew.C | 8 +++++--- .../constant/panelRegion/chemistryProperties | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C index adf318299f..523fff0305 100644 --- a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C +++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C @@ -53,11 +53,12 @@ New Info<< "Selecting chemistry type " << chemistryTypeDict << endl; - const int nCmpt = 12; + const int nCmpt = 13; const char* cmptNames[nCmpt] = { "chemistrySolver", "chemistryThermo", + "baseChemistry", "transport", "thermo", "equationOfState", @@ -107,8 +108,9 @@ New word chemistryTypeName ( word(chemistryTypeDict.lookup("chemistrySolver")) + '<' - + word(chemistryTypeDict.lookup("chemistryThermo")) + ',' - + solidThermoTypeName + ',' + gasThermoTypeName + ">" + + word(chemistryTypeDict.lookup("chemistryThermo")) + '<' + + typeName + ',' + + solidThermoTypeName + ',' + gasThermoTypeName + ">>" ); Info<< "chemistryTypeName " << chemistryTypeName << endl; diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties index 9f8ecdd196..dd30353e69 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties @@ -18,7 +18,7 @@ FoamFile chemistryType { chemistrySolver ode; - chemistryThermo pyrolysis; + chemistryThermo pyrolysisChemistryModel; } chemistry on; From b5dc0921678b5a9de413615daec449bd0c8b4a9e Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Apr 2013 10:49:47 +0100 Subject: [PATCH 15/59] Minor formatting --- .../schemes/FitData/FitData.C | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C index 5b227e12eb..c1d322ff4e 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C @@ -45,11 +45,11 @@ Foam::FitData::FitData linearCorrection_(linearCorrection), linearLimitFactor_(linearLimitFactor), centralWeight_(centralWeight), -# ifdef SPHERICAL_GEOMETRY + #ifdef SPHERICAL_GEOMETRY dim_(2), -# else + #else dim_(mesh.nGeometricD()), -# endif + #endif minSize_(Polynomial::nTerms(dim_)) { // Check input @@ -79,7 +79,7 @@ void Foam::FitData::findFaceDirs idir = mesh.faceAreas()[facei]; idir /= mag(idir); -# ifndef SPHERICAL_GEOMETRY + #ifndef SPHERICAL_GEOMETRY if (mesh.nGeometricD() <= 2) // find the normal direction { if (mesh.geometricD()[0] == -1) @@ -100,10 +100,10 @@ void Foam::FitData::findFaceDirs const face& f = mesh.faces()[facei]; kdir = mesh.points()[f[0]] - mesh.faceCentres()[facei]; } -# else + #else // Spherical geometry so kdir is the radial direction kdir = mesh.faceCentres()[facei]; -# endif + #endif if (mesh.nGeometricD() == 3) { @@ -170,11 +170,11 @@ void Foam::FitData::calcFit d.x() = (p - p0)&idir; d.y() = (p - p0)&jdir; -# ifndef SPHERICAL_GEOMETRY + #ifndef SPHERICAL_GEOMETRY d.z() = (p - p0)&kdir; -# else + #else d.z() = mag(p) - mag(p0); -# endif + #endif if (ip == 0) { From 8629dca1f5d3d403a69c6e0876c1a6beb22bd23e Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Apr 2013 10:50:32 +0100 Subject: [PATCH 16/59] P1 radiation model: only evaluate Qr on non-coupled patches --- .../radiationModels/radiationModel/P1/P1.C | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/thermophysicalModels/radiationModels/radiationModel/P1/P1.C b/src/thermophysicalModels/radiationModels/radiationModel/P1/P1.C index a07142897b..cf7a2329d4 100644 --- a/src/thermophysicalModels/radiationModels/radiationModel/P1/P1.C +++ b/src/thermophysicalModels/radiationModels/radiationModel/P1/P1.C @@ -241,10 +241,14 @@ void Foam::radiation::P1::calculate() ); // Calculate radiative heat flux on boundaries. - forAll(mesh_.boundaryMesh(), patchI) + forAll(mesh_.boundaryMesh(), patchi) { - Qr_.boundaryField()[patchI] = - -gamma.boundaryField()[patchI]*G_.boundaryField()[patchI].snGrad(); + if (!G_.boundaryField()[patchi].coupled()) + { + Qr_.boundaryField()[patchi] = + -gamma.boundaryField()[patchi] + *G_.boundaryField()[patchi].snGrad(); + } } } From 928cef3003b7fa173a304c65af1a472c217fa692 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Apr 2013 11:40:23 +0100 Subject: [PATCH 17/59] incompressibleTwoPhaseMixture: Correct the phase name lookup in read --- .../incompressibleTwoPhaseMixture.C | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C index 98046c9b76..397f9566b1 100644 --- a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C +++ b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C @@ -175,8 +175,14 @@ bool Foam::incompressibleTwoPhaseMixture::read() { if ( - nuModel1_().read(subDict(phase1Name_)) - && nuModel2_().read(subDict(phase2Name_)) + nuModel1_().read + ( + subDict(phase1Name_ == "1" ? "phase1": phase1Name_) + ) + && nuModel2_().read + ( + subDict(phase2Name_ == "2" ? "phase2": phase2Name_) + ) ) { nuModel1_->viscosityProperties().lookup("rho") >> rho1_; From b15cf81217be3d6ca203a6bca9df41fc94914d32 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 9 Apr 2013 12:09:55 +0100 Subject: [PATCH 18/59] ENH: autoSnapDriverFeature: protect for zero sized faces --- .../autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C index cecee33cef..37e61cbbb7 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C @@ -767,7 +767,7 @@ void Foam::autoSnapDriver::binFeatureFace ) const { // What to do with very far attraction? For now just ignore the face - if (magSqr(faceDisp) < sqr(snapDist)) + if (magSqr(faceDisp) < sqr(snapDist) && mag(faceSurfaceNormal) > VSMALL) { const point pt = fc + faceDisp; From 876d6b52d598acbdc152481cc022304d281e471b Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 9 Apr 2013 12:10:58 +0100 Subject: [PATCH 19/59] BUG: incompressibleTwoPhaseMixture: re-reading --- .../incompressibleTwoPhaseMixture.C | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C index 98046c9b76..397f9566b1 100644 --- a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C +++ b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C @@ -175,8 +175,14 @@ bool Foam::incompressibleTwoPhaseMixture::read() { if ( - nuModel1_().read(subDict(phase1Name_)) - && nuModel2_().read(subDict(phase2Name_)) + nuModel1_().read + ( + subDict(phase1Name_ == "1" ? "phase1": phase1Name_) + ) + && nuModel2_().read + ( + subDict(phase2Name_ == "2" ? "phase2": phase2Name_) + ) ) { nuModel1_->viscosityProperties().lookup("rho") >> rho1_; From 142d9333c76334023383e871d433363f501f2b0a Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Apr 2013 14:28:54 +0100 Subject: [PATCH 20/59] CentredFitSnGrad: New fit-based snGrad --- src/finiteVolume/Make/files | 1 + .../CentredFitSnGrad/CentredFitSnGradData.C | 272 ++++++++++++++++++ .../CentredFitSnGrad/CentredFitSnGradData.H | 126 ++++++++ .../CentredFitSnGrad/CentredFitSnGradScheme.H | 182 ++++++++++++ .../quadraticFitSnGrad/quadraticFitSnGrads.C | 51 ++++ .../schemes/FitData/FitData.H | 32 ++- 6 files changed, 658 insertions(+), 6 deletions(-) create mode 100644 src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C create mode 100644 src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.H create mode 100644 src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H create mode 100644 src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGrads.C diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 1ce1f78949..2a650f784f 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -356,6 +356,7 @@ $(snGradSchemes)/faceCorrectedSnGrad/faceCorrectedSnGrads.C $(snGradSchemes)/limitedSnGrad/limitedSnGrads.C $(snGradSchemes)/uncorrectedSnGrad/uncorrectedSnGrads.C $(snGradSchemes)/orthogonalSnGrad/orthogonalSnGrads.C +$(snGradSchemes)/quadraticFitSnGrad/quadraticFitSnGrads.C convectionSchemes = finiteVolume/convectionSchemes $(convectionSchemes)/convectionScheme/convectionSchemes.C diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C new file mode 100644 index 0000000000..135deac4bf --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C @@ -0,0 +1,272 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "CentredFitSnGradData.H" +#include "surfaceFields.H" +#include "volFields.H" +#include "SVD.H" +#include "syncTools.H" +#include "extendedCentredCellToFaceStencil.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::CentredFitSnGradData::CentredFitSnGradData +( + const fvMesh& mesh, + const extendedCentredCellToFaceStencil& stencil, + const scalar linearLimitFactor, + const scalar centralWeight +) +: + FitData + < + CentredFitSnGradData, + extendedCentredCellToFaceStencil, + Polynomial + > + ( + mesh, stencil, true, linearLimitFactor, centralWeight + ), + coeffs_(mesh.nFaces()) +{ + if (debug) + { + Info<< "Contructing CentredFitSnGradData" << endl; + } + + calcFit(); + + if (debug) + { + Info<< "CentredFitSnGradData::CentredFitSnGradData() :" + << "Finished constructing polynomialFit data" + << endl; + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::CentredFitSnGradData::calcFit +( + scalarList& coeffsi, + const List& C, + const scalar wLin, + const scalar deltaCoeff, + const label facei +) +{ + vector idir(1,0,0); + vector jdir(0,1,0); + vector kdir(0,0,1); + this->findFaceDirs(idir, jdir, kdir, facei); + + // Setup the point weights + scalarList wts(C.size(), scalar(1)); + wts[0] = this->centralWeight(); + wts[1] = this->centralWeight(); + + // Reference point + point p0 = this->mesh().faceCentres()[facei]; + + // p0 -> p vector in the face-local coordinate system + vector d; + + // Local coordinate scaling + scalar scale = 1; + + // Matrix of the polynomial components + scalarRectangularMatrix B(C.size(), this->minSize(), scalar(0)); + + forAll(C, ip) + { + const point& p = C[ip]; + const vector p0p = p - p0; + + d.x() = p0p & idir; + d.y() = p0p & jdir; + d.z() = p0p & kdir; + + if (ip == 0) + { + scale = cmptMax(cmptMag((d))); + } + + // Scale the radius vector + d /= scale; + + Polynomial::addCoeffs(B[ip], d, wts[ip], this->dim()); + } + + // Additional weighting for constant and linear terms + for (label i = 0; i < B.n(); i++) + { + B[i][0] *= wts[0]; + B[i][1] *= wts[0]; + } + + // Set the fit + label stencilSize = C.size(); + coeffsi.setSize(stencilSize); + + bool goodFit = false; + for (int iIt = 0; iIt < 8 && !goodFit; iIt++) + { + SVD svd(B, SMALL); + + for (label i=0; ilinearLimitFactor()*wLin) + && (mag(wts[0]*wts[1]*svd.VSinvUt()[0][1] - (1 - wLin) + ) < this->linearLimitFactor()*(1 - wLin)) + && coeffsi[0] < 0 && coeffsi[1] > 0 + && mag(coeffsi[0] + deltaCoeff) < 0.5*deltaCoeff + && mag(coeffsi[1] - deltaCoeff) < 0.5*deltaCoeff; + + if (!goodFit) + { + // (not good fit so increase weight in the centre and weight + // for constant and linear terms) + + WarningIn + ( + "CentredFitSnGradData::calcFit" + "(const List& C, const label facei" + ) << "Cannot fit face " << facei << " iteration " << iIt + << " with sum of weights " << sum(coeffsi) << nl + << " Weights " << coeffsi << nl + << " Linear weights " << wLin << " " << 1 - wLin << nl + << " deltaCoeff " << deltaCoeff << nl + << " sing vals " << svd.S() << nl + << "Components of goodFit:\n" + << " wts[0]*wts[0]*svd.VSinvUt()[0][0] = " + << wts[0]*wts[0]*svd.VSinvUt()[0][0] << nl + << " wts[0]*wts[1]*svd.VSinvUt()[0][1] = " + << wts[0]*wts[1]*svd.VSinvUt()[0][1] + << " dim = " << this->dim() << endl; + + wts[0] *= 10; + wts[1] *= 10; + + for (label j = 0; j < B.m(); j++) + { + B[0][j] *= 10; + B[1][j] *= 10; + } + + for (label i = 0; i < B.n(); i++) + { + B[i][0] *= 10; + B[i][1] *= 10; + } + } + } + + if (goodFit) + { + // Remove the uncorrected coefficients + coeffsi[0] += deltaCoeff; + coeffsi[1] -= deltaCoeff; + } + else + { + WarningIn + ( + "CentredFitSnGradData::calcFit(..)" + ) << "Could not fit face " << facei + << " Coefficients = " << coeffsi + << ", reverting to uncorrected." << endl; + + coeffsi = 0; + } +} + + +template +void Foam::CentredFitSnGradData::calcFit() +{ + const fvMesh& mesh = this->mesh(); + + // Get the cell/face centres in stencil order. + // Centred face stencils no good for triangles or tets. + // Need bigger stencils + List > stencilPoints(mesh.nFaces()); + this->stencil().collectData(mesh.C(), stencilPoints); + + // find the fit coefficients for every face in the mesh + + const surfaceScalarField& w = mesh.surfaceInterpolation::weights(); + const surfaceScalarField& dC = mesh.deltaCoeffs(); + + for (label facei = 0; facei < mesh.nInternalFaces(); facei++) + { + calcFit + ( + coeffs_[facei], + stencilPoints[facei], + w[facei], + dC[facei], + facei + ); + } + + const surfaceScalarField::GeometricBoundaryField& bw = w.boundaryField(); + const surfaceScalarField::GeometricBoundaryField& bdC = dC.boundaryField(); + + forAll(bw, patchi) + { + const fvsPatchScalarField& pw = bw[patchi]; + const fvsPatchScalarField& pdC = bdC[patchi]; + + if (pw.coupled()) + { + label facei = pw.patch().start(); + + forAll(pw, i) + { + calcFit + ( + coeffs_[facei], + stencilPoints[facei], + pw[i], + pdC[i], + facei + ); + facei++; + } + } + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.H b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.H new file mode 100644 index 0000000000..c025a17dd5 --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::CentredFitSnGradData + +Description + Data for the quadratic fit correction interpolation scheme + +SourceFiles + CentredFitSnGradData.C + +\*---------------------------------------------------------------------------*/ + +#ifndef CentredFitSnGradData_H +#define CentredFitSnGradData_H + +#include "FitData.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class extendedCentredCellToFaceStencil; + +/*---------------------------------------------------------------------------*\ + Class CentredFitSnGradData Declaration +\*---------------------------------------------------------------------------*/ + +template +class CentredFitSnGradData +: + public FitData + < + CentredFitSnGradData, + extendedCentredCellToFaceStencil, + Polynomial + > +{ + // Private data + + //- For each cell in the mesh store the values which multiply the + // values of the stencil to obtain the gradient for each direction + List coeffs_; + +public: + + TypeName("CentredFitSnGradData"); + + + // Constructors + + //- Construct from components + CentredFitSnGradData + ( + const fvMesh& mesh, + const extendedCentredCellToFaceStencil& stencil, + const scalar linearLimitFactor, + const scalar centralWeight + ); + + + //- Destructor + virtual ~CentredFitSnGradData() + {} + + + // Member functions + + //- Return reference to fit coefficients + const List& coeffs() const + { + return coeffs_; + } + + //- Calculate the fit for the specified face and set the coefficients + void calcFit + ( + scalarList& coeffsi, // coefficients to be set + const List&, // Stencil points + const scalar wLin, // Weight for linear approximation (weights + // nearest neighbours) + const scalar deltaCoeff, // uncorrected delta coefficient + const label faci // Current face index + ); + + void calcFit(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "CentredFitSnGradData.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H new file mode 100644 index 0000000000..ca307811e6 --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::CentredFitSnGradScheme + +Description + Centred fit snGrad scheme which applies an explicit correction to snGrad + +\*---------------------------------------------------------------------------*/ + +#ifndef CentredFitSnGradScheme_H +#define CentredFitSnGradScheme_H + +#include "CentredFitSnGradData.H" +#include "snGradScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class fvMesh; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fv +{ +/*---------------------------------------------------------------------------*\ + Class CentredFitSnGradSnGradScheme Declaration +\*---------------------------------------------------------------------------*/ + +template +class CentredFitSnGradScheme +: + public snGradScheme +{ + // Private Data + + //- Factor the fit is allowed to deviate from linear. + // This limits the amount of high-order correction and increases + // stability on bad meshes + const scalar linearLimitFactor_; + + //- Weights for central stencil + const scalar centralWeight_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + CentredFitSnGradScheme(const CentredFitSnGradScheme&); + + //- Disallow default bitwise assignment + void operator=(const CentredFitSnGradScheme&); + + +public: + + //- Runtime type information + TypeName("CentredFitSnGradScheme"); + + + // Constructors + + //- Construct from mesh and Istream + CentredFitSnGradScheme(const fvMesh& mesh, Istream& is) + : + snGradScheme(mesh), + linearLimitFactor_(readScalar(is)), + centralWeight_(1000) + {} + + + // Member Functions + + //- Return the interpolation weighting factors for the given field + virtual tmp deltaCoeffs + ( + const GeometricField& + ) const + { + return this->mesh().deltaCoeffs(); + } + + //- Return true if this scheme uses an explicit correction + virtual bool corrected() const + { + return true; + } + + //- Return the explicit correction to the face-interpolate + virtual tmp > + correction + ( + const GeometricField& vf + ) const + { + const fvMesh& mesh = this->mesh(); + + const extendedCentredCellToFaceStencil& stencil = Stencil::New + ( + mesh + ); + + const CentredFitSnGradData& cfd = + CentredFitSnGradData::New + ( + mesh, + stencil, + linearLimitFactor_, + centralWeight_ + ); + + const List& f = cfd.coeffs(); + + tmp > sft + = stencil.weightedSum(vf, f); + + sft().dimensions() /= dimLength; + + return sft; + } +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Add the patch constructor functions to the hash tables + +#define makeCentredFitSnGradTypeScheme(SS, POLYNOMIAL, STENCIL, TYPE) \ + \ +typedef CentredFitSnGradScheme \ + CentredFitSnGradScheme##TYPE##POLYNOMIAL##STENCIL##_; \ +defineTemplateTypeNameAndDebugWithName \ + (CentredFitSnGradScheme##TYPE##POLYNOMIAL##STENCIL##_, #SS, 0); \ + \ +snGradScheme::addMeshConstructorToTable \ + > \ + add##SS##STENCIL##TYPE##MeshConstructorToTable_; + +#define makeCentredFitSnGradScheme(SS, POLYNOMIAL, STENCIL) \ + \ +makeCentredFitSnGradTypeScheme(SS,POLYNOMIAL,STENCIL,scalar) \ +makeCentredFitSnGradTypeScheme(SS,POLYNOMIAL,STENCIL,vector) \ +makeCentredFitSnGradTypeScheme(SS,POLYNOMIAL,STENCIL,sphericalTensor) \ +makeCentredFitSnGradTypeScheme(SS,POLYNOMIAL,STENCIL,symmTensor) \ +makeCentredFitSnGradTypeScheme(SS,POLYNOMIAL,STENCIL,tensor) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGrads.C b/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGrads.C new file mode 100644 index 0000000000..63e4ea98fa --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGrads.C @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "CentredFitSnGradScheme.H" +#include "quadraticFitPolynomial.H" +#include "centredCFCCellToFaceStencilObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTemplateTypeNameAndDebug + ( + CentredFitSnGradData, + 0 + ); + + namespace fv + { + makeCentredFitSnGradScheme + ( + quadraticFit, + quadraticFitPolynomial, + centredCFCCellToFaceStencilObject + ); + } +} + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H index cee373b6c4..5faeed6eb1 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H @@ -29,7 +29,7 @@ Description The linearCorrection_ determines whether the fit is for a corrected linear scheme (first two coefficients are corrections for owner and neighbour) or a pure upwind scheme (first coefficient is correction for - owner ; weight on face taken as 1). + owner; weight on face taken as 1). SourceFiles FitData.C @@ -80,7 +80,7 @@ class FitData const label minSize_; - // Private Member Functions +protected: //- Find the normal direction (i) and j and k directions for face faci void findFaceDirs @@ -93,9 +93,6 @@ class FitData public: - //TypeName("FitData"); - - // Constructors //- Construct from components @@ -122,6 +119,30 @@ public: return stencil_; } + //- Factor the fit is allowed to deviate from the base scheme + scalar linearLimitFactor() const + { + return linearLimitFactor_; + } + + //- Return weight for central stencil + scalar centralWeight() const + { + return centralWeight_; + } + + //- Dimensionality of the geometry + label dim() const + { + return dim_; + } + + //- Minimum stencil size + label minSize() const + { + return minSize_; + } + bool linearCorrection() const { return linearCorrection_; @@ -140,7 +161,6 @@ public: //- Calculate the fit for all the faces virtual void calcFit() = 0; - //- Recalculate weights (but not stencil) when the mesh moves bool movePoints(); }; From 99eee3c0d631ba4319b53effd7c8974c6f6b748f Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 9 Apr 2013 16:26:08 +0100 Subject: [PATCH 21/59] ENH: Better handling for regExp usage in sampledSurfaces --- .../sampledSurfacesTemplates.C | 44 ++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index e6ba8d42f1..35880afafa 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -168,18 +168,32 @@ void Foam::sampledSurfaces::sampleAndWrite template void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& objects) { + wordList names; if (loadFromFiles_) { IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); + names = fieldObjects.names(); + } + else + { + names = mesh_.thisDb().names(); + } - wordList names(fieldObjects.names()); + labelList nameIDs(findStrings(fieldSelection_, names)); - labelList fieldNames(findStrings(fieldSelection_, names)); + wordHashSet fieldNames(wordList(names, nameIDs)); - forAll(fieldNames, fieldI) + forAllConstIter(wordHashSet, fieldNames, iter) + { + const word& fieldName = iter.key(); + + if ((Pstream::master()) && verbose_) { - const word& fieldName = names[fieldNames[fieldI]]; + Pout<< "sampleAndWrite: " << fieldName << endl; + } + if (loadFromFiles_) + { const GeoField fld ( IOobject @@ -192,30 +206,10 @@ void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& objects) mesh_ ); - if ((Pstream::master()) && verbose_) - { - Pout<< "sampleAndWrite: " << fieldName << endl; - } - sampleAndWrite(fld); } - } - else - { - const wordList fieldNames - ( - mesh_.thisDb().names(fieldSelection_) - ); - - forAll(fieldNames, i) + else { - const word& fieldName = fieldNames[i]; - - if ((Pstream::master()) && verbose_) - { - Pout<< "sampleAndWrite: " << fieldName << endl; - } - sampleAndWrite ( mesh_.thisDb().lookupObject(fieldName) From a97ff291c0c891d07d84255d83a48d5e3e42a4a1 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 9 Apr 2013 17:53:12 +0100 Subject: [PATCH 22/59] STYLE: Minor code formatting --- .../constraint/processorCyclic/processorCyclicPolyPatch.H | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H index 0b9d4f70d9..76a833ba61 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class processorCyclicPolyPatch Declaration + Class processorCyclicPolyPatch Declaration \*---------------------------------------------------------------------------*/ class processorCyclicPolyPatch @@ -63,8 +63,6 @@ class processorCyclicPolyPatch //- Index of originating patch mutable label referPatchID_; - // Private member functions - protected: @@ -223,8 +221,7 @@ public: // Destructor - - virtual ~processorCyclicPolyPatch(); + virtual ~processorCyclicPolyPatch(); // Member functions From da535a449a7c069171eaf466bea28710e1ec1879 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Apr 2013 22:28:40 +0100 Subject: [PATCH 23/59] linearFitSnGrad: Added new snGrad scheme which handles non-orthogonality with a compact molecule --- src/finiteVolume/Make/files | 1 + .../linearFitSnGrad/linearFitSnGrads.C | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/finiteVolume/finiteVolume/snGradSchemes/linearFitSnGrad/linearFitSnGrads.C diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 2a650f784f..dd37136533 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -357,6 +357,7 @@ $(snGradSchemes)/limitedSnGrad/limitedSnGrads.C $(snGradSchemes)/uncorrectedSnGrad/uncorrectedSnGrads.C $(snGradSchemes)/orthogonalSnGrad/orthogonalSnGrads.C $(snGradSchemes)/quadraticFitSnGrad/quadraticFitSnGrads.C +$(snGradSchemes)/linearFitSnGrad/linearFitSnGrads.C convectionSchemes = finiteVolume/convectionSchemes $(convectionSchemes)/convectionScheme/convectionSchemes.C diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/linearFitSnGrad/linearFitSnGrads.C b/src/finiteVolume/finiteVolume/snGradSchemes/linearFitSnGrad/linearFitSnGrads.C new file mode 100644 index 0000000000..4335cc8e69 --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/linearFitSnGrad/linearFitSnGrads.C @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "CentredFitSnGradScheme.H" +#include "linearFitPolynomial.H" +#include "centredFECCellToFaceStencilObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTemplateTypeNameAndDebug + ( + CentredFitSnGradData, + 0 + ); + + namespace fv + { + makeCentredFitSnGradScheme + ( + linearFit, + linearFitPolynomial, + centredFECCellToFaceStencilObject + ); + } +} + +// ************************************************************************* // From eecbe11085d87204b69651e650d2d01a63535e4d Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 10 Apr 2013 12:15:47 +0100 Subject: [PATCH 24/59] CentredFitSnGrad: Change deltaCoeffs -> nonOrthDeltaCoeffs for very non-orthogonal meshes --- .../CentredFitSnGrad/CentredFitSnGradData.C | 4 +--- .../CentredFitSnGrad/CentredFitSnGradData.H | 3 ++- .../CentredFitSnGrad/CentredFitSnGradScheme.H | 23 ++++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C index 135deac4bf..36a363ea1f 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C @@ -25,9 +25,7 @@ License #include "CentredFitSnGradData.H" #include "surfaceFields.H" -#include "volFields.H" #include "SVD.H" -#include "syncTools.H" #include "extendedCentredCellToFaceStencil.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -226,7 +224,7 @@ void Foam::CentredFitSnGradData::calcFit() // find the fit coefficients for every face in the mesh const surfaceScalarField& w = mesh.surfaceInterpolation::weights(); - const surfaceScalarField& dC = mesh.deltaCoeffs(); + const surfaceScalarField& dC = mesh.nonOrthDeltaCoeffs(); for (label facei = 0; facei < mesh.nInternalFaces(); facei++) { diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.H b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.H index c025a17dd5..be834684a7 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.H @@ -25,7 +25,7 @@ Class Foam::CentredFitSnGradData Description - Data for the quadratic fit correction interpolation scheme + Data for centred fit snGrad schemes SourceFiles CentredFitSnGradData.C @@ -64,6 +64,7 @@ class CentredFitSnGradData // values of the stencil to obtain the gradient for each direction List coeffs_; + public: TypeName("CentredFitSnGradData"); diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H index ca307811e6..d92478c317 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H @@ -100,7 +100,7 @@ public: const GeometricField& ) const { - return this->mesh().deltaCoeffs(); + return this->mesh().nonOrthDeltaCoeffs(); } //- Return true if this scheme uses an explicit correction @@ -124,18 +124,18 @@ public: ); const CentredFitSnGradData& cfd = - CentredFitSnGradData::New - ( - mesh, - stencil, - linearLimitFactor_, - centralWeight_ - ); - - const List& f = cfd.coeffs(); + CentredFitSnGradData::New + ( + mesh, + stencil, + linearLimitFactor_, + centralWeight_ + ); tmp > sft - = stencil.weightedSum(vf, f); + ( + stencil.weightedSum(vf, cfd.coeffs()) + ); sft().dimensions() /= dimLength; @@ -143,6 +143,7 @@ public: } }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fv From 7e376c96851307ea72ca758748cd7cacc9032a9e Mon Sep 17 00:00:00 2001 From: laurence Date: Wed, 10 Apr 2013 16:35:39 +0100 Subject: [PATCH 25/59] BUG: extendedFeatureEdgeMesh: Swap feature point algorithm for a faster one The population of featurePointFeatureEdges was slow. Added a List called edgeMap that contains the featureEdge index for every edge in a patch (returns -1 if it is not a feature edge). --- .../extendedFeatureEdgeMeshTemplates.C | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshTemplates.C b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshTemplates.C index 63cef912b1..ecc049995b 100644 --- a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshTemplates.C +++ b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshTemplates.C @@ -65,8 +65,7 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges labelListList featurePointFeatureEdges(nFeatPts); forAll(featurePointFeatureEdges, pI) { - featurePointFeatureEdges[pI] = - labelList(pointEdges[featurePoints[pI]].size(), -1); + featurePointFeatureEdges[pI] = pointEdges[featurePoints[pI]]; } // Mapping between old and new indices, there is entry in the map for each @@ -74,6 +73,10 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges // >= 0 corresponds to the index labelList pointMap(sFeatLocalPts.size(), -1); + // Mapping between surface edge index and its feature edge index. -1 if it + // is not a feature edge + labelList edgeMap(sFeatEds.size(), -1); + // Noting when the normal of a face has been used so not to duplicate labelList faceMap(surf.size(), -1); @@ -98,6 +101,8 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges { label sFEI = featureEdges[i]; + edgeMap[sFEI] = i; + const edge& fE(sFeatEds[sFEI]); // Check to see if the points have been already used @@ -156,43 +161,31 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges { regionEdges.append(i); } - - forAll(featurePointFeatureEdges, pI) - { - const labelList& fpfEdges = pointEdges[featurePoints[pI]]; - - labelList& fpfe = featurePointFeatureEdges[pI]; - - forAll(fpfEdges, eI) - { - if (sFEI == fpfEdges[eI]) - { - fpfe[eI] = i; - } - } - } } + // Populate feature point feature edges + DynamicList