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
3b3bb717
Commit
3b3bb717
authored
Feb 10, 2016
by
Henry Weller
Browse files
variableHeightFlowRateInletVelocityFvPatchVectorField: Changed the flow-rate to a Function1
to support time-variation
parent
e37da9fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C
View file @
3b3bb717
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-201
3
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-201
6
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -24,10 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include
"variableHeightFlowRateInletVelocityFvPatchVectorField.H"
#include
"volFields.H"
#include
"addToRunTimeSelectionTable.H"
#include
"fvPatchFieldMapper.H"
#include
"surfaceFields.H"
#include
"volFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
...
...
@@ -39,7 +37,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField
<
vector
>
(
p
,
iF
),
flowRate_
(
0
),
flowRate_
(),
alphaName_
(
"none"
)
{}
...
...
@@ -47,29 +45,29 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
Foam
::
variableHeightFlowRateInletVelocityFvPatchVectorField
::
variableHeightFlowRateInletVelocityFvPatchVectorField
(
const
variableHeightFlowRateInletVelocityFvPatchVectorField
&
ptf
,
const
fvPatch
&
p
,
const
DimensionedField
<
vector
,
volMesh
>&
iF
,
const
fvPatchFieldMapper
&
mapper
const
dictionary
&
dict
)
:
fixedValueFvPatchField
<
vector
>
(
ptf
,
p
,
iF
,
mapper
),
flowRate_
(
ptf
.
flowRate_
),
alphaName_
(
ptf
.
alphaName_
)
fixedValueFvPatchField
<
vector
>
(
p
,
iF
,
dict
),
flowRate_
(
Function1
<
scalar
>::
New
(
"flowRate"
,
dict
)
),
alphaName_
(
dict
.
lookup
(
"alpha"
)
)
{}
Foam
::
variableHeightFlowRateInletVelocityFvPatchVectorField
::
variableHeightFlowRateInletVelocityFvPatchVectorField
(
const
variableHeightFlowRateInletVelocityFvPatchVectorField
&
ptf
,
const
fvPatch
&
p
,
const
DimensionedField
<
vector
,
volMesh
>&
iF
,
const
dictionary
&
dict
const
fvPatchFieldMapper
&
mapper
)
:
fixedValueFvPatchField
<
vector
>
(
p
,
iF
,
dict
),
flowRate_
(
readScalar
(
dict
.
lookup
(
"flowRate"
))
),
alphaName_
(
dict
.
lookup
(
"alpha"
)
)
fixedValueFvPatchField
<
vector
>
(
ptf
,
p
,
iF
,
mapper
),
flowRate_
(
ptf
.
flowRate_
,
false
),
alphaName_
(
ptf
.
alphaName_
)
{}
...
...
@@ -80,7 +78,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField
<
vector
>
(
ptf
),
flowRate_
(
ptf
.
flowRate_
),
flowRate_
(
ptf
.
flowRate_
,
false
),
alphaName_
(
ptf
.
alphaName_
)
{}
...
...
@@ -93,7 +91,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField
<
vector
>
(
ptf
,
iF
),
flowRate_
(
ptf
.
flowRate_
),
flowRate_
(
ptf
.
flowRate_
,
false
),
alphaName_
(
ptf
.
alphaName_
)
{}
...
...
@@ -114,8 +112,11 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
alphap
=
max
(
alphap
,
scalar
(
0
));
alphap
=
min
(
alphap
,
scalar
(
1
));
const
scalar
t
=
db
().
time
().
timeOutputValue
();
scalar
flowRate
=
flowRate_
->
value
(
t
);
// a simpler way of doing this would be nice
scalar
avgU
=
-
flowRate
_
/
gSum
(
patch
().
magSf
()
*
alphap
);
scalar
avgU
=
-
flowRate
/
gSum
(
patch
().
magSf
()
*
alphap
);
vectorField
n
(
patch
().
nf
());
...
...
@@ -131,11 +132,8 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField::write
)
const
{
fvPatchField
<
vector
>::
write
(
os
);
os
.
writeKeyword
(
"flowRate"
)
<<
flowRate_
<<
token
::
END_STATEMENT
<<
nl
;
os
.
writeKeyword
(
"alpha"
)
<<
alphaName_
<<
token
::
END_STATEMENT
<<
nl
;
flowRate_
->
writeData
(
os
);
os
.
writeKeyword
(
"alpha"
)
<<
alphaName_
<<
token
::
END_STATEMENT
<<
nl
;
writeEntry
(
"value"
,
os
);
}
...
...
src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.H
View file @
3b3bb717
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
6
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -53,6 +53,8 @@ Description
}
\endverbatim
The \c flowRate entry is a \c Function1 of time, see Foam::Function1Types.
Note
- the value is positive into the domain
- may not work correctly for transonic inlets
...
...
@@ -61,6 +63,7 @@ Note
SeeAlso
Foam::fixedValueFvPatchField
Foam::Function1Types
SourceFiles
variableHeightFlowRateInletVelocityFvPatchVectorField.C
...
...
@@ -71,6 +74,7 @@ SourceFiles
#define variableHeightFlowRateInletVelocityFvPatchVectorField_H
#include
"fixedValueFvPatchFields.H"
#include
"Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -87,7 +91,7 @@ class variableHeightFlowRateInletVelocityFvPatchVectorField
// Private data
//- Inlet integral flow rate
scalar
flowRate_
;
autoPtr
<
Function1
<
scalar
>>
flowRate_
;
//- Name of the phase-fraction field
word
alphaName_
;
...
...
@@ -168,21 +172,6 @@ public:
// Member functions
// Access
//- Return the flux
scalar
flowRate
()
const
{
return
flowRate_
;
}
//- Return reference to the flux to allow adjustment
scalar
&
flowRate
()
{
return
flowRate_
;
}
//- Update the coefficients associated with the patch field
virtual
void
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