From 78c9ffaaac44bf4ea1de2cb91597b3b598be8441 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 7 Sep 2023 12:37:45 +0100 Subject: [PATCH] constrainHbyA: Added constrainHbyA and constrainPhiHbyA which constrain the argument used by the multiphaseEuler solver module. --- .../general/constrainHbyA/constrainHbyA.C | 94 +++++++++++-------- .../general/constrainHbyA/constrainHbyA.H | 14 +++ 2 files changed, 71 insertions(+), 37 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.C b/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.C index a683303c3b..09ea530ee5 100644 --- a/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.C +++ b/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.C @@ -30,6 +30,60 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +void Foam::constrainHbyA +( + volVectorField& HbyA, + const volVectorField& U, + const volScalarField& p +) +{ + volVectorField::Boundary& HbyAbf = HbyA.boundaryFieldRef(); + + forAll(HbyAbf, patchi) + { + if + ( + !U.boundaryField()[patchi].assignable() + && !isA + ( + p.boundaryField()[patchi] + ) + ) + { + HbyAbf[patchi] = U.boundaryField()[patchi]; + } + } +} + + +void Foam::constrainPhiHbyA +( + surfaceScalarField& phiHbyA, + const volVectorField& U, + const volScalarField& p +) +{ + surfaceScalarField::Boundary& phiHbyAbf = phiHbyA.boundaryFieldRef(); + + forAll(phiHbyAbf, patchi) + { + if + ( + !U.boundaryField()[patchi].assignable() + && !isA + ( + p.boundaryField()[patchi] + ) + ) + { + phiHbyAbf[patchi] = + U.mesh().Sf().boundaryField()[patchi] + & U.boundaryField()[patchi]; + } + } +} + + Foam::tmp Foam::constrainHbyA ( const tmp& tHbyA, @@ -53,23 +107,7 @@ Foam::tmp Foam::constrainHbyA ); } - volVectorField& HbyA = tHbyANew.ref(); - volVectorField::Boundary& HbyAbf = HbyA.boundaryFieldRef(); - - forAll(U.boundaryField(), patchi) - { - if - ( - !U.boundaryField()[patchi].assignable() - && !isA - ( - p.boundaryField()[patchi] - ) - ) - { - HbyAbf[patchi] = U.boundaryField()[patchi]; - } - } + constrainHbyA(tHbyANew.ref(), U, p); return tHbyANew; } @@ -98,25 +136,7 @@ Foam::tmp Foam::constrainPhiHbyA ); } - surfaceScalarField& phiHbyA = tphiHbyANew.ref(); - surfaceScalarField::Boundary& phiHbyAbf = phiHbyA.boundaryFieldRef(); - - forAll(U.boundaryField(), patchi) - { - if - ( - !U.boundaryField()[patchi].assignable() - && !isA - ( - p.boundaryField()[patchi] - ) - ) - { - phiHbyAbf[patchi] = - U.mesh().Sf().boundaryField()[patchi] - & U.boundaryField()[patchi]; - } - } + constrainPhiHbyA(tphiHbyANew.ref(), U, p); return tphiHbyANew; } @@ -133,7 +153,7 @@ Foam::tmp Foam::constrainPhid const volScalarField::Boundary& pBf = p.boundaryField(); - forAll(pBf, patchi) + forAll(phidBf, patchi) { if (isA(pBf[patchi])) { diff --git a/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.H b/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.H index 26d8a91c7b..fb6d16d924 100644 --- a/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.H +++ b/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.H @@ -44,6 +44,20 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +void constrainHbyA +( + volVectorField& HbyA, + const volVectorField& U, + const volScalarField& p +); + +void constrainPhiHbyA +( + surfaceScalarField& phiHbyA, + const volVectorField& U, + const volScalarField& p +); + tmp constrainHbyA ( const tmp& tHbyA,