ENH: add finite-area 'ignore' boundary condition

- this is a placeholder boundary BC for using with bad or illegal
  edges. It is currently functionally identical to zero-gradient.
  Naming and definition still subject to change.
This commit is contained in:
Mark Olesen
2023-05-08 10:26:22 +02:00
parent 783934ccad
commit b62e4b06fa
10 changed files with 640 additions and 7 deletions

View File

@ -24,6 +24,7 @@ $(faPatches)/constraint/processor/processorFaPatch.C
$(faPatches)/constraint/wedge/wedgeFaPatch.C $(faPatches)/constraint/wedge/wedgeFaPatch.C
$(faPatches)/constraint/cyclic/cyclicFaPatch.C $(faPatches)/constraint/cyclic/cyclicFaPatch.C
$(faPatches)/constraint/symmetry/symmetryFaPatch.C $(faPatches)/constraint/symmetry/symmetryFaPatch.C
$(faPatches)/other/ignore/ignoreFaPatch.C
distributed/faMeshDistributor.C distributed/faMeshDistributor.C
distributed/faMeshDistributorNew.C distributed/faMeshDistributorNew.C
@ -68,6 +69,7 @@ $(derivedFaPatchFields)/slip/slipFaPatchFields.C
$(derivedFaPatchFields)/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C $(derivedFaPatchFields)/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C
$(derivedFaPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C $(derivedFaPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C
$(derivedFaPatchFields)/uniformFixedValue/uniformFixedValueFaPatchFields.C $(derivedFaPatchFields)/uniformFixedValue/uniformFixedValueFaPatchFields.C
$(derivedFaPatchFields)/ignore/ignoreFaPatchFields.C
$(derivedFaPatchFields)/clampedPlate/clampedPlateFaPatchFields.C $(derivedFaPatchFields)/clampedPlate/clampedPlateFaPatchFields.C
faePatchFields = fields/faePatchFields faePatchFields = fields/faePatchFields

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. 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() void Foam::faPatchData::clear()
{ {
name_.clear(); name_.clear();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,8 +33,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef faPatchData_H #ifndef Foam_faPatchData_H
#define faPatchData_H #define Foam_faPatchData_H
#include "labelList.H" #include "labelList.H"
#include "labelPair.H" #include "labelPair.H"
@ -92,6 +92,9 @@ public:
// Other Functions // Other Functions
//- Has name/type etc
bool good() const;
//- Reset data //- Reset data
void clear(); void clear();

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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)
{}
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
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<faPatch> clone(const faBoundaryMesh& bm) const
{
return autoPtr<faPatch>(new ignoreFaPatch(*this, bm));
}
//- Construct and return a clone, resetting the edge list
// and boundary mesh
virtual autoPtr<faPatch> clone
(
const faBoundaryMesh& bm,
const labelUList& edgeLabels,
const label index,
const label nbrPolyPatchi = -1
) const
{
return autoPtr<faPatch>
(
new ignoreFaPatch(*this, bm, index, edgeLabels, nbrPolyPatchi)
);
}
// Member Functions
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>
\*---------------------------------------------------------------------------*/
#include "ignoreFaPatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::ignoreFaPatchField<Type>::ignoreFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF
)
:
zeroGradientFaPatchField<Type>(p, iF)
{}
template<class Type>
Foam::ignoreFaPatchField<Type>::ignoreFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict
)
:
zeroGradientFaPatchField<Type>(p, iF, dict)
{}
template<class Type>
Foam::ignoreFaPatchField<Type>::ignoreFaPatchField
(
const ignoreFaPatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const faPatchFieldMapper& mapper
)
:
zeroGradientFaPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::ignoreFaPatchField<Type>::ignoreFaPatchField
(
const ignoreFaPatchField<Type>& ptf
)
:
zeroGradientFaPatchField<Type>(ptf)
{}
template<class Type>
Foam::ignoreFaPatchField<Type>::ignoreFaPatchField
(
const ignoreFaPatchField<Type>& ptf,
const DimensionedField<Type, areaMesh>& iF
)
:
zeroGradientFaPatchField<Type>(ptf, iF)
{}
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
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
<patchName>
{
// 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 Type>
class ignoreFaPatchField
:
public zeroGradientFaPatchField<Type>
{
public:
//- Runtime type information
TypeName("ignore");
// Constructors
//- Construct from patch and internal field
ignoreFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&
);
//- Construct from patch, internal field and dictionary
ignoreFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary&
);
//- Construct by mapping the given patch field onto a new patch
ignoreFaPatchField
(
const ignoreFaPatchField<Type>&,
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const faPatchFieldMapper&
);
//- Construct as copy
ignoreFaPatchField
(
const ignoreFaPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<faPatchField<Type>> clone() const
{
return tmp<faPatchField<Type>>
(
new ignoreFaPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
ignoreFaPatchField
(
const ignoreFaPatchField<Type>&,
const DimensionedField<Type, areaMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<faPatchField<Type>> clone
(
const DimensionedField<Type, areaMesh>& iF
) const
{
return tmp<faPatchField<Type>>
(
new ignoreFaPatchField<Type>(*this, iF)
);
}
//- Destructor
virtual ~ignoreFaPatchField() = default;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ignoreFaPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>
\*---------------------------------------------------------------------------*/
#include "ignoreFaPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "areaFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaPatchFields(ignore);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>
\*---------------------------------------------------------------------------*/
#ifndef Foam_ignoreFaPatchFields_H
#define Foam_ignoreFaPatchFields_H
#include "ignoreFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(ignore);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,6 +29,7 @@ License
#include "globalIndex.H" #include "globalIndex.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "edgeHashes.H" #include "edgeHashes.H"
#include "ignoreFaPatch.H"
#include "Time.H" #include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -371,6 +372,12 @@ void Foam::faMeshReconstructor::calcAddressing
{ {
const faPatch& fap = procMesh_.boundary()[patchi]; const faPatch& fap = procMesh_.boundary()[patchi];
if (isA<ignoreFaPatch>(fap))
{
// These are not real edges
continue;
}
labelList& patchEdgeLabels = singlePatchEdgeLabels_[patchi]; labelList& patchEdgeLabels = singlePatchEdgeLabels_[patchi];
patchEdgeLabels = fap.edgeLabels(); patchEdgeLabels = fap.edgeLabels();
@ -490,27 +497,38 @@ void Foam::faMeshReconstructor::createMesh()
// Add in non-processor boundary patches // Add in non-processor boundary patches
faPatchList completePatches(singlePatchEdgeLabels_.size()); faPatchList completePatches(singlePatchEdgeLabels_.size());
label nPatches = 0;
forAll(completePatches, patchi) forAll(completePatches, patchi)
{ {
const labelList& patchEdgeLabels = singlePatchEdgeLabels_[patchi]; const labelList& patchEdgeLabels = singlePatchEdgeLabels_[patchi];
const faPatch& fap = procMesh_.boundary()[patchi]; const faPatch& fap = procMesh_.boundary()[patchi];
if (isA<ignoreFaPatch>(fap))
{
// These are not real edges
continue;
}
const label neiPolyPatchId = fap.ngbPolyPatchIndex(); const label neiPolyPatchId = fap.ngbPolyPatchIndex();
completePatches.set completePatches.set
( (
patchi, nPatches,
fap.clone fap.clone
( (
completeMesh.boundary(), completeMesh.boundary(),
patchEdgeLabels, patchEdgeLabels,
patchi, // index nPatches, // index
neiPolyPatchId neiPolyPatchId
) )
); );
++nPatches;
} }
completePatches.resize(nPatches);
// Serial mesh - no parallel communication // Serial mesh - no parallel communication
const bool oldParRun = Pstream::parRun(false); const bool oldParRun = Pstream::parRun(false);