diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index 8e3500c9d6..1face6ddd5 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -58,6 +58,9 @@ int main(int argc, char *argv[]) #include "CourantNo.H" #include "setInitialDeltaT.H" + surfaceScalarField phiAbs("phiAbs", phi); + fvc::makeAbsolute(phiAbs, U); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -67,9 +70,6 @@ int main(int argc, char *argv[]) #include "alphaCourantNo.H" #include "CourantNo.H" - // Make the fluxes absolute - fvc::makeAbsolute(phi, U); - #include "setDeltaT.H" runTime++; @@ -78,8 +78,18 @@ int main(int argc, char *argv[]) scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); - // Do any mesh changes - mesh.update(); + { + // Calculate the relative velocity used to map the relative flux phi + volVectorField Urel("Urel", U); + + if (mesh.moving()) + { + Urel -= fvc::reconstruct(fvc::meshPhi(U)); + } + + // Do any mesh changes + mesh.update(); + } if (mesh.changing()) { @@ -96,9 +106,6 @@ int main(int argc, char *argv[]) #include "correctPhi.H" } - // Make the fluxes relative to the mesh motion - fvc::makeRelative(phi, U); - if (mesh.changing() && checkMeshCourantNo) { #include "meshCourantNo.H" diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H index 84c1fe45b6..4b90d99499 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H @@ -3,16 +3,19 @@ surfaceScalarField rAUf(fvc::interpolate(rAU)); U = rAU*UEqn.H(); - surfaceScalarField phiU("phiU", (fvc::interpolate(U) & mesh.Sf())); + + phiAbs = + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rAU, rho, U, phiAbs); if (p_rgh.needReference()) { - fvc::makeRelative(phiU, U); - adjustPhi(phiU, U, p_rgh); - fvc::makeAbsolute(phiU, U); + fvc::makeRelative(phiAbs, U); + adjustPhi(phiAbs, U, p_rgh); + fvc::makeAbsolute(phiAbs, U); } - phi = phiU + + phi = phiAbs + ( fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) - ghf*fvc::snGrad(rho) @@ -38,11 +41,13 @@ } } - U += rAU*fvc::reconstruct((phi - phiU)/rAUf); + U += rAU*fvc::reconstruct((phi - phiAbs)/rAUf); U.correctBoundaryConditions(); #include "continuityErrs.H" + phiAbs = phi; + // Make the fluxes relative to the mesh motion fvc::makeRelative(phi, U); diff --git a/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.C b/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.C index a73a7bc4e6..c0720d90cb 100644 --- a/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.C +++ b/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.C @@ -40,7 +40,7 @@ Foam::Field Foam::interpolateSplineXY forAll(xNew, i) { - yNew[i] = interpolateSmoothXY(xNew[i], xOld, yOld); + yNew[i] = interpolateSplineXY(xNew[i], xOld, yOld); } return yNew; diff --git a/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C b/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C index 9eb89527f3..7c72beaf99 100644 --- a/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C +++ b/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C @@ -107,7 +107,7 @@ bool Foam::adjustPhi { massCorr = (massIn - fixedMassOut)/adjustableMassOut; } - else if (mag(fixedMassOut - massIn)/totalFlux > 1e-10) + else if (mag(fixedMassOut - massIn)/totalFlux > 1e-8) { FatalErrorIn ( diff --git a/src/turbulenceModels/incompressible/LES/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsUSpaldingWallFunction/nuSgsUSpaldingWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/LES/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsUSpaldingWallFunction/nuSgsUSpaldingWallFunctionFvPatchScalarField.C index 5f28777553..73b89be91d 100644 --- a/src/turbulenceModels/incompressible/LES/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsUSpaldingWallFunction/nuSgsUSpaldingWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/LES/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsUSpaldingWallFunction/nuSgsUSpaldingWallFunctionFvPatchScalarField.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nuSgsUSpaldingWallFunctionFvPatchScalarField.H" +#include "LESModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -47,8 +48,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF), - UName_("U"), - nuName_("nu"), kappa_(0.41), E_(9.8) {} @@ -64,8 +63,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(ptf, p, iF, mapper), - UName_(ptf.UName_), - nuName_(ptf.nuName_), kappa_(ptf.kappa_), E_(ptf.E_) {} @@ -80,8 +77,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF, dict), - UName_(dict.lookupOrDefault("U", "U")), - nuName_(dict.lookupOrDefault("nu", "nu")), kappa_(dict.lookupOrDefault("kappa", 0.41)), E_(dict.lookupOrDefault("E", 9.8)) {} @@ -94,8 +89,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(nwfpsf), - UName_(nwfpsf.UName_), - nuName_(nwfpsf.nuName_), kappa_(nwfpsf.kappa_), E_(nwfpsf.E_) {} @@ -109,8 +102,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(nwfpsf, iF), - UName_(nwfpsf.UName_), - nuName_(nwfpsf.nuName_), kappa_(nwfpsf.kappa_), E_(nwfpsf.E_) {} @@ -123,16 +114,15 @@ void nuSgsUSpaldingWallFunctionFvPatchScalarField::evaluate const Pstream::commsTypes ) { + const LESModel& lesModel = db().lookupObject("LESProperties"); + const label patchi = patch().index(); + const fvPatchVectorField& U = lesModel.U().boundaryField()[patchi]; + const scalarField nuw = lesModel.nu()().boundaryField()[patchi]; + const scalarField& ry = patch().deltaCoeffs(); - const fvPatchVectorField& U = - patch().lookupPatchField(UName_); - const scalarField magUp(mag(U.patchInternalField() - U)); - const scalarField& nuw = - patch().lookupPatchField(nuName_); - scalarField& nuSgsw = *this; const scalarField magFaceGradU(mag(U.snGrad())); @@ -185,8 +175,6 @@ void nuSgsUSpaldingWallFunctionFvPatchScalarField::evaluate void nuSgsUSpaldingWallFunctionFvPatchScalarField::write(Ostream& os) const { fvPatchField::write(os); - writeEntryIfDifferent(os, "U", "U", UName_); - writeEntryIfDifferent(os, "nu", "nu", nuName_); os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; writeEntry("value", os); @@ -201,6 +189,7 @@ makePatchTypeField nuSgsUSpaldingWallFunctionFvPatchScalarField ); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace LESModels diff --git a/src/turbulenceModels/incompressible/LES/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsUSpaldingWallFunction/nuSgsUSpaldingWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/LES/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsUSpaldingWallFunction/nuSgsUSpaldingWallFunctionFvPatchScalarField.H index 1ebccdc8ca..11de1fb06f 100644 --- a/src/turbulenceModels/incompressible/LES/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsUSpaldingWallFunction/nuSgsUSpaldingWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/LES/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsUSpaldingWallFunction/nuSgsUSpaldingWallFunctionFvPatchScalarField.H @@ -58,12 +58,6 @@ class nuSgsUSpaldingWallFunctionFvPatchScalarField { // Private data - //- Name of velocity field - word UName_; - - //- Name of laminar viscosity field - word nuName_; - //- Von Karman constant scalar kappa_; diff --git a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/constant/dynamicMeshDict b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/constant/dynamicMeshDict index 105d0818dd..64223ec7b8 100644 --- a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/constant/dynamicMeshDict +++ b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/constant/dynamicMeshDict @@ -39,7 +39,9 @@ dynamicRefineFvMeshCoeffs // on surfaceScalarFields that do not need to be reinterpolated. correctFluxes ( - (phi U) + (phi Urel) + (phiAbs U) + (phiAbs_0 U_0) (nHatf none) (rho*phi none) (ghf none)