From 056bb4f0a0354d45d14423de1f0266d3d89a8bf9 Mon Sep 17 00:00:00 2001 From: Mattijs Janssens Date: Thu, 30 May 2024 15:15:56 +0000 Subject: [PATCH] FaceCellWave: travel through coupled ACMI. See #3139 --- .../polyPatches/polyPatch/polyPatch.C | 18 ++++++- .../polyPatches/polyPatch/polyPatch.H | 16 ++++-- ...ureForceBaffleVelocityFvPatchVectorField.C | 30 +++++++++++- .../wallDistAddressing/wallDistAddressing.C | 37 +++++++++----- .../inverseDistanceDiffusivity.C | 1 - .../inverseVolume/inverseVolumeDiffusivity.C | 1 - .../basic/InteractionLists/InteractionLists.C | 6 +-- .../cyclicACMIPolyPatch/cyclicACMIPolyPatch.C | 29 +++++++++-- .../algorithms/MeshWave/FaceCellWave.C | 11 ++++- src/meshTools/cellDist/cellDistFuncs.C | 49 +++++++++++++++---- .../cellDist/patchWave/patchDataWave.C | 44 ++++++++++------- .../cellDist/patchWave/patchDataWave.H | 4 +- src/meshTools/cellDist/patchWave/patchWave.C | 48 +++++++++--------- src/meshTools/cellDist/patchWave/patchWave.H | 4 +- 14 files changed, 212 insertions(+), 86 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C index 3f2530d6da..bc132c24ab 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C @@ -350,13 +350,15 @@ Foam::tmp Foam::polyPatch::faceCellCentres() const } -Foam::tmp Foam::polyPatch::areaFraction() const +Foam::tmp Foam::polyPatch::areaFraction +( + const pointField& points +) const { auto tfraction = tmp::New(size()); auto& fraction = tfraction.ref(); const vectorField::subField faceAreas = this->faceAreas(); - const pointField& points = this->points(); forAll(*this, facei) { @@ -369,6 +371,18 @@ Foam::tmp Foam::polyPatch::areaFraction() const } +const Foam::tmp& Foam::polyPatch::areaFraction() const +{ + return areaFraction_; +} + + +void Foam::polyPatch::areaFraction(const tmp& fraction) +{ + areaFraction_ = fraction; +} + + const Foam::labelUList& Foam::polyPatch::faceCells() const { if (!faceCellsPtr_) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index c676179197..49d2786bc0 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -88,6 +88,9 @@ class polyPatch //- Demand-driven: global edge addressing mutable std::unique_ptr mePtr_; + //- Cached area fraction + tmp areaFraction_; + protected: @@ -441,9 +444,16 @@ public: //- Return face cell centres tmp faceCellCentres() const; - //- Return the area fraction as the ratio of the stored face area - //- and the area given by the face points - tmp areaFraction() const; + //- Calculate the area fraction as the ratio of the stored face + // area and the area given by the face points. + tmp areaFraction(const pointField& points) const; + + //- Return the cached area fraction. Usually only set for the + //- non-overlap patches on ACMI. + const tmp& areaFraction() const; + + //- Set cached area fraction + void areaFraction(const tmp&); // Addressing into mesh diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C index 6f2a989768..cb80bf364a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C @@ -342,6 +342,7 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs() ).neighbFvPatch().Sf(); } + // Update this wall patch vectorField::subField Sfw = patch().patch().faceAreas(); vectorField newSfw((1 - areaFraction)*initWallSf_); @@ -350,16 +351,41 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs() Sfw[facei] = newSfw[facei]; } const_cast(patch().magSf()) = mag(patch().Sf()); + // Cache fraction + const_cast(patch().patch()).areaFraction + ( + tmp::New + ( + patch().patch().size(), + (1-areaFraction) + ) + ); + // Update owner side of cyclic const_cast(cyclicPatch.Sf()) = areaFraction*initCyclicSf_; - const_cast(cyclicPatch.magSf()) = mag(cyclicPatch.Sf()); + const_cast(cyclicPatch.patch()).areaFraction + ( + tmp::New + ( + cyclicPatch.patch().size(), + areaFraction + ) + ); + // Update neighbour side of cyclic const_cast(nbrPatch.Sf()) = areaFraction*nbrCyclicSf_; - const_cast(nbrPatch.magSf()) = mag(nbrPatch.Sf()); + const_cast(cyclicPatch.patch()).areaFraction + ( + tmp::New + ( + nbrPatch.patch().size(), + areaFraction + ) + ); curTimeIndex_ = this->db().time().timeIndex(); } diff --git a/src/finiteVolume/fvMesh/wallDist/wallDistAddressing/wallDistAddressing.C b/src/finiteVolume/fvMesh/wallDist/wallDistAddressing/wallDistAddressing.C index 653079e98e..67a20853af 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDistAddressing/wallDistAddressing.C +++ b/src/finiteVolume/fvMesh/wallDist/wallDistAddressing/wallDistAddressing.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2023 OpenCFD Ltd. + Copyright (C) 2023-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -146,29 +146,40 @@ void Foam::wallDistAddressing::correct(volScalarField& y) globalWallsPtr_.reset(new globalIndex(nWalls)); const globalIndex& globalWalls = globalWallsPtr_(); - labelList seedFaces(nWalls); - List seedInfo(nWalls); + DynamicList