constrainHbyA: Added constrainPhiHbyA to constrain the predicted flux directly
This commit is contained in:
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "constrainHbyA.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fixedFluxExtrapolatedPressureFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -70,4 +71,47 @@ Foam::tmp<Foam::volVectorField> Foam::constrainHbyA
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::constrainPhiHbyA
|
||||
(
|
||||
const tmp<surfaceScalarField>& tphiHbyA,
|
||||
const volVectorField& U,
|
||||
const volScalarField& p
|
||||
)
|
||||
{
|
||||
tmp<surfaceScalarField> tphiHbyANew;
|
||||
|
||||
if (tphiHbyA.isTmp())
|
||||
{
|
||||
tphiHbyANew = tphiHbyA;
|
||||
tphiHbyANew.ref().rename("phiHbyA");
|
||||
}
|
||||
else
|
||||
{
|
||||
tphiHbyANew = surfaceScalarField::New("phiHbyA", tphiHbyA);
|
||||
}
|
||||
|
||||
surfaceScalarField& phiHbyA = tphiHbyANew.ref();
|
||||
surfaceScalarField::Boundary& phiHbyAbf = phiHbyA.boundaryFieldRef();
|
||||
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
if
|
||||
(
|
||||
!U.boundaryField()[patchi].assignable()
|
||||
&& !isA<fixedFluxExtrapolatedPressureFvPatchScalarField>
|
||||
(
|
||||
p.boundaryField()[patchi]
|
||||
)
|
||||
)
|
||||
{
|
||||
phiHbyAbf[patchi] =
|
||||
U.mesh().Sf().boundaryField()[patchi]
|
||||
& U.boundaryField()[patchi];
|
||||
}
|
||||
}
|
||||
|
||||
return tphiHbyANew;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,6 +35,7 @@ SourceFiles
|
||||
#define constrainHbyA_H
|
||||
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,6 +51,13 @@ tmp<volVectorField> constrainHbyA
|
||||
const volScalarField& p
|
||||
);
|
||||
|
||||
tmp<surfaceScalarField> constrainPhiHbyA
|
||||
(
|
||||
const tmp<surfaceScalarField>& tphiHbyA,
|
||||
const volVectorField& U,
|
||||
const volScalarField& p
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
Reference in New Issue
Block a user