From b5d3f85bd4a05ee7f059e1a869b63ba615a36778 Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 17 May 2015 14:56:40 +0100 Subject: [PATCH] functionObjects: Upgrade to use new turbulence modeling library --- .../postProcessing/wall/yPlus/yPlus.C | 5 +- .../utilities/CourantNo/CourantNo.C | 55 +-- .../utilities/CourantNo/CourantNo.H | 15 +- .../DESModelRegions/DESModelRegions.C | 242 ------------- .../DESModelRegions/DESModelRegions.H | 163 --------- .../DESModelRegionsFunctionObject.C | 42 --- .../DESModelRegionsFunctionObject.H | 54 --- .../DESModelRegions/IODESModelRegions.H | 49 --- .../functionObjects/utilities/Make/files | 25 +- .../functionObjects/utilities/Make/options | 29 +- .../functionObjects/utilities/Peclet/Peclet.C | 4 +- .../scalarTransport/scalarTransport.C | 6 +- .../turbulenceFields/turbulenceFields.C | 4 +- .../wallShearStress/wallShearStress.C | 6 +- .../IOyPlusLES.H => yPlus/IOyPlus.H} | 14 +- .../{yPlusRAS/yPlusRAS.C => yPlus/yPlus.C} | 124 +++---- .../{yPlusRAS/yPlusRAS.H => yPlus/yPlus.H} | 50 ++- .../yPlusFunctionObject.C} | 8 +- .../yPlusFunctionObject.H} | 16 +- .../utilities/yPlus/yPlusTemplates.C | 122 +++++++ .../utilities/yPlusLES/yPlusLES.C | 329 ------------------ .../utilities/yPlusLES/yPlusLES.H | 180 ---------- .../yPlusLES/yPlusLESFunctionObject.C | 42 --- .../yPlusLES/yPlusLESFunctionObject.H | 53 --- .../utilities/yPlusRAS/IOyPlusRAS.H | 49 --- 25 files changed, 276 insertions(+), 1410 deletions(-) delete mode 100644 src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C delete mode 100644 src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H delete mode 100644 src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.C delete mode 100644 src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.H delete mode 100644 src/postProcessing/functionObjects/utilities/DESModelRegions/IODESModelRegions.H rename src/postProcessing/functionObjects/utilities/{yPlusLES/IOyPlusLES.H => yPlus/IOyPlus.H} (84%) rename src/postProcessing/functionObjects/utilities/{yPlusRAS/yPlusRAS.C => yPlus/yPlus.C} (61%) rename src/postProcessing/functionObjects/utilities/{yPlusRAS/yPlusRAS.H => yPlus/yPlus.H} (80%) rename src/postProcessing/functionObjects/utilities/{yPlusRAS/yPlusRASFunctionObject.C => yPlus/yPlusFunctionObject.C} (86%) rename src/postProcessing/functionObjects/utilities/{yPlusRAS/yPlusRASFunctionObject.H => yPlus/yPlusFunctionObject.H} (80%) create mode 100644 src/postProcessing/functionObjects/utilities/yPlus/yPlusTemplates.C delete mode 100644 src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C delete mode 100644 src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H delete mode 100644 src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.C delete mode 100644 src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.H delete mode 100644 src/postProcessing/functionObjects/utilities/yPlusRAS/IOyPlusRAS.H diff --git a/applications/utilities/postProcessing/wall/yPlus/yPlus.C b/applications/utilities/postProcessing/wall/yPlus/yPlus.C index 9ff6c4905b..775e79bc6e 100644 --- a/applications/utilities/postProcessing/wall/yPlus/yPlus.C +++ b/applications/utilities/postProcessing/wall/yPlus/yPlus.C @@ -52,7 +52,6 @@ void calcYPlus ( const TurbulenceModel& turbulenceModel, const fvMesh& mesh, - const Time& runTime, const volVectorField& U, volScalarField& yPlus ) @@ -128,7 +127,7 @@ void calcIncompressibleYPlus incompressible::turbulenceModel::New(U, phi, laminarTransport) ); - calcYPlus(turbulenceModel, mesh, runTime, U, yPlus); + calcYPlus(turbulenceModel, mesh, U, yPlus); } @@ -174,7 +173,7 @@ void calcCompressibleYPlus ) ); - calcYPlus(turbulenceModel, mesh, runTime, U, yPlus); + calcYPlus(turbulenceModel, mesh, U, yPlus); } diff --git a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C index dbb81f8363..5653a6a177 100644 --- a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C +++ b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,51 +24,32 @@ License \*---------------------------------------------------------------------------*/ #include "CourantNo.H" -#include "volFields.H" #include "surfaceFields.H" -#include "dictionary.H" -#include "zeroGradientFvPatchFields.H" #include "fvcSurfaceIntegrate.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -defineTypeNameAndDebug(CourantNo, 0); + defineTypeNameAndDebug(CourantNo, 0); } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::tmp Foam::CourantNo::rho +Foam::tmp +Foam::CourantNo::byRho ( - const surfaceScalarField& phi + const tmp& Co ) const { - if (phi.dimensions() == dimMass/dimTime) + if (Co().dimensions() == dimDensity) { - return (obr_.lookupObject(rhoName_)); + return Co/obr_.lookupObject(rhoName_); } else { - const fvMesh& mesh = refCast(obr_); - - return tmp - ( - new volScalarField - ( - IOobject - ( - "rho", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar("rho", dimless, 1.0) - ) - ); + return Co; } } @@ -162,23 +143,19 @@ void Foam::CourantNo::execute() const surfaceScalarField& phi = mesh.lookupObject(phiName_); - volScalarField& CourantNo = + volScalarField& Co = const_cast ( mesh.lookupObject(type()) ); - scalarField& iField = CourantNo.internalField(); - - const scalarField sumPhi + Co.dimensionedInternalField() = byRho ( - fvc::surfaceSum(mag(phi))().internalField() - /rho(phi)().internalField() + (0.5*mesh.time().deltaT()) + *fvc::surfaceSum(mag(phi))().dimensionedInternalField() + /mesh.V() ); - - iField = 0.5*sumPhi/mesh.V().field()*mesh.time().deltaTValue(); - - CourantNo.correctBoundaryConditions(); + Co.correctBoundaryConditions(); } } @@ -193,9 +170,7 @@ void Foam::CourantNo::end() void Foam::CourantNo::timeSet() -{ - // Do nothing -} +{} void Foam::CourantNo::write() diff --git a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H index 16724bee94..7460d74ffb 100644 --- a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H +++ b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,10 +41,7 @@ SourceFiles #ifndef CourantNo_H #define CourantNo_H -#include "volFieldsFwd.H" -#include "surfaceFieldsFwd.H" -#include "OFstream.H" -#include "Switch.H" +#include "volFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -83,9 +80,11 @@ class CourantNo // Private Member Functions - //- Return 1 if the flux field is volumetric, otherwise return rho - // from the database - tmp rho(const surfaceScalarField& p) const; + //- Divide Co by rho if required + tmp byRho + ( + const tmp& Co + ) const; //- Disallow default bitwise copy construct CourantNo(const CourantNo&); diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C deleted file mode 100644 index 23063d1548..0000000000 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C +++ /dev/null @@ -1,242 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 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 "DESModelRegions.H" -#include "volFields.H" -#include "compressible/turbulenceModel/turbulenceModel.H" -#include "compressible/LES/DESModel/DESModel.H" -#include "incompressible/turbulenceModel/turbulenceModel.H" -#include "incompressible/LES/DESModel/DESModel.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -defineTypeNameAndDebug(DESModelRegions, 0); -} - - -// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // - -void Foam::DESModelRegions::writeFileHeader(const label i) -{ - writeHeader(file(), "DES model region coverage (% volume)"); - - writeCommented(file(), "Time"); - writeTabbed(file(), "LES"); - writeTabbed(file(), "RAS"); - file() << endl; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::DESModelRegions::DESModelRegions -( - const word& name, - const objectRegistry& obr, - const dictionary& dict, - const bool loadFromFiles -) -: - functionObjectFile(obr, name, typeName), - name_(name), - obr_(obr), - active_(true), - log_(false) -{ - // Check if the available mesh is an fvMesh, otherwise deactivate - if (!isA(obr_)) - { - active_ = false; - WarningIn - ( - "DESModelRegions::DESModelRegions" - "(" - "const word&, " - "const objectRegistry&, " - "const dictionary&, " - "const bool" - ")" - ) << "No fvMesh available, deactivating " << name_ << nl - << endl; - } - - if (active_) - { - const fvMesh& mesh = refCast(obr_); - - volScalarField* DESModelRegionsPtr - ( - new volScalarField - ( - IOobject - ( - type(), - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar("0", dimless, 0.0) - ) - ); - - mesh.objectRegistry::store(DESModelRegionsPtr); - } - - read(dict); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::DESModelRegions::~DESModelRegions() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::DESModelRegions::read(const dictionary& dict) -{ - if (active_) - { - log_ = dict.lookupOrDefault("log", false); - } -} - - -void Foam::DESModelRegions::execute() -{ - typedef incompressible::turbulenceModel icoModel; - typedef incompressible::DESModel icoDESModel; - - typedef compressible::turbulenceModel cmpModel; - typedef compressible::DESModel cmpDESModel; - - if (active_) - { - functionObjectFile::write(); - - const fvMesh& mesh = refCast(obr_); - - Info(log_)<< type() << " " << name_ << " output:" << nl; - - volScalarField& DESModelRegions = - const_cast - ( - mesh.lookupObject(type()) - ); - - - label DESpresent = false; - if (mesh.foundObject(turbulenceModel::propertiesName)) - { - const icoModel& model = - mesh.lookupObject(turbulenceModel::propertiesName); - - if (isA(model)) - { - const icoDESModel& des = - dynamic_cast(model); - DESModelRegions == des.LESRegion(); - DESpresent = true; - } - } - else if (mesh.foundObject(turbulenceModel::propertiesName)) - { - const cmpModel& model = - mesh.lookupObject(turbulenceModel::propertiesName); - - if (isA(model)) - { - const cmpDESModel& des = - dynamic_cast(model); - DESModelRegions == des.LESRegion(); - DESpresent = true; - } - } - - if (DESpresent) - { - scalar prc = - gSum(DESModelRegions.internalField()*mesh.V()) - /gSum(mesh.V())*100.0; - - if (Pstream::master() && log_) - { - file() << obr_.time().value() - << token::TAB << prc - << token::TAB << 100.0 - prc - << endl; - } - - Info(log_) - << " LES = " << prc << " % (volume)" << nl - << " RAS = " << 100.0 - prc << " % (volume)" << endl; - } - else - { - Info(log_)<< " No DES turbulence model found in database" << nl - << endl; - } - } -} - - -void Foam::DESModelRegions::end() -{ - if (active_) - { - execute(); - } -} - - -void Foam::DESModelRegions::timeSet() -{ - // Do nothing -} - - -void Foam::DESModelRegions::write() -{ - if (log_) - { - const volScalarField& DESModelRegions = - obr_.lookupObject(type()); - - - Info<< type() << " " << name_ << " output:" << nl - << " writing field " << DESModelRegions.name() << nl - << endl; - - DESModelRegions.write(); - } -} - - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H deleted file mode 100644 index d0bf101ae0..0000000000 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H +++ /dev/null @@ -1,163 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::DESModelRegions - -Group - grpUtilitiesFunctionObjects - -Description - This function object writes out an indicator field for DES turbulence - calculations, that is: - - - 0 for RAS regions - - 1 for LES regions - -SourceFiles - DESModelRegions.C - IODESModelRegions.H - -\*---------------------------------------------------------------------------*/ - -#ifndef DESModelRegions_H -#define DESModelRegions_H - -#include "functionObjectFile.H" -#include "volFieldsFwd.H" -#include "Switch.H" -#include "OFstream.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class objectRegistry; -class dictionary; -class polyMesh; -class mapPolyMesh; -class fvMesh; - -/*---------------------------------------------------------------------------*\ - Class DESModelRegions Declaration -\*---------------------------------------------------------------------------*/ - -class DESModelRegions -: - public functionObjectFile -{ -protected: - - // Protected data - - //- Name of this set of DESModelRegions object - word name_; - - const objectRegistry& obr_; - - //- on/off switch - bool active_; - - //- Switch to send output to Info as well as to file - Switch log_; - - - // Protected Member Functions - - //- File header information - virtual void writeFileHeader(const label i); - - //- Disallow default bitwise copy construct - DESModelRegions(const DESModelRegions&); - - //- Disallow default bitwise assignment - void operator=(const DESModelRegions&); - - -public: - - //- Runtime type information - TypeName("DESModelRegions"); - - - // Constructors - - //- Construct for given objectRegistry and dictionary. - // Allow the possibility to load fields from files - DESModelRegions - ( - const word& name, - const objectRegistry&, - const dictionary&, - const bool loadFromFiles = false - ); - - - //- Destructor - virtual ~DESModelRegions(); - - - // Member Functions - - //- Return name of the set of DESModelRegions - virtual const word& name() const - { - return name_; - } - - //- Read the DESModelRegions data - virtual void read(const dictionary&); - - //- Execute, currently does nothing - virtual void execute(); - - //- Execute at the final time-loop, currently does nothing - virtual void end(); - - //- Called when time was set at the end of the Time::operator++ - virtual void timeSet(); - - //- Calculate the DESModelRegions and write - virtual void write(); - - //- Update for changes of mesh - virtual void updateMesh(const mapPolyMesh&) - {} - - //- Update for changes of mesh - virtual void movePoints(const polyMesh&) - {} -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.C b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.C deleted file mode 100644 index 2312e6f5fb..0000000000 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.C +++ /dev/null @@ -1,42 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012 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 "DESModelRegionsFunctionObject.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineNamedTemplateTypeNameAndDebug(DESModelRegionsFunctionObject, 0); - - addToRunTimeSelectionTable - ( - functionObject, - DESModelRegionsFunctionObject, - dictionary - ); -} - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.H b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.H deleted file mode 100644 index 7e9a6ba45c..0000000000 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.H +++ /dev/null @@ -1,54 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012 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 . - -Typedef - Foam::DESModelRegionsFunctionObject - -Description - FunctionObject wrapper around DESModelRegions to allow it to be created - via the functions entry within controlDict. - -SourceFiles - DESModelRegionsFunctionObject.C - -\*---------------------------------------------------------------------------*/ - -#ifndef DESModelRegionsFunctionObject_H -#define DESModelRegionsFunctionObject_H - -#include "DESModelRegions.H" -#include "OutputFilterFunctionObject.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef OutputFilterFunctionObject - DESModelRegionsFunctionObject; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/IODESModelRegions.H b/src/postProcessing/functionObjects/utilities/DESModelRegions/IODESModelRegions.H deleted file mode 100644 index 17cc16b74e..0000000000 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/IODESModelRegions.H +++ /dev/null @@ -1,49 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012 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 . - -Typedef - Foam::IODESModelRegions - -Description - Instance of the generic IOOutputFilter for DESModelRegions. - -\*---------------------------------------------------------------------------*/ - -#ifndef IODESModelRegions_H -#define IODESModelRegions_H - -#include "DESModelRegions.H" -#include "IOOutputFilter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef IOOutputFilter IODESModelRegions; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Make/files b/src/postProcessing/functionObjects/utilities/Make/files index 3f2c2ebad4..43e5bc68eb 100644 --- a/src/postProcessing/functionObjects/utilities/Make/files +++ b/src/postProcessing/functionObjects/utilities/Make/files @@ -5,50 +5,39 @@ CourantNo/CourantNoFunctionObject.C Lambda2/Lambda2.C Lambda2/Lambda2FunctionObject.C -/* + Peclet/Peclet.C Peclet/PecletFunctionObject.C -*/ + Q/Q.C Q/QFunctionObject.C blendingFactor/blendingFactor.C blendingFactor/blendingFactorFunctionObject.C -/* -DESModelRegions/DESModelRegions.C -DESModelRegions/DESModelRegionsFunctionObject.C -*/ + dsmcFields/dsmcFields.C dsmcFields/dsmcFieldsFunctionObject.C pressureTools/pressureTools.C pressureTools/pressureToolsFunctionObject.C -/* scalarTransport/scalarTransport.C scalarTransport/scalarTransportFunctionObject.C -*/ timeActivatedFileUpdate/timeActivatedFileUpdate.C timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C -/* turbulenceFields/turbulenceFields.C turbulenceFields/turbulenceFieldsFunctionObject.C -*/ vorticity/vorticity.C vorticity/vorticityFunctionObject.C -/* + wallShearStress/wallShearStress.C wallShearStress/wallShearStressFunctionObject.C -*/ -/* -yPlusLES/yPlusLES.C -yPlusLES/yPlusLESFunctionObject.C -*/ -yPlusRAS/yPlusRAS.C -yPlusRAS/yPlusRASFunctionObject.C + +yPlus/yPlus.C +yPlus/yPlusFunctionObject.C setTimeStep/setTimeStepFunctionObject.C diff --git a/src/postProcessing/functionObjects/utilities/Make/options b/src/postProcessing/functionObjects/utilities/Make/options index 0ec41c4a47..b59c6b86db 100644 --- a/src/postProcessing/functionObjects/utilities/Make/options +++ b/src/postProcessing/functionObjects/utilities/Make/options @@ -1,20 +1,29 @@ EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/DSMC/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/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 \ + -I$(LIB_SRC)/sampling/lnInclude LIB_LIBS = \ - -lfiniteVolume \ -lfvOptions \ - -lmeshTools \ - -lsampling \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ + -lcompressibleTurbulenceModels \ + -lincompressibleTransportModels \ + -lcompressibleTransportModels \ + -lfluidThermophysicalModels \ + -lspecie \ -llagrangian \ -lDSMC \ - -lincompressibleTransportModels \ - -lturbulenceModels \ - -lfluidThermophysicalModels + -lfiniteVolume \ + -lmeshTools \ + -lsampling diff --git a/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C index a0683b4a1a..18ac584332 100644 --- a/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C +++ b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C @@ -27,8 +27,8 @@ License #include "volFields.H" #include "dictionary.H" #include "surfaceFields.H" -#include "incompressible/turbulenceModel/turbulenceModel.H" -#include "compressible/turbulenceModel/turbulenceModel.H" +#include "turbulentTransportModel.H" +#include "turbulentFluidThermoModel.H" #include "surfaceInterpolate.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C index d65dc92fbe..97dde67611 100644 --- a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C +++ b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C @@ -34,14 +34,14 @@ License #include "fvcDiv.H" #include "fvmLaplacian.H" #include "fvmSup.H" -#include "incompressible/turbulenceModel/turbulenceModel.H" -#include "compressible/turbulenceModel/turbulenceModel.H" +#include "turbulentTransportModel.H" +#include "turbulentFluidThermoModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -defineTypeNameAndDebug(scalarTransport, 0); + defineTypeNameAndDebug(scalarTransport, 0); } diff --git a/src/postProcessing/functionObjects/utilities/turbulenceFields/turbulenceFields.C b/src/postProcessing/functionObjects/utilities/turbulenceFields/turbulenceFields.C index 3fbbb8fb07..cb1fb77a36 100644 --- a/src/postProcessing/functionObjects/utilities/turbulenceFields/turbulenceFields.C +++ b/src/postProcessing/functionObjects/utilities/turbulenceFields/turbulenceFields.C @@ -25,8 +25,8 @@ License #include "turbulenceFields.H" #include "dictionary.H" -#include "compressible/turbulenceModel/turbulenceModel.H" -#include "incompressible/turbulenceModel/turbulenceModel.H" +#include "turbulentTransportModel.H" +#include "turbulentFluidThermoModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C index 393d890d2a..c6bd8a9e19 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C @@ -26,15 +26,15 @@ License #include "wallShearStress.H" #include "volFields.H" #include "surfaceFields.H" -#include "incompressible/turbulenceModel/turbulenceModel.H" -#include "compressible/turbulenceModel/turbulenceModel.H" +#include "turbulentTransportModel.H" +#include "turbulentFluidThermoModel.H" #include "wallPolyPatch.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -defineTypeNameAndDebug(wallShearStress, 0); + defineTypeNameAndDebug(wallShearStress, 0); } diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/IOyPlusLES.H b/src/postProcessing/functionObjects/utilities/yPlus/IOyPlus.H similarity index 84% rename from src/postProcessing/functionObjects/utilities/yPlusLES/IOyPlusLES.H rename to src/postProcessing/functionObjects/utilities/yPlus/IOyPlus.H index 55c541ab8f..dc2eaef11e 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/IOyPlusLES.H +++ b/src/postProcessing/functionObjects/utilities/yPlus/IOyPlus.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,24 +22,24 @@ License along with OpenFOAM. If not, see . Typedef - Foam::IOyPlusLES + Foam::IOyPlus Description - Instance of the generic IOOutputFilter for yPlusLES. + Instance of the generic IOOutputFilter for yPlus. \*---------------------------------------------------------------------------*/ -#ifndef IOyPlusLES_H -#define IOyPlusLES_H +#ifndef IOyPlus_H +#define IOyPlus_H -#include "yPlusLES.H" +#include "yPlus.H" #include "IOOutputFilter.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - typedef IOOutputFilter IOyPlusLES; + typedef IOOutputFilter IOyPlus; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C b/src/postProcessing/functionObjects/utilities/yPlus/yPlus.C similarity index 61% rename from src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C rename to src/postProcessing/functionObjects/utilities/yPlus/yPlus.C index 12c8349a3e..c85882fc9e 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C +++ b/src/postProcessing/functionObjects/utilities/yPlus/yPlus.C @@ -23,24 +23,24 @@ License \*---------------------------------------------------------------------------*/ -#include "yPlusRAS.H" +#include "yPlus.H" #include "volFields.H" -#include "turbulenceModel.H" -#include "nutWallFunctionFvPatchScalarField.H" +#include "turbulentTransportModel.H" +#include "turbulentFluidThermoModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(yPlusRAS, 0); + defineTypeNameAndDebug(yPlus, 0); } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::yPlusRAS::writeFileHeader(const label i) +void Foam::yPlus::writeFileHeader(const label i) { - writeHeader(file(), "y+ (RAS)"); + writeHeader(file(), "y+ ()"); writeCommented(file(), "Time"); writeTabbed(file(), "patch"); @@ -51,68 +51,9 @@ void Foam::yPlusRAS::writeFileHeader(const label i) } -void Foam::yPlusRAS::calcYPlus -( - const fvMesh& mesh, - volScalarField& yPlus -) -{ - const turbulenceModel& model = mesh.lookupObject - ( - turbulenceModel::propertiesName - ); - - const volScalarField nut(model.nut()); - const volScalarField::GeometricBoundaryField& nutPatches = - nut.boundaryField(); - - bool foundPatch = false; - forAll(nutPatches, patchi) - { - if (isA(nutPatches[patchi])) - { - foundPatch = true; - - const nutWallFunctionFvPatchScalarField& nutPw = - dynamic_cast - < - const nutWallFunctionFvPatchScalarField& - >(nutPatches[patchi]); - - yPlus.boundaryField()[patchi] = nutPw.yPlus(); - const scalarField& Yp = yPlus.boundaryField()[patchi]; - - scalar minYp = gMin(Yp); - scalar maxYp = gMax(Yp); - scalar avgYp = gAverage(Yp); - - if (Pstream::master()) - { - Info(log_)<< " patch " << nutPw.patch().name() - << " y+ : min = " << minYp << ", max = " << maxYp - << ", average = " << avgYp << nl; - - file() << obr_.time().value() - << token::TAB << nutPw.patch().name() - << token::TAB << minYp - << token::TAB << maxYp - << token::TAB << avgYp - << endl; - } - } - } - - if (log_ && !foundPatch) - { - Info<< " no " << nutWallFunctionFvPatchScalarField::typeName - << " patches" << endl; - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::yPlusRAS::yPlusRAS +Foam::yPlus::yPlus ( const word& name, const objectRegistry& obr, @@ -133,7 +74,7 @@ Foam::yPlusRAS::yPlusRAS active_ = false; WarningIn ( - "yPlusRAS::yPlusRAS" + "yPlus::yPlus" "(" "const word&, " "const objectRegistry&, " @@ -148,7 +89,7 @@ Foam::yPlusRAS::yPlusRAS { const fvMesh& mesh = refCast(obr_); - volScalarField* yPlusRASPtr + volScalarField* yPlusPtr ( new volScalarField ( @@ -165,20 +106,20 @@ Foam::yPlusRAS::yPlusRAS ) ); - mesh.objectRegistry::store(yPlusRASPtr); + mesh.objectRegistry::store(yPlusPtr); } } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::yPlusRAS::~yPlusRAS() +Foam::yPlus::~yPlus() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::yPlusRAS::read(const dictionary& dict) +void Foam::yPlus::read(const dictionary& dict) { if (active_) { @@ -188,15 +129,18 @@ void Foam::yPlusRAS::read(const dictionary& dict) } -void Foam::yPlusRAS::execute() +void Foam::yPlus::execute() { + typedef compressible::turbulenceModel cmpModel; + typedef incompressible::turbulenceModel icoModel; + if (active_) { functionObjectFile::write(); const fvMesh& mesh = refCast(obr_); - volScalarField& yPlusRAS = + volScalarField& yPlus = const_cast ( mesh.lookupObject(type()) @@ -204,12 +148,32 @@ void Foam::yPlusRAS::execute() Info(log_)<< type() << " " << name_ << " output:" << nl; - calcYPlus(mesh, yPlusRAS); + tmp Reff; + if (mesh.foundObject(turbulenceModel::propertiesName)) + { + const cmpModel& model = + mesh.lookupObject(turbulenceModel::propertiesName); + + calcYPlus(model, mesh, yPlus); + } + else if (mesh.foundObject(turbulenceModel::propertiesName)) + { + const icoModel& model = + mesh.lookupObject(turbulenceModel::propertiesName); + + calcYPlus(model, mesh, yPlus); + } + else + { + FatalErrorIn("void Foam::yPlus::write()") + << "Unable to find turbulence model in the " + << "database" << exit(FatalError); + } } } -void Foam::yPlusRAS::end() +void Foam::yPlus::end() { if (active_) { @@ -218,24 +182,24 @@ void Foam::yPlusRAS::end() } -void Foam::yPlusRAS::timeSet() +void Foam::yPlus::timeSet() { // Do nothing } -void Foam::yPlusRAS::write() +void Foam::yPlus::write() { if (active_) { functionObjectFile::write(); - const volScalarField& yPlusRAS = + const volScalarField& yPlus = obr_.lookupObject(type()); - Info(log_)<< " writing field " << yPlusRAS.name() << nl << endl; + Info(log_)<< " writing field " << yPlus.name() << nl << endl; - yPlusRAS.write(); + yPlus.write(); } } diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H b/src/postProcessing/functionObjects/utilities/yPlus/yPlus.H similarity index 80% rename from src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H rename to src/postProcessing/functionObjects/utilities/yPlus/yPlus.H index 7c3cdd696e..a2a27bf022 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H +++ b/src/postProcessing/functionObjects/utilities/yPlus/yPlus.H @@ -22,23 +22,23 @@ License along with OpenFOAM. If not, see . Class - Foam::yPlusRAS + Foam::yPlus Group grpUtilitiesFunctionObjects Description - Evaluates and outputs turbulence y+ for RAS models. Values written to - time directories as field 'yPlusRAS' + Evaluates and outputs turbulence y+ for models. Values written to + time directories as field 'yPlus' SourceFiles - yPlusRAS.C - IOyPlusRAS.H + yPlus.C + IOyPlus.H \*---------------------------------------------------------------------------*/ -#ifndef yPlusRAS_H -#define yPlusRAS_H +#ifndef yPlus_H +#define yPlus_H #include "functionObjectFile.H" #include "volFieldsFwd.H" @@ -58,16 +58,16 @@ class mapPolyMesh; class fvMesh; /*---------------------------------------------------------------------------*\ - Class yPlusRAS Declaration + Class yPlus Declaration \*---------------------------------------------------------------------------*/ -class yPlusRAS +class yPlus : public functionObjectFile { // Private data - //- Name of this set of yPlusRAS objects + //- Name of this set of yPlus objects word name_; const objectRegistry& obr_; @@ -88,26 +88,32 @@ class yPlusRAS virtual void writeFileHeader(const label i); //- Calculate y+ - void calcYPlus(const fvMesh& mesh, volScalarField& yPlus); + template + void calcYPlus + ( + const TurbulenceModel& turbulenceModel, + const fvMesh& mesh, + volScalarField& yPlus + ); //- Disallow default bitwise copy construct - yPlusRAS(const yPlusRAS&); + yPlus(const yPlus&); //- Disallow default bitwise assignment - void operator=(const yPlusRAS&); + void operator=(const yPlus&); public: //- Runtime type information - TypeName("yPlusRAS"); + TypeName("yPlus"); // Constructors //- Construct for given objectRegistry and dictionary. // Allow the possibility to load fields from files - yPlusRAS + yPlus ( const word& name, const objectRegistry&, @@ -117,18 +123,18 @@ public: //- Destructor - virtual ~yPlusRAS(); + virtual ~yPlus(); // Member Functions - //- Return name of the set of yPlusRAS + //- Return name of the set of yPlus virtual const word& name() const { return name_; } - //- Read the yPlusRAS data + //- Read the yPlus data virtual void read(const dictionary&); //- Execute, currently does nothing @@ -140,7 +146,7 @@ public: //- Called when time was set at the end of the Time::operator++ virtual void timeSet(); - //- Calculate the yPlusRAS and write + //- Calculate the yPlus and write virtual void write(); //- Update for changes of mesh @@ -159,6 +165,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository + #include "yPlusTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.C b/src/postProcessing/functionObjects/utilities/yPlus/yPlusFunctionObject.C similarity index 86% rename from src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.C rename to src/postProcessing/functionObjects/utilities/yPlus/yPlusFunctionObject.C index 77ffceeb84..a8d98b7cf7 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.C +++ b/src/postProcessing/functionObjects/utilities/yPlus/yPlusFunctionObject.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,18 +23,18 @@ License \*---------------------------------------------------------------------------*/ -#include "yPlusRASFunctionObject.H" +#include "yPlusFunctionObject.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineNamedTemplateTypeNameAndDebug(yPlusRASFunctionObject, 0); + defineNamedTemplateTypeNameAndDebug(yPlusFunctionObject, 0); addToRunTimeSelectionTable ( functionObject, - yPlusRASFunctionObject, + yPlusFunctionObject, dictionary ); } diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.H b/src/postProcessing/functionObjects/utilities/yPlus/yPlusFunctionObject.H similarity index 80% rename from src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.H rename to src/postProcessing/functionObjects/utilities/yPlus/yPlusFunctionObject.H index 99d34c6517..dd54426043 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.H +++ b/src/postProcessing/functionObjects/utilities/yPlus/yPlusFunctionObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,28 +22,28 @@ License along with OpenFOAM. If not, see . Typedef - Foam::yPlusRASFunctionObject + Foam::yPlusFunctionObject Description - FunctionObject wrapper around yPlusRAS to allow it to be created + FunctionObject wrapper around yPlus to allow it to be created via the functions entry within controlDict. SourceFiles - yPlusRASFunctionObject.C + yPlusFunctionObject.C \*---------------------------------------------------------------------------*/ -#ifndef yPlusRASFunctionObject_H -#define yPlusRASFunctionObject_H +#ifndef yPlusFunctionObject_H +#define yPlusFunctionObject_H -#include "yPlusRAS.H" +#include "yPlus.H" #include "OutputFilterFunctionObject.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - typedef OutputFilterFunctionObject yPlusRASFunctionObject; + typedef OutputFilterFunctionObject yPlusFunctionObject; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/utilities/yPlus/yPlusTemplates.C b/src/postProcessing/functionObjects/utilities/yPlus/yPlusTemplates.C new file mode 100644 index 0000000000..9061a6f013 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlus/yPlusTemplates.C @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 "yPlus.H" +#include "nutWallFunctionFvPatchScalarField.H" +#include "nearWallDist.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::yPlus::calcYPlus +( + const TurbulenceModel& turbulenceModel, + const fvMesh& mesh, + volScalarField& yPlus +) +{ + volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(); + + const volScalarField::GeometricBoundaryField nutBf = + turbulenceModel.nut()().boundaryField(); + + const volScalarField::GeometricBoundaryField nuEffBf = + turbulenceModel.nuEff()().boundaryField(); + + const volScalarField::GeometricBoundaryField nuBf = + turbulenceModel.nu()().boundaryField(); + + const fvPatchList& patches = mesh.boundary(); + + forAll(patches, patchi) + { + const fvPatch& patch = patches[patchi]; + + if (isA(nutBf[patchi])) + { + const nutWallFunctionFvPatchScalarField& nutPf = + dynamic_cast + ( + nutBf[patchi] + ); + + yPlus.boundaryField()[patchi] = nutPf.yPlus(); + const scalarField& yPlusp = yPlus.boundaryField()[patchi]; + + const scalar minYplus = gMin(yPlusp); + const scalar maxYplus = gMax(yPlusp); + const scalar avgYplus = gAverage(yPlusp); + + if (Pstream::master()) + { + Info(log_) + << " patch " << patch.name() + << " y+ : min = " << minYplus << ", max = " << maxYplus + << ", average = " << avgYplus << nl; + + file() << obr_.time().value() + << token::TAB << patch.name() + << token::TAB << minYplus + << token::TAB << maxYplus + << token::TAB << avgYplus + << endl; + } + } + else if (isA(patch)) + { + yPlus.boundaryField()[patchi] = + d[patchi] + *sqrt + ( + nuEffBf[patchi] + *mag(turbulenceModel.U().boundaryField()[patchi].snGrad()) + )/nuBf[patchi]; + const scalarField& yPlusp = yPlus.boundaryField()[patchi]; + + const scalar minYplus = gMin(yPlusp); + const scalar maxYplus = gMax(yPlusp); + const scalar avgYplus = gAverage(yPlusp); + + if (Pstream::master()) + { + Info(log_) + << " patch " << patch.name() + << " y+ : min = " << minYplus << ", max = " << maxYplus + << ", average = " << avgYplus << nl; + + file() << obr_.time().value() + << token::TAB << patch.name() + << token::TAB << minYplus + << token::TAB << maxYplus + << token::TAB << avgYplus + << endl; + } + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C deleted file mode 100644 index 705df6d9d0..0000000000 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C +++ /dev/null @@ -1,329 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2013-2014 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 "yPlusLES.H" -#include "volFields.H" - -#include "incompressible/LES/LESModel/LESModel.H" -#include "compressible/LES/LESModel/LESModel.H" -#include "wallFvPatch.H" -#include "nearWallDist.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(yPlusLES, 0); -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::yPlusLES::writeFileHeader(const label i) -{ - writeHeader(file(), "y+ (LES)"); - - writeCommented(file(), "Time"); - writeTabbed(file(), "patch"); - writeTabbed(file(), "min"); - writeTabbed(file(), "max"); - writeTabbed(file(), "average"); - file() << endl; -} - - -void Foam::yPlusLES::calcIncompressibleYPlus -( - const fvMesh& mesh, - const volVectorField& U, - volScalarField& yPlus -) -{ - const incompressible::LESModel& model = - mesh.lookupObject("LESProperties"); - - volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(); - volScalarField nuEff(model.nuEff()); - - const fvPatchList& patches = mesh.boundary(); - - const volScalarField nuLam(model.nu()); - - bool foundPatch = false; - forAll(patches, patchi) - { - const fvPatch& currPatch = patches[patchi]; - - if (isA(currPatch)) - { - foundPatch = true; - yPlus.boundaryField()[patchi] = - d[patchi] - *sqrt - ( - nuEff.boundaryField()[patchi] - *mag(U.boundaryField()[patchi].snGrad()) - ) - /nuLam.boundaryField()[patchi]; - - const scalarField& Yp = yPlus.boundaryField()[patchi]; - - scalar minYp = gMin(Yp); - scalar maxYp = gMax(Yp); - scalar avgYp = gAverage(Yp); - - if (Pstream::master()) - { - Info(log_)<< " patch " << currPatch.name() - << " y+ : min = " << minYp << ", max = " << maxYp - << ", average = " << avgYp << nl; - - file() << obr_.time().value() - << token::TAB << currPatch.name() - << token::TAB << minYp - << token::TAB << maxYp - << token::TAB << avgYp - << endl; - } - } - } - - if (log_ && !foundPatch) - { - Info<< " no " << wallFvPatch::typeName << " patches" << endl; - } -} - - -void Foam::yPlusLES::calcCompressibleYPlus -( - const fvMesh& mesh, - const volVectorField& U, - volScalarField& yPlus -) -{ - const compressible::LESModel& model = - mesh.lookupObject("LESProperties"); - - volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(); - volScalarField muEff(model.muEff()); - const volScalarField& rho(model.rho()); - - const fvPatchList& patches = mesh.boundary(); - - const volScalarField muLam(model.mu()); - - Info<< type() << " output:" << nl; - - bool foundPatch = false; - forAll(patches, patchi) - { - const fvPatch& currPatch = patches[patchi]; - - if (isA(currPatch)) - { - foundPatch = true; - yPlus.boundaryField()[patchi] = - d[patchi] - *sqrt - ( - (muEff.boundaryField()[patchi]/rho.boundaryField()[patchi]) - *mag(U.boundaryField()[patchi].snGrad()) - ) - /(muLam.boundaryField()[patchi]/rho.boundaryField()[patchi]); - - const scalarField& Yp = yPlus.boundaryField()[patchi]; - - scalar minYp = gMin(Yp); - scalar maxYp = gMax(Yp); - scalar avgYp = gAverage(Yp); - - if (Pstream::master()) - { - Info(log_)<< " patch " << currPatch.name() - << " y+ : min = " << minYp << ", max = " << maxYp - << ", average = " << avgYp << nl; - - file() << obr_.time().value() - << token::TAB << currPatch.name() - << token::TAB << minYp - << token::TAB << maxYp - << token::TAB << avgYp - << endl; - } - } - } - - if (log_ && !foundPatch) - { - Info<< " no " << wallFvPatch::typeName << " patches" << endl; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::yPlusLES::yPlusLES -( - const word& name, - const objectRegistry& obr, - const dictionary& dict, - const bool loadFromFiles -) -: - functionObjectFile(obr, name, typeName), - name_(name), - obr_(obr), - active_(true), - log_(true), - phiName_("phi"), - UName_("U") -{ - // Check if the available mesh is an fvMesh, otherwise deactivate - if (!isA(obr_)) - { - active_ = false; - WarningIn - ( - "yPlusLES::yPlusLES" - "(" - "const word&, " - "const objectRegistry&, " - "const dictionary&, " - "const bool" - ")" - ) << "No fvMesh available, deactivating " << name_ << nl - << endl; - } - - if (active_) - { - const fvMesh& mesh = refCast(obr_); - - volScalarField* yPlusLESPtr - ( - new volScalarField - ( - IOobject - ( - type(), - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar("0", dimless, 0.0) - ) - ); - - mesh.objectRegistry::store(yPlusLESPtr); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::yPlusLES::~yPlusLES() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::yPlusLES::read(const dictionary& dict) -{ - if (active_) - { - log_ = dict.lookupOrDefault("log", true); - phiName_ = dict.lookupOrDefault("phiName", "phi"); - } -} - - -void Foam::yPlusLES::execute() -{ - if (active_) - { - functionObjectFile::write(); - - const surfaceScalarField& phi = - obr_.lookupObject(phiName_); - - const volVectorField& U = obr_.lookupObject(UName_); - - const fvMesh& mesh = refCast(obr_); - - volScalarField& yPlusLES = - const_cast - ( - mesh.lookupObject(type()) - ); - - Info(log_)<< type() << " " << name_ << " output:" << nl; - - if (phi.dimensions() == dimMass/dimTime) - { - calcCompressibleYPlus(mesh, U, yPlusLES); - } - else - { - calcIncompressibleYPlus(mesh, U, yPlusLES); - } - } -} - - -void Foam::yPlusLES::end() -{ - if (active_) - { - execute(); - } -} - - -void Foam::yPlusLES::timeSet() -{ - // Do nothing -} - - -void Foam::yPlusLES::write() -{ - if (active_) - { - functionObjectFile::write(); - - const volScalarField& yPlusLES = - obr_.lookupObject(type()); - - Info(log_)<< " writing field " << yPlusLES.name() << nl << endl; - - yPlusLES.write(); - } -} - - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H deleted file mode 100644 index 004721a538..0000000000 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H +++ /dev/null @@ -1,180 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2013-2014 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::yPlusLES - -Group - grpUtilitiesFunctionObjects - -Description - Evaluates and outputs turbulence y+ for LES models. Values written to - time directories as field 'yPlusLES' - -SourceFiles - yPlusLES.C - IOyPlusLES.H - -\*---------------------------------------------------------------------------*/ - -#ifndef yPlusLES_H -#define yPlusLES_H - -#include "functionObjectFile.H" -#include "volFieldsFwd.H" -#include "Switch.H" -#include "OFstream.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class objectRegistry; -class dictionary; -class polyMesh; -class mapPolyMesh; -class fvMesh; - -/*---------------------------------------------------------------------------*\ - Class yPlusLES Declaration -\*---------------------------------------------------------------------------*/ - -class yPlusLES -: - public functionObjectFile -{ - // Private data - - //- Name of this set of yPlusLES objects - word name_; - - const objectRegistry& obr_; - - //- on/off switch - bool active_; - - //- Switch to send output to Info as well as to file - Switch log_; - - //- Name of mass/volume flux field (optional, default = phi) - word phiName_; - - //- Name of velocity field - word UName_; - - - // Private Member Functions - - //- File header information - virtual void writeFileHeader(const label i); - - //- Calculate incompressible form of y+ - void calcIncompressibleYPlus - ( - const fvMesh& mesh, - const volVectorField& U, - volScalarField& yPlus - ); - - //- Calculate compressible form of y+ - void calcCompressibleYPlus - ( - const fvMesh& mesh, - const volVectorField& U, - volScalarField& yPlus - ); - - //- Disallow default bitwise copy construct - yPlusLES(const yPlusLES&); - - //- Disallow default bitwise assignment - void operator=(const yPlusLES&); - - -public: - - //- Runtime type information - TypeName("yPlusLES"); - - - // Constructors - - //- Construct for given objectRegistry and dictionary. - // Allow the possibility to load fields from files - yPlusLES - ( - const word& name, - const objectRegistry&, - const dictionary&, - const bool loadFromFiles = false - ); - - - //- Destructor - virtual ~yPlusLES(); - - - // Member Functions - - //- Return name of the set of yPlusLES - virtual const word& name() const - { - return name_; - } - - //- Read the yPlusLES data - virtual void read(const dictionary&); - - //- Execute, currently does nothing - virtual void execute(); - - //- Execute at the final time-loop, currently does nothing - virtual void end(); - - //- Called when time was set at the end of the Time::operator++ - virtual void timeSet(); - - //- Calculate the yPlusLES and write - virtual void write(); - - //- Update for changes of mesh - virtual void updateMesh(const mapPolyMesh&) - {} - - //- Update for changes of mesh - virtual void movePoints(const polyMesh&) - {} -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.C b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.C deleted file mode 100644 index 77ea1c21a3..0000000000 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.C +++ /dev/null @@ -1,42 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012 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 "yPlusLESFunctionObject.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineNamedTemplateTypeNameAndDebug(yPlusLESFunctionObject, 0); - - addToRunTimeSelectionTable - ( - functionObject, - yPlusLESFunctionObject, - dictionary - ); -} - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.H b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.H deleted file mode 100644 index 35a19abb69..0000000000 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.H +++ /dev/null @@ -1,53 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012 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 . - -Typedef - Foam::yPlusLESFunctionObject - -Description - FunctionObject wrapper around yPlusLES to allow it to be created - via the functions entry within controlDict. - -SourceFiles - yPlusLESFunctionObject.C - -\*---------------------------------------------------------------------------*/ - -#ifndef yPlusLESFunctionObject_H -#define yPlusLESFunctionObject_H - -#include "yPlusLES.H" -#include "OutputFilterFunctionObject.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef OutputFilterFunctionObject yPlusLESFunctionObject; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/IOyPlusRAS.H b/src/postProcessing/functionObjects/utilities/yPlusRAS/IOyPlusRAS.H deleted file mode 100644 index 959d3fbf4a..0000000000 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/IOyPlusRAS.H +++ /dev/null @@ -1,49 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012 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 . - -Typedef - Foam::IOyPlusRAS - -Description - Instance of the generic IOOutputFilter for yPlusRAS. - -\*---------------------------------------------------------------------------*/ - -#ifndef IOyPlusRAS_H -#define IOyPlusRAS_H - -#include "yPlusRAS.H" -#include "IOOutputFilter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef IOOutputFilter IOyPlusRAS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* //