Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
openfoam
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
352
Issues
352
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Development
openfoam
Commits
f51cac3a
Commit
f51cac3a
authored
Jun 25, 2020
by
mattijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: SemiImplicitSource: allow Function1 for Su,Sp. Fixes
#1750
.
parent
7b714253
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
30 deletions
+68
-30
src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.C
...s/sources/general/semiImplicitSource/SemiImplicitSource.C
+40
-7
src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H
...s/sources/general/semiImplicitSource/SemiImplicitSource.H
+28
-7
src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSourceI.H
.../sources/general/semiImplicitSource/SemiImplicitSourceI.H
+0
-16
No files found.
src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.C
View file @
f51cac3a
...
...
@@ -30,6 +30,7 @@ License
#include "fvMesh.H"
#include "fvMatrices.H"
#include "fvmSup.H"
#include "Constant.H"
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
...
...
@@ -53,14 +54,46 @@ void Foam::fv::SemiImplicitSource<Type>::setFieldData(const dictionary& dict)
label
count
=
dict
.
size
();
fieldNames_
.
resize
(
count
);
injectionRate_
.
resize
(
count
);
Su_
.
resize
(
count
);
Sp_
.
resize
(
count
);
applied_
.
resize
(
count
,
false
);
count
=
0
;
for
(
const
entry
&
dEntry
:
dict
)
{
fieldNames_
[
count
]
=
dEntry
.
keyword
();
dEntry
.
readEntry
(
injectionRate_
[
count
]);
if
(
!
dEntry
.
isDict
())
{
Tuple2
<
Type
,
scalar
>
injectionRate
;
dEntry
.
readEntry
(
injectionRate
);
Su_
.
set
(
count
,
new
Function1Types
::
Constant
<
Type
>
(
"Su"
,
injectionRate
.
first
()
)
);
Sp_
.
set
(
count
,
new
Function1Types
::
Constant
<
scalar
>
(
"Sp"
,
injectionRate
.
second
()
)
);
}
else
{
const
dictionary
&
Sdict
=
dEntry
.
dict
();
Su_
.
set
(
count
,
Function1
<
Type
>::
New
(
"Su"
,
Sdict
));
Sp_
.
set
(
count
,
Function1
<
scalar
>::
New
(
"Sp"
,
Sdict
));
}
++
count
;
}
...
...
@@ -86,8 +119,7 @@ Foam::fv::SemiImplicitSource<Type>::SemiImplicitSource
:
cellSetOption
(
name
,
modelType
,
dict
,
mesh
),
volumeMode_
(
vmAbsolute
),
VDash_
(
1
.
0
),
injectionRate_
()
VDash_
(
1
.
0
)
{
read
(
dict
);
}
...
...
@@ -125,7 +157,9 @@ void Foam::fv::SemiImplicitSource<Type>::addSup
false
);
UIndirectList
<
Type
>
(
Su
,
cells_
)
=
injectionRate_
[
fieldi
].
first
()
/
VDash_
;
const
scalar
tmVal
=
mesh_
.
time
().
timeOutputValue
();
UIndirectList
<
Type
>
(
Su
,
cells_
)
=
Su_
[
fieldi
].
value
(
tmVal
)
/
VDash_
;
volScalarField
::
Internal
Sp
(
...
...
@@ -142,7 +176,7 @@ void Foam::fv::SemiImplicitSource<Type>::addSup
false
);
UIndirectList
<
scalar
>
(
Sp
,
cells_
)
=
injectionRate_
[
fieldi
].
second
(
)
/
VDash_
;
UIndirectList
<
scalar
>
(
Sp
,
cells_
)
=
Sp_
[
fieldi
].
value
(
tmVal
)
/
VDash_
;
eqn
+=
Su
+
fvm
::
SuSp
(
Sp
,
psi
);
}
...
...
@@ -166,7 +200,6 @@ void Foam::fv::SemiImplicitSource<Type>::addSup
}
template
<
class
Type
>
bool
Foam
::
fv
::
SemiImplicitSource
<
Type
>::
read
(
const
dictionary
&
dict
)
{
...
...
src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H
View file @
f51cac3a
...
...
@@ -60,6 +60,31 @@ Description
- absolute: values are given as \<quantity\>
- specific: values are given as \<quantity\>/m3
The injectionRate can also be specified as a Function1 by having
dictionaries for the field entries instead:
\verbatim
injectionRateSuSp
{
k
{
// Time-ramp from 0 to 30.7 at time 5
Su table
(
(0 0.0)
(5 30.7)
);
Sp 0.0;
}
epsilon
{
Su 1.5;
Sp 0.0;
}
}
\endverbatim
See also
Foam::fvOption
...
...
@@ -74,6 +99,7 @@ SourceFiles
#include "Tuple2.H"
#include "cellSetOption.H"
#include "Enum.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -128,7 +154,8 @@ protected:
scalar
VDash_
;
//- Source field values
List
<
Tuple2
<
Type
,
scalar
>>
injectionRate_
;
PtrList
<
Function1
<
Type
>>
Su_
;
PtrList
<
Function1
<
scalar
>>
Sp_
;
// Protected functions
...
...
@@ -162,18 +189,12 @@ public:
//- Return const access to the volume mode
inline
const
volumeModeType
&
volumeMode
()
const
;
//- Return const access to the source field values
inline
const
List
<
Tuple2
<
Type
,
scalar
>>&
injectionRate
()
const
;
// Edit
//- Return access to the volume mode
inline
volumeModeType
&
volumeMode
();
//- Return access to the source field values
inline
List
<
Tuple2
<
Type
,
scalar
>>&
injectionRate
();
// Evaluation
...
...
src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSourceI.H
View file @
f51cac3a
...
...
@@ -37,14 +37,6 @@ Foam::fv::SemiImplicitSource<Type>::volumeMode() const
}
template
<
class
Type
>
inline
const
Foam
::
List
<
Foam
::
Tuple2
<
Type
,
Foam
::
scalar
>>&
Foam
::
fv
::
SemiImplicitSource
<
Type
>::
injectionRate
()
const
{
return
injectionRate_
;
}
template
<
class
Type
>
inline
typename
Foam
::
fv
::
SemiImplicitSource
<
Type
>::
volumeModeType
&
Foam
::
fv
::
SemiImplicitSource
<
Type
>::
volumeMode
()
...
...
@@ -53,12 +45,4 @@ Foam::fv::SemiImplicitSource<Type>::volumeMode()
}
template
<
class
Type
>
inline
Foam
::
List
<
Foam
::
Tuple2
<
Type
,
Foam
::
scalar
>>&
Foam
::
fv
::
SemiImplicitSource
<
Type
>::
injectionRate
()
{
return
injectionRate_
;
}
// ************************************************************************* //
Write
Preview
Markdown
is supported
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