diff --git a/src/finiteArea/Make/files b/src/finiteArea/Make/files index ea3eb312b9..039386be84 100644 --- a/src/finiteArea/Make/files +++ b/src/finiteArea/Make/files @@ -24,6 +24,7 @@ $(faPatches)/constraint/processor/processorFaPatch.C $(faPatches)/constraint/wedge/wedgeFaPatch.C $(faPatches)/constraint/cyclic/cyclicFaPatch.C $(faPatches)/constraint/symmetry/symmetryFaPatch.C +$(faPatches)/other/ignore/ignoreFaPatch.C distributed/faMeshDistributor.C distributed/faMeshDistributorNew.C @@ -68,6 +69,7 @@ $(derivedFaPatchFields)/slip/slipFaPatchFields.C $(derivedFaPatchFields)/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C $(derivedFaPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C $(derivedFaPatchFields)/uniformFixedValue/uniformFixedValueFaPatchFields.C +$(derivedFaPatchFields)/ignore/ignoreFaPatchFields.C $(derivedFaPatchFields)/clampedPlate/clampedPlateFaPatchFields.C faePatchFields = fields/faePatchFields diff --git a/src/finiteArea/faMesh/faPatches/faPatch/faPatchData.C b/src/finiteArea/faMesh/faPatches/faPatch/faPatchData.C index 00ad7d679c..5be8760611 100644 --- a/src/finiteArea/faMesh/faPatches/faPatch/faPatchData.C +++ b/src/finiteArea/faMesh/faPatches/faPatch/faPatchData.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -74,6 +74,12 @@ Foam::dictionary Foam::faPatchData::dict(const bool withEdgeLabels) const } +bool Foam::faPatchData::good() const +{ + return (!name_.empty() && !type_.empty()); +} + + void Foam::faPatchData::clear() { name_.clear(); diff --git a/src/finiteArea/faMesh/faPatches/faPatch/faPatchData.H b/src/finiteArea/faMesh/faPatches/faPatch/faPatchData.H index ee90a80522..137af00328 100644 --- a/src/finiteArea/faMesh/faPatches/faPatch/faPatchData.H +++ b/src/finiteArea/faMesh/faPatches/faPatch/faPatchData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,8 +33,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef faPatchData_H -#define faPatchData_H +#ifndef Foam_faPatchData_H +#define Foam_faPatchData_H #include "labelList.H" #include "labelPair.H" @@ -92,6 +92,9 @@ public: // Other Functions + //- Has name/type etc + bool good() const; + //- Reset data void clear(); diff --git a/src/finiteArea/faMesh/faPatches/other/ignore/ignoreFaPatch.C b/src/finiteArea/faMesh/faPatches/other/ignore/ignoreFaPatch.C new file mode 100644 index 0000000000..2c34bb23f4 --- /dev/null +++ b/src/finiteArea/faMesh/faPatches/other/ignore/ignoreFaPatch.C @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2023 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 "ignoreFaPatch.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +// Patch name +defineTypeNameAndDebug(ignoreFaPatch, 0); + +// Add the patch constructor functions to the hash tables +addToRunTimeSelectionTable(faPatch, ignoreFaPatch, dictionary); + +} // End namespace Foam + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::ignoreFaPatch::ignoreFaPatch +( + const word& name, + const label index, + const faBoundaryMesh& bm, + const label nbrPolyPatchi, + const word& patchType +) +: + ignoreFaPatch(name, labelList(), index, bm, nbrPolyPatchi, patchType) +{} + + +Foam::ignoreFaPatch::ignoreFaPatch +( + const word& name, + const labelUList& edgeLabels, + const label index, + const faBoundaryMesh& bm, + const label nbrPolyPatchi, + const word& patchType +) +: + faPatch(name, edgeLabels, index, bm, nbrPolyPatchi, patchType) +{} + + +Foam::ignoreFaPatch::ignoreFaPatch +( + const word& name, + const dictionary& dict, + const label index, + const faBoundaryMesh& bm, + const word& patchType +) +: + faPatch(name, dict, index, bm, patchType) +{} + + +Foam::ignoreFaPatch::ignoreFaPatch +( + const ignoreFaPatch& p, + const faBoundaryMesh& bm +) +: + faPatch(p, bm) +{} + + +Foam::ignoreFaPatch::ignoreFaPatch +( + const ignoreFaPatch& p, + const faBoundaryMesh& bm, + const label index, + const labelUList& edgeLabels, + const label nbrPolyPatchi +) +: + faPatch(p, bm, index, edgeLabels, nbrPolyPatchi) +{} + + +// ************************************************************************* // diff --git a/src/finiteArea/faMesh/faPatches/other/ignore/ignoreFaPatch.H b/src/finiteArea/faMesh/faPatches/other/ignore/ignoreFaPatch.H new file mode 100644 index 0000000000..fa5e3f6eae --- /dev/null +++ b/src/finiteArea/faMesh/faPatches/other/ignore/ignoreFaPatch.H @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2023 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::ignoreFaPatch + +Description + A patch which will not exist in the faMesh. Typical example is a front and + back plane of a 2-D geometry + +SourceFiles + ignoreFaPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_ignoreFaPatch_H +#define Foam_ignoreFaPatch_H + +#include "faPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ignoreFaPatch Declaration +\*---------------------------------------------------------------------------*/ + +class ignoreFaPatch +: + public faPatch +{ +public: + + //- Runtime type information + TypeName("ignore"); + + + // Constructors + + //- Minimal construct from components + ignoreFaPatch + ( + const word& name, + const label index, + const faBoundaryMesh& bm, + const label nbrPolyPatchi = -1, + const word& patchType = typeName + ); + + //- Construct from components + ignoreFaPatch + ( + const word& name, + const labelUList& edgeLabels, + const label index, + const faBoundaryMesh& bm, + const label nbrPolyPatchi = -1, + const word& patchType = typeName + ); + + //- Construct from dictionary + ignoreFaPatch + ( + const word& name, + const dictionary& dict, + const label index, + const faBoundaryMesh& bm, + const word& patchType + ); + + //- Copy construct, resetting the boundary mesh + ignoreFaPatch(const ignoreFaPatch& p, const faBoundaryMesh& bm); + + //- Copy construct, resetting boundary mesh and addressing + ignoreFaPatch + ( + const ignoreFaPatch& p, + const faBoundaryMesh& bm, + const label index, + const labelUList& edgeLabels, + const label nbrPolyPatchi = -1 + ); + + + //- Construct and return a clone, resetting the boundary mesh + virtual autoPtr clone(const faBoundaryMesh& bm) const + { + return autoPtr(new ignoreFaPatch(*this, bm)); + } + + //- Construct and return a clone, resetting the edge list + // and boundary mesh + virtual autoPtr clone + ( + const faBoundaryMesh& bm, + const labelUList& edgeLabels, + const label index, + const label nbrPolyPatchi = -1 + ) const + { + return autoPtr + ( + new ignoreFaPatch(*this, bm, index, edgeLabels, nbrPolyPatchi) + ); + } + + + // Member Functions +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchField.C new file mode 100644 index 0000000000..f10e594b74 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchField.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2023 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 "ignoreFaPatchField.H" +#include "faPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::ignoreFaPatchField::ignoreFaPatchField +( + const faPatch& p, + const DimensionedField& iF +) +: + zeroGradientFaPatchField(p, iF) +{} + + +template +Foam::ignoreFaPatchField::ignoreFaPatchField +( + const faPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + zeroGradientFaPatchField(p, iF, dict) +{} + + +template +Foam::ignoreFaPatchField::ignoreFaPatchField +( + const ignoreFaPatchField& ptf, + const faPatch& p, + const DimensionedField& iF, + const faPatchFieldMapper& mapper +) +: + zeroGradientFaPatchField(ptf, p, iF, mapper) +{} + + +template +Foam::ignoreFaPatchField::ignoreFaPatchField +( + const ignoreFaPatchField& ptf +) +: + zeroGradientFaPatchField(ptf) +{} + + +template +Foam::ignoreFaPatchField::ignoreFaPatchField +( + const ignoreFaPatchField& ptf, + const DimensionedField& iF +) +: + zeroGradientFaPatchField(ptf, iF) +{} + + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchField.H new file mode 100644 index 0000000000..6d83692442 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchField.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2023 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::ignoreFaPatchField + +Description + A boundary condition for invalid edges which should be ignored. + Currently functionally identical to a zero-gradient condition. + +Usage + Example of the boundary condition specification: + \verbatim + + { + // Mandatory entries (unmodifiable) + type ignore; + + // Mandatory/Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Reqd | Dflt + type | Type name: ignore | word | yes | - + \endtable + + The inherited entries are elaborated in: + - \link faPatchFields.H \endlink + +SourceFiles + ignoreFaPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_ignoreFaPatchField_H +#define Foam_ignoreFaPatchField_H + +#include "zeroGradientFaPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ignoreFaPatch Declaration +\*---------------------------------------------------------------------------*/ + +template +class ignoreFaPatchField +: + public zeroGradientFaPatchField +{ +public: + + //- Runtime type information + TypeName("ignore"); + + + // Constructors + + //- Construct from patch and internal field + ignoreFaPatchField + ( + const faPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + ignoreFaPatchField + ( + const faPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping the given patch field onto a new patch + ignoreFaPatchField + ( + const ignoreFaPatchField&, + const faPatch&, + const DimensionedField&, + const faPatchFieldMapper& + ); + + //- Construct as copy + ignoreFaPatchField + ( + const ignoreFaPatchField& + ); + + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp> + ( + new ignoreFaPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + ignoreFaPatchField + ( + const ignoreFaPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp> clone + ( + const DimensionedField& iF + ) const + { + return tmp> + ( + new ignoreFaPatchField(*this, iF) + ); + } + + + //- Destructor + virtual ~ignoreFaPatchField() = default; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ignoreFaPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchFields.C b/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchFields.C new file mode 100644 index 0000000000..36d8b600b1 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchFields.C @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2023 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 "ignoreFaPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "areaFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makeFaPatchFields(ignore); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchFields.H new file mode 100644 index 0000000000..a97edf8e3c --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/ignore/ignoreFaPatchFields.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2023 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 + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_ignoreFaPatchFields_H +#define Foam_ignoreFaPatchFields_H + +#include "ignoreFaPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeFaPatchTypeFieldTypedefs(ignore); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C b/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C index 14f834ec56..332480a5b3 100644 --- a/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C +++ b/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,6 +29,7 @@ License #include "globalIndex.H" #include "globalMeshData.H" #include "edgeHashes.H" +#include "ignoreFaPatch.H" #include "Time.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -371,6 +372,12 @@ void Foam::faMeshReconstructor::calcAddressing { const faPatch& fap = procMesh_.boundary()[patchi]; + if (isA(fap)) + { + // These are not real edges + continue; + } + labelList& patchEdgeLabels = singlePatchEdgeLabels_[patchi]; patchEdgeLabels = fap.edgeLabels(); @@ -490,27 +497,38 @@ void Foam::faMeshReconstructor::createMesh() // Add in non-processor boundary patches faPatchList completePatches(singlePatchEdgeLabels_.size()); + label nPatches = 0; forAll(completePatches, patchi) { const labelList& patchEdgeLabels = singlePatchEdgeLabels_[patchi]; const faPatch& fap = procMesh_.boundary()[patchi]; + if (isA(fap)) + { + // These are not real edges + continue; + } + const label neiPolyPatchId = fap.ngbPolyPatchIndex(); completePatches.set ( - patchi, + nPatches, fap.clone ( completeMesh.boundary(), patchEdgeLabels, - patchi, // index + nPatches, // index neiPolyPatchId ) ); + + ++nPatches; } + completePatches.resize(nPatches); + // Serial mesh - no parallel communication const bool oldParRun = Pstream::parRun(false);