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
dcdc9e68
Commit
dcdc9e68
authored
Feb 22, 2019
by
Mark OLESEN
Committed by
Andrew Heather
Feb 22, 2019
Browse files
STYLE: improved layout and bool vs Switch for some CloudFunctionObjects
- add output verbosity in debug mode
parent
8760f6c9
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C
View file @
dcdc9e68
...
...
@@ -201,6 +201,11 @@ void Foam::FacePostProcessing<CloudType>::write()
.
subOrEmptyDict
(
surfaceFormat_
)
);
if
(
debug
)
{
writer
->
verbose
()
=
true
;
}
writer
->
open
(
allPoints
,
...
...
@@ -212,8 +217,6 @@ void Foam::FacePostProcessing<CloudType>::write()
writer
->
write
(
"massTotal"
,
zoneMassTotal
[
zoneI
]);
writer
->
write
(
"massFlowRate"
,
zoneMassFlowRate
[
zoneI
]);
writer
->
clear
();
}
}
}
...
...
@@ -251,12 +254,12 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
CloudFunctionObject
<
CloudType
>
(
dict
,
owner
,
modelName
,
typeName
),
faceZoneIDs_
(),
surfaceFormat_
(
this
->
coeffDict
().
lookup
(
"surfaceFormat"
)),
resetOnWrite_
(
this
->
coeffDict
().
lookup
(
"resetOnWrite"
)),
resetOnWrite_
(
this
->
coeffDict
().
getBool
(
"resetOnWrite"
)),
log_
(
this
->
coeffDict
().
getBool
(
"log"
)),
totalTime_
(
0
.
0
),
mass_
(),
massTotal_
(),
massFlowRate_
(),
log_
(
this
->
coeffDict
().
lookup
(
"log"
)),
outputFilePtr_
(),
timeOld_
(
owner
.
mesh
().
time
().
value
())
{
...
...
@@ -333,11 +336,11 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
faceZoneIDs_
(
pff
.
faceZoneIDs_
),
surfaceFormat_
(
pff
.
surfaceFormat_
),
resetOnWrite_
(
pff
.
resetOnWrite_
),
log_
(
pff
.
log_
),
totalTime_
(
pff
.
totalTime_
),
mass_
(
pff
.
mass_
),
massTotal_
(
pff
.
massTotal_
),
massFlowRate_
(
pff
.
massFlowRate_
),
log_
(
pff
.
log_
),
outputFilePtr_
(),
timeOld_
(
0
.
0
)
{}
...
...
src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H
View file @
dcdc9e68
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
...
...
@@ -61,13 +61,11 @@ class FacePostProcessing
:
public
CloudFunctionObject
<
CloudType
>
{
// Private Data
// Typedefs
//- Convenience typedef for parcel type
typedef
typename
CloudType
::
parcelType
parcelType
;
//- Convenience typedef for parcel type
typedef
typename
CloudType
::
parcelType
parcelType
;
// Private Data
//- Face zone IDs
labelList
faceZoneIDs_
;
...
...
@@ -75,8 +73,11 @@ class FacePostProcessing
//- Surface output format
const
word
surfaceFormat_
;
//- Flag to indicate whether data should be reset/cleared on writing
Switch
resetOnWrite_
;
//- Should be reset/cleared on writing?
bool
resetOnWrite_
;
//- Flag to indicate whether data should be written to file
bool
log_
;
//- Total time
scalar
totalTime_
;
...
...
@@ -90,9 +91,6 @@ class FacePostProcessing
//- Mass flow rate storage
List
<
scalarField
>
massFlowRate_
;
//- Flag to indicate whether data should be written to file
Switch
log_
;
//- Output file pointer per zone
PtrList
<
OFstream
>
outputFilePtr_
;
...
...
@@ -155,16 +153,16 @@ public:
// Member Functions
// Access
// Access
//- Return const access to th
e reset on write
flag
inline
const
Switch
&
resetOnWrite
()
const
;
//- Should data b
e reset on write
?
inline
bool
resetOnWrite
()
const
;
// Evaluation
// Evaluation
//- Post-face hook
virtual
void
postFace
(
const
parcelType
&
p
,
bool
&
keepParticle
);
//- Post-face hook
virtual
void
postFace
(
const
parcelType
&
p
,
bool
&
keepParticle
);
};
...
...
src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessingI.H
View file @
dcdc9e68
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011 OpenFOAM Foundation
...
...
@@ -26,8 +26,7 @@ License
\*---------------------------------------------------------------------------*/
template
<
class
CloudType
>
inline
const
Foam
::
Switch
&
Foam
::
FacePostProcessing
<
CloudType
>::
resetOnWrite
()
const
inline
bool
Foam
::
FacePostProcessing
<
CloudType
>::
resetOnWrite
()
const
{
return
resetOnWrite_
;
}
...
...
src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C
View file @
dcdc9e68
...
...
@@ -471,6 +471,11 @@ void Foam::ParticleCollector<CloudType>::write()
.
subOrEmptyDict
(
surfaceFormat_
)
);
if
(
debug
)
{
writer
->
verbose
()
=
true
;
}
writer
->
open
(
points_
,
...
...
@@ -522,7 +527,9 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
CloudFunctionObject
<
CloudType
>
(
dict
,
owner
,
modelName
,
typeName
),
mode_
(
mtUnknown
),
parcelType_
(
this
->
coeffDict
().
lookupOrDefault
(
"parcelType"
,
-
1
)),
removeCollected_
(
this
->
coeffDict
().
lookup
(
"removeCollected"
)),
removeCollected_
(
this
->
coeffDict
().
getBool
(
"removeCollected"
)),
resetOnWrite_
(
this
->
coeffDict
().
getBool
(
"resetOnWrite"
)),
log_
(
this
->
coeffDict
().
getBool
(
"log"
)),
points_
(),
faces_
(),
faceTris_
(),
...
...
@@ -535,12 +542,10 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
this
->
coeffDict
().
getBool
(
"negateParcelsOppositeNormal"
)
),
surfaceFormat_
(
this
->
coeffDict
().
lookup
(
"surfaceFormat"
)),
resetOnWrite_
(
this
->
coeffDict
().
lookup
(
"resetOnWrite"
)),
totalTime_
(
0
.
0
),
mass_
(),
massTotal_
(),
massFlowRate_
(),
log_
(
this
->
coeffDict
().
lookup
(
"log"
)),
outputFilePtr_
(),
timeOld_
(
owner
.
mesh
().
time
().
value
()),
hitFaceIDs_
()
...
...
@@ -608,6 +613,8 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
mode_
(
pc
.
mode_
),
parcelType_
(
pc
.
parcelType_
),
removeCollected_
(
pc
.
removeCollected_
),
resetOnWrite_
(
pc
.
resetOnWrite_
),
log_
(
pc
.
log_
),
points_
(
pc
.
points_
),
faces_
(
pc
.
faces_
),
faceTris_
(
pc
.
faceTris_
),
...
...
@@ -618,12 +625,10 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
normal_
(
pc
.
normal_
),
negateParcelsOppositeNormal_
(
pc
.
negateParcelsOppositeNormal_
),
surfaceFormat_
(
pc
.
surfaceFormat_
),
resetOnWrite_
(
pc
.
resetOnWrite_
),
totalTime_
(
pc
.
totalTime_
),
mass_
(
pc
.
mass_
),
massTotal_
(
pc
.
massTotal_
),
massFlowRate_
(
pc
.
massFlowRate_
),
log_
(
pc
.
log_
),
outputFilePtr_
(),
timeOld_
(
0
.
0
),
hitFaceIDs_
()
...
...
src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H
View file @
dcdc9e68
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2017 OpenFOAM Foundation
...
...
@@ -97,7 +97,6 @@ SourceFiles
#include
"CloudFunctionObject.H"
#include
"cylindricalCS.H"
#include
"face.H"
#include
"Switch.H"
#include
"OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -126,12 +125,10 @@ public:
private:
// Private Data
// Typedefs
//- Convenience typedef for parcel type
typedef
typename
CloudType
::
parcelType
parcelType
;
//- Convenience typedef for parcel type
typedef
typename
CloudType
::
parcelType
parcelType
;
// Private Data
//- Collector mode type
modeType
mode_
;
...
...
@@ -140,7 +137,13 @@ private:
const
label
parcelType_
;
//- Flag to remove collected particles
Switch
removeCollected_
;
bool
removeCollected_
;
//- Should data be reset/cleared on writing?
bool
resetOnWrite_
;
//- Flag to indicate whether data should be written to file
bool
log_
;
//- List of points
Field
<
point
>
points_
;
...
...
@@ -178,9 +181,6 @@ private:
//- Surface output format
const
word
surfaceFormat_
;
//- Flag to indicate whether data should be reset/cleared on writing
Switch
resetOnWrite_
;
//- Total time
scalar
totalTime_
;
...
...
@@ -193,9 +193,6 @@ private:
//- Mass flow rate storage
List
<
scalar
>
massFlowRate_
;
//- Flag to indicate whether data should be written to file
Switch
log_
;
//- Output file pointer
autoPtr
<
OFstream
>
outputFilePtr_
;
...
...
@@ -280,22 +277,22 @@ public:
// Member Functions
// Access
// Access
//- Return const access to th
e reset on write
flag
inline
const
Switch
&
resetOnWrite
()
const
;
//- Should data b
e reset on write
?
inline
bool
resetOnWrite
()
const
;
// Evaluation
// Evaluation
//- Post-move hook
virtual
void
postMove
(
parcelType
&
p
,
const
scalar
dt
,
const
point
&
position0
,
bool
&
keepParticle
);
//- Post-move hook
virtual
void
postMove
(
parcelType
&
p
,
const
scalar
dt
,
const
point
&
position0
,
bool
&
keepParticle
);
};
...
...
src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H
View file @
dcdc9e68
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012 OpenFOAM Foundation
...
...
@@ -26,8 +26,7 @@ License
\*---------------------------------------------------------------------------*/
template
<
class
CloudType
>
inline
const
Foam
::
Switch
&
Foam
::
ParticleCollector
<
CloudType
>::
resetOnWrite
()
const
inline
bool
Foam
::
ParticleCollector
<
CloudType
>::
resetOnWrite
()
const
{
return
resetOnWrite_
;
}
...
...
src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C
View file @
dcdc9e68
...
...
@@ -64,7 +64,7 @@ Foam::ParticleTracks<CloudType>::ParticleTracks
CloudFunctionObject
<
CloudType
>
(
dict
,
owner
,
modelName
,
typeName
),
trackInterval_
(
this
->
coeffDict
().
getLabel
(
"trackInterval"
)),
maxSamples_
(
this
->
coeffDict
().
getLabel
(
"maxSamples"
)),
resetOnWrite_
(
this
->
coeffDict
().
lookup
(
"resetOnWrite"
)),
resetOnWrite_
(
this
->
coeffDict
().
getBool
(
"resetOnWrite"
)),
faceHitCounter_
(),
cloudPtr_
(
nullptr
)
{}
...
...
src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H
View file @
dcdc9e68
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
...
...
@@ -57,13 +57,11 @@ class ParticleTracks
:
public
CloudFunctionObject
<
CloudType
>
{
// Private data
//- Convenience typedef for parcel type
typedef
typename
CloudType
::
parcelType
parcelType
;
// Typedefs
//- Convenience typedef for parcel type
typedef
typename
CloudType
::
parcelType
parcelType
;
// Private Data
//- Number of face-hit intervals between storing parcel data
label
trackInterval_
;
...
...
@@ -71,8 +69,8 @@ class ParticleTracks
//- Maximum number of particles to store per track
label
maxSamples_
;
//-
Flag to indicate whether
data should be reset/cleared on writing
Switch
resetOnWrite_
;
//-
Should
data should be reset/cleared on writing
?
bool
resetOnWrite_
;
//- Table of number of times a particle has hit a face
labelPairLookup
faceHitCounter_
;
...
...
@@ -83,7 +81,7 @@ class ParticleTracks
protected:
// Protected
m
ember
f
unctions
// Protected
M
ember
F
unctions
//- Write post-processing info
void
write
();
...
...
@@ -124,31 +122,31 @@ public:
// Member Functions
// Access
// Access
//- Return const access to the track interval
inline
label
trackInterval
()
const
;
//- Return const access to the track interval
inline
label
trackInterval
()
const
;
//- Return const access to the max samples
inline
label
maxSamples
()
const
;
//- Return const access to the max samples
inline
label
maxSamples
()
const
;
//- Return const access to th
e reset on write
flag
inline
const
Switch
&
resetOnWrite
()
const
;
//- Should data b
e reset on write
?
inline
bool
resetOnWrite
()
const
;
//- Return the table of number of times a particle has hit a face
inline
const
labelPairLookup
&
faceHitCounter
()
const
;
//- Return the table of number of times a particle has hit a face
inline
const
labelPairLookup
&
faceHitCounter
()
const
;
//- Return const access to the cloud
inline
const
Cloud
<
parcelType
>&
cloud
()
const
;
//- Return const access to the cloud
inline
const
Cloud
<
parcelType
>&
cloud
()
const
;
// Evaluation
// Evaluation
//- Pre-evolve hook
virtual
void
preEvolve
();
//- Pre-evolve hook
virtual
void
preEvolve
();
//- Post-face hook
virtual
void
postFace
(
const
parcelType
&
p
,
bool
&
keepParticle
);
//- Post-face hook
virtual
void
postFace
(
const
parcelType
&
p
,
bool
&
keepParticle
);
};
...
...
src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracksI.H
View file @
dcdc9e68
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011 OpenFOAM Foundation
...
...
@@ -44,7 +44,7 @@ inline Foam::label Foam::ParticleTracks<CloudType>::maxSamples() const
template
<
class
CloudType
>
inline
const
Foam
::
Switch
&
Foam
::
ParticleTracks
<
CloudType
>::
resetOnWrite
()
const
inline
bool
Foam
::
ParticleTracks
<
CloudType
>::
resetOnWrite
()
const
{
return
resetOnWrite_
;
}
...
...
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