MULES: Removed use of slicing and syncTools

MULES no longer synchronises the limiter field using syncTools. Surface
boundary field synchronisation is now done with a surface-field-specific
communication procedure that should result in scaling benefits relative
to syncTools. This change also means that the limiter does not need to
be continuous face field which is then sliced; it can be a standard
surface field.
This commit is contained in:
Will Bainbridge
2021-10-28 10:29:17 +01:00
parent 49bf52b469
commit 8cc05a479e
16 changed files with 366 additions and 99 deletions

View File

@ -17,11 +17,8 @@
for (int gCorr=0; gCorr<nAlphaCorr; gCorr++) for (int gCorr=0; gCorr<nAlphaCorr; gCorr++)
{ {
// Create the limiter to be used for all phase-fractions
scalarField allLambda(mesh.nFaces(), 1.0);
// Split the limiter into a surfaceScalarField // Split the limiter into a surfaceScalarField
slicedSurfaceScalarField lambda surfaceScalarField lambda
( (
IOobject IOobject
( (
@ -33,12 +30,9 @@
false false
), ),
mesh, mesh,
dimless, dimensionedScalar(dimless, 1)
allLambda,
false // Use slices for the couples
); );
// Create the complete convection flux for alpha1 // Create the complete convection flux for alpha1
surfaceScalarField alphaPhi1 surfaceScalarField alphaPhi1
( (
@ -79,7 +73,7 @@
MULES::limiter MULES::limiter
( (
allLambda, lambda,
rDeltaT, rDeltaT,
geometricOneField(), geometricOneField(),
alpha1, alpha1,
@ -95,7 +89,7 @@
{ {
MULES::limiter MULES::limiter
( (
allLambda, lambda,
1.0/runTime.deltaT().value(), 1.0/runTime.deltaT().value(),
geometricOneField(), geometricOneField(),
alpha1, alpha1,
@ -142,7 +136,7 @@
MULES::limiter MULES::limiter
( (
allLambda, lambda,
rDeltaT, rDeltaT,
geometricOneField(), geometricOneField(),
alpha2, alpha2,
@ -158,7 +152,7 @@
{ {
MULES::limiter MULES::limiter
( (
allLambda, lambda,
1.0/runTime.deltaT().value(), 1.0/runTime.deltaT().value(),
geometricOneField(), geometricOneField(),
alpha2, alpha2,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -474,20 +474,114 @@ types() const
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
typename Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary Foam::tmp<typename Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary>
Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary:: Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::
boundaryInternalField() const boundaryInternalField() const
{ {
typename GeometricField<Type, PatchField, GeoMesh>::Boundary tmp<typename GeometricField<Type, PatchField, GeoMesh>::Boundary> tresult
BoundaryInternalField(*this); (
GeometricField<Type, PatchField, GeoMesh>::Internal::null(),
*this
);
forAll(BoundaryInternalField, patchi) typename GeometricField<Type, PatchField, GeoMesh>::Boundary& result =
tresult.ref();
forAll(*this, patchi)
{ {
BoundaryInternalField[patchi] == result[patchi] == this->operator[](patchi).patchInternalField();
this->operator[](patchi).patchInternalField();
} }
return BoundaryInternalField; return tresult;
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::tmp<typename Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary>
Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::
boundaryNeighbourField() const
{
tmp<typename GeometricField<Type, PatchField, GeoMesh>::Boundary> tresult
(
new typename GeometricField<Type, PatchField, GeoMesh>::Boundary
(
GeometricField<Type, PatchField, GeoMesh>::Internal::null(),
*this
)
);
typename GeometricField<Type, PatchField, GeoMesh>::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;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -185,7 +185,10 @@ public:
//- Return BoundaryField of the cell values neighbouring //- Return BoundaryField of the cell values neighbouring
// the boundary // the boundary
Boundary boundaryInternalField() const; tmp<Boundary> boundaryInternalField() const;
//- Return BoundaryField of the values on the other side of couples
tmp<Boundary> boundaryNeighbourField() const;
//- Return a list of pointers for each patch field with only those //- Return a list of pointers for each patch field with only those
// pointing to interfaces being set // pointing to interfaces being set

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cyclicFvsPatchField.H" #include "cyclicFvsPatchField.H"
#include "GeometricField.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -98,4 +100,29 @@ Foam::cyclicFvsPatchField<Type>::cyclicFvsPatchField
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::cyclicFvsPatchField<Type>::patchNeighbourField
(
const Pstream::commsTypes commsType
) const
{
typedef GeometricField<Type, fvsPatchField, surfaceMesh> geoField;
const geoField& gf = refCast<const geoField>(this->internalField());
const cyclicFvPatch& cp = refCast<const cyclicFvPatch>(this->patch());
tmp<Field<Type>> tresult
(
new Field<Type>(gf.boundaryField()[cp.nbrPatchID()])
);
cp.transform().transform(tresult.ref(), tresult.ref());
return tresult;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -111,6 +111,17 @@ public:
new cyclicFvsPatchField<Type>(*this, iF) new cyclicFvsPatchField<Type>(*this, iF)
); );
} }
// Member Functions
// Evaluation functions
//- Return patchField on the opposite patch of a coupled patch
virtual tmp<Field<Type>> patchNeighbourField
(
const Pstream::commsTypes commsType
) const;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cyclicAMIFvsPatchField.H" #include "cyclicAMIFvsPatchField.H"
#include "GeometricField.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -107,4 +109,34 @@ bool Foam::cyclicAMIFvsPatchField<Type>::coupled() const
} }
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::cyclicAMIFvsPatchField<Type>::patchNeighbourField
(
const Pstream::commsTypes commsType
) const
{
typedef GeometricField<Type, fvsPatchField, surfaceMesh> geoField;
const geoField& gf = refCast<const geoField>(this->internalField());
const cyclicAMIFvPatch& cp = refCast<const cyclicAMIFvPatch>(this->patch());
const Field<Type>& pnf = gf.boundaryField()[cp.nbrPatchID()];
tmp<Field<Type>> tpnf;
if (cp.applyLowWeightCorrection())
{
tpnf = cyclicAMIPatch_.interpolate(pnf, *this);
}
else
{
tpnf = cyclicAMIPatch_.interpolate(pnf);
}
cp.transform().transform(tpnf.ref(), tpnf());
return tpnf;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -119,6 +119,14 @@ public:
//- Return true if running parallel //- Return true if running parallel
virtual bool coupled() const; virtual bool coupled() const;
// Evaluation functions
//- Return patchField on the opposite patch of a coupled patch
virtual tmp<Field<Type>> patchNeighbourField
(
const Pstream::commsTypes commsType
) const;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "processorFvsPatchField.H" #include "processorFvsPatchField.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -63,7 +64,7 @@ Foam::processorFvsPatchField<Type>::processorFvsPatchField
coupledFvsPatchField<Type>(p, iF, dict), coupledFvsPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorFvPatch>(p)) procPatch_(refCast<const processorFvPatch>(p))
{ {
if (!isType<processorFvPatch>(p)) if (!isA<processorFvPatch>(p))
{ {
FatalIOErrorInFunction FatalIOErrorInFunction
( (
@ -87,7 +88,7 @@ Foam::processorFvsPatchField<Type>::processorFvsPatchField
coupledFvsPatchField<Type>(ptf, p, iF, mapper), coupledFvsPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorFvPatch>(p)) procPatch_(refCast<const processorFvPatch>(p))
{ {
if (!isType<processorFvPatch>(this->patch())) if (!isA<processorFvPatch>(this->patch()))
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Field type does not correspond to patch type for patch " << "Field type does not correspond to patch type for patch "
@ -118,4 +119,77 @@ Foam::processorFvsPatchField<Type>::~processorFvsPatchField()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::processorFvsPatchField<Type>::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<char*>(receiveBuf_.begin()),
receiveBuf_.byteSize(),
procPatch_.tag(),
procPatch_.comm()
);
}
OPstream::write
(
commsType,
procPatch_.neighbProcNo(),
reinterpret_cast<const char*>(this->begin()),
this->byteSize(),
procPatch_.tag(),
procPatch_.comm()
);
}
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::processorFvsPatchField<Type>::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<char*>(receiveBuf_.begin()),
receiveBuf_.byteSize(),
procPatch_.tag(),
procPatch_.comm()
);
}
procPatch_.transform().transform(receiveBuf_, receiveBuf_);
return receiveBuf_;
}
else
{
return tmp<Field<Type>>(new Field<Type>());
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,6 +57,9 @@ class processorFvsPatchField
//- Local reference cast into the processor patch //- Local reference cast into the processor patch
const processorFvPatch& procPatch_; const processorFvPatch& procPatch_;
//- Receive buffer for non-blocking communication
mutable Field<Type> receiveBuf_;
public: public:
@ -141,6 +144,22 @@ public:
return false; 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<Field<Type>> patchNeighbourField
(
const Pstream::commsTypes commsType
) const;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,7 +34,7 @@ Foam::processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
const DimensionedField<Type, surfaceMesh>& iF const DimensionedField<Type, surfaceMesh>& iF
) )
: :
coupledFvsPatchField<Type>(p, iF), processorFvsPatchField<Type>(p, iF),
procPatch_(refCast<const processorCyclicFvPatch>(p)) procPatch_(refCast<const processorCyclicFvPatch>(p))
{} {}
@ -47,7 +47,7 @@ Foam::processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
const Field<Type>& f const Field<Type>& f
) )
: :
coupledFvsPatchField<Type>(p, iF, f), processorFvsPatchField<Type>(p, iF, f),
procPatch_(refCast<const processorCyclicFvPatch>(p)) procPatch_(refCast<const processorCyclicFvPatch>(p))
{} {}
@ -60,7 +60,7 @@ Foam::processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
const dictionary& dict const dictionary& dict
) )
: :
coupledFvsPatchField<Type>(p, iF, dict), processorFvsPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorCyclicFvPatch>(p)) procPatch_(refCast<const processorCyclicFvPatch>(p))
{ {
if (!isType<processorCyclicFvPatch>(p)) if (!isType<processorCyclicFvPatch>(p))
@ -84,7 +84,7 @@ Foam::processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
coupledFvsPatchField<Type>(ptf, p, iF, mapper), processorFvsPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorCyclicFvPatch>(p)) procPatch_(refCast<const processorCyclicFvPatch>(p))
{ {
if (!isType<processorCyclicFvPatch>(this->patch())) if (!isType<processorCyclicFvPatch>(this->patch()))
@ -106,7 +106,7 @@ Foam::processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
const DimensionedField<Type, surfaceMesh>& iF const DimensionedField<Type, surfaceMesh>& iF
) )
: :
coupledFvsPatchField<Type>(ptf, iF), processorFvsPatchField<Type>(ptf, iF),
procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch())) procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch()))
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,8 +35,8 @@ SourceFiles
#ifndef processorCyclicFvsPatchField_H #ifndef processorCyclicFvsPatchField_H
#define processorCyclicFvsPatchField_H #define processorCyclicFvsPatchField_H
#include "coupledFvsPatchField.H"
#include "processorCyclicFvPatch.H" #include "processorCyclicFvPatch.H"
#include "processorFvsPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,7 +50,7 @@ namespace Foam
template<class Type> template<class Type>
class processorCyclicFvsPatchField class processorCyclicFvsPatchField
: :
public coupledFvsPatchField<Type> public processorFvsPatchField<Type>
{ {
// Private Data // Private Data

View File

@ -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<Field<Type>> patchNeighbourField
(
const Pstream::commsTypes commsType
) const
{
NotImplemented;
return *this;
}
// Mapping functions // Mapping functions
//- Map (and resize as needed) from self given a mapping object //- Map (and resize as needed) from self given a mapping object

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -131,7 +131,7 @@ template
> >
void limiterCorr void limiterCorr
( (
scalarField& allLambda, surfaceScalarField& allLambda,
const RdeltaTType& rDeltaT, const RdeltaTType& rDeltaT,
const RhoType& rho, const RhoType& rho,
const volScalarField& psi, const volScalarField& psi,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,7 +28,6 @@ License
#include "localEulerDdtScheme.H" #include "localEulerDdtScheme.H"
#include "slicedSurfaceFields.H" #include "slicedSurfaceFields.H"
#include "wedgeFvPatch.H" #include "wedgeFvPatch.H"
#include "syncTools.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -199,7 +198,7 @@ template
> >
void Foam::MULES::limiterCorr void Foam::MULES::limiterCorr
( (
scalarField& allLambda, surfaceScalarField& lambda,
const RdeltaTType& rDeltaT, const RdeltaTType& rDeltaT,
const RhoType& rho, const RhoType& rho,
const volScalarField& psi, const volScalarField& psi,
@ -259,23 +258,6 @@ void Foam::MULES::limiterCorr
const surfaceScalarField::Boundary& phiCorrBf = const surfaceScalarField::Boundary& phiCorrBf =
phiCorr.boundaryField(); 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; scalarField& lambdaIf = lambda;
surfaceScalarField::Boundary& lambdaBf = surfaceScalarField::Boundary& lambdaBf =
lambda.boundaryFieldRef(); lambda.boundaryFieldRef();
@ -559,7 +541,21 @@ void Foam::MULES::limiterCorr
} }
} }
syncTools::syncFaceList(mesh, allLambda, minEqOp<scalar>()); // 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(); const fvMesh& mesh = psi.mesh();
scalarField allLambda(mesh.nFaces(), 1.0); surfaceScalarField lambda
slicedSurfaceScalarField lambda
( (
IOobject IOobject
( (
@ -602,14 +596,12 @@ void Foam::MULES::limitCorr
false false
), ),
mesh, mesh,
dimless, dimensionedScalar(dimless, 1)
allLambda,
false // Use slices for the couples
); );
limiterCorr limiterCorr
( (
allLambda, lambda,
rDeltaT, rDeltaT,
rho, rho,
psi, psi,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -133,7 +133,7 @@ template
> >
void limiter void limiter
( (
scalarField& allLambda, surfaceScalarField& lambda,
const RdeltaTType& rDeltaT, const RdeltaTType& rDeltaT,
const RhoType& rho, const RhoType& rho,
const volScalarField& psi, const volScalarField& psi,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,6 @@ License
#include "localEulerDdtScheme.H" #include "localEulerDdtScheme.H"
#include "slicedSurfaceFields.H" #include "slicedSurfaceFields.H"
#include "wedgeFvPatch.H" #include "wedgeFvPatch.H"
#include "syncTools.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -190,7 +189,7 @@ template
> >
void Foam::MULES::limiter void Foam::MULES::limiter
( (
scalarField& allLambda, surfaceScalarField& lambda,
const RdeltaTType& rDeltaT, const RdeltaTType& rDeltaT,
const RhoType& rho, const RhoType& rho,
const volScalarField& psi, const volScalarField& psi,
@ -253,23 +252,6 @@ void Foam::MULES::limiter
const surfaceScalarField::Boundary& phiCorrBf = const surfaceScalarField::Boundary& phiCorrBf =
phiCorr.boundaryField(); 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; scalarField& lambdaIf = lambda;
surfaceScalarField::Boundary& lambdaBf = lambda.boundaryFieldRef(); surfaceScalarField::Boundary& lambdaBf = lambda.boundaryFieldRef();
@ -560,7 +542,21 @@ void Foam::MULES::limiter
} }
} }
syncTools::syncFaceList(mesh, allLambda, minEqOp<scalar>()); // 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; surfaceScalarField& phiCorr = phiPsi;
phiCorr -= phiBD; phiCorr -= phiBD;
scalarField allLambda(mesh.nFaces(), 1.0); surfaceScalarField lambda
slicedSurfaceScalarField lambda
( (
IOobject IOobject
( (
@ -622,14 +616,12 @@ void Foam::MULES::limit
false false
), ),
mesh, mesh,
dimless, dimensionedScalar(dimless, 1)
allLambda,
false // Use slices for the couples
); );
limiter limiter
( (
allLambda, lambda,
rDeltaT, rDeltaT,
rho, rho,
psi, psi,