Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
4bc3b2b9
Commit
4bc3b2b9
authored
Feb 12, 2019
by
Mark Olesen
Committed by
Andrew Heather
Feb 12, 2019
Browse files
STYLE: minor adjustments for code formatting and comments
parent
d1bc0d6e
Changes
20
Hide whitespace changes
Inline
Side-by-side
src/functionObjects/field/fieldAverage/fieldAverage.C
View file @
4bc3b2b9
...
...
@@ -269,12 +269,12 @@ Foam::functionObjects::fieldAverage::fieldAverage
:
fvMeshFunctionObject
(
name
,
runTime
,
dict
),
prevTimeIndex_
(
-
1
),
initialised_
(
false
),
restartOnRestart_
(
false
),
restartOnOutput_
(
false
),
periodicRestart_
(
false
),
restartPeriod_
(
GREAT
),
restartTime_
(
GREAT
),
initialised_
(
false
),
faItems_
(),
periodIndex_
(
1
)
{
...
...
@@ -282,12 +282,6 @@ Foam::functionObjects::fieldAverage::fieldAverage
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
fieldAverage
::~
fieldAverage
()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool
Foam
::
functionObjects
::
fieldAverage
::
read
(
const
dictionary
&
dict
)
...
...
src/functionObjects/field/fieldAverage/fieldAverage.H
View file @
4bc3b2b9
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-201
6
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-201
9
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
...
...
@@ -161,6 +161,9 @@ protected:
//- Time at last call, prevents repeated averaging
label
prevTimeIndex_
;
//- Initialised flag
bool
initialised_
;
//- Restart the averaging process on restart
Switch
restartOnRestart_
;
...
...
@@ -176,9 +179,6 @@ protected:
//- Specific restart time
scalar
restartTime_
;
//- Initialised flag
bool
initialised_
;
//- List of field average items, describing what averages to be
// calculated and output
List
<
fieldAverageItem
>
faItems_
;
...
...
@@ -301,7 +301,7 @@ public:
//- Destructor
virtual
~
fieldAverage
();
virtual
~
fieldAverage
()
=
default
;
// Member Functions
...
...
src/functionObjects/field/fieldAverage/fieldAverageTemplates.C
View file @
4bc3b2b9
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-201
7
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-201
9
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
...
...
@@ -77,9 +77,11 @@ void Foam::functionObjects::fieldAverage::addMeanFieldType
meanFieldName
,
obr
().
time
().
timeName
(
obr
().
time
().
startTime
().
value
()),
obr
(),
restartOnOutput_
?
IOobject
::
NO_READ
:
IOobject
::
READ_IF_PRESENT
,
(
restartOnOutput_
?
IOobject
::
NO_READ
:
IOobject
::
READ_IF_PRESENT
),
IOobject
::
NO_WRITE
),
1
*
baseField
...
...
src/functionObjects/field/fieldExpression/fieldExpression.C
View file @
4bc3b2b9
...
...
@@ -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) 2016 OpenFOAM Foundation
...
...
@@ -85,12 +85,6 @@ Foam::functionObjects::fieldExpression::fieldExpression
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
fieldExpression
::~
fieldExpression
()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool
Foam
::
functionObjects
::
fieldExpression
::
read
(
const
dictionary
&
dict
)
...
...
@@ -102,10 +96,7 @@ bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
dict
.
readEntry
(
"field"
,
fieldName_
);
}
if
(
dict
.
found
(
"result"
))
{
dict
.
readEntry
(
"result"
,
resultName_
);
}
dict
.
readIfPresent
(
"result"
,
resultName_
);
return
true
;
}
...
...
@@ -124,10 +115,8 @@ bool Foam::functionObjects::fieldExpression::execute()
return
false
;
}
else
{
return
true
;
}
return
true
;
}
...
...
src/functionObjects/field/fieldExpression/fieldExpression.H
View file @
4bc3b2b9
...
...
@@ -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-2016 OpenFOAM Foundation
...
...
@@ -63,7 +63,7 @@ class fieldExpression
{
protected:
// Protected
m
ember
d
ata
// Protected
M
ember
D
ata
//- Name of field to process
word
fieldName_
;
...
...
@@ -72,7 +72,7 @@ protected:
word
resultName_
;
// Protected
m
ember
f
unctions
// Protected
M
ember
F
unctions
virtual
bool
calc
()
=
0
;
...
...
@@ -81,11 +81,6 @@ protected:
template
<
class
Type
>
bool
foundObject
(
const
word
&
name
,
const
bool
verbose
=
true
)
const
;
private:
// Private Member Functions
//- No copy construct
fieldExpression
(
const
fieldExpression
&
)
=
delete
;
...
...
@@ -113,13 +108,13 @@ public:
//- Destructor
virtual
~
fieldExpression
();
virtual
~
fieldExpression
()
=
default
;
// Member Functions
//- Read the fieldExpression data
virtual
bool
read
(
const
dictionary
&
);
virtual
bool
read
(
const
dictionary
&
dict
);
//- Calculate the result field
virtual
bool
execute
();
...
...
src/functionObjects/field/fieldExpression/fieldExpressionTemplates.C
View file @
4bc3b2b9
...
...
@@ -40,18 +40,16 @@ bool Foam::functionObjects::fieldExpression::foundObject
{
return
true
;
}
else
if
(
debug
||
verbose
)
{
if
(
debug
||
verbose
)
{
Warning
<<
" functionObjects::"
<<
type
()
<<
" "
<<
this
->
name
()
<<
" cannot find required object "
<<
name
<<
" of type "
<<
Type
::
typeName
<<
endl
;
}
return
false
;
Warning
<<
" functionObjects::"
<<
type
()
<<
" "
<<
this
->
name
()
<<
" cannot find required object "
<<
name
<<
" of type "
<<
Type
::
typeName
<<
endl
;
}
return
false
;
}
...
...
src/functionObjects/field/fieldsExpression/fieldsExpression.C
View file @
4bc3b2b9
...
...
@@ -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) 2016 OpenFOAM Foundation
...
...
@@ -57,7 +57,7 @@ void Foam::functionObjects::fieldsExpression::setResultName
if
(
!
fieldNames_
.
empty
())
{
resultName_
=
typeName
+
'('
+
fieldNames_
[
0
];
for
(
label
i
=
1
;
i
<
fieldNames_
.
size
();
i
++
)
for
(
label
i
=
1
;
i
<
fieldNames_
.
size
();
++
i
)
{
resultName_
+=
','
+
fieldNames_
[
i
];
}
...
...
@@ -99,12 +99,6 @@ Foam::functionObjects::fieldsExpression::fieldsExpression
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
fieldsExpression
::~
fieldsExpression
()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool
Foam
::
functionObjects
::
fieldsExpression
::
read
(
const
dictionary
&
dict
)
...
...
@@ -116,10 +110,7 @@ bool Foam::functionObjects::fieldsExpression::read(const dictionary& dict)
dict
.
readEntry
(
"fields"
,
fieldNames_
);
}
if
(
dict
.
found
(
"result"
))
{
dict
.
readEntry
(
"result"
,
resultName_
);
}
dict
.
readIfPresent
(
"result"
,
resultName_
);
return
true
;
}
...
...
@@ -138,10 +129,8 @@ bool Foam::functionObjects::fieldsExpression::execute()
return
false
;
}
else
{
return
true
;
}
return
true
;
}
...
...
src/functionObjects/field/fieldsExpression/fieldsExpression.H
View file @
4bc3b2b9
...
...
@@ -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-2016 OpenFOAM Foundation
...
...
@@ -71,7 +71,7 @@ protected:
word
resultName_
;
// Protected
m
ember
f
unctions
// Protected
M
ember
F
unctions
void
setResultName
(
...
...
@@ -93,13 +93,9 @@ protected:
template
<
class
FOType
>
bool
calcAllTypes
(
FOType
&
fo
);
//- Calculate expression
virtual
bool
calc
()
=
0
;
private:
// Private Member Functions
//- No copy construct
fieldsExpression
(
const
fieldsExpression
&
)
=
delete
;
...
...
@@ -127,13 +123,13 @@ public:
//- Destructor
virtual
~
fieldsExpression
();
virtual
~
fieldsExpression
()
=
default
;
// Member Functions
//- Read the fieldsExpression data
virtual
bool
read
(
const
dictionary
&
);
virtual
bool
read
(
const
dictionary
&
dict
);
//- Calculate the result fields
virtual
bool
execute
();
...
...
src/functionObjects/field/fieldsExpression/fieldsExpressionTemplates.C
View file @
4bc3b2b9
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016
-2019
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
...
...
@@ -62,10 +62,8 @@ bool Foam::functionObjects::fieldsExpression::calcFieldTypes(FOType& fo)
fo
.
template
calcFieldType
<
SurfFieldType
>
()
);
}
else
{
return
false
;
}
return
false
;
}
...
...
src/functionObjects/field/fluxSummary/fluxSummary.C
View file @
4bc3b2b9
...
...
@@ -74,20 +74,7 @@ Foam::functionObjects::fluxSummary::modeTypeNames_
bool
Foam
::
functionObjects
::
fluxSummary
::
isSurfaceMode
()
const
{
bool
isSurf
=
false
;
switch
(
mode_
)
{
case
mdSurface
:
case
mdSurfaceAndDirection
:
isSurf
=
true
;
break
;
default:
break
;
}
return
isSurf
;
return
(
mdSurface
==
mode_
||
mdSurfaceAndDirection
==
mode_
);
}
...
...
@@ -99,8 +86,8 @@ Foam::word Foam::functionObjects::fluxSummary::checkFlowType
{
// Surfaces are multipled by their area, so account for that
// in the dimension checking
dimensionSet
dims
=
fieldDims
*
(
isSurfaceMode
()
?
dimTime
*
dimArea
:
dimTime
);
const
dimensionSet
dims
=
(
fieldDims
*
(
isSurfaceMode
()
?
dimTime
*
dimArea
:
dimTime
)
)
;
if
(
dims
==
dimVolume
)
{
...
...
@@ -110,16 +97,14 @@ Foam::word Foam::functionObjects::fluxSummary::checkFlowType
{
return
"mass"
;
}
else
{
FatalErrorInFunction
<<
"Unsupported flux field "
<<
fieldName
<<
" with dimensions "
<<
fieldDims
<<
". Expected either mass flow or volumetric flow rate."
<<
abort
(
FatalError
);
return
Foam
::
word
::
null
;
}
FatalErrorInFunction
<<
"Unsupported flux field "
<<
fieldName
<<
" with dimensions "
<<
fieldDims
<<
". Expected either mass flow or volumetric flow rate."
<<
abort
(
FatalError
);
return
word
::
null
;
}
...
...
@@ -143,8 +128,8 @@ void Foam::functionObjects::fluxSummary::initialiseSurface
}
names
.
append
(
surfName
);
directions
.
append
(
Zero
);
//
d
ummy value
faceFlip
.
append
(
boolList
());
//
n
o flip-map
directions
.
append
(
Zero
);
//
D
ummy value
faceFlip
.
append
(
boolList
());
//
N
o flip-map
}
...
...
@@ -168,19 +153,19 @@ void Foam::functionObjects::fluxSummary::initialiseSurfaceAndDirection
<<
exit
(
FatalError
);
}
const
surfMesh
&
s
=
*
surfptr
;
const
auto
&
s
=
*
surfptr
;
const
vector
refDir
=
dir
/
(
mag
(
dir
)
+
ROOTVSMALL
);
names
.
append
(
surfName
);
directions
.
append
(
refDir
);
faceFlip
.
append
(
boolList
(
0
));
faceFlip
.
append
(
boolList
());
// No flip-map
boolList
&
flips
=
faceFlip
[
faceFlip
.
size
()
-
1
];
flips
.
setSize
(
s
.
size
(),
false
);
forAll
(
s
,
i
)
{
//
o
rientation set by comparison with reference direction
//
O
rientation set by comparison with reference direction
const
vector
&
n
=
s
.
faceNormals
()[
i
];
if
((
n
&
refDir
)
>
tolerance_
)
...
...
src/functionObjects/field/fluxSummary/fluxSummary.H
View file @
4bc3b2b9
...
...
@@ -58,12 +58,12 @@ Usage
Where the entries comprise:
\table
Property
| Description | Required
| Default
value
type
|
t
ype name: fluxSummary
| yes
|
write
|
w
rite flux data to file
|
no | yes
log
|
w
rite flux data to standard output | no | yes
mode
|
m
ode to generate faces to test | yes |
scaleFactor
|
o
ptional factor to scale result | no | 1
Property | Description
| Required | Default
type |
T
ype name: fluxSummary
| yes
|
write |
W
rite flux data to file
|
no | yes
log |
W
rite flux data to standard output
| no
| yes
mode |
M
ode to generate faces to test
| yes |
scaleFactor |
O
ptional factor to scale result
| no
| 1
\endtable
The mode is one of:
...
...
@@ -97,6 +97,8 @@ SourceFiles
namespace
Foam
{
// Forward Declarations
class
dimensionSet
;
namespace
functionObjects
...
...
@@ -288,7 +290,7 @@ public:
// Member Functions
//- Read the field fluxSummary data
virtual
bool
read
(
const
dictionary
&
);
virtual
bool
read
(
const
dictionary
&
dict
);
//- Execute, currently does nothing
virtual
bool
execute
();
...
...
src/functionObjects/field/grad/grad.C
View file @
4bc3b2b9
...
...
@@ -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) 2013-2016 OpenFOAM Foundation
...
...
@@ -66,10 +66,4 @@ Foam::functionObjects::grad::grad
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
grad
::~
grad
()
{}
// ************************************************************************* //
src/functionObjects/field/grad/grad.H
View file @
4bc3b2b9
...
...
@@ -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-2016 OpenFOAM Foundation
...
...
@@ -91,7 +91,7 @@ public:
//- Destructor
virtual
~
grad
();
virtual
~
grad
()
=
default
;
};
...
...
src/functionObjects/field/grad/gradTemplates.C
View file @
4bc3b2b9
...
...
@@ -53,10 +53,8 @@ bool Foam::functionObjects::grad::calcGrad()
mesh_
.
changing
()
&&
mesh_
.
cache
(
resultName_
)
);
}
else
{
return
false
;
}
return
false
;
}
...
...
src/functionObjects/field/mag/mag.C
View file @
4bc3b2b9
...
...
@@ -69,10 +69,4 @@ Foam::functionObjects::mag::mag
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
mag
::~
mag
()
{}
// ************************************************************************* //
src/functionObjects/field/mag/mag.H
View file @
4bc3b2b9
...
...
@@ -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-2016 OpenFOAM Foundation
...
...
@@ -92,7 +92,7 @@ public:
//- Destructor
virtual
~
mag
();
virtual
~
mag
()
=
default
;
};
...
...
src/functionObjects/field/mag/magTemplates.C
View file @
4bc3b2b9
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016
-2019
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation
...
...
@@ -62,10 +62,8 @@ bool Foam::functionObjects::mag::calcMag()
Foam
::
mag
(
lookupObject
<
SurfFieldType
>
(
fieldName_
))
);
}
else
{
return
false
;
}
return
false
;
}
...
...
src/functionObjects/field/magSqr/magSqr.C
View file @
4bc3b2b9
...
...
@@ -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) 2016 OpenFOAM Foundation
...
...
@@ -69,10 +69,4 @@ Foam::functionObjects::magSqr::magSqr
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
magSqr
::~
magSqr
()
{}
// ************************************************************************* //
src/functionObjects/field/magSqr/magSqr.H
View file @
4bc3b2b9
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016
-2019
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
...
...
@@ -94,7 +94,7 @@ public:
//- Destructor
virtual
~
magSqr
();
virtual
~
magSqr
()
=
default
;
};
...
...
src/functionObjects/field/magSqr/magSqrTemplates.C
View file @
4bc3b2b9
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016
-2019
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
...
...
@@ -62,10 +62,8 @@ bool Foam::functionObjects::magSqr::calcMagSqr()
Foam
::
magSqr
(
lookupObject
<
SurfFieldType
>
(
fieldName_
))
);