From ef1f62b8460a33447ecdb5efff1a61b4f4574ac8 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 29 Dec 2014 12:05:54 +0000 Subject: [PATCH] atmBoundaryLayerInletVelocity: removed spurious limit U <= Uref Rewrote using field algebra rather than looping over cells Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1384 --- ...daryLayerInletVelocityFvPatchVectorField.C | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C index 1935c29bc1..85f8438318 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -111,31 +111,16 @@ atmBoundaryLayerInletVelocityFvPatchVectorField << abort(FatalError); } + // Ensure direction vectors are normalized n_ /= mag(n_); z_ /= mag(z_); - forAll (Ustar_, i) - { - Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001))); - } - - const vectorField& c = patch().Cf(); - const scalarField coord(c & z_); - scalarField Un(coord.size()); - - forAll(coord, i) - { - if ((coord[i] - zGround_[i]) < Href_) - { - Un[i] = - (Ustar_[i]/kappa_) - * log((coord[i] - zGround_[i] + z0_[i])/max(z0_[i], 0.001)); - } - else - { - Un[i] = Uref_; - } - } + Ustar_ = kappa_*Uref_/(log((Href_ + z0_)/max(z0_, 0.001))); + scalarField Un + ( + (Ustar_/kappa_) + *log(((z_ & patch().Cf()) - zGround_ + z0_)/max(z0_, 0.001)) + ); vectorField::operator=(n_*Un); }