Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
4bb7f08e
Commit
4bb7f08e
authored
Feb 15, 2016
by
Henry Weller
Browse files
constrainPressure: Updated to use the more efficient patch-based MRF::relative function
parent
618bf48a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.C
View file @
4bb7f08e
...
...
@@ -43,48 +43,35 @@ void Foam::constrainPressure
)
{
const
fvMesh
&
mesh
=
p
.
mesh
();
volScalarField
::
GeometricBoundaryField
&
pBf
=
p
.
boundaryField
();
bool
hasFixedFluxBCs
=
false
;
const
volVectorField
::
GeometricBoundaryField
&
UBf
=
U
.
boundaryField
();
const
surfaceScalarField
::
GeometricBoundaryField
&
phiHbyABf
=
phiHbyA
.
boundaryField
();
const
typename
RAUType
::
GeometricBoundaryField
&
rhorAUBf
=
rhorAU
.
boundaryField
();
const
surfaceVectorField
::
GeometricBoundaryField
&
SfBf
=
mesh
.
Sf
().
boundaryField
();
const
surfaceScalarField
::
GeometricBoundaryField
&
magSfBf
=
mesh
.
magSf
().
boundaryField
();
forAll
(
pBf
,
patchi
)
{
if
(
isA
<
fixedFluxPressureFvPatchScalarField
>
(
pBf
[
patchi
]))
{
hasFixedFluxBCs
=
true
;
break
;
}
}
if
(
hasFixedFluxBCs
)
{
const
surfaceScalarField
::
GeometricBoundaryField
&
phiHbyABf
=
phiHbyA
.
boundaryField
();
const
typename
RAUType
::
GeometricBoundaryField
&
rhorAUBf
=
rhorAU
.
boundaryField
();
const
surfaceScalarField
::
GeometricBoundaryField
&
magSfBf
=
mesh
.
magSf
().
boundaryField
();
// Pre-compute tho relative flux for all patches: currently MRFZone does
// not support computing the relative flux for individual patches
FieldField
<
fvsPatchField
,
scalar
>
phiRelBf
(
MRF
.
relative
(
mesh
.
Sf
().
boundaryField
()
&
U
.
boundaryField
())
);
forAll
(
pBf
,
patchi
)
{
if
(
isA
<
fixedFluxPressureFvPatchScalarField
>
(
pBf
[
patchi
]))
{
refCast
<
fixedFluxPressureFvPatchScalarField
>
(
pBf
[
patchi
])
.
updateCoeffs
refCast
<
fixedFluxPressureFvPatchScalarField
>
(
pBf
[
patchi
]
).
updateCoeffs
(
(
(
phiHbyABf
[
patchi
]
-
rho
.
boundaryField
()[
patchi
]
*
phiRelBf
[
patchi
]
)
/
(
magSfBf
[
patchi
]
*
rhorAUBf
[
patchi
])
);
}
phiHbyABf
[
patchi
]
-
rho
.
boundaryField
()[
patchi
]
*
MRF
.
relative
(
SfBf
[
patchi
]
&
UBf
[
patchi
],
patchi
)
)
/
(
magSfBf
[
patchi
]
*
rhorAUBf
[
patchi
])
);
}
}
}
...
...
src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.H
View file @
4bb7f08e
...
...
@@ -68,6 +68,13 @@ public:
{
return
U
;
}
//- Return the argument unchanged
template
<
class
Type
>
inline
const
Type
&
relative
(
const
Type
&
U
,
const
label
patchi
)
const
{
return
U
;
}
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment