diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C index 71324652b2f70163c0334ecba6241033fa642ed1..4be69297f84a7a449cc3811ab2297cde21988b9d 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C @@ -69,7 +69,8 @@ Foam::valuePointPatchField<Type>::valuePointPatchField else { FatalIOErrorInFunction(dict) - << "Essential entry 'value' missing on patch " << p.name() + << "Essential entry 'value' missing on patch " + << p.name() << endl << exit(FatalIOError); } } diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C index cc4490fe85b2d6282ffc862713673b7b928d95cd..1ec83dd17af73cdf7ca9d45de1a12413c9ec7f50 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C @@ -42,7 +42,7 @@ Foam::pointPatchField<Type>::pointPatchField patch_(p), internalField_(iF), updated_(false), - patchType_(word::null) + patchType_() {} @@ -57,8 +57,10 @@ Foam::pointPatchField<Type>::pointPatchField patch_(p), internalField_(iF), updated_(false), - patchType_(dict.getOrDefault<word>("patchType", word::null)) -{} + patchType_() +{ + dict.readIfPresent("patchType", patchType_, keyType::LITERAL); +} template<class Type> @@ -118,7 +120,7 @@ void Foam::pointPatchField<Type>::write(Ostream& os) const { os.writeEntry("type", type()); - if (patchType_.size()) + if (!patchType_.empty()) { os.writeEntry("patchType", patchType_); } diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index 92aee089a6663076d6d90504cc3cd8bac5ca861f..b6346620922677b58e5a12b1996559337b4f52c7 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H @@ -202,9 +202,9 @@ public: // (does not set the patch field values) static autoPtr<pointPatchField<Type>> New ( - const word&, - const pointPatch&, - const DimensionedField<Type, pointMesh>& + const word& patchFieldType, + const pointPatch& p, + const DimensionedField<Type, pointMesh>& iF ); //- Return a pointer to a new patchField created on freestore given @@ -213,10 +213,10 @@ public: // Allows override of constraint type static autoPtr<pointPatchField<Type>> New ( - const word&, + const word& patchFieldType, const word& actualPatchType, - const pointPatch&, - const DimensionedField<Type, pointMesh>& + const pointPatch& p, + const DimensionedField<Type, pointMesh>& iF ); //- Return a pointer to a new patchField created on freestore from diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C index 38efd74909e50d4ebca519f2a50a081ae4738ef3..4c47084577d16d589dfe83af7f9c2c5758b8c9b3 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,7 +37,10 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New const DimensionedField<Type, pointMesh>& iF ) { - DebugInFunction << "Constructing pointPatchField<Type>" << endl; + DebugInFunction + << "patchFieldType = " << patchFieldType + << " [" << actualPatchType + << "] : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = pointPatchConstructorTable(patchFieldType); @@ -53,11 +56,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New autoPtr<pointPatchField<Type>> pfPtr(ctorPtr(p, iF)); - if - ( - actualPatchType.empty() - || actualPatchType != p.type() - ) + if (actualPatchType.empty() || actualPatchType != p.type()) { if (pfPtr().constraintType() != p.constraintType()) { @@ -110,10 +109,16 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New const dictionary& dict ) { - DebugInFunction << "Constructing pointPatchField<Type>" << endl; - const word patchFieldType(dict.get<word>("type")); + word actualPatchType; + dict.readIfPresent("patchType", actualPatchType, keyType::LITERAL); + + DebugInFunction + << "patchFieldType = " << patchFieldType + << " [" << actualPatchType + << "] : " << p.type() << " name = " << p.name() << endl; + auto* ctorPtr = dictionaryConstructorTable(patchFieldType); if (!ctorPtr) @@ -137,11 +142,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New // Construct (but not necessarily returned) autoPtr<pointPatchField<Type>> pfPtr(ctorPtr(p, iF, dict)); - if - ( - !dict.found("patchType") - || dict.get<word>("patchType") != p.type() - ) + if (actualPatchType.empty() || actualPatchType != p.type()) { if (pfPtr().constraintType() != p.constraintType()) { @@ -176,7 +177,9 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New const pointPatchFieldMapper& pfMapper ) { - DebugInFunction << "Constructing pointPatchField<Type>" << endl; + DebugInFunction + << "patchFieldType = " << ptf.type() + << " : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = patchMapperConstructorTable(ptf.type()); diff --git a/src/finiteArea/Make/files b/src/finiteArea/Make/files index 7c2cdd41237291e3d9f31a4274e183a1d1e98e82..99d971d4dbf1afe7ed97befbfd111583e140369c 100644 --- a/src/finiteArea/Make/files +++ b/src/finiteArea/Make/files @@ -7,6 +7,7 @@ faMesh/faMeshTopology.C faMesh/faMeshUpdate.C faMesh/faMeshBoundaryHalo.C faMesh/faBoundaryMesh/faBoundaryMesh.C +faMesh/faBoundaryMesh/faBoundaryMeshEntries.C faPatches = faMesh/faPatches $(faPatches)/faPatch/faPatch.C diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.C b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.C new file mode 100644 index 0000000000000000000000000000000000000000..a2d9c3b0211f8605ccd425aa83956ee0989f2d12 --- /dev/null +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.C @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "faBoundaryMeshEntries.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeName(faBoundaryMeshEntries); +} + +// ************************************************************************* // diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.H b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.H new file mode 100644 index 0000000000000000000000000000000000000000..9059813c2b5df4d5eb3bf0df2895999502f4f7f8 --- /dev/null +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +Class + Foam::faBoundaryMeshEntries + +Description + Read and store dictionary entries for finite-area boundary patches. + +SourceFiles + faBoundaryMeshEntries.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_faBoundaryMeshEntries_H +#define Foam_faBoundaryMeshEntries_H + +#include "regIOobject.H" +#include "PtrList.H" +#include "entry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class faBoundaryMeshEntries Declaration +\*---------------------------------------------------------------------------*/ + +class faBoundaryMeshEntries +: + public regIOobject, + public PtrList<entry> +{ +public: + + //- Runtime type information + TypeNameNoDebug("faBoundaryMesh"); + + + // Constructors + + //- Read construct from IOobject + explicit faBoundaryMeshEntries(const IOobject& io) + : + regIOobject(io), + PtrList<entry>() + { + if + ( + ( + io.readOpt() == IOobject::MUST_READ + || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED + ) + || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk()) + ) + { + readStream(typeName) >> *this; + } + } + + + // Member Functions + + bool writeData(Ostream&) const + { + NotImplemented; + return false; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/faMesh/faMesh.C b/src/finiteArea/faMesh/faMesh.C index 1d584566668d9ed58735d62dc01c4bc3f7cd12f2..32e767ee265ce46f941c4bbcc37092bffea3637a 100644 --- a/src/finiteArea/faMesh/faMesh.C +++ b/src/finiteArea/faMesh/faMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -264,19 +264,46 @@ void Foam::faMesh::clearOut() const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::faMesh::faMesh(const polyMesh& pMesh, const zero) +bool Foam::faMesh::init(const bool doInit) +{ + if (doInit) + { + setPrimitiveMeshData(); + } + + // Create global mesh data + if (Pstream::parRun()) + { + (void)globalData(); + } + + // Calculate topology for the patches (processor-processor comms etc.) + boundary_.updateMesh(); + + // Calculate the geometry for the patches (transformation tensors etc.) + boundary_.calcGeometry(); + + return false; +} + + +Foam::faMesh::faMesh(const polyMesh& pMesh, const Foam::zero) : - faMesh(pMesh, labelList()) + faMesh(pMesh, labelList(), static_cast<const IOobject&>(pMesh)) {} -Foam::faMesh::faMesh(const polyMesh& pMesh) +Foam::faMesh::faMesh +( + const polyMesh& pMesh, + const bool doInit +) : MeshObject<polyMesh, Foam::UpdateableMeshObject, faMesh>(pMesh), - edgeInterpolation(*this), faSchemes(mesh()), + edgeInterpolation(*this), faSolution(mesh()), - data(mesh()), + data(mesh()), // Always NO_READ, NO_WRITE faceLabels_ ( IOobject @@ -294,7 +321,14 @@ Foam::faMesh::faMesh(const polyMesh& pMesh) IOobject ( "faBoundary", - time().findInstance(meshDir(), "faBoundary"), + // Allow boundary file that is newer than faceLabels + time().findInstance + ( + meshDir(), + "faBoundary", + IOobject::MUST_READ, + faceLabels_.instance() + ), faMesh::meshSubDir, mesh(), IOobject::MUST_READ, @@ -331,19 +365,12 @@ Foam::faMesh::faMesh(const polyMesh& pMesh) setPrimitiveMeshData(); - // Create global mesh data - if (Pstream::parRun()) + if (doInit) { - globalData(); + faMesh::init(false); // do not init lower levels } - // Calculate topology for the patches (processor-processor comms etc.) - boundary_.updateMesh(); - - // Calculate the geometry for the patches (transformation tensors etc.) - boundary_.calcGeometry(); - - if (fileHandler().isFile(pMesh.time().timePath()/"S0")) + if (doInit && fileHandler().isFile(pMesh.time().timePath()/"S0")) { S0Ptr_ = new DimensionedField<scalar, areaMesh> ( @@ -365,14 +392,25 @@ Foam::faMesh::faMesh(const polyMesh& pMesh) Foam::faMesh::faMesh ( const polyMesh& pMesh, - const UList<label>& faceLabels + labelList&& faceLabels +) +: + faMesh(pMesh, std::move(faceLabels), static_cast<const IOobject&>(pMesh)) +{} + + +Foam::faMesh::faMesh +( + const polyMesh& pMesh, + labelList&& faceLabels, + const IOobject& io ) : MeshObject<polyMesh, Foam::UpdateableMeshObject, faMesh>(pMesh), + faSchemes(mesh(), io.readOpt()), edgeInterpolation(*this), - faSchemes(mesh()), - faSolution(mesh()), - data(mesh()), + faSolution(mesh(), io.readOpt()), + data(mesh()), // Always NO_READ, NO_WRITE faceLabels_ ( IOobject @@ -384,7 +422,7 @@ Foam::faMesh::faMesh IOobject::NO_READ, IOobject::NO_WRITE ), - faceLabels + std::move(faceLabels) ), boundary_ ( @@ -427,7 +465,7 @@ Foam::faMesh::faMesh {} -Foam::faMesh::faMesh(const polyPatch& pp) +Foam::faMesh::faMesh(const polyPatch& pp, const bool doInit) : faMesh ( @@ -447,24 +485,18 @@ Foam::faMesh::faMesh(const polyPatch& pp) setPrimitiveMeshData(); - // Create global mesh data - if (Pstream::parRun()) + if (doInit) { - globalData(); + faMesh::init(false); // do not init lower levels } - - // Calculate topology for the patches (processor-processor comms etc.) - boundary_.updateMesh(); - - // Calculate the geometry for the patches (transformation tensors etc.) - boundary_.calcGeometry(); } Foam::faMesh::faMesh ( const polyMesh& pMesh, - const dictionary& faMeshDefinition + const dictionary& faMeshDefinition, + const bool doInit ) : faMesh @@ -493,22 +525,14 @@ Foam::faMesh::faMesh ) ); - addFaPatches(newPatches); - // Create global mesh data - if (Pstream::parRun()) + if (doInit) { - globalData(); + faMesh::init(false); // do not init lower levels } - // Calculate topology for the patches (processor-processor comms etc.) - boundary_.updateMesh(); - - // Calculate the geometry for the patches (transformation tensors etc.) - boundary_.calcGeometry(); - - if (fileHandler().isFile(pMesh.time().timePath()/"S0")) + if (doInit && fileHandler().isFile(pMesh.time().timePath()/"S0")) { S0Ptr_ = new DimensionedField<scalar, areaMesh> ( @@ -573,6 +597,21 @@ const Foam::objectRegistry& Foam::faMesh::thisDb() const } +void Foam::faMesh::removeFiles(const fileName& instanceDir) const +{ + fileName meshFilesPath = thisDb().time().path()/instanceDir/meshDir(); + + Foam::rm(meshFilesPath/"faceLabels"); + Foam::rm(meshFilesPath/"faBoundary"); +} + + +void Foam::faMesh::removeFiles() const +{ + removeFiles(mesh().instance()); +} + + const Foam::labelList& Foam::faMesh::patchStarts() const { if (!patchStartsPtr_) @@ -814,11 +853,10 @@ bool Foam::faMesh::movePoints() } // Move boundary points - const_cast<faBoundaryMesh&>(boundary_).movePoints(newPoints); + boundary_.movePoints(newPoints); // Move interpolation - const edgeInterpolation& cei = *this; - const_cast<edgeInterpolation&>(cei).edgeInterpolation::movePoints(); + edgeInterpolation::movePoints(); // Note: Fluxes were dummy? diff --git a/src/finiteArea/faMesh/faMesh.H b/src/finiteArea/faMesh/faMesh.H index d91ecb9e283ac47932f39a880f152c929f93cd1b..7d4bd4704d5de55cead696a0d1cf016c4c8fae96 100644 --- a/src/finiteArea/faMesh/faMesh.H +++ b/src/finiteArea/faMesh/faMesh.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,7 +28,17 @@ Class Foam::faMesh Description - Finite area mesh. Used for 2-D non-Euclidian finite area method. + Finite area mesh (used for 2-D non-Euclidian finite area method) + defined using a \em patch of faces on a polyMesh + (ie, uindirectPrimitivePatch). + + The ordering of faces and points on the faMesh corresponds to + the localFaces and localPoints as per Foam::PrimitivePatch but + the edge addressing is handled slightly differently. + The internal edges of the faMesh will generally correspond identically + to the internalEdges of the PrimitivePatch (may change in the future) + but the boundaryEdges will be reordered compared to the PrimitivePatch + to allow edge boundary slices to be obtained. SourceFiles faMesh.C @@ -84,8 +94,8 @@ class faMesh : public MeshObject<polyMesh, Foam::UpdateableMeshObject, faMesh>, public lduMesh, - public edgeInterpolation, public faSchemes, + public edgeInterpolation, // may need input from faSchemes public faSolution, public data { @@ -213,10 +223,10 @@ class faMesh // Primitive size data - //- Number of points + //- Total number of points mutable label nPoints_; - //- Number of edges + //- Total number of edges mutable label nEdges_; //- Number of internal edges @@ -324,10 +334,12 @@ class faMesh //- No copy assignment void operator=(const faMesh&) = delete; - //- Set indirect patch, removing any old one + //- Set indirect patch, removing any old one. + // No communication void initPatch() const; - //- Set primitive mesh data + //- Set primitive mesh data. + // No communication void setPrimitiveMeshData(); //- Get list of (proc/patchi/patchEdgei/meshFacei) tuple pairs in an @@ -489,29 +501,38 @@ public: // Constructors + //- Read construct from polyMesh, using its IOobject properties + explicit faMesh(const polyMesh& pMesh, const bool doInit = true); + //- Construct zero-sized from polyMesh // Boundary is added using addFaPatches() member function faMesh(const polyMesh& pMesh, const Foam::zero); - //- Construct from polyMesh - explicit faMesh(const polyMesh& pMesh); + //- 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 for specified face labels without boundary. - // Boundary is added using addFaPatches() member function + //- Construct from components (face labels) without boundary, + //- using alternative IOobject properties + //- (primarily the readOption). + // Boundary is added using addFaPatches() member function. faMesh ( const polyMesh& pMesh, - const UList<label>& faceLabels + labelList&& faceLabels, + const IOobject& io ); //- Construct from single polyPatch - explicit faMesh(const polyPatch& pp); + explicit faMesh(const polyPatch& pp, const bool doInit = true); //- Construct from definition faMesh ( const polyMesh& pMesh, - const dictionary& faMeshDefinition + const dictionary& faMeshDefinition, + const bool doInit = true ); @@ -527,7 +548,7 @@ public: // Member Functions - // Helpers + // Topological Change //- Add boundary patches. Constructor helper void addFaPatches @@ -543,6 +564,9 @@ public: const bool validBoundary = true ); + //- Initialise non-demand-driven data etc + bool init(const bool doInit); + // Database @@ -694,19 +718,28 @@ public: tmp<vectorField> haloFaceNormals(const label patchi) const; - // Mesh motion and morphing + // Storage management - //- Is mesh moving - bool moving() const - { - return mesh().moving(); - } + //- Remove all files from mesh instance + void removeFiles(const fileName& instanceDir) const; + + //- Remove all files from mesh instance() + void removeFiles() const; + + + // Mesh motion and morphing + + //- Is mesh moving + bool moving() const + { + return mesh().moving(); + } - //- Update after mesh motion - virtual bool movePoints(); + //- Update after mesh motion + virtual bool movePoints(); - //- Update after topo change - virtual void updateMesh(const mapPolyMesh&); + //- Update after topo change + virtual void updateMesh(const mapPolyMesh&); // Mapping diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.C b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.C index 9a568d7cea44169a58595e57d4c7ad01d8b16c95..8481c191de0fbf449142397505fb0e4569f986fd 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.C +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.C @@ -42,7 +42,7 @@ Foam::faPatchField<Type>::faPatchField patch_(p), internalField_(iF), updated_(false), - patchType_(word::null) + patchType_() {} @@ -58,7 +58,7 @@ Foam::faPatchField<Type>::faPatchField patch_(p), internalField_(iF), updated_(false), - patchType_(word::null) + patchType_() {} @@ -75,7 +75,7 @@ Foam::faPatchField<Type>::faPatchField patch_(p), internalField_(iF), updated_(false), - patchType_(word::null) + patchType_() {} @@ -84,15 +84,20 @@ Foam::faPatchField<Type>::faPatchField ( const faPatch& p, const DimensionedField<Type, areaMesh>& iF, - const dictionary& dict + const dictionary& dict, + const bool valueRequired ) : Field<Type>(p.size()), patch_(p), internalField_(iF), updated_(false), - patchType_(dict.getOrDefault<word>("patchType", word::null)) + patchType_() { + dict.readIfPresent("patchType", patchType_, keyType::LITERAL); + + /// if (valueRequired) - not yet needed. Already a lazy evaluation + if (dict.found("value")) { faPatchField<Type>::operator= @@ -208,7 +213,7 @@ void Foam::faPatchField<Type>::write(Ostream& os) const { os.writeEntry("type", type()); - if (patchType_.size()) + if (!patchType_.empty()) { os.writeEntry("patchType", patchType_); } diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H index 389510504c97b5588d63b9c0442fa5c40829922d..3ec4c8a26ce28a353d9e559d24d9b062c87398aa 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,8 +45,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef faPatchField_H -#define faPatchField_H +#ifndef Foam_faPatchField_H +#define Foam_faPatchField_H #include "faPatch.H" #include "DimensionedField.H" @@ -176,7 +176,8 @@ public: ( const faPatch&, const DimensionedField<Type, areaMesh>&, - const dictionary& + const dictionary&, + const bool valueRequired=true ); //- Construct by mapping the given faPatchField onto a new patch diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldNew.C b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldNew.C index 4ce72902d74b69edbb69c596f27e87785d0010cd..80bc3721dd3194c78fed2ae9302363f162622a5b 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldNew.C +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldNew.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,11 +38,9 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New ) { DebugInFunction - << "Constructing faPatchField<Type> " - << "patchFieldType:" << patchFieldType - << "actualPatchType:" << actualPatchType - << "p.Type():" << p.type() - << endl; + << "patchFieldType = " << patchFieldType + << " [" << actualPatchType + << "] : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = patchConstructorTable(patchFieldType); @@ -58,11 +56,7 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New auto* patchTypeCtor = patchConstructorTable(p.type()); - if - ( - actualPatchType == word::null - || actualPatchType != p.type() - ) + if (actualPatchType.empty() || actualPatchType != p.type()) { if (patchTypeCtor) { @@ -106,10 +100,16 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New const dictionary& dict ) { - DebugInFunction << "Constructing faPatchField<Type>" << endl; - const word patchFieldType(dict.get<word>("type")); + word actualPatchType; + dict.readIfPresent("patchType", actualPatchType, keyType::LITERAL); + + DebugInFunction + << "patchFieldType = " << patchFieldType + << " [" << actualPatchType + << "] : " << p.type() << " name = " << p.name() << endl; + auto* ctorPtr = dictionaryConstructorTable(patchFieldType); if (!ctorPtr) @@ -130,15 +130,18 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New } } - auto* patchTypeCtor = dictionaryConstructorTable(p.type()); - - if (patchTypeCtor && patchTypeCtor != ctorPtr) + if (actualPatchType.empty() || actualPatchType != p.type()) { - FatalIOErrorInFunction(dict) - << "inconsistent patch and patchField types for \n" - << " patch type " << p.type() - << " and patchField type " << patchFieldType - << exit(FatalIOError); + auto* patchTypeCtor = dictionaryConstructorTable(p.type()); + + if (patchTypeCtor && patchTypeCtor != ctorPtr) + { + FatalIOErrorInFunction(dict) + << "inconsistent patch and patchField types for\n" + " patch type " << p.type() + << " and patchField type " << patchFieldType + << exit(FatalIOError); + } } return ctorPtr(p, iF, dict); @@ -154,7 +157,9 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New const faPatchFieldMapper& pfMapper ) { - DebugInFunction << "Constructing faPatchField<Type>" << endl; + DebugInFunction + << "patchFieldType = " << ptf.type() + << " : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = patchMapperConstructorTable(ptf.type()); diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.C b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.C index 4fda7ee2ed2997211a036294cbcd87eece83c304..8a2411b483220ca5307a89950f796f06a8566386 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.C +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.C @@ -170,6 +170,11 @@ template<class Type> void Foam::faePatchField<Type>::write(Ostream& os) const { os.writeEntry("type", type()); + + // if (!patchType_.empty()) + // { + // os.writeEntry("patchType", patchType_); + // } } diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H index 68aba20ed2464cde4da93999be222769ffeb0e83..ab434bc053330cd5a2954945b978e6ea8dfbad35 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -220,7 +220,19 @@ public: // (does not set the patch field values) static tmp<faePatchField<Type>> New ( - const word&, + const word& patchFieldType, + const faPatch&, + const DimensionedField<Type, edgeMesh>& + ); + + //- Return a pointer to a new patchField created on freestore given + // patch and internal field + // (does not set the patch field values) + // Allows override of constraint type + static tmp<faePatchField<Type>> New + ( + const word& patchFieldType, + const word& actualPatchType, const faPatch&, const DimensionedField<Type, edgeMesh>& ); diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldNew.C b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldNew.C index b8b80f29eac4964d6801ed449eb6803a9a5b717d..e6a7b36022ef57f06027c4655369c0405ffe1250 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldNew.C +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldNew.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,11 +32,15 @@ template<class Type> Foam::tmp<Foam::faePatchField<Type>> Foam::faePatchField<Type>::New ( const word& patchFieldType, + const word& actualPatchType, const faPatch& p, const DimensionedField<Type, edgeMesh>& iF ) { - DebugInFunction << "Constructing faePatchField" << endl; + DebugInFunction + << "patchFieldType = " << patchFieldType + << " [" << actualPatchType + << "] : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = patchConstructorTable(patchFieldType); @@ -50,16 +54,29 @@ Foam::tmp<Foam::faePatchField<Type>> Foam::faePatchField<Type>::New ) << exit(FatalError); } - auto* patchTypeCtor = patchConstructorTable(p.type()); - - if (patchTypeCtor) - { - return patchTypeCtor(p, iF); - } - else + if (actualPatchType.empty() || actualPatchType != p.type()) { - return ctorPtr(p, iF); + auto* patchTypeCtor = patchConstructorTable(p.type()); + + if (patchTypeCtor) + { + return patchTypeCtor(p, iF); + } } + + return ctorPtr(p, iF); +} + + +template<class Type> +Foam::tmp<Foam::faePatchField<Type>> Foam::faePatchField<Type>::New +( + const word& patchFieldType, + const faPatch& p, + const DimensionedField<Type, edgeMesh>& iF +) +{ + return New(patchFieldType, word::null, p, iF); } @@ -71,10 +88,20 @@ Foam::tmp<Foam::faePatchField<Type>> Foam::faePatchField<Type>::New const dictionary& dict ) { - DebugInFunction << "Constructing faePatchField" << endl; - const word patchFieldType(dict.get<word>("type")); + // word actualPatchType; + // dict.readIfPresent("patchType", actualPatchType, keyType::LITERAL); + // + // DebugInFunction + // << "patchFieldType = " << patchFieldType + // << " [" << actualPatchType + // << "] : " << p.type() << " name = " << p.name() << endl; + + DebugInFunction + << "patchFieldType = " << patchFieldType + << " : " << p.type() << " name = " << p.name() << endl; + auto* ctorPtr = dictionaryConstructorTable(patchFieldType); if (!ctorPtr) @@ -100,8 +127,8 @@ Foam::tmp<Foam::faePatchField<Type>> Foam::faePatchField<Type>::New if (patchTypeCtor && patchTypeCtor != ctorPtr) { FatalIOErrorInFunction(dict) - << "inconsistent patch and patchField types for \n" - << " patch type " << p.type() + << "inconsistent patch and patchField types for\n" + " patch type " << p.type() << " and patchField type " << patchFieldType << exit(FatalIOError); } @@ -119,7 +146,9 @@ Foam::tmp<Foam::faePatchField<Type>> Foam::faePatchField<Type>::New const faPatchFieldMapper& pfMapper ) { - DebugInFunction << "Constructing faePatchField<Type>" << endl; + DebugInFunction + << "patchFieldType = " << ptf.type() + << " : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = patchMapperConstructorTable(ptf.type()); diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C index 9fd80b6a794920c8f181d96760922939e7050c9f..473b930cb91a9dc89cfeffe328551afed82bd605 100644 --- a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C +++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C @@ -164,7 +164,7 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField driver_.readDict(dict_); // Similar to fvPatchField constructor, which we have bypassed - dict.readIfPresent("patchType", this->patchType()); + dict.readIfPresent("patchType", this->patchType(), keyType::LITERAL); bool needsRefValue = true; if (dict.found("refValue")) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C index f25df2e4b06a29b243cf2be661ec394aa522e8fa..3c4c04659858f402abbd363cf2f859ee4898dd85 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -256,7 +256,7 @@ void Foam::fixedJumpFvPatchField<Type>::write(Ostream& os) const fvPatchField<Type>::write(os); // Write patchType if not done already by fvPatchField - if (!this->patchType().size()) + if (this->patchType().empty()) { os.writeEntry("patchType", this->interfaceFieldType()); } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 5cb5ff130f25199a6eb15acffc81b8f59a577dc8..af1946f5347ee0d9119d2324c83af73d99f1d28f 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2021 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -119,9 +119,12 @@ Foam::fvPatchField<Type>::fvPatchField internalField_(iF), updated_(false), manipulatedMatrix_(false), - useImplicit_(dict.getOrDefault<bool>("useImplicit", false)), - patchType_(dict.getOrDefault<word>("patchType", word::null)) + useImplicit_(false), + patchType_() { + dict.readIfPresent("useImplicit", useImplicit_, keyType::LITERAL); + dict.readIfPresent("patchType", patchType_, keyType::LITERAL); + if (valueRequired) { if (dict.found("value")) @@ -134,7 +137,8 @@ Foam::fvPatchField<Type>::fvPatchField else { FatalIOErrorInFunction(dict) - << "Essential entry 'value' missing on patch " << p.name() << nl + << "Essential entry 'value' missing on patch " + << p.name() << endl << exit(FatalIOError); } } @@ -390,7 +394,7 @@ void Foam::fvPatchField<Type>::write(Ostream& os) const os.writeEntry("useImplicit", "true"); } - if (patchType_.size()) + if (!patchType_.empty()) { os.writeEntry("patchType", patchType_); } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 5b0c9ca43e50b75f1160bd5e8ec42ef450fcadd4..ce9c89d4fd363f5899a0437d0bf15b71e4adca4a 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -68,7 +68,6 @@ template<class Type> class fvPatchField; template<class Type> class calculatedFvPatchField; template<class Type> class fvMatrix; - template<class Type> Ostream& operator<<(Ostream&, const fvPatchField<Type>&); @@ -246,7 +245,7 @@ public: // (does not set the patch field values) static tmp<fvPatchField<Type>> New ( - const word&, + const word& patchFieldType, const fvPatch&, const DimensionedField<Type, volMesh>& ); @@ -257,7 +256,7 @@ public: // Allows override of constraint type static tmp<fvPatchField<Type>> New ( - const word&, + const word& patchFieldType, const word& actualPatchType, const fvPatch&, const DimensionedField<Type, volMesh>& diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C index 75c8170cbaaf6555ff830fcd870f00c58f27ec6e..7a220be7f6400dbbfb832893e56de218392e9240 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -39,7 +39,8 @@ Foam::tmp<Foam::fvPatchField<Type>> Foam::fvPatchField<Type>::New { DebugInFunction << "patchFieldType = " << patchFieldType - << " : " << p.type() << nl; + << " [" << actualPatchType + << "] : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = patchConstructorTable(patchFieldType); @@ -55,11 +56,7 @@ Foam::tmp<Foam::fvPatchField<Type>> Foam::fvPatchField<Type>::New auto* patchTypeCtor = patchConstructorTable(p.type()); - if - ( - actualPatchType == word::null - || actualPatchType != p.type() - ) + if (actualPatchType.empty() || actualPatchType != p.type()) { if (patchTypeCtor) { @@ -105,8 +102,13 @@ Foam::tmp<Foam::fvPatchField<Type>> Foam::fvPatchField<Type>::New { const word patchFieldType(dict.get<word>("type")); + word actualPatchType; + dict.readIfPresent("patchType", actualPatchType, keyType::LITERAL); + DebugInFunction - << "patchFieldType = " << patchFieldType << nl; + << "patchFieldType = " << patchFieldType + << " [" << actualPatchType + << "] : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = dictionaryConstructorTable(patchFieldType); @@ -128,11 +130,7 @@ Foam::tmp<Foam::fvPatchField<Type>> Foam::fvPatchField<Type>::New } } - if - ( - !dict.found("patchType") - || dict.get<word>("patchType") != p.type() - ) + if (actualPatchType.empty() || actualPatchType != p.type()) { auto* patchTypeCtor = dictionaryConstructorTable(p.type()); @@ -160,7 +158,8 @@ Foam::tmp<Foam::fvPatchField<Type>> Foam::fvPatchField<Type>::New ) { DebugInFunction - << "Constructing fvPatchField<Type>" << nl; + << "patchFieldType = " << ptf.type() + << " : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = patchMapperConstructorTable(ptf.type()); diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C index 28f1c05a19c250a4cdb3ada89c0b0d3f2e3e3d75..3d37d8c2517e01a85604c6c4776bb248d27b590d 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C @@ -81,25 +81,30 @@ Foam::fvsPatchField<Type>::fvsPatchField ( const fvPatch& p, const DimensionedField<Type, surfaceMesh>& iF, - const dictionary& dict + const dictionary& dict, + const bool valueRequired ) : Field<Type>(p.size()), patch_(p), internalField_(iF) { - if (dict.found("value")) + if (valueRequired) { - fvsPatchField<Type>::operator= - ( - Field<Type>("value", dict, p.size()) - ); - } - else - { - FatalIOErrorInFunction(dict) - << "Essential entry 'value' missing on patch " << p.name() << nl - << exit(FatalIOError); + if (dict.found("value")) + { + fvsPatchField<Type>::operator= + ( + Field<Type>("value", dict, p.size()) + ); + } + else + { + FatalIOErrorInFunction(dict) + << "Essential entry 'value' missing on patch " + << p.name() << endl + << exit(FatalIOError); + } } } diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index 227f23b9326d29d3031d8a001fce6d1e364af6bf..c65ee8877dc0db30df13aa47b31a4b1043c42573 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -55,21 +55,15 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward Declarations class objectRegistry; class dictionary; class fvPatchFieldMapper; class surfaceMesh; - -// Forward declaration of friend functions and operators - -template<class Type> -class fvsPatchField; - -template<class Type> -class calculatedFvsPatchField; +template<class Type> class fvsPatchField; +template<class Type> class calculatedFvsPatchField; template<class Type> Ostream& operator<<(Ostream&, const fvsPatchField<Type>&); @@ -170,7 +164,8 @@ public: ( const fvPatch&, const DimensionedField<Type, surfaceMesh>&, - const dictionary& + const dictionary&, + const bool valueRequired=true ); //- Construct by mapping the given fvsPatchField onto a new patch @@ -215,7 +210,7 @@ public: // (does not set the patch field values) static tmp<fvsPatchField<Type>> New ( - const word&, + const word& patchFieldType, const fvPatch&, const DimensionedField<Type, surfaceMesh>& ); @@ -226,7 +221,7 @@ public: // Allows override of constraint type static tmp<fvsPatchField<Type>> New ( - const word&, + const word& patchFieldType, const word& actualPatchType, const fvPatch&, const DimensionedField<Type, surfaceMesh>& diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C index eba528f84c75e876bdfb71767e3d3f23f32b7f15..854857339eed65e0d68940107e7130e41b8543cb 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,7 +37,10 @@ Foam::tmp<Foam::fvsPatchField<Type>> Foam::fvsPatchField<Type>::New const DimensionedField<Type, surfaceMesh>& iF ) { - DebugInFunction << "Constructing fvsPatchField" << endl; + DebugInFunction + << "patchFieldType = " << patchFieldType + << " [" << actualPatchType + << "] : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = patchConstructorTable(patchFieldType); @@ -51,11 +54,7 @@ Foam::tmp<Foam::fvsPatchField<Type>> Foam::fvsPatchField<Type>::New ) << exit(FatalError); } - if - ( - actualPatchType == word::null - || actualPatchType != p.type() - ) + if (actualPatchType.empty() || actualPatchType != p.type()) { auto* patchTypeCtor = patchConstructorTable(p.type()); @@ -89,10 +88,16 @@ Foam::tmp<Foam::fvsPatchField<Type>> Foam::fvsPatchField<Type>::New const dictionary& dict ) { - DebugInFunction << "Constructing fvsPatchField" << endl; - const word patchFieldType(dict.get<word>("type")); + word actualPatchType; + dict.readIfPresent("patchType", actualPatchType, keyType::LITERAL); + + DebugInFunction + << "patchFieldType = " << patchFieldType + << " [" << actualPatchType + << "] : " << p.type() << " name = " << p.name() << endl; + auto* ctorPtr = dictionaryConstructorTable(patchFieldType); if (!ctorPtr) @@ -113,11 +118,7 @@ Foam::tmp<Foam::fvsPatchField<Type>> Foam::fvsPatchField<Type>::New } } - if - ( - !dict.found("patchType") - || dict.get<word>("patchType") != p.type() - ) + if (actualPatchType.empty() || actualPatchType != p.type()) { auto* patchTypeCtor = dictionaryConstructorTable(p.type()); @@ -144,7 +145,9 @@ Foam::tmp<Foam::fvsPatchField<Type>> Foam::fvsPatchField<Type>::New const fvPatchFieldMapper& pfMapper ) { - DebugInFunction << "Constructing fvsPatchField" << endl; + DebugInFunction + << "patchFieldType = " << ptf.type() + << " : " << p.type() << " name = " << p.name() << endl; auto* ctorPtr = patchMapperConstructorTable(ptf.type()); diff --git a/src/parallel/decompose/faDecompose/faMeshDecomposition.C b/src/parallel/decompose/faDecompose/faMeshDecomposition.C index b69099875736479b34e039116f0590ce21ced3ff..66a15a601a4624a49eb2c34ee048897fb818bce8 100644 --- a/src/parallel/decompose/faDecompose/faMeshDecomposition.C +++ b/src/parallel/decompose/faDecompose/faMeshDecomposition.C @@ -329,11 +329,11 @@ void Foam::faMeshDecomposition::decomposeMesh() ).val(); } - // create processor finite area mesh + // Create processor finite area mesh faMesh procMesh ( procFvMesh, - procFaceLabels_[procI] + labelList(procFaceLabels_[procI]) ); const uindirectPrimitivePatch& patch = this->patch(); @@ -1073,7 +1073,7 @@ void Foam::faMeshDecomposition::decomposeMesh() faMesh procMesh ( procFvMesh, - procFaceLabels_[procI] + labelList(procFaceLabels_[procI]) ); @@ -1205,7 +1205,7 @@ bool Foam::faMeshDecomposition::writeDecomposition() faMesh procMesh ( procFvMesh, - procFaceLabels_[procI] + labelList(procFaceLabels_[procI]) ); // Create processor boundary patches