Completed boundaryField() -> boundaryFieldRef()
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1938 Because C++ does not support overloading based on the return-type there is a problem defining both const and non-const member functions which are resolved based on the const-ness of the object for which they are called rather than the intent of the programmer declared via the const-ness of the returned type. The issue for the "boundaryField()" member function is that the non-const version increments the event-counter and checks the state of the stored old-time fields in case the returned value is altered whereas the const version has no side-effects and simply returns the reference. If the the non-const function is called within the patch-loop the event-counter may overflow. To resolve this it in necessary to avoid calling the non-const form of "boundaryField()" if the results is not altered and cache the reference outside the patch-loop when mutation of the patch fields is needed. The most straight forward way of resolving this problem is to name the const and non-const forms of the member functions differently e.g. the non-const form could be named: mutableBoundaryField() mutBoundaryField() nonConstBoundaryField() boundaryFieldRef() Given that in C++ a reference is non-const unless specified as const: "T&" vs "const T&" the logical convention would be boundaryFieldRef() boundaryFieldConstRef() and given that the const form which is more commonly used is it could simply be named "boundaryField()" then the logical convention is GeometricBoundaryField& boundaryFieldRef(); inline const GeometricBoundaryField& boundaryField() const; This is also consistent with the new "tmp" class for which non-const access to the stored object is obtained using the ".ref()" member function. This new convention for non-const access to the components of GeometricField will be applied to "dimensionedInternalField()" and "internalField()" in the future, i.e. "dimensionedInternalFieldRef()" and "internalFieldRef()".
This commit is contained in:
@ -130,7 +130,7 @@ void PDRkEpsilon::correct()
|
||||
tgradU.clear();
|
||||
|
||||
// Update espsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
epsilon_.boundaryFieldRef().updateCoeffs();
|
||||
|
||||
// Add the blockage generation term so that it is included consistently
|
||||
// in both the k and epsilon equations
|
||||
@ -163,7 +163,7 @@ void PDRkEpsilon::correct()
|
||||
|
||||
epsEqn.ref().relax();
|
||||
|
||||
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
|
||||
epsEqn.ref().boundaryManipulate(epsilon_.boundaryFieldRef());
|
||||
|
||||
solve(epsEqn);
|
||||
bound(epsilon_, epsilonMin_);
|
||||
|
||||
@ -119,9 +119,11 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEXiEq::XiEq() const
|
||||
}
|
||||
}
|
||||
|
||||
volScalarField::GeometricBoundaryField& xieqBf = xieq.boundaryFieldRef();
|
||||
|
||||
forAll(xieq.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& xieqp = xieq.boundaryField()[patchi];
|
||||
scalarField& xieqp = xieqBf[patchi];
|
||||
const scalarField& Kp = K.boundaryField()[patchi];
|
||||
const scalarField& Map = Ma.boundaryField()[patchi];
|
||||
const scalarField& upBySup = upBySu.boundaryField()[patchi];
|
||||
|
||||
@ -266,9 +266,11 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
|
||||
Su0[celli] = Su0pTphi(p[celli], Tu[celli], phi);
|
||||
}
|
||||
|
||||
forAll(Su0.boundaryField(), patchi)
|
||||
volScalarField::GeometricBoundaryField& Su0Bf = Su0.boundaryFieldRef();
|
||||
|
||||
forAll(Su0Bf, patchi)
|
||||
{
|
||||
scalarField& Su0p = Su0.boundaryField()[patchi];
|
||||
scalarField& Su0p = Su0Bf[patchi];
|
||||
const scalarField& pp = p.boundaryField()[patchi];
|
||||
const scalarField& Tup = Tu.boundaryField()[patchi];
|
||||
|
||||
@ -313,9 +315,11 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
|
||||
Su0[celli] = Su0pTphi(p[celli], Tu[celli], phi[celli]);
|
||||
}
|
||||
|
||||
forAll(Su0.boundaryField(), patchi)
|
||||
volScalarField::GeometricBoundaryField& Su0Bf = Su0.boundaryFieldRef();
|
||||
|
||||
forAll(Su0Bf, patchi)
|
||||
{
|
||||
scalarField& Su0p = Su0.boundaryField()[patchi];
|
||||
scalarField& Su0p = Su0Bf[patchi];
|
||||
const scalarField& pp = p.boundaryField()[patchi];
|
||||
const scalarField& Tup = Tu.boundaryField()[patchi];
|
||||
const scalarField& phip = phi.boundaryField()[patchi];
|
||||
@ -365,9 +369,11 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Ma
|
||||
ma[celli] = Ma(phi[celli]);
|
||||
}
|
||||
|
||||
forAll(ma.boundaryField(), patchi)
|
||||
volScalarField::GeometricBoundaryField& maBf = ma.boundaryFieldRef();
|
||||
|
||||
forAll(maBf, patchi)
|
||||
{
|
||||
scalarField& map = ma.boundaryField()[patchi];
|
||||
scalarField& map = maBf[patchi];
|
||||
const scalarField& phip = phi.boundaryField()[patchi];
|
||||
|
||||
forAll(map, facei)
|
||||
|
||||
@ -189,7 +189,7 @@ int main(int argc, char *argv[])
|
||||
rhoU.dimensionedInternalField()
|
||||
/rho.dimensionedInternalField();
|
||||
U.correctBoundaryConditions();
|
||||
rhoU.boundaryField() == rho.boundaryField()*U.boundaryField();
|
||||
rhoU.boundaryFieldRef() == rho.boundaryField()*U.boundaryField();
|
||||
|
||||
if (!inviscid)
|
||||
{
|
||||
@ -223,7 +223,7 @@ int main(int argc, char *argv[])
|
||||
e = rhoE/rho - 0.5*magSqr(U);
|
||||
e.correctBoundaryConditions();
|
||||
thermo.correct();
|
||||
rhoE.boundaryField() ==
|
||||
rhoE.boundaryFieldRef() ==
|
||||
rho.boundaryField()*
|
||||
(
|
||||
e.boundaryField() + 0.5*magSqr(U.boundaryField())
|
||||
@ -244,7 +244,7 @@ int main(int argc, char *argv[])
|
||||
rho.dimensionedInternalField()
|
||||
/psi.dimensionedInternalField();
|
||||
p.correctBoundaryConditions();
|
||||
rho.boundaryField() == psi.boundaryField()*p.boundaryField();
|
||||
rho.boundaryFieldRef() == psi.boundaryField()*p.boundaryField();
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ int main(int argc, char *argv[])
|
||||
rhoU.dimensionedInternalField()
|
||||
/rho.dimensionedInternalField();
|
||||
U.correctBoundaryConditions();
|
||||
rhoU.boundaryField() == rho.boundaryField()*U.boundaryField();
|
||||
rhoU.boundaryFieldRef() == rho.boundaryField()*U.boundaryField();
|
||||
|
||||
if (!inviscid)
|
||||
{
|
||||
@ -216,7 +216,7 @@ int main(int argc, char *argv[])
|
||||
e = rhoE/rho - 0.5*magSqr(U);
|
||||
e.correctBoundaryConditions();
|
||||
thermo.correct();
|
||||
rhoE.boundaryField() ==
|
||||
rhoE.boundaryFieldRef() ==
|
||||
rho.boundaryField()*
|
||||
(
|
||||
e.boundaryField() + 0.5*magSqr(U.boundaryField())
|
||||
@ -237,7 +237,7 @@ int main(int argc, char *argv[])
|
||||
rho.dimensionedInternalField()
|
||||
/psi.dimensionedInternalField();
|
||||
p.correctBoundaryConditions();
|
||||
rho.boundaryField() == psi.boundaryField()*p.boundaryField();
|
||||
rho.boundaryFieldRef() == psi.boundaryField()*p.boundaryField();
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
|
||||
@ -923,7 +923,7 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixtureThermo::K
|
||||
{
|
||||
tmp<surfaceVectorField> tnHatfv = nHatfv(alpha1, alpha2);
|
||||
|
||||
correctContactAngle(alpha1, alpha2, tnHatfv.ref().boundaryField());
|
||||
correctContactAngle(alpha1, alpha2, tnHatfv.ref().boundaryFieldRef());
|
||||
|
||||
// Simple expression for curvature
|
||||
return -fvc::div(tnHatfv & mesh_.Sf());
|
||||
|
||||
@ -54,11 +54,14 @@
|
||||
phic += (mixture.cAlpha()*icAlpha)*fvc::interpolate(mag(U));
|
||||
}
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& phicBf =
|
||||
phic.boundaryFieldRef();
|
||||
|
||||
// Do not compress interface at non-coupled boundary faces
|
||||
// (inlets, outlets etc.)
|
||||
forAll(phic.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchScalarField& phicp = phic.boundaryField()[patchi];
|
||||
fvsPatchScalarField& phicp = phicBf[patchi];
|
||||
|
||||
if (!phicp.coupled())
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -134,7 +134,7 @@ void Foam::threePhaseInterfaceProperties::calculateK()
|
||||
// Face unit interface normal
|
||||
surfaceVectorField nHatfv(gradAlphaf/(mag(gradAlphaf) + deltaN_));
|
||||
|
||||
correctContactAngle(nHatfv.boundaryField());
|
||||
correctContactAngle(nHatfv.boundaryFieldRef());
|
||||
|
||||
// Face unit interface normal flux
|
||||
nHatf_ = nHatfv & Sf;
|
||||
|
||||
@ -124,11 +124,13 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
);
|
||||
}
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& alphaPhiCorrBf =
|
||||
alphaPhiCorr.boundaryFieldRef();
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(alphaPhiCorr.boundaryField(), patchi)
|
||||
forAll(alphaPhiCorrBf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhiCorrp =
|
||||
alphaPhiCorr.boundaryField()[patchi];
|
||||
fvsPatchScalarField& alphaPhiCorrp = alphaPhiCorrBf[patchi];
|
||||
|
||||
if (!alphaPhiCorrp.coupled())
|
||||
{
|
||||
@ -372,7 +374,7 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::K
|
||||
{
|
||||
tmp<surfaceVectorField> tnHatfv = nHatfv(phase1, phase2);
|
||||
|
||||
correctContactAngle(phase1, phase2, tnHatfv.ref().boundaryField());
|
||||
correctContactAngle(phase1, phase2, tnHatfv.ref().boundaryFieldRef());
|
||||
|
||||
// Simple expression for curvature
|
||||
return -fvc::div(tnHatfv & mesh_.Sf());
|
||||
@ -666,6 +668,9 @@ Foam::tmp<Foam::volVectorField> Foam::multiphaseSystem::Svm
|
||||
}
|
||||
}
|
||||
|
||||
volVectorField::GeometricBoundaryField& SvmBf =
|
||||
tSvm.ref().boundaryFieldRef();
|
||||
|
||||
// Remove virtual mass at fixed-flux boundaries
|
||||
forAll(phase.phi().boundaryField(), patchi)
|
||||
{
|
||||
@ -677,7 +682,7 @@ Foam::tmp<Foam::volVectorField> Foam::multiphaseSystem::Svm
|
||||
)
|
||||
)
|
||||
{
|
||||
tSvm.ref().boundaryField()[patchi] = Zero;
|
||||
SvmBf[patchi] = Zero;
|
||||
}
|
||||
}
|
||||
|
||||
@ -713,6 +718,8 @@ Foam::multiphaseSystem::dragCoeffs() const
|
||||
)
|
||||
).ptr();
|
||||
|
||||
volScalarField::GeometricBoundaryField& Kbf = Kptr->boundaryFieldRef();
|
||||
|
||||
// Remove drag at fixed-flux boundaries
|
||||
forAll(dm.phase1().phi().boundaryField(), patchi)
|
||||
{
|
||||
@ -724,7 +731,7 @@ Foam::multiphaseSystem::dragCoeffs() const
|
||||
)
|
||||
)
|
||||
{
|
||||
Kptr->boundaryField()[patchi] = 0.0;
|
||||
Kbf[patchi] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@
|
||||
|
||||
setSnGrad<fixedFluxPressureFvPatchScalarField>
|
||||
(
|
||||
p_rgh.boundaryField(),
|
||||
p_rgh.boundaryFieldRef(),
|
||||
(
|
||||
phiHbyA.boundaryField() - MRF.relative(phib)
|
||||
)/(mesh.magSf().boundaryField()*rAUf.boundaryField())
|
||||
|
||||
@ -523,7 +523,7 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::K
|
||||
{
|
||||
tmp<surfaceVectorField> tnHatfv = nHatfv(alpha1, alpha2);
|
||||
|
||||
correctContactAngle(alpha1, alpha2, tnHatfv.ref().boundaryField());
|
||||
correctContactAngle(alpha1, alpha2, tnHatfv.ref().boundaryFieldRef());
|
||||
|
||||
// Simple expression for curvature
|
||||
return -fvc::div(tnHatfv & mesh_.Sf());
|
||||
|
||||
@ -118,9 +118,11 @@ Foam::saturationModels::polynomial::Tsat
|
||||
Tsat[celli] = C_.value(p[celli]);
|
||||
}
|
||||
|
||||
volScalarField::GeometricBoundaryField& TsatBf = Tsat.boundaryFieldRef();
|
||||
|
||||
forAll(Tsat.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& Tsatp = Tsat.boundaryField()[patchi];
|
||||
scalarField& Tsatp = TsatBf[patchi];
|
||||
const scalarField& pp = p.boundaryField()[patchi];
|
||||
|
||||
forAll(Tsatp, facei)
|
||||
|
||||
@ -50,11 +50,13 @@ Foam::tmp<Foam::volVectorField> Foam::wallLubricationModel::zeroGradWalls
|
||||
volVectorField& Fi = tFi.ref();
|
||||
const fvPatchList& patches = Fi.mesh().boundary();
|
||||
|
||||
volVectorField::GeometricBoundaryField& FiBf = Fi.boundaryFieldRef();
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
if (isA<wallFvPatch>(patches[patchi]))
|
||||
{
|
||||
fvPatchVectorField& Fiw = Fi.boundaryField()[patchi];
|
||||
fvPatchVectorField& Fiw = FiBf[patchi];
|
||||
Fiw = Fiw.patchInternalField();
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,9 @@ void Foam::BlendedInterfacialModel<ModelType>::correctFixedFluxBCs
|
||||
GeometricField& field
|
||||
) const
|
||||
{
|
||||
typename GeometricField::GeometricBoundaryField& fieldBf =
|
||||
field.boundaryFieldRef();
|
||||
|
||||
forAll(phase1_.phi()().boundaryField(), patchi)
|
||||
{
|
||||
if
|
||||
@ -46,7 +49,7 @@ void Foam::BlendedInterfacialModel<ModelType>::correctFixedFluxBCs
|
||||
)
|
||||
)
|
||||
{
|
||||
field.boundaryField()[patchi] = Zero;
|
||||
fieldBf[patchi] = Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -353,9 +353,9 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
|
||||
// Limit the H[12] boundary field to avoid /0
|
||||
const scalar HLimit = 1e-4;
|
||||
H1.boundaryField() =
|
||||
H1.boundaryFieldRef() =
|
||||
max(H1.boundaryField(), phase1.boundaryField()*HLimit);
|
||||
H2.boundaryField() =
|
||||
H2.boundaryFieldRef() =
|
||||
max(H2.boundaryField(), phase2.boundaryField()*HLimit);
|
||||
|
||||
volScalarField mDotL
|
||||
|
||||
@ -134,11 +134,13 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
);
|
||||
}
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& alphaPhiCorrBf =
|
||||
alphaPhiCorr.boundaryFieldRef();
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(alphaPhiCorr.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhiCorrp =
|
||||
alphaPhiCorr.boundaryField()[patchi];
|
||||
fvsPatchScalarField& alphaPhiCorrp = alphaPhiCorrBf[patchi];
|
||||
|
||||
if (!alphaPhiCorrp.coupled())
|
||||
{
|
||||
@ -477,7 +479,7 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::K
|
||||
{
|
||||
tmp<surfaceVectorField> tnHatfv = nHatfv(phase1, phase2);
|
||||
|
||||
correctContactAngle(phase1, phase2, tnHatfv.ref().boundaryField());
|
||||
correctContactAngle(phase1, phase2, tnHatfv.ref().boundaryFieldRef());
|
||||
|
||||
// Simple expression for curvature
|
||||
return -fvc::div(tnHatfv & mesh_.Sf());
|
||||
|
||||
@ -182,6 +182,9 @@ while (pimple.correct())
|
||||
);
|
||||
surfaceScalarField phiCorrCoeff(pos(alphafBar - 0.99));
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& phiCorrCoeffBf =
|
||||
phiCorrCoeff.boundaryFieldRef();
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
// Set ddtPhiCorr to 0 on non-coupled boundaries
|
||||
@ -191,7 +194,7 @@ while (pimple.correct())
|
||||
|| isA<cyclicAMIFvPatch>(mesh.boundary()[patchi])
|
||||
)
|
||||
{
|
||||
phiCorrCoeff.boundaryField()[patchi] = 0;
|
||||
phiCorrCoeffBf[patchi] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,7 +284,7 @@ while (pimple.correct())
|
||||
|
||||
setSnGrad<fixedFluxPressureFvPatchScalarField>
|
||||
(
|
||||
p_rgh.boundaryField(),
|
||||
p_rgh.boundaryFieldRef(),
|
||||
(
|
||||
phiHbyA.boundaryField() - phib
|
||||
)/(mesh.magSf().boundaryField()*rAUf.boundaryField())
|
||||
|
||||
@ -149,17 +149,25 @@ while (pimple.correct())
|
||||
surfaceScalarField phiCorrCoeff1(pos(alphaf1Bar - 0.99));
|
||||
surfaceScalarField phiCorrCoeff2(pos(0.01 - alphaf1Bar));
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
// Set ddtPhiCorr to 0 on non-coupled boundaries
|
||||
if
|
||||
(
|
||||
!mesh.boundary()[patchi].coupled()
|
||||
|| isA<cyclicAMIFvPatch>(mesh.boundary()[patchi])
|
||||
)
|
||||
surfaceScalarField::GeometricBoundaryField& phiCorrCoeff1Bf =
|
||||
phiCorrCoeff1.boundaryFieldRef();
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& phiCorrCoeff2Bf =
|
||||
phiCorrCoeff2.boundaryFieldRef();
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
phiCorrCoeff1.boundaryField()[patchi] = 0;
|
||||
phiCorrCoeff2.boundaryField()[patchi] = 0;
|
||||
// Set ddtPhiCorr to 0 on non-coupled boundaries
|
||||
if
|
||||
(
|
||||
!mesh.boundary()[patchi].coupled()
|
||||
|| isA<cyclicAMIFvPatch>(mesh.boundary()[patchi])
|
||||
)
|
||||
{
|
||||
phiCorrCoeff1Bf[patchi] = 0;
|
||||
phiCorrCoeff2Bf[patchi] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +223,7 @@ while (pimple.correct())
|
||||
// Update the fixedFluxPressure BCs to ensure flux consistency
|
||||
setSnGrad<fixedFluxPressureFvPatchScalarField>
|
||||
(
|
||||
p_rgh.boundaryField(),
|
||||
p_rgh.boundaryFieldRef(),
|
||||
(
|
||||
phiHbyA.boundaryField()
|
||||
- (
|
||||
|
||||
@ -201,7 +201,7 @@ while (pimple.correct())
|
||||
// Update the fixedFluxPressure BCs to ensure flux consistency
|
||||
setSnGrad<fixedFluxPressureFvPatchScalarField>
|
||||
(
|
||||
p_rgh.boundaryField(),
|
||||
p_rgh.boundaryFieldRef(),
|
||||
(
|
||||
phiHbyA.boundaryField()
|
||||
- (
|
||||
|
||||
@ -163,11 +163,13 @@ JohnsonJacksonSchaeffer::nu
|
||||
const fvPatchList& patches = phase.mesh().boundary();
|
||||
const volVectorField& U = phase.U();
|
||||
|
||||
volScalarField::GeometricBoundaryField& nufBf = nuf.boundaryFieldRef();
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
if (!patches[patchi].coupled())
|
||||
{
|
||||
nuf.boundaryField()[patchi] =
|
||||
nufBf[patchi] =
|
||||
(
|
||||
pf.boundaryField()[patchi]*sin(phi_.value())
|
||||
/(
|
||||
|
||||
@ -152,11 +152,13 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu
|
||||
const fvPatchList& patches = phase.mesh().boundary();
|
||||
const volVectorField& U = phase.U();
|
||||
|
||||
volScalarField::GeometricBoundaryField& nufBf = nuf.boundaryFieldRef();
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
if (!patches[patchi].coupled())
|
||||
{
|
||||
nuf.boundaryField()[patchi] =
|
||||
nufBf[patchi] =
|
||||
(
|
||||
pf.boundaryField()[patchi]*sin(phi_.value())
|
||||
/(
|
||||
|
||||
@ -295,7 +295,7 @@ Foam::RASModels::kineticTheoryModel::pPrime() const
|
||||
);
|
||||
|
||||
volScalarField::GeometricBoundaryField& bpPrime =
|
||||
tpPrime.ref().boundaryField();
|
||||
tpPrime.ref().boundaryFieldRef();
|
||||
|
||||
forAll(bpPrime, patchi)
|
||||
{
|
||||
|
||||
@ -165,7 +165,7 @@ Foam::RASModels::phasePressureModel::pPrime() const
|
||||
);
|
||||
|
||||
volScalarField::GeometricBoundaryField& bpPrime =
|
||||
tpPrime.ref().boundaryField();
|
||||
tpPrime.ref().boundaryFieldRef();
|
||||
|
||||
forAll(bpPrime, patchi)
|
||||
{
|
||||
@ -193,7 +193,7 @@ Foam::RASModels::phasePressureModel::pPrimef() const
|
||||
);
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& bpPrime =
|
||||
tpPrime.ref().boundaryField();
|
||||
tpPrime.ref().boundaryFieldRef();
|
||||
|
||||
forAll(bpPrime, patchi)
|
||||
{
|
||||
|
||||
@ -316,11 +316,13 @@ void Foam::twoPhaseSystem::solve()
|
||||
)
|
||||
);
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& alphaPhic1Bf =
|
||||
alphaPhic1.boundaryFieldRef();
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(alphaPhic1.boundaryField(), patchi)
|
||||
forAll(alphaPhic1Bf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhic1p =
|
||||
alphaPhic1.boundaryField()[patchi];
|
||||
fvsPatchScalarField& alphaPhic1p = alphaPhic1Bf[patchi];
|
||||
|
||||
if (!alphaPhic1p.coupled())
|
||||
{
|
||||
|
||||
@ -146,17 +146,25 @@ while (pimple.correct())
|
||||
surfaceScalarField phiCorrCoeff1(pos(alphaf1Bar - 0.99));
|
||||
surfaceScalarField phiCorrCoeff2(pos(0.01 - alphaf1Bar));
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
// Set ddtPhiCorr to 0 on non-coupled boundaries
|
||||
if
|
||||
(
|
||||
!mesh.boundary()[patchi].coupled()
|
||||
|| isA<cyclicAMIFvPatch>(mesh.boundary()[patchi])
|
||||
)
|
||||
surfaceScalarField::GeometricBoundaryField& phiCorrCoeff1Bf =
|
||||
phiCorrCoeff1.boundaryFieldRef();
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& phiCorrCoeff2Bf =
|
||||
phiCorrCoeff2.boundaryFieldRef();
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
phiCorrCoeff1.boundaryField()[patchi] = 0;
|
||||
phiCorrCoeff2.boundaryField()[patchi] = 0;
|
||||
// Set ddtPhiCorr to 0 on non-coupled boundaries
|
||||
if
|
||||
(
|
||||
!mesh.boundary()[patchi].coupled()
|
||||
|| isA<cyclicAMIFvPatch>(mesh.boundary()[patchi])
|
||||
)
|
||||
{
|
||||
phiCorrCoeff1Bf[patchi] = 0;
|
||||
phiCorrCoeff2Bf[patchi] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +220,7 @@ while (pimple.correct())
|
||||
// Update the fixedFluxPressure BCs to ensure flux consistency
|
||||
setSnGrad<fixedFluxPressureFvPatchScalarField>
|
||||
(
|
||||
p_rgh.boundaryField(),
|
||||
p_rgh.boundaryFieldRef(),
|
||||
(
|
||||
phiHbyA.boundaryField()
|
||||
- (
|
||||
|
||||
@ -200,7 +200,7 @@ while (pimple.correct())
|
||||
// Update the fixedFluxPressure BCs to ensure flux consistency
|
||||
setSnGrad<fixedFluxPressureFvPatchScalarField>
|
||||
(
|
||||
p_rgh.boundaryField(),
|
||||
p_rgh.boundaryFieldRef(),
|
||||
(
|
||||
phiHbyA.boundaryField()
|
||||
- (
|
||||
|
||||
@ -279,7 +279,7 @@ Foam::RASModels::kineticTheoryModel::pPrime() const
|
||||
);
|
||||
|
||||
volScalarField::GeometricBoundaryField& bpPrime =
|
||||
tpPrime.ref().boundaryField();
|
||||
tpPrime.ref().boundaryFieldRef();
|
||||
|
||||
forAll(bpPrime, patchi)
|
||||
{
|
||||
|
||||
@ -171,7 +171,7 @@ Foam::RASModels::phasePressureModel::pPrime() const
|
||||
);
|
||||
|
||||
volScalarField::GeometricBoundaryField& bpPrime =
|
||||
tpPrime.ref().boundaryField();
|
||||
tpPrime.ref().boundaryFieldRef();
|
||||
|
||||
forAll(bpPrime, patchi)
|
||||
{
|
||||
@ -199,7 +199,7 @@ Foam::RASModels::phasePressureModel::pPrimef() const
|
||||
);
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& bpPrime =
|
||||
tpPrime.ref().boundaryField();
|
||||
tpPrime.ref().boundaryFieldRef();
|
||||
|
||||
forAll(bpPrime, patchi)
|
||||
{
|
||||
|
||||
@ -36,6 +36,9 @@ void Foam::BlendedInterfacialModel<modelType>::correctFixedFluxBCs
|
||||
GeometricField& field
|
||||
) const
|
||||
{
|
||||
typename GeometricField::GeometricBoundaryField& fieldBf =
|
||||
field.boundaryFieldRef();
|
||||
|
||||
forAll(pair_.phase1().phi().boundaryField(), patchi)
|
||||
{
|
||||
if
|
||||
@ -46,7 +49,7 @@ void Foam::BlendedInterfacialModel<modelType>::correctFixedFluxBCs
|
||||
)
|
||||
)
|
||||
{
|
||||
field.boundaryField()[patchi] = Zero;
|
||||
fieldBf[patchi] = Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -446,11 +446,13 @@ void Foam::twoPhaseSystem::solve()
|
||||
)
|
||||
);
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& alphaPhic1Bf =
|
||||
alphaPhic1.boundaryFieldRef();
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(alphaPhic1.boundaryField(), patchi)
|
||||
forAll(alphaPhic1Bf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhic1p =
|
||||
alphaPhic1.boundaryField()[patchi];
|
||||
fvsPatchScalarField& alphaPhic1p = alphaPhic1Bf[patchi];
|
||||
|
||||
if (!alphaPhic1p.coupled())
|
||||
{
|
||||
|
||||
@ -429,30 +429,28 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return dimensioned internal field
|
||||
//- Return a reference to the dimensioned internal field
|
||||
// Note: this increments the event counter and checks the
|
||||
// old-time fields; avoid in loops.
|
||||
DimensionedInternalField& dimensionedInternalField();
|
||||
|
||||
//- Return dimensioned internal field
|
||||
//- Return a const-reference to the dimensioned internal field
|
||||
inline const DimensionedInternalField& dimensionedInternalField() const;
|
||||
|
||||
//- Return internal field
|
||||
//- Return a reference to the internal field
|
||||
// Note: this increments the event counter and checks the
|
||||
// old-time fields; avoid in loops.
|
||||
InternalField& internalField();
|
||||
|
||||
//- Return internal field
|
||||
//- Return a const-reference to the internal field
|
||||
inline const InternalField& internalField() const;
|
||||
|
||||
//- Return reference to GeometricBoundaryField
|
||||
//- Return a reference to the boundary field
|
||||
// Note: this increments the event counter and checks the
|
||||
// old-time fields; avoid in loops.
|
||||
GeometricBoundaryField& boundaryFieldRef();
|
||||
|
||||
//- Return reference to GeometricBoundaryField
|
||||
#ifndef BOUNDARY_FIELD_REF
|
||||
GeometricBoundaryField& boundaryField()
|
||||
{
|
||||
return boundaryFieldRef();
|
||||
}
|
||||
#endif
|
||||
|
||||
//- Return reference to GeometricBoundaryField for const field
|
||||
//- Return const-reference to the boundary field
|
||||
inline const GeometricBoundaryField& boundaryField() const;
|
||||
|
||||
//- Return the time index of the field
|
||||
|
||||
@ -196,7 +196,7 @@ void mixtureKEpsilon<BasicTurbulenceModel>::correctInletOutlet
|
||||
const volScalarField& refVsf
|
||||
) const
|
||||
{
|
||||
volScalarField::GeometricBoundaryField& bf = vsf.boundaryField();
|
||||
volScalarField::GeometricBoundaryField& bf = vsf.boundaryFieldRef();
|
||||
const volScalarField::GeometricBoundaryField& refBf =
|
||||
refVsf.boundaryField();
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ void Foam::constrainPressure
|
||||
{
|
||||
const fvMesh& mesh = p.mesh();
|
||||
|
||||
volScalarField::GeometricBoundaryField& pBf = p.boundaryField();
|
||||
volScalarField::GeometricBoundaryField& pBf = p.boundaryFieldRef();
|
||||
|
||||
const volVectorField::GeometricBoundaryField& UBf = U.boundaryField();
|
||||
const surfaceScalarField::GeometricBoundaryField& phiHbyABf =
|
||||
|
||||
@ -609,7 +609,7 @@ void Foam::MULES::limitSum(SurfaceScalarFieldList& phiPsiCorrs)
|
||||
limitSum(phiPsiCorrsInternal);
|
||||
}
|
||||
|
||||
surfaceScalarField::GeometricBoundaryField& bfld =
|
||||
const surfaceScalarField::GeometricBoundaryField& bfld =
|
||||
phiPsiCorrs[0].boundaryField();
|
||||
|
||||
forAll(bfld, patchi)
|
||||
@ -622,7 +622,7 @@ void Foam::MULES::limitSum(SurfaceScalarFieldList& phiPsiCorrs)
|
||||
phiPsiCorrsPatch.set
|
||||
(
|
||||
phasei,
|
||||
&phiPsiCorrs[phasei].boundaryField()[patchi]
|
||||
&phiPsiCorrs[phasei].boundaryFieldRef()[patchi]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user