Commit 0ff0b5cb authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: avoid ambiguous construct from tmp - solvers/ compressible

parent c5ee4e1b
......@@ -181,13 +181,16 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
)
);
Field<scalar> C2 = pmu/prho
Field<scalar> C2
(
pmu/prho
*sqrt(ppsi*constant::mathematical::piByTwo)
*2.0*gamma_/Pr.value()/(gamma_ + 1.0)
*(2.0 - accommodationCoeff_)/accommodationCoeff_;
*(2.0 - accommodationCoeff_)/accommodationCoeff_
);
Field<scalar> aCoeff = prho.snGrad() - prho/C2;
Field<scalar> KEbyRho = 0.5*magSqr(pU);
Field<scalar> aCoeff(prho.snGrad() - prho/C2);
Field<scalar> KEbyRho(0.5*magSqr(pU));
valueFraction() = (1.0/(1.0 + patch().deltaCoeffs()*C2));
refValue() = Twall_;
......@@ -214,9 +217,11 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
namespace Foam
{
makePatchTypeField(fvPatchScalarField, smoluchowskiJumpTFvPatchScalarField);
makeNonTemplatedPatchTypeField
(
fvPatchScalarField,
smoluchowskiJumpTFvPatchScalarField
);
}
......
......@@ -83,8 +83,7 @@ maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
if
(
mag(accommodationCoeff_) < SMALL
||
mag(accommodationCoeff_) > 2.0
|| mag(accommodationCoeff_) > 2.0
)
{
FatalIOErrorIn
......@@ -142,10 +141,13 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs()
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>("psi");
Field<scalar> C1 = sqrt(ppsi*constant::mathematical::piByTwo)
*(2.0 - accommodationCoeff_)/accommodationCoeff_;
Field<scalar> C1
(
sqrt(ppsi*constant::mathematical::piByTwo)
* (2.0 - accommodationCoeff_)/accommodationCoeff_
);
Field<scalar> pnu = pmu/prho;
Field<scalar> pnu(pmu/prho);
valueFraction() = (1.0/(1.0 + patch().deltaCoeffs()*C1*pnu));
refValue() = Uwall_;
......@@ -156,8 +158,8 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs()
this->db().objectRegistry::lookupObject<volScalarField>("T");
label patchi = this->patch().index();
const fvPatchScalarField& pT = vsfT.boundaryField()[patchi];
Field<vector> gradpT = fvc::grad(vsfT)().boundaryField()[patchi];
vectorField n = patch().nf();
Field<vector> gradpT(fvc::grad(vsfT)().boundaryField()[patchi]);
vectorField n(patch().nf());
refValue() -= 3.0*pnu/(4.0*pT)*transform(I - n*n, gradpT);
}
......@@ -166,7 +168,7 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs()
{
const fvPatchTensorField& ptauMC =
patch().lookupPatchField<volTensorField, tensor>("tauMC");
vectorField n = patch().nf();
vectorField n(patch().nf());
refValue() -= C1/prho*transform(I - n*n, (n & ptauMC));
}
......@@ -196,7 +198,11 @@ void maxwellSlipUFvPatchVectorField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchVectorField, maxwellSlipUFvPatchVectorField);
makeNonTemplatedPatchTypeField
(
fvPatchVectorField,
maxwellSlipUFvPatchVectorField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -135,8 +135,8 @@ void mixedFixedValueSlipFvPatchField<Type>::rmap
template<class Type>
tmp<Field<Type> > mixedFixedValueSlipFvPatchField<Type>::snGrad() const
{
vectorField nHat = this->patch().nf();
Field<Type> pif = this->patchInternalField();
tmp<vectorField> nHat = this->patch().nf();
Field<Type> pif(this->patchInternalField());
return
(
......@@ -155,7 +155,7 @@ void mixedFixedValueSlipFvPatchField<Type>::evaluate(const Pstream::commsTypes)
this->updateCoeffs();
}
vectorField nHat = this->patch().nf();
vectorField nHat(this->patch().nf());
Field<Type>::operator=
(
......@@ -174,7 +174,7 @@ template<class Type>
tmp<Field<Type> >
mixedFixedValueSlipFvPatchField<Type>::snGradTransformDiag() const
{
vectorField nHat = this->patch().nf();
vectorField nHat(this->patch().nf());
vectorField diag(nHat.size());
diag.replace(vector::X, mag(nHat.component(vector::X)));
......
......@@ -112,7 +112,11 @@ void fixedRhoFvPatchScalarField::updateCoeffs()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, fixedRhoFvPatchScalarField);
makeNonTemplatedPatchTypeField
(
fvPatchScalarField,
fixedRhoFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -34,8 +34,10 @@ scalar meanCoNum = 0.0;
if (mesh.nInternalFaces())
{
surfaceScalarField amaxSfbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()*amaxSf;
surfaceScalarField amaxSfbyDelta
(
mesh.surfaceInterpolation::deltaCoeffs()*amaxSf
);
CoNum = max(amaxSfbyDelta/mesh.magSf()).value()*runTime.deltaTValue();
......
......@@ -62,52 +62,76 @@ int main(int argc, char *argv[])
{
// --- upwind interpolation of primitive fields on faces
surfaceScalarField rho_pos =
fvc::interpolate(rho, pos, "reconstruct(rho)");
surfaceScalarField rho_neg =
fvc::interpolate(rho, neg, "reconstruct(rho)");
surfaceScalarField rho_pos
(
fvc::interpolate(rho, pos, "reconstruct(rho)")
);
surfaceScalarField rho_neg
(
fvc::interpolate(rho, neg, "reconstruct(rho)")
);
surfaceVectorField rhoU_pos =
fvc::interpolate(rhoU, pos, "reconstruct(U)");
surfaceVectorField rhoU_neg =
fvc::interpolate(rhoU, neg, "reconstruct(U)");
surfaceVectorField rhoU_pos
(
fvc::interpolate(rhoU, pos, "reconstruct(U)")
);
surfaceVectorField rhoU_neg
(
fvc::interpolate(rhoU, neg, "reconstruct(U)")
);
volScalarField rPsi = 1.0/psi;
surfaceScalarField rPsi_pos =
fvc::interpolate(rPsi, pos, "reconstruct(T)");
surfaceScalarField rPsi_neg =
fvc::interpolate(rPsi, neg, "reconstruct(T)");
volScalarField rPsi(1.0/psi);
surfaceScalarField rPsi_pos
(
fvc::interpolate(rPsi, pos, "reconstruct(T)")
);
surfaceScalarField rPsi_neg
(
fvc::interpolate(rPsi, neg, "reconstruct(T)")
);
surfaceScalarField e_pos =
fvc::interpolate(e, pos, "reconstruct(T)");
surfaceScalarField e_neg =
fvc::interpolate(e, neg, "reconstruct(T)");
surfaceScalarField e_pos
(
fvc::interpolate(e, pos, "reconstruct(T)")
);
surfaceScalarField e_neg
(
fvc::interpolate(e, neg, "reconstruct(T)")
);
surfaceVectorField U_pos = rhoU_pos/rho_pos;
surfaceVectorField U_neg = rhoU_neg/rho_neg;
surfaceVectorField U_pos(rhoU_pos/rho_pos);
surfaceVectorField U_neg(rhoU_neg/rho_neg);
surfaceScalarField p_pos = rho_pos*rPsi_pos;
surfaceScalarField p_neg = rho_neg*rPsi_neg;
surfaceScalarField p_pos(rho_pos*rPsi_pos);
surfaceScalarField p_neg(rho_neg*rPsi_neg);
surfaceScalarField phiv_pos = U_pos & mesh.Sf();
surfaceScalarField phiv_neg = U_neg & mesh.Sf();
surfaceScalarField phiv_pos(U_pos & mesh.Sf());
surfaceScalarField phiv_neg(U_neg & mesh.Sf());
volScalarField c = sqrt(thermo.Cp()/thermo.Cv()*rPsi);
surfaceScalarField cSf_pos =
fvc::interpolate(c, pos, "reconstruct(T)")*mesh.magSf();
surfaceScalarField cSf_neg =
fvc::interpolate(c, neg, "reconstruct(T)")*mesh.magSf();
volScalarField c(sqrt(thermo.Cp()/thermo.Cv()*rPsi));
surfaceScalarField cSf_pos
(
fvc::interpolate(c, pos, "reconstruct(T)")*mesh.magSf()
);
surfaceScalarField cSf_neg
(
fvc::interpolate(c, neg, "reconstruct(T)")*mesh.magSf()
);
surfaceScalarField ap =
max(max(phiv_pos + cSf_pos, phiv_neg + cSf_neg), v_zero);
surfaceScalarField am =
min(min(phiv_pos - cSf_pos, phiv_neg - cSf_neg), v_zero);
surfaceScalarField ap
(
max(max(phiv_pos + cSf_pos, phiv_neg + cSf_neg), v_zero)
);
surfaceScalarField am
(
min(min(phiv_pos - cSf_pos, phiv_neg - cSf_neg), v_zero)
);
surfaceScalarField a_pos = ap/(ap - am);
surfaceScalarField a_pos(ap/(ap - am));
surfaceScalarField amaxSf("amaxSf", max(mag(am), mag(ap)));
surfaceScalarField aSf = am*a_pos;
surfaceScalarField aSf(am*a_pos);
if (fluxScheme == "Tadmor")
{
......@@ -115,13 +139,13 @@ int main(int argc, char *argv[])
a_pos = 0.5;
}
surfaceScalarField a_neg = (1.0 - a_pos);
surfaceScalarField a_neg(1.0 - a_pos);
phiv_pos *= a_pos;
phiv_neg *= a_neg;
surfaceScalarField aphiv_pos = phiv_pos - aSf;
surfaceScalarField aphiv_neg = phiv_neg + aSf;
surfaceScalarField aphiv_pos(phiv_pos - aSf);
surfaceScalarField aphiv_neg(phiv_neg + aSf);
// Reuse amaxSf for the maximum positive and negative fluxes
// estimated by the central scheme
......@@ -148,14 +172,18 @@ int main(int argc, char *argv[])
surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg);
surfaceVectorField phiUp =
surfaceVectorField phiUp
(
(aphiv_pos*rhoU_pos + aphiv_neg*rhoU_neg)
+ (a_pos*p_pos + a_neg*p_neg)*mesh.Sf();
+ (a_pos*p_pos + a_neg*p_neg)*mesh.Sf()
);
surfaceScalarField phiEp =
surfaceScalarField phiEp
(
aphiv_pos*(rho_pos*(e_pos + 0.5*magSqr(U_pos)) + p_pos)
+ aphiv_neg*(rho_neg*(e_neg + 0.5*magSqr(U_neg)) + p_neg)
+ aSf*p_pos - aSf*p_neg;
+ aSf*p_pos - aSf*p_neg
);
volTensorField tauMC("tauMC", mu*dev2(fvc::grad(U)().T()));
......@@ -185,7 +213,7 @@ int main(int argc, char *argv[])
}
// --- Solve energy
surfaceScalarField sigmaDotU =
surfaceScalarField sigmaDotU
(
(
fvc::interpolate(mu)*mesh.magSf()*fvc::snGrad(U)
......
......@@ -59,48 +59,72 @@ int main(int argc, char *argv[])
{
// --- upwind interpolation of primitive fields on faces
surfaceScalarField rho_pos =
fvc::interpolate(rho, pos, "reconstruct(rho)");
surfaceScalarField rho_neg =
fvc::interpolate(rho, neg, "reconstruct(rho)");
surfaceScalarField rho_pos
(
fvc::interpolate(rho, pos, "reconstruct(rho)")
);
surfaceScalarField rho_neg
(
fvc::interpolate(rho, neg, "reconstruct(rho)")
);
surfaceVectorField rhoU_pos =
fvc::interpolate(rhoU, pos, "reconstruct(U)");
surfaceVectorField rhoU_neg =
fvc::interpolate(rhoU, neg, "reconstruct(U)");
surfaceVectorField rhoU_pos
(
fvc::interpolate(rhoU, pos, "reconstruct(U)")
);
surfaceVectorField rhoU_neg
(
fvc::interpolate(rhoU, neg, "reconstruct(U)")
);
volScalarField rPsi = 1.0/psi;
surfaceScalarField rPsi_pos =
fvc::interpolate(rPsi, pos, "reconstruct(T)");
surfaceScalarField rPsi_neg =
fvc::interpolate(rPsi, neg, "reconstruct(T)");
volScalarField rPsi(1.0/psi);
surfaceScalarField rPsi_pos
(
fvc::interpolate(rPsi, pos, "reconstruct(T)")
);
surfaceScalarField rPsi_neg
(
fvc::interpolate(rPsi, neg, "reconstruct(T)")
);
surfaceScalarField e_pos =
fvc::interpolate(e, pos, "reconstruct(T)");
surfaceScalarField e_neg =
fvc::interpolate(e, neg, "reconstruct(T)");
surfaceScalarField e_pos
(
fvc::interpolate(e, pos, "reconstruct(T)")
);
surfaceScalarField e_neg
(
fvc::interpolate(e, neg, "reconstruct(T)")
);
surfaceVectorField U_pos = rhoU_pos/rho_pos;
surfaceVectorField U_neg = rhoU_neg/rho_neg;
surfaceVectorField U_pos(rhoU_pos/rho_pos);
surfaceVectorField U_neg(rhoU_neg/rho_neg);
surfaceScalarField p_pos = rho_pos*rPsi_pos;
surfaceScalarField p_neg = rho_neg*rPsi_neg;
surfaceScalarField p_pos(rho_pos*rPsi_pos);
surfaceScalarField p_neg(rho_neg*rPsi_neg);
surfaceScalarField phiv_pos = U_pos & mesh.Sf();
surfaceScalarField phiv_neg = U_neg & mesh.Sf();
surfaceScalarField phiv_pos(U_pos & mesh.Sf());
surfaceScalarField phiv_neg(U_neg & mesh.Sf());
volScalarField c = sqrt(thermo.Cp()/thermo.Cv()*rPsi);
surfaceScalarField cSf_pos =
fvc::interpolate(c, pos, "reconstruct(T)")*mesh.magSf();
surfaceScalarField cSf_neg =
fvc::interpolate(c, neg, "reconstruct(T)")*mesh.magSf();
volScalarField c(sqrt(thermo.Cp()/thermo.Cv()*rPsi));
surfaceScalarField cSf_pos
(
fvc::interpolate(c, pos, "reconstruct(T)")*mesh.magSf()
);
surfaceScalarField cSf_neg
(
fvc::interpolate(c, neg, "reconstruct(T)")*mesh.magSf()
);
surfaceScalarField ap =
max(max(phiv_pos + cSf_pos, phiv_neg + cSf_neg), v_zero);
surfaceScalarField am =
min(min(phiv_pos - cSf_pos, phiv_neg - cSf_neg), v_zero);
surfaceScalarField ap
(
max(max(phiv_pos + cSf_pos, phiv_neg + cSf_neg), v_zero)
);
surfaceScalarField am
(
min(min(phiv_pos - cSf_pos, phiv_neg - cSf_neg), v_zero)
);
surfaceScalarField a_pos = ap/(ap - am);
surfaceScalarField a_pos(ap/(ap - am));
surfaceScalarField amaxSf("amaxSf", max(mag(am), mag(ap)));
......@@ -112,7 +136,7 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
surfaceScalarField aSf = am*a_pos;
surfaceScalarField aSf(am*a_pos);
if (fluxScheme == "Tadmor")
{
......@@ -120,24 +144,28 @@ int main(int argc, char *argv[])
a_pos = 0.5;
}
surfaceScalarField a_neg = (1.0 - a_pos);
surfaceScalarField a_neg(1.0 - a_pos);
phiv_pos *= a_pos;
phiv_neg *= a_neg;
surfaceScalarField aphiv_pos = phiv_pos - aSf;
surfaceScalarField aphiv_neg = phiv_neg + aSf;
surfaceScalarField aphiv_pos(phiv_pos - aSf);
surfaceScalarField aphiv_neg(phiv_neg + aSf);
surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg);
surfaceVectorField phiUp =
surfaceVectorField phiUp
(
(aphiv_pos*rhoU_pos + aphiv_neg*rhoU_neg)
+ (a_pos*p_pos + a_neg*p_neg)*mesh.Sf();
+ (a_pos*p_pos + a_neg*p_neg)*mesh.Sf()
);
surfaceScalarField phiEp =
surfaceScalarField phiEp
(
aphiv_pos*(rho_pos*(e_pos + 0.5*magSqr(U_pos)) + p_pos)
+ aphiv_neg*(rho_neg*(e_neg + 0.5*magSqr(U_neg)) + p_neg)
+ aSf*p_pos - aSf*p_neg;
+ aSf*p_pos - aSf*p_neg
);
volTensorField tauMC("tauMC", mu*dev2(fvc::grad(U)().T()));
......@@ -167,7 +195,7 @@ int main(int argc, char *argv[])
}
// --- Solve energy
surfaceScalarField sigmaDotU =
surfaceScalarField sigmaDotU
(
(
fvc::interpolate(mu)*mesh.magSf()*fvc::snGrad(U)
......
......@@ -9,7 +9,7 @@ tmp<fvVectorMatrix> UEqn
UEqn().relax();
volScalarField rAU = 1.0/UEqn().A();
volScalarField rAU(1.0/UEqn().A());
if (momentumPredictor)
{
......
......@@ -52,5 +52,7 @@
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
volScalarField DpDt
(
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
);
......@@ -12,7 +12,7 @@ UEqn().relax();
mrfZones.addCoriolis(rho, UEqn());
pZones.addResistance(UEqn());
volScalarField rAU = 1.0/UEqn().A();
volScalarField rAU(1.0/UEqn().A());
if (momentumPredictor)
{
......
......@@ -65,8 +65,10 @@
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
volScalarField DpDt
(
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
);
MRFZones mrfZones(mesh);
mrfZones.correctBoundaryVelocity(U);
......
rho = thermo.rho();
volScalarField rAU = 1.0/UEqn().A();
volScalarField rAU(1.0/UEqn().A());
U = rAU*UEqn().H();
if (nCorr <= 1)
......
......@@ -22,7 +22,7 @@
trTU = inv(tTU());
trTU().rename("rAU");
volVectorField gradp = fvc::grad(p);
volVectorField gradp(fvc::grad(p));
for (int UCorr=0; UCorr<nUCorr; UCorr++)
{
......
......@@ -3,7 +3,7 @@ rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
volScalarField rAU = 1.0/UEqn().A();
volScalarField rAU(1.0/UEqn().A());
U = rAU*UEqn().H();
UEqn.clear();
......
......@@ -3,10 +3,10 @@ rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
volScalarField p0 = p;
volScalarField p0(p);
volScalarField AU = UEqn().A();
volScalarField AtU = AU - UEqn().H1();
volScalarField AU(UEqn().A());
volScalarField AtU(AU - UEqn().H1());
U = UEqn().H()/AU;
UEqn.clear();
......
......@@ -51,5 +51,7 @@
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
volScalarField DpDt
(
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
);