diff --git a/src/functionObjects/field/Make/files b/src/functionObjects/field/Make/files
index da6a530727..f94c521831 100644
--- a/src/functionObjects/field/Make/files
+++ b/src/functionObjects/field/Make/files
@@ -143,6 +143,13 @@ DMD/DMDModels/DMDModel/DMDModel.C
DMD/DMDModels/DMDModel/DMDModelNew.C
DMD/DMDModels/derived/STDMD/STDMD.C
+resolutionIndex/resolutionIndex.C
+resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C
+resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelNew.C
+resolutionIndex/resolutionIndexModels/PopeIndex/PopeIndex.C
+resolutionIndex/resolutionIndexModels/CelikNuIndex/CelikNuIndex.C
+resolutionIndex/resolutionIndexModels/CelikEtaIndex/CelikEtaIndex.C
+
age/age.C
comfort/comfort.C
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndex.C b/src/functionObjects/field/resolutionIndex/resolutionIndex.C
new file mode 100644
index 0000000000..6950e47537
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndex.C
@@ -0,0 +1,123 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 "resolutionIndex.H"
+#include "resolutionIndexModel.H"
+#include "turbulenceModel.H"
+#include "RASModel.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace functionObjects
+{
+ defineTypeNameAndDebug(resolutionIndex, 0);
+ addToRunTimeSelectionTable(functionObject, resolutionIndex, dictionary);
+}
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::functionObjects::resolutionIndex::resolutionIndex
+(
+ const word& name,
+ const Time& runTime,
+ const dictionary& dict
+)
+:
+ fvMeshFunctionObject(name, runTime, dict),
+ resolutionIndexModelPtr_()
+{
+ read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+Foam::functionObjects::resolutionIndex::~resolutionIndex()
+{} // resolutionIndexModel was forward declared
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+bool Foam::functionObjects::resolutionIndex::read(const dictionary& dict)
+{
+ if (mesh_.foundObject(turbulenceModel::propertiesName))
+ {
+ FatalIOErrorInFunction(dict)
+ << type() << " " << name()
+ << " is not available for RANS-based turbulence models."
+ << exit(FatalIOError);
+
+ return false;
+ }
+
+ if (!fvMeshFunctionObject::read(dict))
+ {
+ return false;
+ }
+
+ Info<< type() << " " << name() << ":" << endl;
+
+ resolutionIndexModelPtr_.reset
+ (
+ resolutionIndexModel::New(name(), mesh_, dict)
+ );
+
+ return true;
+}
+
+
+bool Foam::functionObjects::resolutionIndex::execute()
+{
+ if (!resolutionIndexModelPtr_->execute())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+
+bool Foam::functionObjects::resolutionIndex::write()
+{
+ Info<< type() << " " << name() << " write:" << endl;
+
+ if (!resolutionIndexModelPtr_->write())
+ {
+ return false;
+ }
+ Info<< endl;
+
+ return true;
+}
+
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndex.H b/src/functionObjects/field/resolutionIndex/resolutionIndex.H
new file mode 100644
index 0000000000..7f4fefbc6a
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndex.H
@@ -0,0 +1,191 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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::functionObjects::resolutionIndex
+
+Group
+ grpFieldFunctionObjects
+
+Description
+ Computes a single-mesh resolution index according to the specified model,
+ which is used as a LES/DES quality/post-verification metric that does
+ not require any experimental or DNS data.
+
+ Operands:
+ \table
+ Operand | Type | Location
+ input | vol\Field(s) | \/\
+ output file | - | -
+ output field | volScalarField | \/\
+ \endtable
+
+ References:
+ \verbatim
+ Governing equation (tag:P):
+ Pope, S. B. (2000).
+ Turbulent flows.
+ Cambridge, UK: Cambridge Univ. Press
+ DOI:10.1017/CBO9780511840531
+
+ Governing equations (tag:CKJ):
+ Celik, I., Klein, M., & Janicka, J. (2009).
+ Assessment measures for engineering LES applications.
+ Journal of fluids engineering, 131(3).
+ DOI:10.1115/1.3059703
+ \endverbatim
+
+Usage
+ Minimal example by using \c system/controlDict.functions:
+ \verbatim
+ resolutionIndex1
+ {
+ // Mandatory entries
+ type resolutionIndex;
+ libs (fieldFunctionObjects);
+ model ;
+
+ // Conditional entries
+
+ // Option-1: when model == PopeIndex
+
+ // Option-2: when model == CelikNuIndex
+
+ // Option-3: when model == CelikEtaIndex
+
+ // Inherited entries
+ ...
+ }
+ \endverbatim
+
+ where the entries mean:
+ \table
+ Property | Description | Type | Reqd | Deflt
+ type | Type name: resolutionIndex | word | yes | -
+ libs | Library name: fieldFunctionObjects | word | yes | -
+ model | Name of the resolutionIndex model | word | yes | -
+ \endtable
+
+ Options for the \c model entry:
+ \verbatim
+ PopeIndex | Resolution method proposed by Pope (2000)
+ CelikNuIndex | Resolution method proposed by Celik et al. (2009)
+ CelikEtaIndex | Resolution method proposed by Celik et al. (2009)
+ \endverbatim
+
+ The inherited entries are elaborated in:
+ - \link functionObject.H \endlink
+
+Note
+ - The \c resolutionIndex throws runtime error
+ when the turbulence model is RANS based.
+ - Resolution-estimator models strictly assume that
+ the flow is in a fully turbulent regime.
+
+SourceFiles
+ resolutionIndex.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef Foam_functionObjects_resolutionIndex_H
+#define Foam_functionObjects_resolutionIndex_H
+
+#include "fvMeshFunctionObject.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward Declarations
+class resolutionIndexModel;
+
+namespace functionObjects
+{
+
+/*---------------------------------------------------------------------------*\
+ Class resolutionIndex Declaration
+\*---------------------------------------------------------------------------*/
+
+class resolutionIndex
+:
+ public fvMeshFunctionObject
+{
+ // Private Data
+
+ //- Resolution index model
+ autoPtr resolutionIndexModelPtr_;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("resolutionIndex");
+
+
+ // Constructors
+
+ //- Construct from Time and dictionary
+ resolutionIndex
+ (
+ const word& name,
+ const Time& runTime,
+ const dictionary& dict
+ );
+
+ //- No copy construct
+ resolutionIndex(const resolutionIndex&) = delete;
+
+ //- No copy assignment
+ void operator=(const resolutionIndex&) = delete;
+
+
+ // Destructor
+ virtual ~resolutionIndex();
+
+
+ // Member Functions
+
+ //- Read the resolutionIndex data
+ virtual bool read(const dictionary& dict);
+
+ //- Calculate the result field
+ virtual bool execute();
+
+ //- Write the result field
+ virtual bool write();
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace functionObjects
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikEtaIndex/CelikEtaIndex.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikEtaIndex/CelikEtaIndex.C
new file mode 100644
index 0000000000..5d4c27f9d8
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikEtaIndex/CelikEtaIndex.C
@@ -0,0 +1,185 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 "CelikEtaIndex.H"
+#include "resolutionIndexModel.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace resolutionIndexModels
+{
+ defineTypeNameAndDebug(CelikEtaIndex, 0);
+ addToRunTimeSelectionTable(resolutionIndexModel, CelikEtaIndex, dictionary);
+}
+}
+
+
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+Foam::tmp
+Foam::resolutionIndexModels::CelikEtaIndex::eta() const
+{
+ const auto& nu = getOrReadField(nuName_);
+ tmp tepsilon = epsilon();
+
+ const dimensionedScalar epsilonMin(tepsilon.cref().dimensions(), SMALL);
+
+ // (CKJ:Eq. 23)
+ return pow025(pow3(nu)/max(epsilonMin, tepsilon));
+}
+
+
+Foam::tmp
+Foam::resolutionIndexModels::CelikEtaIndex::epsilon() const
+{
+ const auto& kSgs = getOrReadField(kName_);
+ const auto& Delta = getOrReadField(deltaName_);
+ tmp tnuEff = nuEff();
+
+ // (Derived based on CKJ:Eq. 25-26, p.031102-5)
+ return tnuEff*kSgs/(Ck_*sqr(Delta));
+}
+
+
+Foam::tmp
+Foam::resolutionIndexModels::CelikEtaIndex::nuEff() const
+{
+ const auto& nu = getOrReadField(nuName_);
+ const auto& nuSgs = getOrReadField(nutName_);
+ tmp tnuNum = nuNum();
+
+ // (CKJ:p. 031102-3)
+ return tnuNum + nuSgs + nu;
+}
+
+
+Foam::tmp
+Foam::resolutionIndexModels::CelikEtaIndex::nuNum() const
+{
+ const auto& Delta = getOrReadField(deltaName_);
+
+ tmp tkNum = kNum();
+
+ // (CKJ:Eq. 35)
+ return sign(tkNum.cref())*Cnu_*Delta*sqrt(mag(tkNum.cref()));
+}
+
+
+Foam::tmp
+Foam::resolutionIndexModels::CelikEtaIndex::kNum() const
+{
+ const auto& kSgs = getOrReadField(kName_);
+ const auto& Delta = getOrReadField(deltaName_);
+
+ tmp th = cbrt(V());
+
+ // (CKJ:Eq. 28)
+ return Cn_*sqr(th/Delta)*kSgs;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::resolutionIndexModels::CelikEtaIndex::CelikEtaIndex
+(
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+)
+:
+ resolutionIndexModel(name, mesh, dict),
+ alphaEta_(),
+ m_(),
+ Cnu_(),
+ Cn_(),
+ Ck_(),
+ kName_(),
+ deltaName_(),
+ nuName_(),
+ nutName_()
+{
+ read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+bool Foam::resolutionIndexModels::CelikEtaIndex::read(const dictionary& dict)
+{
+ if (!resolutionIndexModel::read(dict))
+ {
+ return false;
+ }
+
+ // (Default values from CKJ:p. 031102-3, 031102-5)
+ alphaEta_ = dict.getOrDefault("alphaEta", 0.05);
+ m_ = dict.getOrDefault("m", 0.5);
+ Cnu_ = dict.getOrDefault("Cnu", 0.1);
+ Cn_ = dict.getOrDefault("Cn", 1.0);
+ Ck_ = dict.getOrDefault("Ck", 0.0376);
+ kName_ = dict.getOrDefault("k", "k");
+ deltaName_ = dict.getOrDefault("delta", "delta");
+ nuName_ = dict.getOrDefault("nu", "nu");
+ nutName_ = dict.getOrDefault("nut", "nut");
+
+ return true;
+}
+
+
+bool Foam::resolutionIndexModels::CelikEtaIndex::execute()
+{
+ // Calculate Kolmogorov and mesh length scales
+ tmp teta = eta();
+ tmp th = cbrt(V());
+
+ // Calculate index field
+ auto& index = getOrReadField(resultName());
+
+ // (CKJ:Eq. 9)
+ index = 1.0/(1.0 + alphaEta_*pow(th/teta, m_));
+ index.correctBoundaryConditions();
+
+ return true;
+}
+
+
+bool Foam::resolutionIndexModels::CelikEtaIndex::write()
+{
+ const auto& index = getOrReadField(resultName());
+
+ Info<< tab << "writing field:" << index.name() << endl;
+
+ index.write();
+
+ return true;
+}
+
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikEtaIndex/CelikEtaIndex.H b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikEtaIndex/CelikEtaIndex.H
new file mode 100644
index 0000000000..a21c304213
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikEtaIndex/CelikEtaIndex.H
@@ -0,0 +1,257 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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::resolutionIndexModels::CelikEtaIndex
+
+Description
+ Computes a single-mesh resolution index according to Celik et al.'s index
+ using Kolmogorov length scale, which is used as a LES/DES quality/post
+ verification metric that does not require any experimental or DNS data.
+
+ \f[
+ \Gamma_{Celik,\eta}(\mathbf{x}, t) =
+ \frac{1}{1 + \alpha_\eta \left(\frac{h}{\eta_{eff}}\right)^m}
+ \f]
+
+ with
+
+ \f[
+ \eta_{eff} = \left(\frac{\nu^3}{\epsilon}\right)^{1/4}
+ \f]
+
+ \f[
+ \epsilon = \nu_{eff} \frac{k_{sgs}}{C_k \Delta^2}
+ \f]
+
+ \f[
+ \nu_{eff} = \nu_{num} + \nu_{sgs} + \nu
+ \f]
+
+ \f[
+ \nu_{num} = {sgn}(k_{num}) C_\nu \Delta \sqrt{k_{num}}
+ \f]
+
+ \f[
+ k_{num} = C_n \left(\frac{h}{\Delta}\right)^2 k_{sgs}
+ \f]
+
+ where
+ \vartable
+ \Gamma_{Celik,\eta}(\mathbf{x}, t) | Celik et al.'s index [-]
+ \alpha_\eta | Empirical constant [-]
+ h | Characteristic length scale with \f$h = V^{1/3} \f$ [m]
+ V | Cell volume [m^3]
+ \eta_{eff} | Kolmogorov length scale [m]
+ m | Empirical exponent [-]
+ \nu | Kinematic viscosity of fluid [m^2/s]
+ \epsilon | Kinetic energy dissipation rate [m^2/s^3]
+ \nu_{eff} | Effective eddy viscosity [m^2/s]
+ \nu_{num} | Numerical eddy viscosity [m^2/s]
+ \nu_{sgs} | Subgrid-scale eddy viscosity [m^2/s]
+ k_{num} | Numerical turbulent kinetic energy [m^2/s^2]
+ C_\nu | Empirical constant [-]
+ \Delta | Filter length scale [m]
+ k_{sgs} | Subgrid-scale turbulent kinetic energy [m^2/s^2]
+ C_n | Empirical constant [-]
+ C_k | Empirical constant [-]
+ \endvartable
+
+ References:
+ \verbatim
+ Governing equations (tag:CCY):
+ Celik, I. B., Cehreli Z. N., Yavuz I. (2005).
+ Index of resolution quality for large eddy simulations.
+ Journal of Fluids Engineering. 127:949–958.
+ DOI:10.1115/1.1990201
+
+ Governing equations (tag:CKJ):
+ Celik, I., Klein, M., & Janicka, J. (2009).
+ Assessment measures for engineering LES applications.
+ Journal of fluids engineering, 131(3).
+ DOI:10.1115/1.3059703
+ \endverbatim
+
+Usage
+ Minimal example by using \c system/controlDict.functions:
+ \verbatim
+ resolutionIndex1
+ {
+ // Inherited entries
+ ...
+ model CelikEtaIndex;
+
+ // Optional entries
+ alphaEta ;
+ m ;
+ Cnu ;
+ Cn ;
+ Ck ;
+ k ;
+ delta ;
+ nu ;
+ nut ;
+ }
+ \endverbatim
+
+ where the entries mean:
+ \table
+ Property | Description | Type | Reqd | Deflt
+ model | Model name: CelikEtaIndex | word | yes | -
+ alphaEta | Empirical constant | scalar | no | 0.05
+ m | Empirical exponent | scalar | no | 0.5
+ Cnu | Empirical constant | scalar | no | 0.1
+ Cn | Empirical constant | scalar | no | 1.0
+ Ck | Empirical constant | scalar | no | 0.0376
+ k | Name of subgrid-scale turbulent kinetic energy field | word | no | k
+ delta | Name of filter field | word | no | delta
+ nu | Name of kinematic viscosity field | word | no | nu
+ nut | Name of subgrid-scale eddy viscosity field | word | no | nut
+ \endtable
+
+SourceFiles
+ CelikEtaIndex.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef Foam_resolutionIndexModels_CelikEtaIndex_H
+#define Foam_resolutionIndexModels_CelikEtaIndex_H
+
+#include "resolutionIndexModel.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace resolutionIndexModels
+{
+
+/*---------------------------------------------------------------------------*\
+ Class CelikEtaIndex Declaration
+\*---------------------------------------------------------------------------*/
+
+class CelikEtaIndex
+:
+ public resolutionIndexModel
+{
+ // Private Data
+
+ //- Empirical constant
+ scalar alphaEta_;
+
+ //- Empirical exponent
+ scalar m_;
+
+ //- Empirical constant
+ scalar Cnu_;
+
+ //- Empirical constant
+ scalar Cn_;
+
+ //- Empirical constant
+ scalar Ck_;
+
+ //- Name of subgrid-scale turbulent kinetic energy field
+ word kName_;
+
+ //- Name of filter field
+ word deltaName_;
+
+ //- Name of kinematic viscosity field
+ word nuName_;
+
+ //- Name of subgrid-scale eddy viscosity field
+ word nutName_;
+
+
+ // Private Member Functions
+
+ //- Return Kolmogorov length scale field
+ tmp eta() const;
+
+ //- Return kinetic energy dissipation rate field
+ tmp epsilon() const;
+
+ //- Return effective eddy viscosity field
+ tmp nuEff() const;
+
+ //- Return numerical eddy viscosity field
+ tmp nuNum() const;
+
+ //- Return numerical turbulent kinetic energy field
+ tmp kNum() const;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("CelikEtaIndex");
+
+
+ // Constructors
+
+ //- Construct from components
+ CelikEtaIndex
+ (
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+ );
+
+ //- No copy construct
+ CelikEtaIndex(const CelikEtaIndex&) = delete;
+
+ //- No copy assignment
+ void operator=(const CelikEtaIndex&) = delete;
+
+
+ // Destructor
+ virtual ~CelikEtaIndex() = default;
+
+
+ // Member Functions
+
+ //- Read top-level dictionary
+ virtual bool read(const dictionary& dict);
+
+ //- Calculate the result field
+ virtual bool execute();
+
+ //- Write the result field
+ virtual bool write();
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace resolutionIndexModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikNuIndex/CelikNuIndex.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikNuIndex/CelikNuIndex.C
new file mode 100644
index 0000000000..6417f2b404
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikNuIndex/CelikNuIndex.C
@@ -0,0 +1,148 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 "CelikNuIndex.H"
+#include "resolutionIndexModel.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace resolutionIndexModels
+{
+ defineTypeNameAndDebug(CelikNuIndex, 0);
+ addToRunTimeSelectionTable(resolutionIndexModel, CelikNuIndex, dictionary);
+}
+}
+
+
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+Foam::tmp
+Foam::resolutionIndexModels::CelikNuIndex::nuNum() const
+{
+ const auto& Delta = getOrReadField(deltaName_);
+
+ tmp tkNum = kNum();
+
+ // (CKJ:Eq. 35)
+ return sign(tkNum.cref())*Cnu_*Delta*sqrt(tkNum.cref());
+}
+
+
+Foam::tmp
+Foam::resolutionIndexModels::CelikNuIndex::kNum() const
+{
+ const auto& kSgs = getOrReadField(kName_);
+ const auto& Delta = getOrReadField(deltaName_);
+
+ tmp th = cbrt(V());
+
+ // (CKJ:Eq. 28)
+ return Cn_*sqr(th/Delta)*kSgs;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::resolutionIndexModels::CelikNuIndex::CelikNuIndex
+(
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+)
+:
+ resolutionIndexModel(name, mesh, dict),
+ alphaNu_(),
+ n_(),
+ Cnu_(),
+ Cn_(),
+ kName_(),
+ deltaName_(),
+ nuName_(),
+ nutName_()
+{
+ read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+bool Foam::resolutionIndexModels::CelikNuIndex::read(const dictionary& dict)
+{
+ if (!resolutionIndexModel::read(dict))
+ {
+ return false;
+ }
+
+ // (Default values from CKJ:p. 031102-3, 031102-5)
+ alphaNu_ = dict.getOrDefault("alphaNu", 0.05);
+ n_ = dict.getOrDefault("n", 0.53);
+ Cnu_ = dict.getOrDefault("Cnu", 0.1);
+ Cn_ = dict.getOrDefault("Cn", 1.0);
+ kName_ = dict.getOrDefault("k", "k");
+ deltaName_ = dict.getOrDefault("delta", "delta");
+ nuName_ = dict.getOrDefault("nu", "nu");
+ nutName_ = dict.getOrDefault("nut", "nut");
+
+ return true;
+}
+
+
+bool Foam::resolutionIndexModels::CelikNuIndex::execute()
+{
+ // Calculate effective eddy viscosity field
+ const auto& nu = getOrReadField(nuName_);
+ const auto& nuSgs = getOrReadField(nutName_);
+ tmp tnuNum = nuNum();
+ tmp tnuEff = tnuNum + nuSgs + nu;
+
+ // Calculate index field
+ auto& index = getOrReadField(resultName());
+
+ // (CKJ:Eq. 10)
+ index = 1.0/(1.0 + alphaNu_*pow(tnuEff/nu, n_));
+ index.correctBoundaryConditions();
+
+ return true;
+}
+
+
+bool Foam::resolutionIndexModels::CelikNuIndex::write()
+{
+ const auto& index = getOrReadField(resultName());
+
+ Info<< tab << "writing field:" << index.name() << endl;
+
+ index.write();
+
+ return true;
+}
+
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikNuIndex/CelikNuIndex.H b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikNuIndex/CelikNuIndex.H
new file mode 100644
index 0000000000..412a174bc2
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/CelikNuIndex/CelikNuIndex.H
@@ -0,0 +1,246 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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::resolutionIndexModels::CelikNuIndex
+
+Description
+ Computes a single-mesh resolution index according to Celik et al.'s index
+ using effective viscosity, which is used as a LES/DES quality/post
+ verification metric that does not require any experimental or DNS data.
+
+ \f[
+ \Gamma_{Celik,\nu}(\mathbf{x}, t) =
+ \frac{1}{1 + \alpha_\nu \left(\frac{\nu_{eff}}{\nu}\right)^n}
+ \f]
+
+ with
+
+ \f[
+ \nu_{eff} = \nu_{num} + \nu_{sgs} + \nu
+ \f]
+
+ \f[
+ \nu_{num} = {sgn}(k_{num}) C_\nu \Delta \sqrt{k_{num}}
+ \f]
+
+ \f[
+ k_{num} = C_n \left(\frac{h}{\Delta}\right)^2 k_{sgs}
+ \f]
+
+ where
+ \vartable
+ \Gamma_{Celik,\nu}(\mathbf{x}, t) | Celik et al.'s index [-]
+ \alpha_\nu | Empirical constant [-]
+ \nu_{eff} | Effective eddy viscosity [m^2/s]
+ \nu_{num} | Numerical eddy viscosity [m^2/s]
+ \nu_{sgs} | Subgrid-scale eddy viscosity [m^2/s]
+ \nu | Kinematic viscosity of fluid [m^2/s]
+ n | Empirical exponent [-]
+ k_{num} | Numerical turbulent kinetic energy [m^2/s^2]
+ C_\nu | Empirical constant [-]
+ \Delta | Filter length scale [m]
+ C_n | Empirical constant [-]
+ h | Characteristic length scale with \f$h = V^{1/3} \f$ [m]
+ V | Cell volume [m^3]
+ k_{sgs} | Subgrid-scale turbulent kinetic energy [m^2/s^2]
+ \endvartable
+
+ Criterion for acceptable-quality resolution:
+
+ \f[
+ \Gamma_{Celik,\nu}(\mathbf{x}) \geq 0.8
+ \f]
+
+ Required fields:
+ \verbatim
+ k | Subgrid scale turbulent kinetic energy [m^2/s^2]
+ delta | Filter length [m]
+ nu | Kinematic viscosity [m^2/s]
+ nut | Subgrid-scale eddy viscosity [m^2/s]
+ \endverbatim
+
+ References:
+ \verbatim
+ Governing equations (tag:CCY):
+ Celik, I. B., Cehreli Z. N., Yavuz I. (2005).
+ Index of resolution quality for large eddy simulations.
+ Journal of Fluids Engineering. 127:949–958.
+ DOI:10.1115/1.1990201
+
+ Governing equations (tag:CKJ):
+ Celik, I., Klein, M., & Janicka, J. (2009).
+ Assessment measures for engineering LES applications.
+ Journal of fluids engineering, 131(3).
+ DOI:10.1115/1.3059703
+ \endverbatim
+
+Usage
+ Minimal example by using \c system/controlDict.functions:
+ \verbatim
+ resolutionIndex1
+ {
+ // Inherited entries
+ ...
+ model CelikNuIndex;
+
+ // Optional entries
+ alphaNu ;
+ n ;
+ Cnu ;
+ Cn ;
+ k ;
+ delta ;
+ nu ;
+ nut ;
+ }
+ \endverbatim
+
+ where the entries mean:
+ \table
+ Property | Description | Type | Reqd | Deflt
+ model | Model name: CelikNuIndex | word | yes | -
+ alphaNu | Empirical constant | scalar | no | 0.05
+ n | Empirical exponent | scalar | no | 0.53
+ Cnu | Empirical constant | scalar | no | 0.1
+ Cn | Empirical constant | scalar | no | 1.0
+ k | Name of subgrid-scale turbulent kinetic energy field | word | no | k
+ delta | Name of filter field | word | no | delta
+ nu | Name of kinematic viscosity field | word | no | nu
+ nut | Name of subgrid-scale eddy viscosity field | word | no | nut
+ \endtable
+
+SourceFiles
+ CelikNuIndex.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef Foam_resolutionIndexModels_CelikNuIndex_H
+#define Foam_resolutionIndexModels_CelikNuIndex_H
+
+#include "resolutionIndexModel.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace resolutionIndexModels
+{
+
+/*---------------------------------------------------------------------------*\
+ Class CelikNuIndex Declaration
+\*---------------------------------------------------------------------------*/
+
+class CelikNuIndex
+:
+ public resolutionIndexModel
+{
+ // Private Data
+
+ //- Empirical constant
+ scalar alphaNu_;
+
+ //- Empirical exponent
+ scalar n_;
+
+ //- Empirical constant
+ scalar Cnu_;
+
+ //- Empirical constant
+ scalar Cn_;
+
+ //- Name of subgrid-scale turbulent kinetic energy field
+ word kName_;
+
+ //- Name of filter field
+ word deltaName_;
+
+ //- Name of kinematic viscosity field
+ word nuName_;
+
+ //- Name of subgrid-scale eddy viscosity field
+ word nutName_;
+
+
+ // Private Member Functions
+
+ //- Return numerical eddy viscosity field
+ tmp nuNum() const;
+
+ //- Return numerical turbulent kinetic energy field
+ tmp kNum() const;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("CelikNuIndex");
+
+
+ // Constructors
+
+ //- Construct from components
+ CelikNuIndex
+ (
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+ );
+
+ //- No copy construct
+ CelikNuIndex(const CelikNuIndex&) = delete;
+
+ //- No copy assignment
+ void operator=(const CelikNuIndex&) = delete;
+
+
+ // Destructor
+ virtual ~CelikNuIndex() = default;
+
+
+ // Member Functions
+
+ //- Read top-level dictionary
+ virtual bool read(const dictionary& dict);
+
+ //- Calculate the result field
+ virtual bool execute();
+
+ //- Write the result field
+ virtual bool write();
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace resolutionIndexModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/PopeIndex/PopeIndex.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/PopeIndex/PopeIndex.C
new file mode 100644
index 0000000000..d5ab7c8fb7
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/PopeIndex/PopeIndex.C
@@ -0,0 +1,146 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 "PopeIndex.H"
+#include "resolutionIndexModel.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace resolutionIndexModels
+{
+ defineTypeNameAndDebug(PopeIndex, 0);
+ addToRunTimeSelectionTable(resolutionIndexModel, PopeIndex, dictionary);
+}
+}
+
+
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+Foam::tmp
+Foam::resolutionIndexModels::PopeIndex::kNum() const
+{
+ const auto& kSgs = getOrReadField(kName_);
+ const auto& Delta = getOrReadField(deltaName_);
+
+ tmp th = cbrt(V());
+
+ // (CKJ:Eq. 28)
+ return Cn_*sqr(th/Delta)*kSgs;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::resolutionIndexModels::PopeIndex::PopeIndex
+(
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+)
+:
+ resolutionIndexModel(name, mesh, dict),
+ includeKnum_(),
+ Cn_(),
+ UName_(),
+ UMeanName_(),
+ kName_(),
+ deltaName_()
+{
+ read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+bool Foam::resolutionIndexModels::PopeIndex::read(const dictionary& dict)
+{
+ if (!resolutionIndexModel::read(dict))
+ {
+ return false;
+ }
+
+ includeKnum_ = dict.getOrDefault("includeKnum", true);
+ if (includeKnum_)
+ {
+ Cn_ = dict.getOrDefault("Cnu", 1.0);
+ }
+ UName_ = dict.getOrDefault("U", "U");
+ UMeanName_ = dict.getOrDefault("UMean", "UMean");
+ kName_ = dict.getOrDefault("k", "k");
+ deltaName_ = dict.getOrDefault("delta", "delta");
+
+ return true;
+}
+
+
+bool Foam::resolutionIndexModels::PopeIndex::execute()
+{
+ // Calculate resolved k field
+ const auto& U = getOrReadField(UName_);
+ const auto& UMean = getOrReadField(UMeanName_);
+ const volScalarField kRes(0.5*magSqr(U - UMean));
+
+ // Calculate subgrid-scale k field
+ const auto& kSgs = getOrReadField(kName_);
+
+ // Calculate total k field
+ tmp tkTot = kRes + kSgs;
+ if (includeKnum_)
+ {
+ tkTot.ref() += mag(kNum());
+ }
+
+
+ // Calculate index field
+ auto& index = getOrReadField(resultName());
+
+ const dimensionedScalar kMin(kSgs.dimensions(), SMALL);
+
+ // (P:p. 560;CKJ:Eq. 11)
+ index = kRes/max(kMin, tkTot);
+ index.correctBoundaryConditions();
+
+ return true;
+}
+
+
+bool Foam::resolutionIndexModels::PopeIndex::write()
+{
+ const auto& index = getOrReadField(resultName());
+
+ Info<< tab << "writing field:" << index.name() << endl;
+
+ index.write();
+
+ return true;
+}
+
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/PopeIndex/PopeIndex.H b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/PopeIndex/PopeIndex.H
new file mode 100644
index 0000000000..0f358dcdc2
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/PopeIndex/PopeIndex.H
@@ -0,0 +1,237 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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::resolutionIndexModels::PopeIndex
+
+Description
+ Computes a single-mesh resolution index according to Pope's index,
+ which is used as a LES/DES quality/post-verification metric that does
+ not require any experimental or DNS data.
+
+ \f[
+ \Gamma_{Pope}(\mathbf{x}, t) = \frac{k_{res}}{k_{tot}}
+ \f]
+
+ with
+
+ \f[
+ k_{tot} = k_{res} + k_{sgs} + |k_{num}|
+ \f]
+
+ where
+ \vartable
+ \Gamma_{Pope}(\mathbf{x}, t) | Pope's index [-]
+ k_{tot} | Total turbulent kinetic energy [m^2/s^2]
+ k_{res} | Resolved turbulent kinetic energy [m^2/s^2]
+ k_{sgs} | Subgrid-scale turbulent kinetic energy [m^2/s^2]
+ k_{num} | Numerical turbulent kinetic energy [m^2/s^2]
+ \endvartable
+
+ Inclusion of \f$k_{num}\f$ is optional, and set as \c true by default:
+
+ \f[
+ k_{num} = C_n \left(\frac{h}{\Delta}\right)^2 k_{sgs}
+ \f]
+
+ where
+ \vartable
+ C_n | Empirical constant [-]
+ h | Characteristic length scale with \f$h = V^{1/3} \f$ [m]
+ V | Cell volume [m^3]
+ \Delta | Filter length scale [m]
+ \endvartable
+
+ Typical criterion for acceptable-quality resolution:
+
+ \f[
+ \Gamma_{Pope}(\mathbf{x}) \geq 0.8
+ \f]
+
+ Required fields:
+ \verbatim
+ U | Velocity [m/s]
+ UMean | Mean velocity [m/s]
+ k | Subgrid-scale turbulent kinetic energy [m^2/s^2]
+ delta | Filter length [m]
+ \endverbatim
+
+ References:
+ \verbatim
+ Governing equation (tag:P):
+ Pope, S. B. (2000).
+ Turbulent flows.
+ Cambridge, UK: Cambridge Univ. Press
+ DOI:10.1017/CBO9780511840531
+
+ Governing equations for the denominator kNum term (tag:CKJ):
+ Celik, I., Klein, M., & Janicka, J. (2009).
+ Assessment measures for engineering LES applications.
+ Journal of fluids engineering, 131(3).
+ DOI:10.1115/1.3059703
+ \endverbatim
+
+Usage
+ Minimal example by using \c system/controlDict.functions:
+ \verbatim
+ resolutionIndex1
+ {
+ // Inherited entries
+ ...
+ model PopeIndex;
+
+ // Optional entries
+ U ;
+ UMean ;
+ k ;
+ delta ;
+ includeKnum ;
+
+ // Conditional entries
+ // when includeKnum = true
+ Cn ;
+ }
+ \endverbatim
+
+ where the entries mean:
+ \table
+ Property | Description | Type | Reqd | Deflt
+ model | Model name: PopeIndex | word | yes | -
+ U | Name of velocity field | word | no | U
+ UMean | Name of mean velocity field | word | no | UMean
+ k | Name of subgrid-scale turbulent kinetic energy field | word | no | k
+ delta | Name of filter field | word | no | delta
+ includeKnum | Flag to include numerical k field | bool | no | true
+ Cn | Empirical constant | choice | no | 1.0
+ \endtable
+
+Note
+ - Some studies measured \f$\Gamma_{Pope} > 1\f$ with \f$k_{res}\f$ comparisons
+ between a LES and a corresponding filtered DNS. Nonphysical results may
+ occur.
+
+SourceFiles
+ PopeIndex.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef Foam_resolutionIndexModels_PopeIndex_H
+#define Foam_resolutionIndexModels_PopeIndex_H
+
+#include "resolutionIndexModel.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace resolutionIndexModels
+{
+
+/*---------------------------------------------------------------------------*\
+ Class PopeIndex Declaration
+\*---------------------------------------------------------------------------*/
+
+class PopeIndex
+:
+ public resolutionIndexModel
+{
+ // Private Data
+
+ //- Flag to include numerical turbulent kinetic energy field
+ bool includeKnum_;
+
+ //- Empirical constant in numerical turbulent kinetic energy estimation
+ scalar Cn_;
+
+ //- Name of velocity field
+ word UName_;
+
+ //- Name of mean velocity field
+ word UMeanName_;
+
+ //- Name of subgrid-scale turbulent kinetic energy field
+ word kName_;
+
+ //- Name of filter field
+ word deltaName_;
+
+
+ // Private Member Functions
+
+ //- Return numerical turbulent kinetic energy field
+ tmp kNum() const;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("PopeIndex");
+
+
+ // Constructors
+
+ //- Construct from components
+ PopeIndex
+ (
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+ );
+
+ //- No copy construct
+ PopeIndex(const PopeIndex&) = delete;
+
+ //- No copy assignment
+ void operator=(const PopeIndex&) = delete;
+
+
+ // Destructor
+ virtual ~PopeIndex() = default;
+
+
+ // Member Functions
+
+ //- Read top-level dictionary
+ virtual bool read(const dictionary& dict);
+
+ //- Calculate the result field
+ virtual bool execute();
+
+ //- Write the result field
+ virtual bool write();
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace resolutionIndexModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C
new file mode 100644
index 0000000000..0255a9b58c
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C
@@ -0,0 +1,117 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 "resolutionIndexModel.H"
+#include "fvMesh.H"
+#include "ListOps.H"
+#include "turbulenceFields.H"
+#include "turbulenceModel.H"
+#include "zeroGradientFvPatchFields.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineTypeNameAndDebug(resolutionIndexModel, 0);
+ defineRunTimeSelectionTable(resolutionIndexModel, dictionary);
+}
+
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+Foam::tmp Foam::resolutionIndexModel::V() const
+{
+ auto tV = tmp::New
+ (
+ IOobject
+ (
+ "V",
+ mesh_.time().timeName(),
+ mesh_,
+ IOobject::NO_READ,
+ IOobject::NO_WRITE,
+ false
+ ),
+ mesh_,
+ dimVolume,
+ zeroGradientFvPatchScalarField::typeName
+ );
+
+ tV.ref().primitiveFieldRef() = mesh_.V();
+ tV.ref().correctBoundaryConditions();
+
+ return tV;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::resolutionIndexModel::resolutionIndexModel
+(
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+)
+:
+ mesh_(mesh),
+ resultName_(word::null)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+bool Foam::resolutionIndexModel::read(const dictionary& dict)
+{
+ resultName_ = dict.getOrDefault("result", type());
+
+ auto* indexPtr = mesh_.getObjectPtr(resultName_);
+
+ if (!indexPtr)
+ {
+ indexPtr = new volScalarField
+ (
+ IOobject
+ (
+ resultName_,
+ mesh_.time().timeName(),
+ mesh_,
+ IOobject::READ_IF_PRESENT,
+ IOobject::NO_WRITE
+ ),
+ mesh_,
+ dimensionedScalar(dimless, Zero),
+ zeroGradientFvPatchScalarField::typeName
+ );
+
+ mesh_.objectRegistry::store(indexPtr);
+ }
+
+ return true;
+}
+
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.H b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.H
new file mode 100644
index 0000000000..5d73ca86f9
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.H
@@ -0,0 +1,183 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 .
+
+Namespace
+ Foam::resolutionIndexModels
+
+Description
+ A namespace for various \c resolutionIndex model implementations.
+
+Class
+ Foam::resolutionIndexModel
+
+Description
+ A base class for \c resolutionIndex models.
+
+SourceFiles
+ resolutionIndexModel.C
+ resolutionIndexModelNew.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef Foam_resolutionIndexModel_H
+#define Foam_resolutionIndexModel_H
+
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward Declarations
+class fvMesh;
+
+/*---------------------------------------------------------------------------*\
+ Class resolutionIndexModel Declaration
+\*---------------------------------------------------------------------------*/
+
+class resolutionIndexModel
+{
+ // Private Data
+
+ //- Const reference to the mesh
+ const fvMesh& mesh_;
+
+ //- Name of result field
+ word resultName_;
+
+
+protected:
+
+ // Protected Member Functions
+
+ //- Return requested field from the object registry
+ //- or read+register the field to the object registry
+ template
+ GeoFieldType& getOrReadField(const word& fieldName) const;
+
+ //- Return cell volume field
+ tmp V() const;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("resolutionIndexModel");
+
+
+ // Declare runtime constructor selection table
+
+ declareRunTimeSelectionTable
+ (
+ autoPtr,
+ resolutionIndexModel,
+ dictionary,
+ (
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+ ),
+ (name, mesh, dict)
+ );
+
+
+ // Selectors
+
+ //- Return a reference to the selected resolutionIndex model
+ static autoPtr New
+ (
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+ );
+
+
+ // Constructors
+
+ //- Construct from components
+ resolutionIndexModel
+ (
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+ );
+
+ //- No copy construct
+ resolutionIndexModel(const resolutionIndexModel&) = delete;
+
+ //- No copy assignment
+ void operator=(const resolutionIndexModel&) = delete;
+
+
+ //- Destructor
+ virtual ~resolutionIndexModel() = default;
+
+
+ // Member Functions
+
+ // Access
+
+ //- Return const reference to the mesh
+ const fvMesh& mesh() const noexcept
+ {
+ return mesh_;
+ }
+
+ //- Return const reference to the result name
+ const word& resultName() const noexcept
+ {
+ return resultName_;
+ }
+
+
+ // I-O
+
+ //- Read top-level dictionary
+ virtual bool read(const dictionary& dict);
+
+ //- Calculate the result field
+ virtual bool execute() = 0;
+
+ //- Write the result field
+ virtual bool write() = 0;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+ #include "resolutionIndexModelTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelNew.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelNew.C
new file mode 100644
index 0000000000..5b42b986e8
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelNew.C
@@ -0,0 +1,61 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 "resolutionIndexModel.H"
+#include "fvMesh.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+Foam::autoPtr Foam::resolutionIndexModel::New
+(
+ const word& name,
+ const fvMesh& mesh,
+ const dictionary& dict
+)
+{
+ const word modelType(dict.get("model"));
+
+ Info<< " Selecting model: " << modelType << nl << endl;
+
+ auto* ctorPtr = dictionaryConstructorTable(modelType);
+
+ if (!ctorPtr)
+ {
+ FatalIOErrorInLookup
+ (
+ dict,
+ "resolutionIndexModel",
+ modelType,
+ *dictionaryConstructorTablePtr_
+ ) << exit(FatalIOError);
+ }
+
+ return autoPtr(ctorPtr(name, mesh, dict));
+}
+
+
+// ************************************************************************* //
diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelTemplates.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelTemplates.C
new file mode 100644
index 0000000000..61e494e74a
--- /dev/null
+++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelTemplates.C
@@ -0,0 +1,62 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2022 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 "resolutionIndexModel.H"
+#include "volFields.H"
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+template
+GeoFieldType& Foam::resolutionIndexModel::getOrReadField
+(
+ const word& fieldName
+) const
+{
+ auto* ptr = mesh_.getObjectPtr(fieldName);
+
+ if (!ptr)
+ {
+ ptr = new GeoFieldType
+ (
+ IOobject
+ (
+ fieldName,
+ mesh_.time().timeName(),
+ mesh_,
+ IOobject::MUST_READ,
+ IOobject::AUTO_WRITE
+ ),
+ mesh_
+ );
+ mesh_.objectRegistry::store(ptr);
+ }
+
+ return *ptr;
+}
+
+
+// ************************************************************************* //