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
801fb7bd
Commit
801fb7bd
authored
Mar 27, 2018
by
Andrew Heather
Browse files
ENH: streamLine/wallBoundedStreamLine - minor refactoring to enable new derived functionality
parent
ee2ca640
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/functionObjects/field/streamLine/streamLineBase.C
View file @
801fb7bd
...
...
@@ -141,11 +141,11 @@ void Foam::functionObjects::streamLineBase::initInterpolations
{
if
(
foundObject
<
volScalarField
>
(
fieldName
))
{
nScalar
++
;
++
nScalar
;
}
else
if
(
foundObject
<
volVectorField
>
(
fieldName
))
{
nVector
++
;
++
nVector
;
}
else
{
...
...
@@ -509,114 +509,8 @@ void Foam::functionObjects::streamLineBase::trimToBox(const treeBoundBox& bb)
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
streamLineBase
::
streamLineBase
(
const
word
&
name
,
const
Time
&
runTime
,
const
dictionary
&
dict
)
:
fvMeshFunctionObject
(
name
,
runTime
,
dict
),
dict_
(
dict
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
streamLineBase
::~
streamLineBase
()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool
Foam
::
functionObjects
::
streamLineBase
::
read
(
const
dictionary
&
dict
)
bool
Foam
::
functionObjects
::
streamLineBase
::
writeToFile
()
{
if
(
&
dict_
!=
&
dict
)
{
// Update local copy of dictionary:
dict_
=
dict
;
}
fvMeshFunctionObject
::
read
(
dict
);
Info
<<
type
()
<<
" "
<<
name
()
<<
":"
<<
nl
;
dict
.
lookup
(
"fields"
)
>>
fields_
;
UName_
=
dict
.
lookupOrDefault
<
word
>
(
"U"
,
"U"
);
Info
<<
" Employing velocity field "
<<
UName_
<<
endl
;
if
(
!
fields_
.
found
(
UName_
))
{
FatalIOErrorInFunction
(
dict
)
<<
"Velocity field for tracking "
<<
UName_
<<
" should be present in the list of fields "
<<
fields_
<<
exit
(
FatalIOError
);
}
dict
.
lookup
(
"trackForward"
)
>>
trackForward_
;
dict
.
lookup
(
"lifeTime"
)
>>
lifeTime_
;
if
(
lifeTime_
<
1
)
{
FatalErrorInFunction
<<
"Illegal value "
<<
lifeTime_
<<
" for lifeTime"
<<
exit
(
FatalError
);
}
trackLength_
=
VGREAT
;
if
(
dict
.
readIfPresent
(
"trackLength"
,
trackLength_
))
{
Info
<<
type
()
<<
" : fixed track length specified : "
<<
trackLength_
<<
nl
<<
endl
;
}
bounds_
=
boundBox
::
invertedBox
;
if
(
dict
.
readIfPresent
(
"bounds"
,
bounds_
)
&&
!
bounds_
.
empty
())
{
Info
<<
" clipping all segments to "
<<
bounds_
<<
nl
<<
endl
;
}
interpolationScheme_
=
dict
.
lookupOrDefault
(
"interpolationScheme"
,
interpolationCellPoint
<
scalar
>::
typeName
);
//Info<< " using interpolation " << interpolationScheme_ << endl;
cloudName_
=
dict
.
lookupOrDefault
<
word
>
(
"cloud"
,
type
());
sampledSetPtr_
.
clear
();
sampledSetAxis_
.
clear
();
scalarFormatterPtr_
=
writer
<
scalar
>::
New
(
dict
.
lookup
(
"setFormat"
));
vectorFormatterPtr_
=
writer
<
vector
>::
New
(
dict
.
lookup
(
"setFormat"
));
return
true
;
}
bool
Foam
::
functionObjects
::
streamLineBase
::
execute
()
{
return
true
;
}
bool
Foam
::
functionObjects
::
streamLineBase
::
write
()
{
Log
<<
type
()
<<
" "
<<
name
()
<<
" write:"
<<
nl
;
// Do all injection and tracking
track
();
if
(
Pstream
::
parRun
())
{
// Append slave tracks to master ones
...
...
@@ -897,6 +791,147 @@ bool Foam::functionObjects::streamLineBase::write()
}
void
Foam
::
functionObjects
::
streamLineBase
::
resetFieldNames
(
const
word
&
newUName
,
const
wordList
&
newFieldNames
)
{
UName_
=
newUName
;
fields_
=
newFieldNames
;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
streamLineBase
::
streamLineBase
(
const
word
&
name
,
const
Time
&
runTime
,
const
dictionary
&
dict
)
:
fvMeshFunctionObject
(
name
,
runTime
,
dict
),
dict_
(
dict
),
fields_
()
{}
Foam
::
functionObjects
::
streamLineBase
::
streamLineBase
(
const
word
&
name
,
const
Time
&
runTime
,
const
dictionary
&
dict
,
const
wordList
&
fieldNames
)
:
fvMeshFunctionObject
(
name
,
runTime
,
dict
),
dict_
(
dict
),
fields_
(
fieldNames
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
streamLineBase
::~
streamLineBase
()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool
Foam
::
functionObjects
::
streamLineBase
::
read
(
const
dictionary
&
dict
)
{
if
(
&
dict_
!=
&
dict
)
{
// Update local copy of dictionary:
dict_
=
dict
;
}
fvMeshFunctionObject
::
read
(
dict
);
Info
<<
type
()
<<
" "
<<
name
()
<<
":"
<<
nl
;
UName_
=
dict
.
lookupOrDefault
<
word
>
(
"U"
,
"U"
);
if
(
fields_
.
empty
())
{
dict
.
lookup
(
"fields"
)
>>
fields_
;
if
(
!
fields_
.
found
(
UName_
))
{
FatalIOErrorInFunction
(
dict
)
<<
"Velocity field for tracking "
<<
UName_
<<
" should be present in the list of fields "
<<
fields_
<<
exit
(
FatalIOError
);
}
}
Info
<<
" Employing velocity field "
<<
UName_
<<
endl
;
dict
.
lookup
(
"trackForward"
)
>>
trackForward_
;
dict
.
lookup
(
"lifeTime"
)
>>
lifeTime_
;
if
(
lifeTime_
<
1
)
{
FatalErrorInFunction
<<
"Illegal value "
<<
lifeTime_
<<
" for lifeTime"
<<
exit
(
FatalError
);
}
trackLength_
=
VGREAT
;
if
(
dict
.
readIfPresent
(
"trackLength"
,
trackLength_
))
{
Info
<<
type
()
<<
" : fixed track length specified : "
<<
trackLength_
<<
nl
<<
endl
;
}
bounds_
=
boundBox
::
invertedBox
;
if
(
dict
.
readIfPresent
(
"bounds"
,
bounds_
)
&&
!
bounds_
.
empty
())
{
Info
<<
" clipping all segments to "
<<
bounds_
<<
nl
<<
endl
;
}
interpolationScheme_
=
dict
.
lookupOrDefault
(
"interpolationScheme"
,
interpolationCellPoint
<
scalar
>::
typeName
);
//Info<< " using interpolation " << interpolationScheme_ << endl;
cloudName_
=
dict
.
lookupOrDefault
<
word
>
(
"cloud"
,
type
());
sampledSetPtr_
.
clear
();
sampledSetAxis_
.
clear
();
scalarFormatterPtr_
=
writer
<
scalar
>::
New
(
dict
.
lookup
(
"setFormat"
));
vectorFormatterPtr_
=
writer
<
vector
>::
New
(
dict
.
lookup
(
"setFormat"
));
return
true
;
}
bool
Foam
::
functionObjects
::
streamLineBase
::
execute
()
{
return
true
;
}
bool
Foam
::
functionObjects
::
streamLineBase
::
write
()
{
Log
<<
type
()
<<
" "
<<
name
()
<<
" write:"
<<
nl
;
// Do all injection and tracking
track
();
writeToFile
();
return
true
;
}
void
Foam
::
functionObjects
::
streamLineBase
::
updateMesh
(
const
mapPolyMesh
&
mpm
)
{
if
(
&
mpm
.
mesh
()
==
&
mesh_
)
...
...
src/functionObjects/field/streamLine/streamLineBase.H
View file @
801fb7bd
...
...
@@ -63,7 +63,7 @@ class streamLineBase
:
public
fvMeshFunctionObject
{
// Private data
protected:
//- Seed set engine
mutable
autoPtr
<
sampledSet
>
sampledSetPtr_
;
...
...
@@ -71,8 +71,6 @@ class streamLineBase
//- Axis of the sampled points to output
mutable
word
sampledSetAxis_
;
protected:
//- Input dictionary
dictionary
dict_
;
...
...
@@ -184,6 +182,16 @@ protected:
//- Do the actual tracking to fill the track data
virtual
void
track
()
=
0
;
//- Write tracks to file
virtual
bool
writeToFile
();
//- Reset the field names
virtual
void
resetFieldNames
(
const
word
&
newUName
,
const
wordList
&
newFieldNames
);
public:
...
...
@@ -202,6 +210,15 @@ public:
const
dictionary
&
dict
);
//- Construct from Time and dictionary and list of fields to sample
streamLineBase
(
const
word
&
name
,
const
Time
&
runTime
,
const
dictionary
&
dict
,
const
wordList
&
fieldNames
);
//- Destructor
virtual
~
streamLineBase
();
...
...
src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C
View file @
801fb7bd
...
...
@@ -236,6 +236,20 @@ Foam::functionObjects::wallBoundedStreamLine::wallBoundedStreamLine
}
Foam
::
functionObjects
::
wallBoundedStreamLine
::
wallBoundedStreamLine
(
const
word
&
name
,
const
Time
&
runTime
,
const
dictionary
&
dict
,
const
wordList
&
fieldNames
)
:
streamLineBase
(
name
,
runTime
,
dict
,
fieldNames
)
{
read
(
dict_
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
wallBoundedStreamLine
::~
wallBoundedStreamLine
()
...
...
src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.H
View file @
801fb7bd
...
...
@@ -125,6 +125,17 @@ class wallBoundedStreamLine
{
// Private Member Functions
//- Disallow default bitwise copy construct
wallBoundedStreamLine
(
const
wallBoundedStreamLine
&
)
=
delete
;
//- Disallow default bitwise assignment
void
operator
=
(
const
wallBoundedStreamLine
&
)
=
delete
;
protected:
// Protected Member Functions
//- Find wall tet on cell
tetIndices
findNearestTet
(
...
...
@@ -133,12 +144,6 @@ class wallBoundedStreamLine
const
label
celli
)
const
;
//- Disallow default bitwise copy construct
wallBoundedStreamLine
(
const
wallBoundedStreamLine
&
)
=
delete
;
//- Disallow default bitwise assignment
void
operator
=
(
const
wallBoundedStreamLine
&
)
=
delete
;
public:
...
...
@@ -156,6 +161,15 @@ public:
const
dictionary
&
dict
);
//- Construct from Time and dictionary and list of fields to sample
wallBoundedStreamLine
(
const
word
&
name
,
const
Time
&
runTime
,
const
dictionary
&
dict
,
const
wordList
&
fieldNames
);
//- Destructor
virtual
~
wallBoundedStreamLine
();
...
...
src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H
View file @
801fb7bd
...
...
@@ -121,12 +121,15 @@ public:
allScalars_
(
allScalars
),
allVectors_
(
allVectors
)
{}
virtual
~
trackingData
()
{}
};
pr
ivate
:
pr
otected
:
// Pr
ivate
data
// Pr
otected
data
//- Lifetime of particle. Particle dies when reaches 0.
label
lifeTime_
;
...
...
@@ -141,7 +144,7 @@ private:
List
<
DynamicList
<
vector
>>
sampledVectors_
;
// Pr
ivate
Member Functions
// Pr
otected
Member Functions
vector
interpolateFields
(
...
...
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