ENH: MRF: Remove ddtCorr from MRF regions

MRFZone: Filter-out excluded patches from ddtCorr
This commit is contained in:
Henry Weller 2018-02-10 22:46:17 +00:00 committed by Andrew Heather
parent fe4752d28a
commit 05f5a293bc
29 changed files with 179 additions and 34 deletions

View File

@ -13,7 +13,10 @@ if (pimple.transonic())
*(
(
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
+ MRF.zeroFilter
(
rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
)
)
)
);
@ -47,7 +50,7 @@ else
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, rhoUf))
)
);

View File

@ -11,7 +11,7 @@ surfaceScalarField phiHbyA
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
)
+ phig
);

View File

@ -17,7 +17,10 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+ MRF.zeroFilter
(
rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
)
)
);
@ -49,7 +52,7 @@ else
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
)
);

View File

@ -17,8 +17,11 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
/fvc::interpolate(rho)
+ MRF.zeroFilter
(
fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
/fvc::interpolate(rho)
)
)
);
@ -61,7 +64,7 @@ else
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi))
)
);

View File

@ -15,7 +15,7 @@ surfaceScalarField phiHbyA
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
)
+ phig
);

View File

@ -20,7 +20,7 @@ surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::interpolate(rho)*fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf))
);
fvc::makeRelative(phiHbyA, rho, U);

View File

@ -21,7 +21,10 @@ surfaceScalarField phiHbyA
"phiHbyA",
(
fvc::interpolate(rho)*fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi, rhoUf)
+ MRF.zeroFilter
(
fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi, rhoUf)
)
)
);

View File

@ -9,7 +9,7 @@ surfaceScalarField phid
fvc::interpolate(psi)
*(
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho))
)
);

View File

@ -9,7 +9,7 @@
(
"phiHbyA",
fvc::flux(HbyA)
+ rAUf*fvc::ddtCorr(U, phi)
+ MRF.zeroFilter(rAUf*fvc::ddtCorr(U, phi))
+ phig
);

View File

@ -19,7 +19,7 @@ surfaceScalarField phiHbyA
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
)
+ phig
);

View File

@ -19,7 +19,7 @@ surfaceScalarField phiHbyA
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
)
+ phig
);

View File

@ -4,7 +4,7 @@ surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rAU)*fvc::ddtCorr(U, phi, Uf)
+ MRF.zeroFilter(fvc::interpolate(rAU)*fvc::ddtCorr(U, phi, Uf))
);
MRF.makeRelative(phiHbyA);

View File

@ -4,7 +4,7 @@ surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
+ MRF.zeroFilter(fvc::interpolate(rAU)*fvc::ddtCorr(U, phi))
);
MRF.makeRelative(phiHbyA);

View File

@ -12,7 +12,10 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+ MRF.zeroFilter
(
rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
)
)
);
@ -45,7 +48,7 @@ else
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
)
);

View File

@ -18,7 +18,7 @@ surfaceScalarField phiHbyA
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
)
+ phig
);

View File

@ -20,7 +20,10 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+ MRF.zeroFilter
(
rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
)
)
);

View File

@ -20,7 +20,10 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
+ MRF.zeroFilter
(
rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
)
)
);
@ -53,7 +56,7 @@ else
(
"phiHbyA",
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
+ MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, rhoUf))
);
fvc::makeRelative(phiHbyA, rho, U);

View File

@ -6,7 +6,7 @@
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf)
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf))
);
MRF.makeRelative(phiHbyA);

View File

@ -6,7 +6,7 @@
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi))
);
MRF.makeRelative(phiHbyA);

View File

@ -6,7 +6,7 @@
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi))
);
MRF.makeRelative(phiHbyA);

View File

@ -6,7 +6,7 @@
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi))
);
MRF.makeRelative(phiHbyA);
adjustPhi(phiHbyA, U, p_rgh);

View File

@ -14,7 +14,7 @@
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf)
+ MRF.zeroFilter(fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf))
);
MRF.makeRelative(phiHbyA);

View File

@ -98,7 +98,10 @@
phiHbyAs[phasei] =
(
fvc::flux(HbyAs[phasei])
+ rAlphaAUfs[phasei]*fvc::ddtCorr(phase.U(), phase.phi())
+ MRF.zeroFilter
(
rAlphaAUfs[phasei]*fvc::ddtCorr(phase.U(), phase.phi())
)
);
MRF.makeRelative(phiHbyAs[phasei]);
MRF.makeRelative(phase.phi().oldTime());

View File

@ -11,7 +11,7 @@ surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(HbyA)
+ rAUf*fvc::ddtCorr(U, phi)
+ MRF.zeroFilter(rAUf*fvc::ddtCorr(U, phi))
);
MRF.makeRelative(phiHbyA);

View File

@ -12,7 +12,7 @@
(
"phiHbyA",
fvc::flux(HbyA)
+ rAUf*fvc::ddtCorr(U, Uf)
+ MRF.zeroFilter(rAUf*fvc::ddtCorr(U, Uf))
);
MRF.makeRelative(phiHbyA);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -257,6 +257,10 @@ public:
//- Correct the boundary velocity for the rotation of the MRF region
void correctBoundaryVelocity(volVectorField& U) const;
//- Zero the MRF region of the given field
template<class Type>
void zero(GeometricField<Type, fvsPatchField, surfaceMesh>& phi) const;
//- Update MRFZone faces if the mesh topology changes
void update();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -184,6 +184,14 @@ public:
surfaceScalarField& phi
) const;
//- Filter-out the MRF region contribution from the given field
// setting the corresponding values to zero
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> zeroFilter
(
const tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>& tphi
) const;
//- Update MRFZone faces if the mesh topology changes
void update();
@ -210,6 +218,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "MRFZoneListTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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 "MRFZoneList.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>>
Foam::MRFZoneList::zeroFilter
(
const tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>& tphi
) const
{
if (size())
{
tmp<surfaceScalarField> zphi
(
New
(
tphi,
"zeroFilter(" + tphi().name() + ')',
tphi().dimensions(),
true
)
);
forAll(*this, i)
{
operator[](i).zero(zphi.ref());
}
return zphi;
}
else
{
return tmp<surfaceScalarField>(tphi, true);
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -207,4 +207,43 @@ void Foam::MRFZone::makeAbsoluteRhoFlux
}
template<class Type>
void Foam::MRFZone::zero
(
GeometricField<Type, fvsPatchField, surfaceMesh>& phi
) const
{
if (!active_)
{
return;
}
Field<Type>& phii = phi.primitiveFieldRef();
forAll(internalFaces_, i)
{
phii[internalFaces_[i]] = Zero;
}
typename GeometricField<Type, fvsPatchField, surfaceMesh>::Boundary& phibf =
phi.boundaryFieldRef();
forAll(includedFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
{
phibf[patchi][includedFaces_[patchi][i]] = Zero;
}
}
forAll(excludedFaces_, patchi)
{
forAll(excludedFaces_[patchi], i)
{
phibf[patchi][excludedFaces_[patchi][i]] = Zero;
}
}
}
// ************************************************************************* //