Compare commits

...

1 Commits

Author SHA1 Message Date
82c405882d ENH: fvPatch: allow explicit coupled provision for any patch. 2021-12-14 16:07:18 +00:00
10 changed files with 107 additions and 7 deletions

View File

@ -458,6 +458,8 @@ $(GAMGInterfaces)/GAMGInterface/GAMGInterfaceNew.C
$(GAMGInterfaces)/processorGAMGInterface/processorGAMGInterface.C
$(GAMGInterfaces)/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C
$(GAMGInterfaces)/cyclicGAMGInterface/cyclicGAMGInterface.C
$(GAMGInterfaces)/primitiveGAMGInterface/primitiveGAMGInterface.C
GAMGInterfaceFields = $(GAMG)/interfaceFields
$(GAMGInterfaceFields)/GAMGInterfaceField/GAMGInterfaceField.C

View File

@ -97,6 +97,7 @@ Foam::polyPatch::polyPatch
),
start_(start),
boundaryMesh_(bm),
coupled_(false),
faceCellsPtr_(nullptr),
mePtr_(nullptr)
{
@ -126,6 +127,7 @@ Foam::polyPatch::polyPatch
),
start_(start),
boundaryMesh_(bm),
coupled_(false),
faceCellsPtr_(nullptr),
mePtr_(nullptr)
{}
@ -153,6 +155,7 @@ Foam::polyPatch::polyPatch
),
start_(dict.get<label>("startFace")),
boundaryMesh_(bm),
coupled_(dict.getOrDefault<bool>("coupled", false)),
faceCellsPtr_(nullptr),
mePtr_(nullptr)
{
@ -160,6 +163,10 @@ Foam::polyPatch::polyPatch
{
inGroups().appendUniq(patchType);
}
DebugVar(name);
DebugVar(coupled_);
}
@ -182,6 +189,7 @@ Foam::polyPatch::polyPatch
),
start_(pp.start()),
boundaryMesh_(bm),
coupled_(pp.coupled()),
faceCellsPtr_(nullptr),
mePtr_(nullptr)
{}
@ -209,6 +217,7 @@ Foam::polyPatch::polyPatch
),
start_(newStart),
boundaryMesh_(bm),
coupled_(pp.coupled()),
faceCellsPtr_(nullptr),
mePtr_(nullptr)
{}
@ -236,6 +245,7 @@ Foam::polyPatch::polyPatch
),
start_(newStart),
boundaryMesh_(bm),
coupled_(pp.coupled()),
faceCellsPtr_(nullptr),
mePtr_(nullptr)
{}
@ -247,6 +257,7 @@ Foam::polyPatch::polyPatch(const polyPatch& p)
primitivePatch(p),
start_(p.start_),
boundaryMesh_(p.boundaryMesh_),
coupled_(p.coupled()),
faceCellsPtr_(nullptr),
mePtr_(nullptr)
{}
@ -416,6 +427,7 @@ void Foam::polyPatch::write(Ostream& os) const
patchIdentifier::write(os);
os.writeEntry("nFaces", size());
os.writeEntry("startFace", start());
os.writeEntryIfDifferent<bool>("coupled", false, coupled_);
}

View File

@ -79,6 +79,10 @@ class polyPatch
//- Reference to boundary mesh
const polyBoundaryMesh& boundaryMesh_;
//- Whether supports lduInterface (usually overriden by 'proper'
// constraint coupled patches)
bool coupled_;
//- Demand-driven: face-cell addressing
mutable labelList::subList* faceCellsPtr_;
@ -377,7 +381,14 @@ public:
// points correspondence)
virtual bool coupled() const
{
return false;
return coupled_;
}
//- Return true if this patch is geometrically coupled (i.e. faces and
// points correspondence)
virtual void coupled(const bool coupled)
{
coupled_ = coupled;
}
//- Return true if the given type is a constraint type

View File

@ -1,3 +1,8 @@
fvPatches = fvMesh/fvPatches
$(fvPatches)/fvPatch/fvPatch.C
$(fvPatches)/fvPatch/fvPatchNew.C
fvMesh/fvMeshGeometry.C
fvMesh/fvMesh.C
@ -21,10 +26,6 @@ fvMesh/simplifiedFvMesh/hexCellFvMesh/hexCellFvMesh.C
fvBoundaryMesh = fvMesh/fvBoundaryMesh
$(fvBoundaryMesh)/fvBoundaryMesh.C
fvPatches = fvMesh/fvPatches
$(fvPatches)/fvPatch/fvPatch.C
$(fvPatches)/fvPatch/fvPatchNew.C
basicFvPatches = $(fvPatches)/basic
$(basicFvPatches)/coupled/coupledFvPatch.C
$(basicFvPatches)/generic/genericFvPatch.C

View File

@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "fvsPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,6 +53,31 @@ makeFvsPatchField(fvsPatchSphericalTensorField)
makeFvsPatchField(fvsPatchSymmTensorField)
makeFvsPatchField(fvsPatchTensorField)
//- If running with coupled basic patch make sure PatchField<Type>::New
//- works. TBD: avoid fvsPatchField but go through to SlicedPatchField?
//- (see SlicedGeometricField::slicedBoundaryField)
addNamedToRunTimeSelectionTable
(
fvsPatchScalarField, fvsPatchScalarField, patch, patch
);
addNamedToRunTimeSelectionTable
(
fvsPatchVectorField, fvsPatchVectorField, patch, patch
);
addNamedToRunTimeSelectionTable
(
fvsPatchSphericalTensorField, fvsPatchSphericalTensorField, patch, patch
);
addNamedToRunTimeSelectionTable
(
fvsPatchSymmTensorField, fvsPatchSymmTensorField, patch, patch
);
addNamedToRunTimeSelectionTable
(
fvsPatchTensorField, fvsPatchTensorField, patch, patch
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -150,14 +150,19 @@ Foam::lduInterfacePtrsList Foam::fvBoundaryMesh::interfaces() const
{
const fvPatchList& patches = *this;
DebugVar(patches.size());
lduInterfacePtrsList list(patches.size());
forAll(list, patchi)
{
const lduInterface* lduPtr = isA<lduInterface>(patches[patchi]);
if (lduPtr)
if (lduPtr && patches[patchi].coupled())
{
Pout<< "** fvBoundaryMesh : adding patch " << patches[patchi].name()
<< " at index:" << patchi
<< endl;
list.set(patchi, lduPtr);
}
}

View File

@ -707,6 +707,8 @@ const Foam::lduAddressing& Foam::fvMesh::lduAddr() const
Foam::lduInterfacePtrsList Foam::fvMesh::interfaces() const
{
DebugVar("here");
return boundary().interfaces();
}

View File

@ -53,7 +53,7 @@ namespace Foam
class coupledFvPatch
:
public lduInterface,
// public lduInterface,
public fvPatch
{
// Private data

View File

@ -49,6 +49,7 @@ SourceFiles
#include "fvPatchFieldsFwd.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "lduInterface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,6 +65,8 @@ class surfaceInterpolation;
\*---------------------------------------------------------------------------*/
class fvPatch
:
public lduInterface
{
// Private Data
@ -217,6 +220,43 @@ public:
virtual const labelUList& faceCells() const;
// Interface transfer functions
//- Return the values of the given internal data adjacent to
//- the interface as a field using faceCell mapping
virtual tmp<labelField> interfaceInternalField
(
const labelUList& internalData,
const labelUList& faceCells
) const
{
return tmp<labelField>
(
new labelField(internalData, faceCells)
);
}
//- Return the values of the given internal data adjacent to
// the interface as a field
virtual tmp<labelField> interfaceInternalField
(
const labelUList& internalData
) const
{
return interfaceInternalField(internalData, faceCells());
}
//- Transfer and return internal field adjacent to the interface
virtual tmp<labelField> internalFieldTransfer
(
const Pstream::commsTypes commsType,
const labelUList& iF
) const
{
return interfaceInternalField(iF);
}
// Access functions for geometrical data
//- Return face centres

View File

@ -95,6 +95,7 @@ boundary
inlet
{
type patch;
coupled true;
faces
(
(0 1 12 11)