ENH: Corrected ambiguous field construction from tmp

This commit is contained in:
andy
2011-11-25 12:31:58 +00:00
parent 636145b9b7
commit d3b0b79bf6
13 changed files with 39 additions and 33 deletions

View File

@ -3,7 +3,7 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime);
{ {
{ {
volTensorField gradU1T = fvc::grad(U1)().T(); volTensorField gradU1T(fvc::grad(U1)().T());
if (kineticTheory.on()) if (kineticTheory.on())
{ {
@ -45,7 +45,7 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime);
} }
{ {
volTensorField gradU2T = fvc::grad(U2)().T(); volTensorField gradU2T(fvc::grad(U2)().T());
volTensorField Rc2 volTensorField Rc2
( (
"Rc2", "Rc2",

View File

@ -10,8 +10,8 @@ surfaceScalarField alphaPhi2("alphaPhi2", phi2);
if (g0.value() > 0.0) if (g0.value() > 0.0)
{ {
surfaceScalarField alpha1f = fvc::interpolate(alpha1); surfaceScalarField alpha1f(fvc::interpolate(alpha1));
surfaceScalarField phipp = ppMagf*fvc::snGrad(alpha1)*mesh.magSf(); surfaceScalarField phipp(ppMagf*fvc::snGrad(alpha1)*mesh.magSf());
phir += phipp; phir += phipp;
phic += fvc::interpolate(alpha1)*phipp; phic += fvc::interpolate(alpha1)*phipp;
} }

View File

@ -228,15 +228,19 @@
Info<< "Calculating field DDtU1 and DDtU2\n" << endl; Info<< "Calculating field DDtU1 and DDtU2\n" << endl;
volVectorField DDtU1 = volVectorField DDtU1
(
fvc::ddt(U1) fvc::ddt(U1)
+ fvc::div(phi1, U1) + fvc::div(phi1, U1)
- fvc::div(phi1)*U1; - fvc::div(phi1)*U1
);
volVectorField DDtU2 = volVectorField DDtU2
(
fvc::ddt(U2) fvc::ddt(U2)
+ fvc::div(phi2, U2) + fvc::div(phi2, U2)
- fvc::div(phi2)*U2; - fvc::div(phi2)*U2
);
Info<< "Calculating field g.h\n" << endl; Info<< "Calculating field g.h\n" << endl;
@ -354,8 +358,10 @@
setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue); setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue);
volScalarField dgdt = volScalarField dgdt
pos(alpha2)*fvc::div(phi)/max(alpha2, scalar(0.0001)); (
pos(alpha2)*fvc::div(phi)/max(alpha2, scalar(0.0001))
);
Info<< "Creating field dpdt\n" << endl; Info<< "Creating field dpdt\n" << endl;

View File

@ -35,8 +35,8 @@ volScalarField heatTransferCoeff
); );
{ {
volVectorField Ur = U1 - U2; volVectorField Ur(U1 - U2);
volScalarField magUr = mag(Ur); volScalarField magUr(mag(Ur));
if (dispersedPhase == "1") if (dispersedPhase == "1")
{ {

View File

@ -72,7 +72,7 @@ Foam::tmp<Foam::volScalarField> Foam::dragModels::GidaspowErgunWenYu::K
) const ) const
{ {
volScalarField beta(max(scalar(1) - alpha_, scalar(1.0e-6))); volScalarField beta(max(scalar(1) - alpha_, scalar(1.0e-6)));
volScalarField d = phase1_.d(); volScalarField d(phase1_.d());
volScalarField bp(pow(beta, -2.65)); volScalarField bp(pow(beta, -2.65));
volScalarField Re(max(Ur*d/phase2_.nu(), scalar(1.0e-3))); volScalarField Re(max(Ur*d/phase2_.nu(), scalar(1.0e-3)));
@ -87,7 +87,7 @@ Foam::tmp<Foam::volScalarField> Foam::dragModels::GidaspowErgunWenYu::K
} }
// Wen and Yu (1966) // Wen and Yu (1966)
tmp<volScalarField> tKWenYu = 0.75*Cds*phase2_.rho()*Ur*bp/d; tmp<volScalarField> tKWenYu(0.75*Cds*phase2_.rho()*Ur*bp/d);
volScalarField& KWenYu = tKWenYu(); volScalarField& KWenYu = tKWenYu();
// Ergun // Ergun

View File

@ -71,10 +71,10 @@ Foam::tmp<Foam::volScalarField> Foam::heatTransferModels::RanzMarshall::K
const volScalarField& Ur const volScalarField& Ur
) const ) const
{ {
volScalarField Re = max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3)); volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3)));
dimensionedScalar Prb = dimensionedScalar Prb =
phase2_.rho()*phase2_.nu()*phase2_.Cp()/phase2_.kappa(); phase2_.rho()*phase2_.nu()*phase2_.Cp()/phase2_.kappa();
volScalarField Nu = scalar(2) + 0.6*sqrt(Re)*cbrt(Prb); volScalarField Nu(scalar(2) + 0.6*sqrt(Re)*cbrt(Prb));
return 6.0*phase2_.kappa()*Nu/sqr(phase1_.d()); return 6.0*phase2_.kappa()*Nu/sqr(phase1_.d());
} }

View File

@ -24,14 +24,14 @@
- fvc::Sp(fvc::div(phid2), p); - fvc::Sp(fvc::div(phid2), p);
} }
surfaceScalarField alpha1f = fvc::interpolate(alpha1); surfaceScalarField alpha1f(fvc::interpolate(alpha1));
surfaceScalarField alpha2f = scalar(1) - alpha1f; surfaceScalarField alpha2f(scalar(1) - alpha1f);
volVectorField U10 = U1; volVectorField U10 = U1;
volVectorField U20 = U2; volVectorField U20 = U2;
volScalarField rAU1 = 1.0/U1Eqn.A(); volScalarField rAU1(1.0/U1Eqn.A());
volScalarField rAU2 = 1.0/U2Eqn.A(); volScalarField rAU2(1.0/U2Eqn.A());
surfaceScalarField rAlphaAU1f = fvc::interpolate(alpha1*rAU1); surfaceScalarField rAlphaAU1f = fvc::interpolate(alpha1*rAU1);
surfaceScalarField rAlphaAU2f = fvc::interpolate(alpha2*rAU2); surfaceScalarField rAlphaAU2f = fvc::interpolate(alpha2*rAU2);

View File

@ -1,12 +1,12 @@
if(turbulence) if (turbulence)
{ {
if (mesh.changing()) if (mesh.changing())
{ {
y.correct(); y.correct();
} }
tmp<volTensorField> tgradU2 = fvc::grad(U2); tmp<volTensorField> tgradU2(fvc::grad(U2));
volScalarField G = 2*nut2*(tgradU2() && dev(symm(tgradU2()))); volScalarField G(2*nut2*(tgradU2() && dev(symm(tgradU2()))));
tgradU2.clear(); tgradU2.clear();
#include "wallFunctions.H" #include "wallFunctions.H"

View File

@ -71,10 +71,10 @@ Foam::tmp<Foam::volScalarField> Foam::heatTransferModels::RanzMarshall::K
const volScalarField& Ur const volScalarField& Ur
) const ) const
{ {
volScalarField Re = max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3)); volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3)));
dimensionedScalar Prb = dimensionedScalar Prb =
phase2_.rho()*phase2_.nu()*phase2_.Cp()/phase2_.kappa(); phase2_.rho()*phase2_.nu()*phase2_.Cp()/phase2_.kappa();
volScalarField Nu = scalar(2) + 0.6*sqrt(Re)*cbrt(Prb); volScalarField Nu(scalar(2) + 0.6*sqrt(Re)*cbrt(Prb));
return 6.0*phase2_.kappa()*Nu/sqr(phase1_.d()); return 6.0*phase2_.kappa()*Nu/sqr(phase1_.d());
} }

View File

@ -172,7 +172,7 @@
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
surfaceScalarField mSfGradp = pEqnIncomp.flux()/Dp; surfaceScalarField mSfGradp(pEqnIncomp.flux()/Dp);
phasei = 0; phasei = 0;
phi = dimensionedScalar("phi", phi.dimensions(), 0); phi = dimensionedScalar("phi", phi.dimensions(), 0);

View File

@ -185,7 +185,7 @@
volScalarField& nu = nuPtr(); volScalarField& nu = nuPtr();
Info<< "Normalising E : E/rho\n" << endl; Info<< "Normalising E : E/rho\n" << endl;
volScalarField E = rhoE/rho; volScalarField E(rhoE/rho);
Info<< "Calculating Lame's coefficients\n" << endl; Info<< "Calculating Lame's coefficients\n" << endl;

View File

@ -222,7 +222,7 @@ if (thermalStress)
volScalarField& alpha = alphaPtr(); volScalarField& alpha = alphaPtr();
Info<< "Normalising k : k/rho\n" << endl; Info<< "Normalising k : k/rho\n" << endl;
volScalarField k = rhoK/rho; volScalarField k(rhoK/rho);
Info<< "Calculating thermal coefficients\n" << endl; Info<< "Calculating thermal coefficients\n" << endl;

View File

@ -159,10 +159,10 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
const fvPatchField<scalar>& nu = const fvPatchField<scalar>& nu =
patch().lookupPatchField<volScalarField, scalar>("nu"); patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField E = rhoE/rho; scalarField E(rhoE/rho);
scalarField mu = E/(2.0*(1.0 + nu)); scalarField mu(E/(2.0*(1.0 + nu)));
scalarField lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu)); scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu)));
scalarField threeK = E/(1.0 - 2.0*nu); scalarField threeK(E/(1.0 - 2.0*nu));
Switch planeStress(mechanicalProperties.lookup("planeStress")); Switch planeStress(mechanicalProperties.lookup("planeStress"));
@ -172,7 +172,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
threeK = E/(1.0 - nu); threeK = E/(1.0 - nu);
} }
scalarField twoMuLambda = (2*mu + lambda); scalarField twoMuLambda(2*mu + lambda);
vectorField n(patch().nf()); vectorField n(patch().nf());