From 0302ba4418ba266e308fa4683d0ea06b0ba9071d Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 14 Sep 2022 14:57:53 +0200 Subject: [PATCH] ENH: construct fa::options from fvMesh instead of fvPatch - these were previously constructing from an fvPatch (for simpler integration with regionFaModel) but this unnecessarily restricts the finiteArea to a single volume patch. - adjusted derived faOptions to support multiple patches --- .../corrections/limitVelocity/limitVelocity.C | 4 +- .../corrections/limitVelocity/limitVelocity.H | 4 +- src/faOptions/faOption/faOption.C | 13 ++-- src/faOptions/faOption/faOption.H | 30 ++++----- src/faOptions/faOption/faOptionI.H | 6 -- src/faOptions/faOption/faOptionList.C | 13 ++-- src/faOptions/faOption/faOptionList.H | 13 ++-- src/faOptions/faOption/faOptions.C | 14 ++--- src/faOptions/faOption/faOptions.H | 10 +-- src/faOptions/faceSetOption/faceSetOption.C | 4 +- src/faOptions/faceSetOption/faceSetOption.H | 2 +- .../contactHeatFluxSource.C | 62 +++++++++++++++---- .../contactHeatFluxSource.H | 56 +++++++++-------- .../externalFileSource/externalFileSource.C | 59 +++++++++++++----- .../externalFileSource/externalFileSource.H | 4 +- .../externalHeatFluxSource.C | 4 +- .../externalHeatFluxSource.H | 2 +- .../jouleHeatingSource/jouleHeatingSource.C | 4 +- .../jouleHeatingSource/jouleHeatingSource.H | 8 +-- .../liquidFilm/liquidFilmBase.C | 4 +- .../thermalShellModel/thermalShellModel.C | 4 +- .../vibrationShellModel/vibrationShellModel.C | 4 +- 22 files changed, 189 insertions(+), 135 deletions(-) diff --git a/src/faOptions/corrections/limitVelocity/limitVelocity.C b/src/faOptions/corrections/limitVelocity/limitVelocity.C index 186205ce64..e9c686e127 100644 --- a/src/faOptions/corrections/limitVelocity/limitVelocity.C +++ b/src/faOptions/corrections/limitVelocity/limitVelocity.C @@ -52,10 +52,10 @@ Foam::fa::limitVelocity::limitVelocity const word& name, const word& modelType, const dictionary& dict, - const fvPatch& patch + const fvMesh& mesh ) : - faceSetOption(name, modelType, dict, patch), + faceSetOption(name, modelType, dict, mesh), UName_(coeffs_.getOrDefault("U", "U")), max_(coeffs_.get("max")) { diff --git a/src/faOptions/corrections/limitVelocity/limitVelocity.H b/src/faOptions/corrections/limitVelocity/limitVelocity.H index c4abb1c8d5..c00df0b607 100644 --- a/src/faOptions/corrections/limitVelocity/limitVelocity.H +++ b/src/faOptions/corrections/limitVelocity/limitVelocity.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -110,7 +110,7 @@ public: const word& name, const word& modelType, const dictionary& dict, - const fvPatch& patch + const fvMesh& mesh ); //- No copy construct diff --git a/src/faOptions/faOption/faOption.C b/src/faOptions/faOption/faOption.C index e95fd30c44..079c1db011 100644 --- a/src/faOptions/faOption/faOption.C +++ b/src/faOptions/faOption/faOption.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,13 +56,12 @@ Foam::fa::option::option const word& name, const word& modelType, const dictionary& dict, - const fvPatch& patch + const fvMesh& mesh ) : name_(name), modelType_(modelType), - mesh_(patch.boundaryMesh().mesh()), - patch_(patch), + mesh_(mesh), dict_(dict), coeffs_(dict.optionalSubDict(modelType + "Coeffs")), fieldNames_(), @@ -83,7 +82,7 @@ Foam::autoPtr Foam::fa::option::New ( const word& name, const dictionary& coeffs, - const fvPatch& patch + const fvMesh& mesh ) { const word modelType(coeffs.get("type")); @@ -91,7 +90,7 @@ Foam::autoPtr Foam::fa::option::New Info<< indent << "Selecting finite area options type " << modelType << endl; - patch.boundaryMesh().mesh().time().libs().open + mesh.time().libs().open ( coeffs, "libs", @@ -111,7 +110,7 @@ Foam::autoPtr Foam::fa::option::New ) << exit(FatalIOError); } - return autoPtr(ctorPtr(name, modelType, coeffs, patch)); + return autoPtr(ctorPtr(name, modelType, coeffs, mesh)); } diff --git a/src/faOptions/faOption/faOption.H b/src/faOptions/faOption/faOption.H index 8e55e5c29a..40ab0a3e80 100644 --- a/src/faOptions/faOption/faOption.H +++ b/src/faOptions/faOption/faOption.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,8 +72,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Foam_faOption_H -#define Foam_faOption_H +#ifndef Foam_fa_option_H +#define Foam_fa_option_H #include "faMatricesFwd.H" #include "areaFieldsFwd.H" @@ -114,9 +114,6 @@ protected: //- Reference to the mesh database const fvMesh& mesh_; - //- Reference to the patch - const fvPatch& patch_; - //- Top level source dictionary dictionary dict_; @@ -174,9 +171,9 @@ public: const word& name, const word& modelType, const dictionary& dict, - const fvPatch& patch + const fvMesh& mesh ), - (name, modelType, dict, patch) + (name, modelType, dict, mesh) ); @@ -188,7 +185,7 @@ public: const word& name, const word& modelType, const dictionary& dict, - const fvPatch& patch + const fvMesh& mesh ); //- Return clone @@ -202,8 +199,8 @@ public: //- on the freestore from an Istream class iNew { - //- Reference to the patch - const fvPatch& patch_; + //- Reference to the mesh + const fvMesh& mesh_; //- Name const word& name_; @@ -212,11 +209,11 @@ public: iNew ( - const fvPatch& patch, + const fvMesh& mesh, const word& name ) : - patch_(patch), + mesh_(mesh), name_(name) {} @@ -226,7 +223,7 @@ public: return autoPtr