From e175594e9f53294796ce6360b392a04f3566f88a Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Thu, 9 Jun 2016 14:52:04 +0100 Subject: [PATCH] Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-dev --- .../postProcessing/wall/yPlus/Make/files | 3 - .../postProcessing/wall/yPlus/Make/options | 24 -- .../postProcessing/wall/yPlus/yPlus.C | 260 ------------------ bin/supercededByPostProcessOption | 40 +++ bin/yPlus | 1 + etc/caseDicts/postProcessing/fields/yPlus | 18 ++ src/functionObjects/field/yPlus/yPlus.C | 4 +- src/functionObjects/field/yPlus/yPlus.H | 6 - 8 files changed, 60 insertions(+), 296 deletions(-) delete mode 100644 applications/utilities/postProcessing/wall/yPlus/Make/files delete mode 100644 applications/utilities/postProcessing/wall/yPlus/Make/options delete mode 100644 applications/utilities/postProcessing/wall/yPlus/yPlus.C create mode 100755 bin/supercededByPostProcessOption create mode 120000 bin/yPlus create mode 100644 etc/caseDicts/postProcessing/fields/yPlus diff --git a/applications/utilities/postProcessing/wall/yPlus/Make/files b/applications/utilities/postProcessing/wall/yPlus/Make/files deleted file mode 100644 index e52ae0b6aa8..00000000000 --- a/applications/utilities/postProcessing/wall/yPlus/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -yPlus.C - -EXE = $(FOAM_APPBIN)/yPlus diff --git a/applications/utilities/postProcessing/wall/yPlus/Make/options b/applications/utilities/postProcessing/wall/yPlus/Make/options deleted file mode 100644 index bca86c931d4..00000000000 --- a/applications/utilities/postProcessing/wall/yPlus/Make/options +++ /dev/null @@ -1,24 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/transportModels \ - -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ - -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ - -I$(LIB_SRC)/transportModels/compressible/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude - -EXE_LIBS = \ - -lturbulenceModels \ - -lincompressibleTurbulenceModels \ - -lcompressibleTurbulenceModels \ - -lincompressibleTransportModels \ - -lcompressibleTransportModels \ - -lfluidThermophysicalModels \ - -lspecie \ - -lfiniteVolume \ - -lfvOptions \ - -lgenericPatchFields \ - -lmeshTools \ - -lsampling diff --git a/applications/utilities/postProcessing/wall/yPlus/yPlus.C b/applications/utilities/postProcessing/wall/yPlus/yPlus.C deleted file mode 100644 index 7b891a04971..00000000000 --- a/applications/utilities/postProcessing/wall/yPlus/yPlus.C +++ /dev/null @@ -1,260 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 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 <http://www.gnu.org/licenses/>. - -Application - yPlus - -Description - Calculates and reports yPlus for the near-wall cells of all wall patches, - for the specified times for laminar, LES and RAS. - - For walls at which wall-functions are applied the wall-function provides - the y+ values otherwise they are obtained directly from the near-wall - velocity gradient and effective and laminar viscosities. - - Compressible modes is automatically selected based on the existence of the - "thermophysicalProperties" dictionary required to construct the - thermodynamics package. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "singlePhaseTransportModel.H" -#include "turbulentTransportModel.H" -#include "turbulentFluidThermoModel.H" -#include "nutWallFunctionFvPatchScalarField.H" -#include "nearWallDist.H" -#include "wallFvPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template<class TurbulenceModel> -void calcYPlus -( - const TurbulenceModel& turbulenceModel, - const fvMesh& mesh, - const volVectorField& U, - volScalarField& yPlus -) -{ - volScalarField::Boundary d = nearWallDist(mesh).y(); - - const volScalarField::Boundary nutBf = - turbulenceModel->nut()().boundaryField(); - - const volScalarField::Boundary nuEffBf = - turbulenceModel->nuEff()().boundaryField(); - - const volScalarField::Boundary nuBf = - turbulenceModel->nu()().boundaryField(); - - volScalarField::Boundary& yPlusBf = - yPlus.boundaryFieldRef(); - - const fvPatchList& patches = mesh.boundary(); - - forAll(patches, patchi) - { - const fvPatch& patch = patches[patchi]; - - if (isA<nutWallFunctionFvPatchScalarField>(nutBf[patchi])) - { - const nutWallFunctionFvPatchScalarField& nutPf = - dynamic_cast<const nutWallFunctionFvPatchScalarField&> - ( - nutBf[patchi] - ); - - yPlusBf[patchi] = nutPf.yPlus(); - const scalarField& Yp = yPlus.boundaryField()[patchi]; - - Info<< "Patch " << patchi - << " named " << nutPf.patch().name() - << ", wall-function " << nutPf.type() - << ", y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) - << " average: " << gAverage(Yp) << nl << endl; - } - else if (isA<wallFvPatch>(patch)) - { - yPlusBf[patchi] = - d[patchi] - *sqrt - ( - nuEffBf[patchi] - *mag(U.boundaryField()[patchi].snGrad()) - )/nuBf[patchi]; - const scalarField& Yp = yPlus.boundaryField()[patchi]; - - Info<< "Patch " << patchi - << " named " << patch.name() - << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) - << " average: " << gAverage(Yp) << nl << endl; - } - } -} - - -void calcIncompressibleYPlus -( - const fvMesh& mesh, - const Time& runTime, - const volVectorField& U, - volScalarField& yPlus -) -{ - #include "createPhi.H" - - singlePhaseTransportModel laminarTransport(U, phi); - - autoPtr<incompressible::turbulenceModel> turbulenceModel - ( - incompressible::turbulenceModel::New(U, phi, laminarTransport) - ); - - calcYPlus(turbulenceModel, mesh, U, yPlus); -} - - -void calcCompressibleYPlus -( - const fvMesh& mesh, - const Time& runTime, - const volVectorField& U, - volScalarField& yPlus -) -{ - IOobject rhoHeader - ( - "rho", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (!rhoHeader.headerOk()) - { - Info<< " no rho field" << endl; - return; - } - - Info<< "Reading field rho\n" << endl; - volScalarField rho(rhoHeader, mesh); - - #include "compressibleCreatePhi.H" - - autoPtr<fluidThermo> pThermo(fluidThermo::New(mesh)); - fluidThermo& thermo = pThermo(); - - autoPtr<compressible::turbulenceModel> turbulenceModel - ( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - calcYPlus(turbulenceModel, mesh, U, yPlus); -} - - -int main(int argc, char *argv[]) -{ - timeSelector::addOptions(); - #include "addRegionOption.H" - #include "setRootCase.H" - #include "createTime.H" - instantList timeDirs = timeSelector::select(runTime, args, "yPlus"); - #include "createNamedMesh.H" - - forAll(timeDirs, timeI) - { - runTime.setTime(timeDirs[timeI], timeI); - Info<< "Time = " << runTime.timeName() << endl; - mesh.readUpdate(); - - volScalarField yPlus - ( - IOobject - ( - "yPlus", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar("yPlus", dimless, 0.0) - ); - - IOobject UHeader - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (UHeader.headerOk()) - { - Info<< "Reading field U\n" << endl; - volVectorField U(UHeader, mesh); - - if - ( - IOobject - ( - basicThermo::dictName, - runTime.constant(), - mesh - ).headerOk() - ) - { - calcCompressibleYPlus(mesh, runTime, U, yPlus); - } - else - { - calcIncompressibleYPlus(mesh, runTime, U, yPlus); - } - } - else - { - Info<< " no U field" << endl; - } - - Info<< "Writing yPlus to field " << yPlus.name() << nl << endl; - - yPlus.write(); - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/bin/supercededByPostProcessOption b/bin/supercededByPostProcessOption new file mode 100755 index 00000000000..4d44ffc908f --- /dev/null +++ b/bin/supercededByPostProcessOption @@ -0,0 +1,40 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2016 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 <http://www.gnu.org/licenses/>. +# +# Script +# supercededByPostProcessOption +# +# Description +# Replacement script to suggest using the new "-postProcess" +# solver command-line option. +# +#------------------------------------------------------------------------------ +Script=${0##*/} + +echo $Script "has been superceded by the \ +'-postProcess' solver command-line option, e.g." + +echo "simpleFoam -postProcess -func" $Script + +#------------------------------------------------------------------------------ diff --git a/bin/yPlus b/bin/yPlus new file mode 120000 index 00000000000..ff6b4704c67 --- /dev/null +++ b/bin/yPlus @@ -0,0 +1 @@ +supercededByPostProcessOption \ No newline at end of file diff --git a/etc/caseDicts/postProcessing/fields/yPlus b/etc/caseDicts/postProcessing/fields/yPlus new file mode 100644 index 00000000000..92816e76a0b --- /dev/null +++ b/etc/caseDicts/postProcessing/fields/yPlus @@ -0,0 +1,18 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +yPlus +{ + type yPlus; + libs ("libfieldFunctionObjects.so"); + + executeControl writeTime; + writeControl writeTime; +} + +// ************************************************************************* // diff --git a/src/functionObjects/field/yPlus/yPlus.C b/src/functionObjects/field/yPlus/yPlus.C index 18f38e76467..e1e9249b52a 100644 --- a/src/functionObjects/field/yPlus/yPlus.C +++ b/src/functionObjects/field/yPlus/yPlus.C @@ -162,8 +162,7 @@ Foam::functionObjects::yPlus::yPlus const dictionary& dict ) : - writeFiles(name, runTime, dict, name), - phiName_("phi") + writeFiles(name, runTime, dict, name) { if (!isA<fvMesh>(obr_)) { @@ -207,7 +206,6 @@ Foam::functionObjects::yPlus::~yPlus() bool Foam::functionObjects::yPlus::read(const dictionary& dict) { writeFiles::read(dict); - phiName_ = dict.lookupOrDefault<word>("phi", "phi"); return true; } diff --git a/src/functionObjects/field/yPlus/yPlus.H b/src/functionObjects/field/yPlus/yPlus.H index ce4bc069d66..e1d8c74b1e6 100644 --- a/src/functionObjects/field/yPlus/yPlus.H +++ b/src/functionObjects/field/yPlus/yPlus.H @@ -67,12 +67,6 @@ class yPlus : public writeFiles { - // Private data - - //- Name of mass/volume flux field (optional, default = phi) - word phiName_; - - // Private Member Functions //- File header information -- GitLab