From 6be1a5d417ed922ce36ce2625d7cd758666b8eff Mon Sep 17 00:00:00 2001 From: sergio <s.ferraris@opencfd.co.uk> Date: Fri, 22 Jul 2011 12:44:23 +0100 Subject: [PATCH] Adding directionality to porous media --- .../porousBafflePressureFvPatchFields.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C index f82551589d0..1652ab878e2 100644 --- a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C +++ b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C @@ -66,6 +66,8 @@ void Foam::porousBafflePressureFvPatchField<Foam::scalar>::updateCoeffs() scalarField Un(phip/patch().magSf()); + scalarField magUn(mag(Un)); + if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) { const incompressible::turbulenceModel& model = @@ -76,7 +78,7 @@ void Foam::porousBafflePressureFvPatchField<Foam::scalar>::updateCoeffs() const scalarField nuEffw = model.nuEff()().boundaryField()[patchI]; - jump_ = -(I_*nuEffw*mag(Un) + D_*0.5*magSqr(Un)*length_); + jump_ = -sign(Un)*(I_*nuEffw + D_*0.5*magUn*length_)*magUn; } else { @@ -93,7 +95,7 @@ void Foam::porousBafflePressureFvPatchField<Foam::scalar>::updateCoeffs() Un /= rhow; - jump_ = -(I_*muEffw*mag(Un) + D_*0.5*rhow*magSqr(Un)*length_); + jump_ = -sign(Un)*(I_*muEffw + D_*0.5*rhow*magUn*length_)*magUn; } if (debug) -- GitLab