From a1d6d552a35c4236d4400bc81bcbe2e079fcf4a2 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 4 Apr 2024 11:01:19 +0100 Subject: [PATCH] physicalProperties: Generalise usage This class is no longer pure virtual, and can be constructed for any object registry. This means it can be used as a generic physical properties dictionary, as well as being derived into more specific contexts (i.e., finite-volume viscosity and thermodynamic models). --- .../physicalProperties/physicalProperties.C | 9 +++++---- .../physicalProperties/physicalProperties.H | 12 +++++------- .../basic/PhysicalPropertiesThermo.H | 5 ++++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/physicalProperties/physicalProperties/physicalProperties.C b/src/physicalProperties/physicalProperties/physicalProperties.C index c943e2144b..29e1ec46e5 100644 --- a/src/physicalProperties/physicalProperties/physicalProperties.C +++ b/src/physicalProperties/physicalProperties/physicalProperties.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,7 +24,8 @@ License \*---------------------------------------------------------------------------*/ #include "physicalProperties.H" -#include "fvMesh.H" +#include "objectRegistry.H" +#include "Time.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -102,11 +103,11 @@ Foam::IOobject Foam::physicalProperties::findModelDict Foam::physicalProperties::physicalProperties ( - const fvMesh& mesh, + const objectRegistry& obr, const word& group ) : - IOdictionary(findModelDict(mesh, group, true)) + IOdictionary(findModelDict(obr, group, true)) { // Ensure name of IOdictionary is typeName rename(IOobject::groupName(physicalProperties::typeName, group)); diff --git a/src/physicalProperties/physicalProperties/physicalProperties.H b/src/physicalProperties/physicalProperties/physicalProperties.H index 5125804863..05543609ad 100644 --- a/src/physicalProperties/physicalProperties/physicalProperties.H +++ b/src/physicalProperties/physicalProperties/physicalProperties.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::physicalProperties Description - An abstract base class for physical properties. + A base class for physical properties. SourceFiles physicalProperties.C @@ -42,9 +42,6 @@ SourceFiles namespace Foam { -// Forward declaration of classes -class fvMesh; - /*---------------------------------------------------------------------------*\ Class physicalProperties Declaration \*---------------------------------------------------------------------------*/ @@ -63,7 +60,7 @@ public: // Constructors //- Construct from components - physicalProperties(const fvMesh& mesh, const word& group); + physicalProperties(const objectRegistry& obr, const word& group); //- Disallow default bitwise copy construction physicalProperties(const physicalProperties&) = delete; @@ -76,6 +73,7 @@ public: // Member Functions + //- Find the physicalProperties dictionary and return the IOobject static IOobject findModelDict ( const objectRegistry& obr, @@ -84,7 +82,7 @@ public: ); //- Read physicalProperties dictionary - virtual bool read() = 0; + virtual bool read(); // Member Operators diff --git a/src/thermophysicalModels/basic/PhysicalPropertiesThermo.H b/src/thermophysicalModels/basic/PhysicalPropertiesThermo.H index ce0ee1b409..fb3c689a47 100644 --- a/src/thermophysicalModels/basic/PhysicalPropertiesThermo.H +++ b/src/thermophysicalModels/basic/PhysicalPropertiesThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,6 +40,9 @@ Description namespace Foam { +// Forward declaration of classes +class fvMesh; + /*---------------------------------------------------------------------------*\ Class PhysicalPropertiesThermo Declaration \*---------------------------------------------------------------------------*/