From 66cd36309275430aaf5eda9907d82fc98b4c3638 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 27 May 2009 19:22:35 +0100 Subject: [PATCH 1/3] updated --- .../mutRoughWallFunctionFvPatchScalarField.C | 28 +++++++++---------- .../mutRoughWallFunctionFvPatchScalarField.H | 7 +---- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.C index 38a275aeb5..a6b699d20d 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.C @@ -45,25 +45,23 @@ namespace RASModels scalar mutRoughWallFunctionFvPatchScalarField::fnRough ( const scalar KsPlus, - const scalar Cs, - const scalar kappa + const scalar Cs ) const { - // Set deltaB based on non-dimensional roughness height - scalar deltaB = 0.0; + // Return fn based on non-dimensional roughness height + if (KsPlus < 90.0) { - deltaB = - 1.0/kappa - *log((KsPlus - 2.25)/87.75 + Cs*KsPlus) - *sin(0.4258*(log(KsPlus) - 0.811)); + return pow + ( + (KsPlus - 2.25)/87.75 + Cs*KsPlus, + sin(0.4258*(log(KsPlus) - 0.811)) + ); } else { - deltaB = 1.0/kappa*log(1.0 + Cs*KsPlus); + return (1.0 + Cs*KsPlus); } - - return exp(min(deltaB*kappa, 50.0)); } @@ -216,8 +214,8 @@ void mutRoughWallFunctionFvPatchScalarField::updateCoeffs() scalar yPlusLamNew = yPlusLam; if (KsPlus > 2.25) { - Edash = E/fnRough(KsPlus, Cs_[faceI], kappa); - yPlusLam = rasModel.yPlusLam(kappa, Edash); + Edash = E/fnRough(KsPlus, Cs_[faceI]); + yPlusLamNew = rasModel.yPlusLam(kappa, Edash); } if (debug) @@ -231,7 +229,9 @@ void mutRoughWallFunctionFvPatchScalarField::updateCoeffs() if (yPlus > yPlusLamNew) { - mutw[faceI] = muw[faceI]*(yPlus*kappa/log(Edash*yPlus) - 1); + mutw[faceI] = + muw[faceI] + *(yPlus*kappa/log(max(Edash*yPlus, 1+1e-4)) - 1); } else { diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.H index 88209f4184..b12ad6bc57 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.H @@ -83,12 +83,7 @@ class mutRoughWallFunctionFvPatchScalarField // Private member functions //- Compute the roughness function - scalar fnRough - ( - const scalar KsPlus, - const scalar Cs, - const scalar kappa - ) const; + scalar fnRough(const scalar KsPlus, const scalar Cs) const; public: From fd9cf0c1f6690023043b2a10036359bd21cf0192 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 27 May 2009 19:23:05 +0100 Subject: [PATCH 2/3] removed kappa from argument list - not used --- .../nutRoughWallFunctionFvPatchScalarField.C | 5 ++--- .../nutRoughWallFunctionFvPatchScalarField.H | 7 +------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C index 7b6e14493e..afb08a5d52 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C @@ -45,8 +45,7 @@ namespace RASModels scalar nutRoughWallFunctionFvPatchScalarField::fnRough ( const scalar KsPlus, - const scalar Cs, - const scalar kappa + const scalar Cs ) const { // Return fn based on non-dimensional roughness height @@ -205,7 +204,7 @@ void nutRoughWallFunctionFvPatchScalarField::updateCoeffs() if (KsPlus > 2.25) { - Edash = E/fnRough(KsPlus, Cs_[faceI], kappa); + Edash = E/fnRough(KsPlus, Cs_[faceI]); } if (yPlus > yPlusLam) diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.H index 968c5c3f8f..3371cbaa6d 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.H @@ -80,12 +80,7 @@ class nutRoughWallFunctionFvPatchScalarField // Private member functions //- Compute the roughness function - scalar fnRough - ( - const scalar KsPlus, - const scalar Cs, - const scalar kappa - ) const; + scalar fnRough(const scalar KsPlus, const scalar Cs) const; public: From 0a976928574d9cc355babbde63ce6cd5de6bf0b4 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 28 May 2009 11:46:54 +0100 Subject: [PATCH 3/3] bugfix: changed order of logic to prevent hand on redude in parallel --- src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 5ad5dca8cd..5eae3a9f80 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -480,7 +480,7 @@ void Foam::fvMatrix::setReference const bool forceReference ) { - if (celli >= 0 && (psi_.needReference() || forceReference)) + if ((forceReference || psi_.needReference()) && celli >= 0) { source()[celli] += diag()[celli]*value; diag()[celli] += diag()[celli];