diff --git a/src/finiteArea/faMesh/faMesh.C b/src/finiteArea/faMesh/faMesh.C index 8e09506272..cfb9e1608c 100644 --- a/src/finiteArea/faMesh/faMesh.C +++ b/src/finiteArea/faMesh/faMesh.C @@ -344,13 +344,18 @@ bool Foam::faMesh::init(const bool doInit) Foam::faMesh::faMesh(const polyMesh& pMesh, const Foam::zero) : - faMesh(pMesh, labelList(), static_cast(pMesh)) + faMesh(pMesh, labelList(), static_cast(pMesh)) {} Foam::faMesh::faMesh(const faMesh& baseMesh, const Foam::zero) : - faMesh(baseMesh, labelList()) + faMesh + ( + baseMesh, + labelList(), + IOobjectOption(IOobjectOption::NO_READ, IOobjectOption::NO_WRITE) + ) {} @@ -471,7 +476,12 @@ Foam::faMesh::faMesh labelList&& faceLabels ) : - faMesh(pMesh, std::move(faceLabels), static_cast(pMesh)) + faMesh + ( + pMesh, + std::move(faceLabels), + static_cast(pMesh) + ) {} @@ -479,13 +489,13 @@ Foam::faMesh::faMesh ( const polyMesh& pMesh, labelList&& faceLabels, - const IOobject& io + IOobjectOption ioOpt ) : MeshObject(pMesh), - faSchemes(mesh(), io.readOpt()), + faSchemes(mesh(), ioOpt.readOpt()), edgeInterpolation(*this), - faSolution(mesh(), io.readOpt()), + faSolution(mesh(), ioOpt.readOpt()), faceLabels_ ( IOobject @@ -553,20 +563,23 @@ Foam::faMesh::faMesh Foam::faMesh::faMesh ( const faMesh& baseMesh, - labelList&& faceLabels + labelList&& faceLabels, + IOobjectOption ioOpt ) : MeshObject(baseMesh.mesh()), faSchemes ( - mesh(), - static_cast(baseMesh) + faMesh::thisDb(), + ioOpt.readOpt(), + static_cast(baseMesh.hasSchemes()) ), edgeInterpolation(*this), faSolution ( - mesh(), - static_cast(baseMesh) + faMesh::thisDb(), + ioOpt.readOpt(), + static_cast(baseMesh.hasSolution()) ), faceLabels_ ( @@ -740,6 +753,42 @@ Foam::faMesh::~faMesh() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const Foam::faSchemes* Foam::faMesh::hasSchemes() const +{ + return static_cast(this); +} + + +const Foam::faSolution* Foam::faMesh::hasSolution() const +{ + return static_cast(this); +} + + +const Foam::faSchemes& Foam::faMesh::schemes() const +{ + return static_cast(*this); +} + + +Foam::faSchemes& Foam::faMesh::schemes() +{ + return static_cast(*this); +} + + +const Foam::faSolution& Foam::faMesh::solution() const +{ + return static_cast(*this); +} + + +Foam::faSolution& Foam::faMesh::solution() +{ + return static_cast(*this); +} + + Foam::fileName Foam::faMesh::meshDir() const { return mesh().dbDir()/faMesh::meshSubDir; diff --git a/src/finiteArea/faMesh/faMesh.H b/src/finiteArea/faMesh/faMesh.H index 49d35817f2..ce875b9a79 100644 --- a/src/finiteArea/faMesh/faMesh.H +++ b/src/finiteArea/faMesh/faMesh.H @@ -534,29 +534,38 @@ public: faMesh(const polyMesh& pMesh, const Foam::zero); //- Construct as copy (for dictionaries) and zero-sized - //- without boundary, using IOobject properties from polyMesh. + //- without boundary. // Boundary is added using addFaPatches() member function faMesh(const faMesh& baseMesh, const Foam::zero); //- Construct as copy (for dictionaries) and faceLabels - //- without boundary, using IOobject properties from polyMesh. + //- without boundary, using read properties from baseMesh. // Boundary is added using addFaPatches() member function faMesh(const faMesh& baseMesh, labelList&& faceLabels); + //- Construct as copy (for dictionaries) and faceLabels + //- without boundary, using specified read properties. + // Boundary is added using addFaPatches() member function. + faMesh + ( + const faMesh& baseMesh, + labelList&& faceLabels, + IOobjectOption ioOpt + ); + //- Construct from components (face labels) without boundary, //- using IOobject properties from polyMesh. // Boundary is added using addFaPatches() member function. faMesh(const polyMesh& pMesh, labelList&& faceLabels); //- Construct from components (face labels) without boundary, - //- using alternative IOobject properties - //- (primarily the readOption). + //- using specified read properties. // Boundary is added using addFaPatches() member function. faMesh ( const polyMesh& pMesh, labelList&& faceLabels, - const IOobject& io + IOobjectOption ioOpt ); //- Construct from single polyPatch @@ -672,6 +681,27 @@ public: const faGlobalMeshData& globalData() const; + // Solution Control + + //- Non-null if faSchemes exists (can test as bool). + const faSchemes* hasSchemes() const; + + //- Non-null if faSolution exists (can test as bool). + const faSolution* hasSolution() const; + + //- Read-access to the faSchemes controls + const faSchemes& schemes() const; + + //- Read/write-access to the faSchemes controls + faSchemes& schemes(); + + //- Read-access to the faSolution controls + const faSolution& solution() const; + + //- Read/write-access to the faSolution controls + faSolution& solution(); + + // Access: Mesh size parameters //- Number of local mesh points diff --git a/src/finiteArea/faSolution/faSolution.H b/src/finiteArea/faSolution/faSolution.H index 3320150cfb..ded55b7431 100644 --- a/src/finiteArea/faSolution/faSolution.H +++ b/src/finiteArea/faSolution/faSolution.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -106,6 +106,19 @@ public: solution(obr, rOpt, "faSolution", fallback) {} + //- Construct for objectRegistry, readOption with the + //- default dictionary name ("faSolution") and + //- fallback dictionary content. + faSolution + ( + const objectRegistry& obr, + IOobjectOption::readOption rOpt, + const dictionary& dict + ) + : + solution(obr, rOpt, "faSolution", &dict) + {} + //- Construct for objectRegistry with the //- default dictionary name ("faSolution"). // Uses the readOption from the registry. diff --git a/src/finiteArea/finiteArea/faSchemes/faSchemes.H b/src/finiteArea/finiteArea/faSchemes/faSchemes.H index 43cc914034..8647069ad3 100644 --- a/src/finiteArea/finiteArea/faSchemes/faSchemes.H +++ b/src/finiteArea/finiteArea/faSchemes/faSchemes.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -106,6 +106,19 @@ public: schemesLookup(obr, rOpt, "faSchemes", fallback) {} + //- Construct for objectRegistry, readOption with the + //- default dictionary name ("faSchemes") and + //- fallback dictionary content. + faSchemes + ( + const objectRegistry& obr, + IOobjectOption::readOption rOpt, + const dictionary& dict + ) + : + schemesLookup(obr, rOpt, "faSchemes", &dict) + {} + //- Construct for objectRegistry with the //- default dictionary name ("faSchemes"). // Uses the readOption from the registry. diff --git a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.H b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.H index fe49cd9092..a77dea6e4a 100644 --- a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.H +++ b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2020-2022 OpenCFD Ltd. + Copyright (C) 2020-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -106,6 +106,19 @@ public: schemesLookup(obr, rOpt, "fvSchemes", fallback) {} + //- Construct for objectRegistry, readOption with the + //- default dictionary name ("fvSchemes") and + //- fallback dictionary content. + fvSchemes + ( + const objectRegistry& obr, + IOobjectOption::readOption rOpt, + const dictionary& dict + ) + : + schemesLookup(obr, rOpt, "fvSchemes", &dict) + {} + //- Construct for objectRegistry with the //- default dictionary name ("fvSchemes"). // Uses the readOption from the registry. diff --git a/src/finiteVolume/finiteVolume/fvSolution/fvSolution.H b/src/finiteVolume/finiteVolume/fvSolution/fvSolution.H index f41ea679f5..e82cfc1edb 100644 --- a/src/finiteVolume/finiteVolume/fvSolution/fvSolution.H +++ b/src/finiteVolume/finiteVolume/fvSolution/fvSolution.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2020-2022 OpenCFD Ltd. + Copyright (C) 2020-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -107,6 +107,19 @@ public: solution(obr, rOpt, "fvSolution", fallback) {} + //- Construct for objectRegistry, readOption with the + //- default dictionary name ("fvSolution") and + //- fallback dictionary content. + fvSolution + ( + const objectRegistry& obr, + IOobjectOption::readOption rOpt, + const dictionary& dict + ) + : + solution(obr, rOpt, "fvSolution", &dict) + {} + //- Construct for objectRegistry with the //- default dictionary name ("fvSolution"). // Uses the readOption from the registry. diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 6e175c400a..3b8de62d6a 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -485,13 +485,15 @@ Foam::fvMesh::fvMesh fvSchemes ( static_cast(*this), - static_cast(baseMesh) + io.readOpt(), + static_cast(baseMesh.hasSchemes()) ), surfaceInterpolation(*this), fvSolution ( static_cast(*this), - static_cast(baseMesh) + io.readOpt(), + static_cast(baseMesh.hasSolution()) ), boundary_(*this), lduPtr_(nullptr), @@ -533,13 +535,15 @@ Foam::fvMesh::fvMesh fvSchemes ( static_cast(*this), - static_cast(baseMesh) + io.readOpt(), + static_cast(baseMesh.hasSchemes()) ), surfaceInterpolation(*this), fvSolution ( static_cast(*this), - static_cast(baseMesh) + io.readOpt(), + static_cast(baseMesh.hasSolution()) ), boundary_(*this), lduPtr_(nullptr), @@ -570,6 +574,42 @@ Foam::fvMesh::~fvMesh() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const Foam::fvSchemes* Foam::fvMesh::hasSchemes() const +{ + return static_cast(this); +} + + +const Foam::fvSolution* Foam::fvMesh::hasSolution() const +{ + return static_cast(this); +} + + +const Foam::fvSchemes& Foam::fvMesh::schemes() const +{ + return static_cast(*this); +} + + +Foam::fvSchemes& Foam::fvMesh::schemes() +{ + return static_cast(*this); +} + + +const Foam::fvSolution& Foam::fvMesh::solution() const +{ + return static_cast(*this); +} + + +Foam::fvSolution& Foam::fvMesh::solution() +{ + return static_cast(*this); +} + + Foam::SolverPerformance Foam::fvMesh::solve ( fvMatrix& m, diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 258401694f..869016e6a5 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -332,6 +332,27 @@ public: } + // Solution Control + + //- Non-null if fvSchemes exists (can test as bool). + const fvSchemes* hasSchemes() const; + + //- Non-null if fvSolution exists (can test as bool). + const fvSolution* hasSolution() const; + + //- Read-access to the fvSchemes controls + const fvSchemes& schemes() const; + + //- Read/write-access to the fvSchemes controls + fvSchemes& schemes(); + + //- Read-access to the fvSolution controls + const fvSolution& solution() const; + + //- Read/write-access to the fvSolution controls + fvSolution& solution(); + + // Overlap //- Interpolate interpolationCells only diff --git a/tutorials/incompressible/pimpleFoam/laminar/filmPanel0/Allrun-parallel b/tutorials/incompressible/pimpleFoam/laminar/filmPanel0/Allrun-parallel index 0665508cae..19064021bc 100755 --- a/tutorials/incompressible/pimpleFoam/laminar/filmPanel0/Allrun-parallel +++ b/tutorials/incompressible/pimpleFoam/laminar/filmPanel0/Allrun-parallel @@ -3,6 +3,9 @@ cd "${0%/*}" || exit # Run from this directory . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions #------------------------------------------------------------------------------ +unset fileHandler +fileHandler="-fileHandler collated" + restore0Dir runApplication blockMesh @@ -15,19 +18,20 @@ then runApplication makeFaMesh - runApplication decomposePar + runApplication decomposePar $fileHandler else # Additional steps (to exercise some functionality) - runParallel $decompDict -s decompose redistributePar -decompose + runParallel $decompDict -s decompose redistributePar -decompose \ + -no-finite-area $fileHandler - runParallel $decompDict makeFaMesh + runParallel $decompDict makeFaMesh $fileHandler - runParallel -s redistribute redistributePar -overwrite + runParallel -s redistribute redistributePar -overwrite $fileHandler fi -runParallel $(getApplication) +runParallel $(getApplication) $fileHandler #------------------------------------------------------------------------------