OpenFOAM: Updated all libraries, solvers and utilities to use the new const-safe tmp

The deprecated non-const tmp functionality is now on the compiler switch
NON_CONST_TMP which can be enabled by adding -DNON_CONST_TMP to EXE_INC
in the Make/options file.  However, it is recommended to upgrade all
code to the new safer tmp by using the '.ref()' member function rather
than the non-const '()' dereference operator when non-const access to
the temporary object is required.

Please report any problems on Mantis.

Henry G. Weller
CFD Direct.
This commit is contained in:
Henry Weller
2016-02-26 17:31:28 +00:00
parent f4ba71ddd0
commit cd852be3da
169 changed files with 511 additions and 477 deletions

View File

@ -2,7 +2,7 @@
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> UEqn
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)
+ MRF.DDt(U)
@ -10,16 +10,17 @@
==
fvOptions(U)
);
fvVectorMatrix& UEqn = tUEqn.ref();
UEqn().relax();
UEqn.relax();
fvOptions.constrain(UEqn());
fvOptions.constrain(UEqn);
if (simple.momentumPredictor())
{
solve
(
UEqn()
UEqn
==
fvc::reconstruct
(

View File

@ -1,9 +1,9 @@
{
volScalarField rAU("rAU", 1.0/UEqn().A());
volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_rgh));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
UEqn.clear();
tUEqn.clear();
surfaceScalarField phig(-rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf());

View File

@ -2,7 +2,7 @@
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> UEqn
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)
+ MRF.DDt(rho, U)
@ -10,16 +10,17 @@
==
fvOptions(rho, U)
);
fvVectorMatrix& UEqn = tUEqn.ref();
UEqn().relax();
UEqn.relax();
fvOptions.constrain(UEqn());
fvOptions.constrain(UEqn);
if (simple.momentumPredictor())
{
solve
(
UEqn()
UEqn
==
fvc::reconstruct
(

View File

@ -2,10 +2,10 @@
rho = thermo.rho();
rho.relax();
volScalarField rAU("rAU", 1.0/UEqn().A());
volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_rgh));
UEqn.clear();
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
tUEqn.clear();
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());

View File

@ -2,7 +2,7 @@
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> UEqn
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)
+ MRF.DDt(rho, U)
@ -10,14 +10,15 @@
==
fvOptions(rho, U)
);
fvVectorMatrix& UEqn = tUEqn.ref();
UEqn().relax();
UEqn.relax();
fvOptions.constrain(UEqn());
fvOptions.constrain(UEqn);
solve
(
UEqn()
UEqn
==
fvc::reconstruct
(

View File

@ -4,10 +4,10 @@
rho = min(rho, rhoMax[i]);
rho.relax();
volScalarField rAU("rAU", 1.0/UEqn().A());
volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_rgh));
UEqn.clear();
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
tUEqn.clear();
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());

View File

@ -2,7 +2,7 @@
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> UEqn
tmp<fvVectorMatrix> tUEqn
(
fvm::ddt(rho, U) + fvm::div(phi, U)
+ MRF.DDt(rho, U)
@ -10,16 +10,17 @@
==
fvOptions(rho, U)
);
fvVectorMatrix& UEqn = tUEqn.ref();
UEqn().relax();
UEqn.relax();
fvOptions.constrain(UEqn());
fvOptions.constrain(UEqn);
if (momentumPredictor)
{
solve
(
UEqn()
UEqn
==
fvc::reconstruct
(

View File

@ -5,9 +5,9 @@
rho = thermo.rho();
volScalarField rAU("rAU", 1.0/UEqn().A());
volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_rgh));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());

View File

@ -6,7 +6,7 @@ if (finalIter)
{
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> hEqn
fvScalarMatrix hEqn
(
fvm::ddt(betav*rho, h)
- (
@ -18,11 +18,11 @@ if (finalIter)
fvOptions(rho, h)
);
hEqn().relax();
hEqn.relax();
fvOptions.constrain(hEqn());
fvOptions.constrain(hEqn);
hEqn().solve(mesh.solver(h.select(finalIter)));
hEqn.solve(mesh.solver(h.select(finalIter)));
fvOptions.correct(h);
}