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
1513a049
Commit
1513a049
authored
May 10, 2018
by
mattijs
Browse files
BUG: swirl: decide based on global properties. Fixes
#824
.
parent
56231b5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
View file @
1513a049
...
...
@@ -75,7 +75,7 @@ swirlFlowRateInletVelocityFvPatchVectorField
dict
.
lookupOrDefault
(
"axis"
,
patch
().
size
()
returnReduce
(
patch
().
size
()
,
maxOp
<
label
>
())
?
-
gSum
(
patch
().
Sf
())
/
gSum
(
patch
().
magSf
())
:
Zero
)
...
...
@@ -145,48 +145,53 @@ void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
{
return
;
}
const
scalar
t
=
this
->
db
().
time
().
timeOutputValue
();
const
scalar
flowRate
=
flowRate_
->
value
(
t
);
const
scalar
rpm
=
rpm_
->
value
(
t
);
const
scalar
totArea
=
gSum
(
patch
().
magSf
());
const
scalar
avgU
=
-
flowRate
/
totArea
;
const
vector
axisHat
=
axis_
/
mag
(
axis_
);
// Update angular velocity - convert [rpm] to [rad/s]
tmp
<
vectorField
>
tangentialVelocity
(
axisHat
^
(
rpm
*
constant
::
mathematical
::
pi
/
30
.
0
)
*
(
patch
().
Cf
()
-
origin_
)
);
if
(
totArea
>
ROOTVSMALL
&&
axis_
!=
vector
(
Zero
))
{
const
scalar
t
=
this
->
db
().
time
().
timeOutputValue
();
const
scalar
flowRate
=
flowRate_
->
value
(
t
);
const
scalar
rpm
=
rpm_
->
value
(
t
);
tmp
<
vectorField
>
n
=
patch
().
nf
()
;
const
scalar
avgU
=
-
flowRate
/
totArea
;
const
surfaceScalarField
&
phi
=
db
().
lookupObject
<
surfaceScalarField
>
(
phiName_
);
const
vector
axisHat
=
axis_
/
mag
(
axis_
);
if
(
phi
.
dimensions
()
==
dimVelocity
*
dimArea
)
{
// volumetric flow-rate
operator
==
(
tangentialVelocity
+
n
*
avgU
);
}
else
if
(
phi
.
dimensions
()
==
dimDensity
*
dimVelocity
*
dimArea
)
{
const
fvPatchField
<
scalar
>&
rhop
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
rhoName_
);
// mass flow-rate
operator
==
(
tangentialVelocity
+
n
*
avgU
/
rhop
);
}
else
{
FatalErrorInFunction
<<
"dimensions of "
<<
phiName_
<<
" are incorrect"
<<
nl
<<
" on patch "
<<
this
->
patch
().
name
()
<<
" of field "
<<
this
->
internalField
().
name
()
<<
" in file "
<<
this
->
internalField
().
objectPath
()
<<
nl
<<
exit
(
FatalError
);
// Update angular velocity - convert [rpm] to [rad/s]
tmp
<
vectorField
>
tangentialVelocity
(
axisHat
^
(
rpm
*
constant
::
mathematical
::
pi
/
30
.
0
)
*
(
patch
().
Cf
()
-
origin_
)
);
tmp
<
vectorField
>
n
=
patch
().
nf
();
const
surfaceScalarField
&
phi
=
db
().
lookupObject
<
surfaceScalarField
>
(
phiName_
);
if
(
phi
.
dimensions
()
==
dimVelocity
*
dimArea
)
{
// volumetric flow-rate
operator
==
(
tangentialVelocity
+
n
*
avgU
);
}
else
if
(
phi
.
dimensions
()
==
dimDensity
*
dimVelocity
*
dimArea
)
{
const
fvPatchField
<
scalar
>&
rhop
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
rhoName_
);
// mass flow-rate
operator
==
(
tangentialVelocity
+
n
*
avgU
/
rhop
);
}
else
{
FatalErrorInFunction
<<
"dimensions of "
<<
phiName_
<<
" are incorrect"
<<
nl
<<
" on patch "
<<
this
->
patch
().
name
()
<<
" of field "
<<
this
->
internalField
().
name
()
<<
" in file "
<<
this
->
internalField
().
objectPath
()
<<
nl
<<
exit
(
FatalError
);
}
}
fixedValueFvPatchField
<
vector
>::
updateCoeffs
();
...
...
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