diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C index 4d0927a6afa5c5bf1bbe3fdfde772851452462ac..363a8fd2dcfdeec4b0b1ae99082d74645ee3f796 100644 --- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C +++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C @@ -109,6 +109,9 @@ int main(int argc, char *argv[]) surfaceScalarField phiv_pos(U_pos & mesh.Sf()); surfaceScalarField phiv_neg(U_neg & mesh.Sf()); + fvc::makeRelative(phiv_pos, U); + fvc::makeRelative(phiv_neg, U); + volScalarField c(sqrt(thermo.Cp()/thermo.Cv()*rPsi)); surfaceScalarField cSf_pos ( @@ -161,17 +164,9 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; mesh.movePoints(motionPtr->newPoints()); - phiv_pos = U_pos & mesh.Sf(); - phiv_neg = U_neg & mesh.Sf(); - fvc::makeRelative(phiv_pos, U); - fvc::makeRelative(phiv_neg, U); - phiv_neg -= mesh.phi(); - phiv_pos *= a_pos; - phiv_neg *= a_neg; - aphiv_pos = phiv_pos - aSf; - aphiv_neg = phiv_neg + aSf; - surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg); + phi = aphiv_pos*rho_pos + aphiv_neg*rho_neg; + Info<< phi.boundaryField()[0] << endl; surfaceVectorField phiUp ( @@ -183,6 +178,7 @@ int main(int argc, char *argv[]) ( 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) + + mesh.phi()*(a_pos*p_pos + a_neg*p_neg) + aSf*p_pos - aSf*p_neg ); diff --git a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/eEqn.H b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/eEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..0c17353ec45ee6026ab67e88b1ff3c882d8d3936 --- /dev/null +++ b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/eEqn.H @@ -0,0 +1,12 @@ +{ + solve + ( + fvm::ddt(rho, e) + + fvm::div(phi, e) + - fvm::laplacian(turbulence->alphaEff(), e) + == + - p*fvc::div(phi/fvc::interpolate(rho) + mesh.phi()) + ); + + thermo.correct(); +} diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/createFields.H b/applications/solvers/multiphase/multiphaseEulerFoam/createFields.H index 7e24071893ba80ee18796d196432e2afb550782a..79fa72d7587eabc198bc6a4d01b132db1db2e5a0 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/createFields.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/createFields.H @@ -53,13 +53,16 @@ phi += fvc::interpolate(alpha)*phase.phi(); } - scalar slamDampCoeff(readScalar(fluid.lookup("slamDampCoeff"))); + scalar slamDampCoeff + ( + fluid.lookupOrDefault<scalar>("slamDampCoeff", 1) + ); dimensionedScalar maxSlamVelocity ( "maxSlamVelocity", dimVelocity, - fluid.lookup("maxSlamVelocity") + fluid.lookupOrDefault<scalar>("maxSlamVelocity", GREAT) ); // dimensionedScalar pMin diff --git a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C index 5063d2b625d5827ae9a298e581bc0244a05aa0dd..57ecd897b3d0fc5f27ae986e5c9ffa6c5b3b892b 100644 --- a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C +++ b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -183,17 +183,17 @@ vector eigenValues(const tensor& t) // Sort the eigenvalues into ascending order - if (mag(i) > mag(ii)) + if (i > ii) { Swap(i, ii); } - if (mag(ii) > mag(iii)) + if (ii > iii) { Swap(ii, iii); } - if (mag(i) > mag(ii)) + if (i > ii) { Swap(i, ii); } @@ -384,17 +384,17 @@ vector eigenValues(const symmTensor& t) // Sort the eigenvalues into ascending order - if (mag(i) > mag(ii)) + if (i > ii) { Swap(i, ii); } - if (mag(ii) > mag(iii)) + if (ii > iii) { Swap(ii, iii); } - if (mag(i) > mag(ii)) + if (i > ii) { Swap(i, ii); } diff --git a/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C b/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C index 7b9952535d50056ed4898511b8e0da120575e42a..08bc334e6d87a52d49c1803542eee595950bb9e6 100644 --- a/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C +++ b/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -116,7 +116,7 @@ vector2D eigenValues(const tensor2D& t) } // Sort the eigenvalues into ascending order - if (mag(i) > mag(ii)) + if (i > ii) { Swap(i, ii); } diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C index c7383f9d0d57dd53a298c23ae53ac620030ee1a9..5786665f6a4cefdb631e7038b719ea4673f0e350 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C @@ -45,7 +45,6 @@ Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New } else { - is.putBack(firstToken); // DataEntryType = CompatibilityConstant<Type>::typeName; DataEntryType = "CompatibilityConstant"; } diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H index 05b525d3a8741eb91c0ddfea6923a6a8c098cc55..f128f5ad51e71c38249692d678a85fc389cdfb4a 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H @@ -29,7 +29,7 @@ Description \verbatim <entryName> tableFile; - tableCoeffs + tableFileCoeffs { fileName dataFile; // name of data file outOfBounds clamp; // optional out-of-bounds handling diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C index ecf9d4c39c70b2874e54da1b479c374bc021f8e1..4cd85a7cf60fabdd1af23b0984cc7addaec52e43 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,8 +41,6 @@ namespace Foam void Foam::IDDESDelta::calcDelta() { - label nD = mesh().nGeometricD(); - const volScalarField& hmax = hmax_(); // initialise wallNorm @@ -50,7 +48,7 @@ void Foam::IDDESDelta::calcDelta() const volVectorField& n = wallNorm.n(); - tmp<volScalarField> faceToFacenMax + tmp<volScalarField> tfaceToFacenMax ( new volScalarField ( @@ -67,61 +65,60 @@ void Foam::IDDESDelta::calcDelta() ) ); + scalarField& faceToFacenMax = tfaceToFacenMax().internalField(); + const cellList& cells = mesh().cells(); + const vectorField& faceCentres = mesh().faceCentres(); - forAll(cells,cellI) + forAll(cells, cellI) { scalar deltaMaxTmp = 0.0; - const labelList& cFaces = mesh().cells()[cellI]; - const point& faceCentre = mesh().faceCentres()[cFaces[0]]; + const labelList& cFaces = cells[cellI]; + const point& faceCentre = faceCentres[cFaces[0]]; const vector nCell = n[cellI]; forAll(cFaces, cFaceI) { label faceI = cFaces[cFaceI]; - const point& faceCentreTwo = mesh().faceCentres()[faceI]; + const point& faceCentreTwo = faceCentres[faceI]; scalar tmp = (faceCentre - faceCentreTwo) & nCell; if (tmp > deltaMaxTmp) { deltaMaxTmp = tmp; } } - faceToFacenMax()[cellI] = deltaMaxTmp; + faceToFacenMax[cellI] = deltaMaxTmp; } - if (nD == 3) - { - delta_.internalField() = - deltaCoeff_ - *min - ( - max - ( - max(cw_*wallDist(mesh()).y(), cw_*hmax), - faceToFacenMax() - ), - hmax - ); - } - else if (nD == 2) + + label nD = mesh().nGeometricD(); + + if (nD == 2) { WarningIn("IDDESDelta::calcDelta()") - << "Case is 2D, LES is not strictly applicable\n" + << "Case is 2D, LES is not strictly applicable" << nl << endl; - - delta_.internalField() = - deltaCoeff_ - *min - ( - max(max(cw_*wallDist(mesh()).y(), cw_*hmax), faceToFacenMax()), - hmax - ); } - else + else if (nD != 3) { FatalErrorIn("IDDESDelta::calcDelta()") - << "Case is not 3D or 2D, LES is not strictly applicable" - << exit(FatalError); + << "Case must be either 2D or 3D" << exit(FatalError); } + + delta_.internalField() = + deltaCoeff_ + *min + ( + max + ( + max + ( + cw_*wallDist(mesh()).y(), + cw_*hmax + ), + tfaceToFacenMax + ), + hmax + ); } @@ -136,10 +133,7 @@ Foam::IDDESDelta::IDDESDelta : LESdelta(name, mesh), hmax_(LESdelta::New("hmax", mesh, dd.parent())), - deltaCoeff_ - ( - readScalar(dd.subDict(type()+"Coeffs").lookup("deltaCoeff")) - ), + deltaCoeff_(readScalar(dd.subDict(type()+"Coeffs").lookup("deltaCoeff"))), cw_(0.15) { dd.subDict(type() + "Coeffs").readIfPresent("cw", cw_); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C index 57186bdc64daa9bf6bf3d907fb83bb9b3546223b..59ab80e4fe712a1b226cb242309ff872178799fb 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C @@ -118,7 +118,9 @@ void fixedShearStressFvPatchVectorField::updateCoeffs() const scalarField& ry = patch().deltaCoeffs(); - tmp<scalarField> nuEffw = rasModel.nuEff()().boundaryField()[patchI]; + tmp<volScalarField> tnuEff = rasModel.nuEff(); + const volScalarField& nuEff = tnuEff(); + const scalarField& nuEffw = nuEff.boundaryField()[patchI]; tmp<vectorField> UwUpdated = tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui));