Skip to content
GitLab
Menu
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
ef48fa18
Commit
ef48fa18
authored
Jul 17, 2017
by
Henry Weller
Committed by
Andrew Heather
Jul 17, 2017
Browse files
flowRateInletVelocity extrapolated: Removed reverse flow and correct only the normal component
Improved stability and convergence.
parent
823d83b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C
View file @
ef48fa18
...
...
@@ -156,31 +156,43 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
{
const
scalar
t
=
db
().
time
().
timeOutputValue
();
tmp
<
vectorField
>
n
=
patch
().
nf
();
const
vectorField
n
(
patch
().
nf
()
)
;
if
(
extrapolateProfile_
)
{
vectorField
newValues
(
this
->
patchInternalField
());
vectorField
Up
(
this
->
patchInternalField
());
scalar
flowRate
=
flowRate_
->
value
(
t
);
scalar
estimatedFlowRate
=
-
gSum
(
rho
*
(
this
->
patch
().
Sf
()
&
newValues
));
// Patch normal extrapolated velocity
scalarField
nUp
(
n
&
Up
);
// Remove the normal component of the extrapolate patch velocity
Up
-=
nUp
*
n
;
// Remove any reverse flow
nUp
=
min
(
nUp
,
0
.
0
);
const
scalar
flowRate
=
flowRate_
->
value
(
t
);
const
scalar
estimatedFlowRate
=
-
gSum
(
rho
*
(
this
->
patch
().
magSf
()
*
nUp
));
if
(
estimatedFlowRate
/
flowRate
>
0
.
5
)
{
n
ewValues
*=
(
mag
(
flowRate
)
/
mag
(
estimatedFlowRate
));
n
Up
*=
(
mag
(
flowRate
)
/
mag
(
estimatedFlowRate
));
}
else
{
newValues
-=
((
flowRate
-
estimatedFlowRate
)
/
gSum
(
rho
*
patch
().
magSf
()))
*
n
;
nUp
-=
((
flowRate
-
estimatedFlowRate
)
/
gSum
(
rho
*
patch
().
magSf
()));
}
this
->
operator
==
(
newValues
);
// Add the corrected normal component of velocity to the patch velocity
Up
+=
nUp
*
n
;
// Correct the patch velocity
this
->
operator
==
(
Up
);
}
else
{
const
scalar
avgU
=
-
flowRate_
->
value
(
t
)
/
gSum
(
rho
*
patch
().
magSf
());
operator
==
(
n
*
avgU
);
operator
==
(
avgU
*
n
);
}
}
...
...
src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C
View file @
ef48fa18
...
...
@@ -160,10 +160,10 @@ void Foam::flowRateOutletVelocityFvPatchVectorField::updateValues
Up
-=
nUp
*
n
;
// Remove any reverse flow
nUp
=
m
in
(
nUp
,
0
.
0
);
nUp
=
m
ax
(
nUp
,
0
.
0
);
const
scalar
flowRate
=
flowRate_
->
value
(
t
);
const
scalar
estimatedFlowRate
=
-
gSum
(
rho
*
(
this
->
patch
().
magSf
()
*
nUp
));
const
scalar
estimatedFlowRate
=
gSum
(
rho
*
(
this
->
patch
().
magSf
()
*
nUp
));
if
(
estimatedFlowRate
/
flowRate
>
0
.
5
)
{
...
...
@@ -171,7 +171,7 @@ void Foam::flowRateOutletVelocityFvPatchVectorField::updateValues
}
else
{
nUp
-
=
((
flowRate
-
estimatedFlowRate
)
/
gSum
(
rho
*
patch
().
magSf
()));
nUp
+
=
((
flowRate
-
estimatedFlowRate
)
/
gSum
(
rho
*
patch
().
magSf
()));
}
// Add the corrected normal component of velocity to the patch velocity
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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