diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H index e4e0e32f20..f7744d972b 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H @@ -17,11 +17,8 @@ for (int gCorr=0; gCorr class PatchField, class GeoMesh> -typename Foam::GeometricField::Boundary +Foam::tmp::Boundary> Foam::GeometricField::Boundary:: boundaryInternalField() const { - typename GeometricField::Boundary - BoundaryInternalField(*this); + tmp::Boundary> tresult + ( + GeometricField::Internal::null(), + *this + ); - forAll(BoundaryInternalField, patchi) + typename GeometricField::Boundary& result = + tresult.ref(); + + forAll(*this, patchi) { - BoundaryInternalField[patchi] == - this->operator[](patchi).patchInternalField(); + result[patchi] == this->operator[](patchi).patchInternalField(); } - return BoundaryInternalField; + return tresult; +} + + +template class PatchField, class GeoMesh> +Foam::tmp::Boundary> +Foam::GeometricField::Boundary:: +boundaryNeighbourField() const +{ + tmp::Boundary> tresult + ( + new typename GeometricField::Boundary + ( + GeometricField::Internal::null(), + *this + ) + ); + + typename GeometricField::Boundary& result = + tresult.ref(); + + if + ( + Pstream::defaultCommsType == Pstream::commsTypes::blocking + || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking + ) + { + const label nReq = Pstream::nRequests(); + + forAll(*this, patchi) + { + if (this->operator[](patchi).coupled()) + { + this->operator[](patchi) + .initPatchNeighbourField(Pstream::defaultCommsType); + } + } + + // Block for any outstanding requests + if + ( + Pstream::parRun() + && Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking + ) + { + Pstream::waitRequests(nReq); + } + + forAll(*this, patchi) + { + if (this->operator[](patchi).coupled()) + { + result[patchi] = + this->operator[](patchi) + .patchNeighbourField(Pstream::defaultCommsType); + } + } + } + else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled) + { + const lduSchedule& patchSchedule = + bmesh_.mesh().globalData().patchSchedule(); + + forAll(patchSchedule, patchEvali) + { + if (this->operator[](patchSchedule[patchEvali].patch).coupled()) + { + if (patchSchedule[patchEvali].init) + { + this->operator[](patchSchedule[patchEvali].patch) + .initPatchNeighbourField(Pstream::defaultCommsType); + } + else + { + result[patchSchedule[patchEvali].patch] = + this->operator[](patchSchedule[patchEvali].patch) + .patchNeighbourField(Pstream::defaultCommsType); + } + } + } + } + else + { + FatalErrorInFunction + << "Unsupported communications type " + << Pstream::commsTypeNames[Pstream::defaultCommsType] + << exit(FatalError); + } + + return tresult; } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 403252e9da..f9fe83b2b9 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -185,7 +185,10 @@ public: //- Return BoundaryField of the cell values neighbouring // the boundary - Boundary boundaryInternalField() const; + tmp boundaryInternalField() const; + + //- Return BoundaryField of the values on the other side of couples + tmp boundaryNeighbourField() const; //- Return a list of pointers for each patch field with only those // pointing to interfaces being set diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.C index 1606409053..dd0bd6d417 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,8 @@ License \*---------------------------------------------------------------------------*/ #include "cyclicFvsPatchField.H" +#include "GeometricField.H" +#include "surfaceMesh.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -98,4 +100,29 @@ Foam::cyclicFvsPatchField::cyclicFvsPatchField {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp> +Foam::cyclicFvsPatchField::patchNeighbourField +( + const Pstream::commsTypes commsType +) const +{ + typedef GeometricField geoField; + const geoField& gf = refCast(this->internalField()); + + const cyclicFvPatch& cp = refCast(this->patch()); + + tmp> tresult + ( + new Field(gf.boundaryField()[cp.nbrPatchID()]) + ); + + cp.transform().transform(tresult.ref(), tresult.ref()); + + return tresult; +} + + // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.H index b73e244ae3..54db3e3e8f 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -111,6 +111,17 @@ public: new cyclicFvsPatchField(*this, iF) ); } + + + // Member Functions + + // Evaluation functions + + //- Return patchField on the opposite patch of a coupled patch + virtual tmp> patchNeighbourField + ( + const Pstream::commsTypes commsType + ) const; }; diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C index 07a2cc46d8..e968065dab 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,8 @@ License \*---------------------------------------------------------------------------*/ #include "cyclicAMIFvsPatchField.H" +#include "GeometricField.H" +#include "surfaceMesh.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -107,4 +109,34 @@ bool Foam::cyclicAMIFvsPatchField::coupled() const } +template +Foam::tmp> +Foam::cyclicAMIFvsPatchField::patchNeighbourField +( + const Pstream::commsTypes commsType +) const +{ + typedef GeometricField geoField; + const geoField& gf = refCast(this->internalField()); + + const cyclicAMIFvPatch& cp = refCast(this->patch()); + + const Field& pnf = gf.boundaryField()[cp.nbrPatchID()]; + + tmp> tpnf; + if (cp.applyLowWeightCorrection()) + { + tpnf = cyclicAMIPatch_.interpolate(pnf, *this); + } + else + { + tpnf = cyclicAMIPatch_.interpolate(pnf); + } + + cp.transform().transform(tpnf.ref(), tpnf()); + + return tpnf; +} + + // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H index 8cd9f2b863..1f5d8a6728 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -119,6 +119,14 @@ public: //- Return true if running parallel virtual bool coupled() const; + + // Evaluation functions + + //- Return patchField on the opposite patch of a coupled patch + virtual tmp> patchNeighbourField + ( + const Pstream::commsTypes commsType + ) const; }; diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.C index 599f457b7c..f4de45b08e 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "processorFvsPatchField.H" +#include "surfaceMesh.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -63,7 +64,7 @@ Foam::processorFvsPatchField::processorFvsPatchField coupledFvsPatchField(p, iF, dict), procPatch_(refCast(p)) { - if (!isType(p)) + if (!isA(p)) { FatalIOErrorInFunction ( @@ -87,7 +88,7 @@ Foam::processorFvsPatchField::processorFvsPatchField coupledFvsPatchField(ptf, p, iF, mapper), procPatch_(refCast(p)) { - if (!isType(this->patch())) + if (!isA(this->patch())) { FatalErrorInFunction << "Field type does not correspond to patch type for patch " @@ -118,4 +119,77 @@ Foam::processorFvsPatchField::~processorFvsPatchField() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::processorFvsPatchField::initPatchNeighbourField +( + const Pstream::commsTypes commsType +) const +{ + if (Pstream::parRun()) + { + if (commsType == Pstream::commsTypes::nonBlocking) + { + receiveBuf_.setSize(this->size()); + + IPstream::read + ( + commsType, + procPatch_.neighbProcNo(), + reinterpret_cast(receiveBuf_.begin()), + receiveBuf_.byteSize(), + procPatch_.tag(), + procPatch_.comm() + ); + } + + OPstream::write + ( + commsType, + procPatch_.neighbProcNo(), + reinterpret_cast(this->begin()), + this->byteSize(), + procPatch_.tag(), + procPatch_.comm() + ); + } +} + + +template +Foam::tmp> +Foam::processorFvsPatchField::patchNeighbourField +( + const Pstream::commsTypes commsType +) const +{ + if (Pstream::parRun()) + { + if (commsType != Pstream::commsTypes::nonBlocking) + { + receiveBuf_.setSize(this->size()); + + IPstream::read + ( + commsType, + procPatch_.neighbProcNo(), + reinterpret_cast(receiveBuf_.begin()), + receiveBuf_.byteSize(), + procPatch_.tag(), + procPatch_.comm() + ); + } + + procPatch_.transform().transform(receiveBuf_, receiveBuf_); + + return receiveBuf_; + } + else + { + return tmp>(new Field()); + } +} + + // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.H index 4581350877..57460ceedb 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,6 +57,9 @@ class processorFvsPatchField //- Local reference cast into the processor patch const processorFvPatch& procPatch_; + //- Receive buffer for non-blocking communication + mutable Field receiveBuf_; + public: @@ -141,6 +144,22 @@ public: return false; } } + + + // Evaluation functions + + //- Initialise return of the patchField on the opposite patch of a + // coupled patch + virtual void initPatchNeighbourField + ( + const Pstream::commsTypes commsType + ) const; + + //- Return patchField on the opposite patch of a coupled patch + virtual tmp> patchNeighbourField + ( + const Pstream::commsTypes commsType + ) const; }; diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C index 40c77e631c..6b5ecba06f 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ Foam::processorCyclicFvsPatchField::processorCyclicFvsPatchField const DimensionedField& iF ) : - coupledFvsPatchField(p, iF), + processorFvsPatchField(p, iF), procPatch_(refCast(p)) {} @@ -47,7 +47,7 @@ Foam::processorCyclicFvsPatchField::processorCyclicFvsPatchField const Field& f ) : - coupledFvsPatchField(p, iF, f), + processorFvsPatchField(p, iF, f), procPatch_(refCast(p)) {} @@ -60,7 +60,7 @@ Foam::processorCyclicFvsPatchField::processorCyclicFvsPatchField const dictionary& dict ) : - coupledFvsPatchField(p, iF, dict), + processorFvsPatchField(p, iF, dict), procPatch_(refCast(p)) { if (!isType(p)) @@ -84,7 +84,7 @@ Foam::processorCyclicFvsPatchField::processorCyclicFvsPatchField const fvPatchFieldMapper& mapper ) : - coupledFvsPatchField(ptf, p, iF, mapper), + processorFvsPatchField(ptf, p, iF, mapper), procPatch_(refCast(p)) { if (!isType(this->patch())) @@ -106,7 +106,7 @@ Foam::processorCyclicFvsPatchField::processorCyclicFvsPatchField const DimensionedField& iF ) : - coupledFvsPatchField(ptf, iF), + processorFvsPatchField(ptf, iF), procPatch_(refCast(ptf.patch())) {} diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.H index 33d514f287..4a22f62c7b 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,8 +35,8 @@ SourceFiles #ifndef processorCyclicFvsPatchField_H #define processorCyclicFvsPatchField_H -#include "coupledFvsPatchField.H" #include "processorCyclicFvPatch.H" +#include "processorFvsPatchField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,7 +50,7 @@ namespace Foam template class processorCyclicFvsPatchField : - public coupledFvsPatchField + public processorFvsPatchField { // Private Data diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index 97115025d8..859f814afd 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -343,6 +343,27 @@ public: } + // Evaluation functions + + //- Initialise return of the patchField on the opposite patch of a + // coupled patch + virtual void initPatchNeighbourField + ( + const Pstream::commsTypes commsType + ) const + {} + + //- Return patchField on the opposite patch of a coupled patch + virtual tmp> patchNeighbourField + ( + const Pstream::commsTypes commsType + ) const + { + NotImplemented; + return *this; + } + + // Mapping functions //- Map (and resize as needed) from self given a mapping object diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H index 91958b7607..8e6c36e436 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -131,7 +131,7 @@ template > void limiterCorr ( - scalarField& allLambda, + surfaceScalarField& allLambda, const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C index 57c3529614..87c533e44c 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,7 +28,6 @@ License #include "localEulerDdtScheme.H" #include "slicedSurfaceFields.H" #include "wedgeFvPatch.H" -#include "syncTools.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -199,7 +198,7 @@ template > void Foam::MULES::limiterCorr ( - scalarField& allLambda, + surfaceScalarField& lambda, const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, @@ -259,23 +258,6 @@ void Foam::MULES::limiterCorr const surfaceScalarField::Boundary& phiCorrBf = phiCorr.boundaryField(); - slicedSurfaceScalarField lambda - ( - IOobject - ( - "lambda", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh, - dimless, - allLambda, - false // Use slices for the couples - ); - scalarField& lambdaIf = lambda; surfaceScalarField::Boundary& lambdaBf = lambda.boundaryFieldRef(); @@ -559,7 +541,21 @@ void Foam::MULES::limiterCorr } } - syncTools::syncFaceList(mesh, allLambda, minEqOp()); + // Take minimum of value across coupled patches + surfaceScalarField::Boundary lambdaNbrBf + ( + surfaceScalarField::Internal::null(), + lambdaBf.boundaryNeighbourField() + ); + forAll(lambdaBf, patchi) + { + fvsPatchScalarField& lambdaPf = lambdaBf[patchi]; + const fvsPatchScalarField& lambdaNbrPf = lambdaNbrBf[patchi]; + if (lambdaPf.coupled()) + { + lambdaPf = min(lambdaPf, lambdaNbrPf); + } + } } } @@ -588,9 +584,7 @@ void Foam::MULES::limitCorr { const fvMesh& mesh = psi.mesh(); - scalarField allLambda(mesh.nFaces(), 1.0); - - slicedSurfaceScalarField lambda + surfaceScalarField lambda ( IOobject ( @@ -602,14 +596,12 @@ void Foam::MULES::limitCorr false ), mesh, - dimless, - allLambda, - false // Use slices for the couples + dimensionedScalar(dimless, 1) ); limiterCorr ( - allLambda, + lambda, rDeltaT, rho, psi, diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H index 60cef62ce0..1de0de8398 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -133,7 +133,7 @@ template > void limiter ( - scalarField& allLambda, + surfaceScalarField& lambda, const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C index 966aadc1f2..60421e4f59 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,7 +29,6 @@ License #include "localEulerDdtScheme.H" #include "slicedSurfaceFields.H" #include "wedgeFvPatch.H" -#include "syncTools.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -190,7 +189,7 @@ template > void Foam::MULES::limiter ( - scalarField& allLambda, + surfaceScalarField& lambda, const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, @@ -253,23 +252,6 @@ void Foam::MULES::limiter const surfaceScalarField::Boundary& phiCorrBf = phiCorr.boundaryField(); - slicedSurfaceScalarField lambda - ( - IOobject - ( - "lambda", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh, - dimless, - allLambda, - false // Use slices for the couples - ); - scalarField& lambdaIf = lambda; surfaceScalarField::Boundary& lambdaBf = lambda.boundaryFieldRef(); @@ -560,7 +542,21 @@ void Foam::MULES::limiter } } - syncTools::syncFaceList(mesh, allLambda, minEqOp()); + // Take minimum value of limiter across coupled patches + surfaceScalarField::Boundary lambdaNbrBf + ( + surfaceScalarField::Internal::null(), + lambdaBf.boundaryNeighbourField() + ); + forAll(lambdaBf, patchi) + { + fvsPatchScalarField& lambdaPf = lambdaBf[patchi]; + const fvsPatchScalarField& lambdaNbrPf = lambdaNbrBf[patchi]; + if (lambdaPf.coupled()) + { + lambdaPf = min(lambdaPf, lambdaNbrPf); + } + } } } @@ -608,9 +604,7 @@ void Foam::MULES::limit surfaceScalarField& phiCorr = phiPsi; phiCorr -= phiBD; - scalarField allLambda(mesh.nFaces(), 1.0); - - slicedSurfaceScalarField lambda + surfaceScalarField lambda ( IOobject ( @@ -622,14 +616,12 @@ void Foam::MULES::limit false ), mesh, - dimless, - allLambda, - false // Use slices for the couples + dimensionedScalar(dimless, 1) ); limiter ( - allLambda, + lambda, rDeltaT, rho, psi,