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
546159a8
Commit
546159a8
authored
May 21, 2016
by
Henry Weller
Browse files
functionObjects: Simplified and reorganised using the fieldExpression base-class
parent
3009367a
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/postProcessing/functionObjects/
utilities
/CourantNo/CourantNo.C
→
src/postProcessing/functionObjects/
field
/CourantNo/CourantNo.C
View file @
546159a8
...
...
@@ -111,8 +111,8 @@ Foam::functionObjects::CourantNo::~CourantNo()
bool
Foam
::
functionObjects
::
CourantNo
::
read
(
const
dictionary
&
dict
)
{
phiName_
=
dict
.
lookupOrDefault
<
word
>
(
"phi
Name
"
,
"phi"
);
rhoName_
=
dict
.
lookupOrDefault
<
word
>
(
"rho
Name
"
,
"rho"
);
phiName_
=
dict
.
lookupOrDefault
<
word
>
(
"phi"
,
"phi"
);
rhoName_
=
dict
.
lookupOrDefault
<
word
>
(
"rho"
,
"rho"
);
return
true
;
}
...
...
src/postProcessing/functionObjects/
utilities
/CourantNo/CourantNo.H
→
src/postProcessing/functionObjects/
field
/CourantNo/CourantNo.H
View file @
546159a8
File moved
src/postProcessing/functionObjects/
utilities
/Lambda2/Lambda2.C
→
src/postProcessing/functionObjects/
field
/Lambda2/Lambda2.C
View file @
546159a8
...
...
@@ -91,7 +91,7 @@ Foam::functionObjects::Lambda2::~Lambda2()
bool
Foam
::
functionObjects
::
Lambda2
::
read
(
const
dictionary
&
dict
)
{
UName_
=
dict
.
lookupOrDefault
<
word
>
(
"U
Name
"
,
"U"
);
UName_
=
dict
.
lookupOrDefault
<
word
>
(
"U"
,
"U"
);
return
true
;
}
...
...
src/postProcessing/functionObjects/
utilities
/Lambda2/Lambda2.H
→
src/postProcessing/functionObjects/
field
/Lambda2/Lambda2.H
View file @
546159a8
File moved
src/postProcessing/functionObjects/field/Make/files
View file @
546159a8
...
...
@@ -36,5 +36,9 @@ fieldExpression/fieldExpression.C
div/div.C
grad/grad.C
mag/mag.C
vorticity/vorticity.C
Q/Q.C
Lambda2/Lambda2.C
CourantNo/CourantNo.C
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
src/postProcessing/functionObjects/
utilities
/Q/Q.C
→
src/postProcessing/functionObjects/
field
/Q/Q.C
View file @
546159a8
...
...
@@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include
"Q.H"
#include
"volFields.H"
#include
"fvcGrad.H"
#include
"addToRunTimeSelectionTable.H"
...
...
@@ -55,29 +54,8 @@ Foam::functionObjects::Q::Q
const
dictionary
&
dict
)
:
fvMeshFunctionObject
(
name
,
runTime
,
dict
)
{
read
(
dict
);
volScalarField
*
QPtr
(
new
volScalarField
(
IOobject
(
type
(),
mesh_
.
time
().
timeName
(),
mesh_
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh_
,
dimensionedScalar
(
"0"
,
dimless
/
sqr
(
dimTime
),
0
.
0
)
)
);
mesh_
.
objectRegistry
::
store
(
QPtr
);
}
fieldExpression
(
name
,
runTime
,
dict
,
"U"
,
"Q"
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
...
...
@@ -88,45 +66,24 @@ Foam::functionObjects::Q::~Q()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool
Foam
::
functionObjects
::
Q
::
read
(
const
dictionary
&
dict
)
{
UName_
=
dict
.
lookupOrDefault
<
word
>
(
"UName"
,
"U"
);
return
true
;
}
bool
Foam
::
functionObjects
::
Q
::
execute
(
const
bool
postProcess
)
{
const
volVectorField
&
U
=
mesh_
.
lookupObject
<
volVectorField
>
(
UName_
);
const
volTensorField
gradU
(
fvc
::
grad
(
U
));
if
(
foundField
<
volVectorField
>
(
fieldName_
))
{
const
volVectorField
&
U
=
lookupField
<
volVectorField
>
(
fieldName_
);
const
tmp
<
volTensorField
>
tgradU
(
fvc
::
grad
(
U
));
const
volTensorField
&
gradU
=
tgradU
();
volScalarField
&
Q
=
const_cast
<
volScalarField
&>
return
store
(
mesh_
.
lookupObject
<
volScalarField
>
(
type
())
resultName_
,
0
.
5
*
(
sqr
(
tr
(
gradU
))
-
tr
(((
gradU
)
&
(
gradU
))))
);
Q
=
0
.
5
*
(
sqr
(
tr
(
gradU
))
-
tr
(((
gradU
)
&
(
gradU
))));
return
true
;
}
bool
Foam
::
functionObjects
::
Q
::
write
(
const
bool
postProcess
)
{
const
volScalarField
&
Q
=
mesh_
.
lookupObject
<
volScalarField
>
(
type
());
Info
<<
type
()
<<
" "
<<
name
()
<<
" output:"
<<
nl
<<
" writing field "
<<
Q
.
name
()
<<
nl
<<
endl
;
Q
.
write
();
return
true
;
}
else
{
return
false
;
}
}
...
...
src/postProcessing/functionObjects/
utilities
/Q/Q.H
→
src/postProcessing/functionObjects/
field
/Q/Q.H
View file @
546159a8
...
...
@@ -36,6 +36,7 @@ Description
\f]
SeeAlso
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
SourceFiles
...
...
@@ -46,8 +47,7 @@ SourceFiles
#ifndef functionObjects_Q_H
#define functionObjects_Q_H
#include
"fvMeshFunctionObject.H"
#include
"volFieldsFwd.H"
#include
"fieldExpression.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -62,22 +62,8 @@ namespace functionObjects
class
Q
:
public
f
vMeshFunctionObject
public
f
ieldExpression
{
// Private data
//- Name of velocity field, default is "U"
word
UName_
;
// Private Member Functions
//- Disallow default bitwise copy construct
Q
(
const
Q
&
);
//- Disallow default bitwise assignment
void
operator
=
(
const
Q
&
);
public:
...
...
@@ -102,14 +88,8 @@ public:
// Member Functions
//- Read the Q data
virtual
bool
read
(
const
dictionary
&
);
//- Calculate the Q-field
virtual
bool
execute
(
const
bool
postProcess
=
false
);
//- Write the Q-field
virtual
bool
write
(
const
bool
postProcess
=
false
);
};
...
...
src/postProcessing/functionObjects/field/div/div.H
View file @
546159a8
...
...
@@ -33,6 +33,7 @@ Description
volScalarField.
SeeAlso
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
SourceFiles
...
...
src/postProcessing/functionObjects/field/fieldExpression/fieldExpression.C
View file @
546159a8
...
...
@@ -42,10 +42,14 @@ Foam::functionObjects::fieldExpression::fieldExpression
(
const
word
&
name
,
const
Time
&
runTime
,
const
dictionary
&
dict
const
dictionary
&
dict
,
const
word
&
fieldName
,
const
word
&
resultName
)
:
fvMeshFunctionObject
(
name
,
runTime
,
dict
)
fvMeshFunctionObject
(
name
,
runTime
,
dict
),
fieldName_
(
fieldName
),
resultName_
(
resultName
)
{
read
(
dict
);
}
...
...
@@ -61,7 +65,10 @@ Foam::functionObjects::fieldExpression::~fieldExpression()
bool
Foam
::
functionObjects
::
fieldExpression
::
read
(
const
dictionary
&
dict
)
{
dict
.
lookup
(
"field"
)
>>
fieldName_
;
if
(
fieldName_
==
word
::
null
||
dict
.
found
(
"field"
))
{
dict
.
lookup
(
"field"
)
>>
fieldName_
;
}
if
(
dict
.
found
(
"result"
))
{
...
...
src/postProcessing/functionObjects/field/fieldExpression/fieldExpression.H
View file @
546159a8
...
...
@@ -93,7 +93,9 @@ public:
(
const
word
&
name
,
const
Time
&
runTime
,
const
dictionary
&
dict
const
dictionary
&
dict
,
const
word
&
fieldName
=
word
::
null
,
const
word
&
resultName
=
word
::
null
);
...
...
src/postProcessing/functionObjects/
utilities
/vorticity/vorticity.C
→
src/postProcessing/functionObjects/
field
/vorticity/vorticity.C
View file @
546159a8
...
...
@@ -91,7 +91,7 @@ Foam::functionObjects::vorticity::~vorticity()
bool
Foam
::
functionObjects
::
vorticity
::
read
(
const
dictionary
&
dict
)
{
UName_
=
dict
.
lookupOrDefault
<
word
>
(
"U
Name
"
,
"U"
);
UName_
=
dict
.
lookupOrDefault
<
word
>
(
"U"
,
"U"
);
if
(
UName_
!=
"U"
)
{
outputName_
=
typeName
+
"("
+
UName_
+
")"
;
...
...
src/postProcessing/functionObjects/
utilities
/vorticity/vorticity.H
→
src/postProcessing/functionObjects/
field
/vorticity/vorticity.H
View file @
546159a8
File moved
src/postProcessing/functionObjects/utilities/Make/files
View file @
546159a8
codedFunctionObject/codedFunctionObject.C
CourantNo/CourantNo.C
Lambda2/Lambda2.C
Peclet/Peclet.C
Q/Q.C
blendingFactor/blendingFactor.C
dsmcFields/dsmcFields.C
residuals/residuals.C
scalarTransport/scalarTransport.C
timeActivatedFileUpdate/timeActivatedFileUpdate.C
turbulenceFields/turbulenceFields.C
vorticity/vorticity.C
yPlus/yPlus.C
setTimeStep/setTimeStepFunctionObject.C
systemCall/systemCall.C
abort/abort.C
...
...
@@ -18,4 +8,12 @@ removeRegisteredObject/removeRegisteredObject.C
writeDictionary/writeDictionary.C
writeRegisteredObject/writeRegisteredObject.C
scalarTransport/scalarTransport.C
blendingFactor/blendingFactor.C
dsmcFields/dsmcFields.C
turbulenceFields/turbulenceFields.C
Peclet/Peclet.C
yPlus/yPlus.C
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
src/postProcessing/functionObjects/utilities/Peclet/Peclet.C
View file @
546159a8
...
...
@@ -94,8 +94,8 @@ Foam::functionObjects::Peclet::~Peclet()
bool
Foam
::
functionObjects
::
Peclet
::
read
(
const
dictionary
&
dict
)
{
phiName_
=
dict
.
lookupOrDefault
<
word
>
(
"phi
Name
"
,
"phi"
);
rhoName_
=
dict
.
lookupOrDefault
<
word
>
(
"rho
Name
"
,
"rho"
);
phiName_
=
dict
.
lookupOrDefault
<
word
>
(
"phi"
,
"phi"
);
rhoName_
=
dict
.
lookupOrDefault
<
word
>
(
"rho"
,
"rho"
);
return
true
;
}
...
...
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