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
5126a6a4
Commit
5126a6a4
authored
Nov 29, 2013
by
andy
Browse files
ENH: Function object updates
parent
d24bc269
Changes
20
Hide whitespace changes
Inline
Side-by-side
src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C
View file @
5126a6a4
...
...
@@ -335,7 +335,6 @@ void Foam::fieldAverage::write()
{
if
(
active_
)
{
calcAverages
();
writeAverages
();
writeAveragingProperties
();
...
...
src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C
View file @
5126a6a4
...
...
@@ -96,7 +96,20 @@ void Foam::fieldCoordinateSystemTransform::read(const dictionary& dict)
void
Foam
::
fieldCoordinateSystemTransform
::
execute
()
{
// Do nothing
if
(
active_
)
{
Info
<<
type
()
<<
" "
<<
name_
<<
" output:"
<<
nl
;
forAll
(
fieldSet_
,
fieldI
)
{
// If necessary load field
transform
<
scalar
>
(
fieldSet_
[
fieldI
]);
transform
<
vector
>
(
fieldSet_
[
fieldI
]);
transform
<
sphericalTensor
>
(
fieldSet_
[
fieldI
]);
transform
<
symmTensor
>
(
fieldSet_
[
fieldI
]);
transform
<
tensor
>
(
fieldSet_
[
fieldI
]);
}
}
}
...
...
@@ -114,16 +127,23 @@ void Foam::fieldCoordinateSystemTransform::timeSet()
void
Foam
::
fieldCoordinateSystemTransform
::
write
()
{
Info
<<
type
()
<<
" "
<<
name_
<<
" output:"
<<
nl
;
forAll
(
fieldSet_
,
fieldI
)
if
(
active_
)
{
// If necessary load field
transform
<
scalar
>
(
fieldSet_
[
fieldI
]);
transform
<
vector
>
(
fieldSet_
[
fieldI
]);
transform
<
sphericalTensor
>
(
fieldSet_
[
fieldI
]);
transform
<
symmTensor
>
(
fieldSet_
[
fieldI
]);
transform
<
tensor
>
(
fieldSet_
[
fieldI
]);
Info
<<
type
()
<<
" "
<<
name_
<<
" output:"
<<
nl
;
forAll
(
fieldSet_
,
fieldI
)
{
const
word
fieldName
=
fieldSet_
[
fieldI
]
+
":Transformed"
;
const
regIOobject
&
field
=
obr_
.
lookupObject
<
regIOobject
>
(
fieldName
);
Info
<<
" writing field "
<<
field
.
name
()
<<
nl
;
field
.
write
();
}
Info
<<
endl
;
}
}
...
...
src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C
View file @
5126a6a4
...
...
@@ -37,7 +37,7 @@ void Foam::fieldCoordinateSystemTransform::transformField
const
Type
&
field
)
const
{
const
word
&
fieldName
=
field
.
name
()
+
"Transformed"
;
const
word
&
fieldName
=
field
.
name
()
+
"
:
Transformed"
;
if
(
!
obr_
.
foundObject
<
Type
>
(
fieldName
))
{
...
...
src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C
View file @
5126a6a4
...
...
@@ -328,32 +328,8 @@ void Foam::nearWallFields::execute()
{
Info
<<
"nearWallFields:execute()"
<<
endl
;
}
}
void
Foam
::
nearWallFields
::
end
()
{
if
(
debug
)
{
Info
<<
"nearWallFields:end()"
<<
endl
;
}
}
void
Foam
::
nearWallFields
::
timeSet
()
{
// Do nothing
}
void
Foam
::
nearWallFields
::
write
()
{
if
(
debug
)
{
Info
<<
"nearWallFields:write()"
<<
endl
;
}
// Do nothing
if
(
active_
)
{
if
...
...
@@ -380,7 +356,7 @@ void Foam::nearWallFields::write()
Info
<<
type
()
<<
" "
<<
name_
<<
" output:"
<<
nl
;
Info
<<
"
Writing sampled
fields to "
<<
obr_
.
time
().
timeName
()
Info
<<
"
Sampling fields
fields to "
<<
obr_
.
time
().
timeName
()
<<
endl
;
sampleFields
(
vsf_
);
...
...
@@ -388,8 +364,37 @@ void Foam::nearWallFields::write()
sampleFields
(
vSpheretf_
);
sampleFields
(
vSymmtf_
);
sampleFields
(
vtf_
);
}
}
void
Foam
::
nearWallFields
::
end
()
{
if
(
debug
)
{
Info
<<
"nearWallFields:end()"
<<
endl
;
}
}
void
Foam
::
nearWallFields
::
timeSet
()
{
// Do nothing
}
void
Foam
::
nearWallFields
::
write
()
{
if
(
debug
)
{
Info
<<
"nearWallFields:write()"
<<
endl
;
}
if
(
active_
)
{
Info
<<
" Writing sampled fields to "
<<
obr_
.
time
().
timeName
()
<<
endl
;
// Write fields
forAll
(
vsf_
,
i
)
{
vsf_
[
i
].
write
();
...
...
src/postProcessing/functionObjects/field/processorField/processorField.C
View file @
5126a6a4
...
...
@@ -53,6 +53,27 @@ Foam::processorField::processorField
if
(
isA
<
fvMesh
>
(
obr_
))
{
read
(
dict
);
const
fvMesh
&
mesh
=
refCast
<
const
fvMesh
>
(
obr_
);
volScalarField
*
procFieldPtr
(
new
volScalarField
(
IOobject
(
"processorID"
,
mesh
.
time
().
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh
,
dimensionedScalar
(
"0"
,
dimless
,
0
.
0
)
)
);
mesh
.
objectRegistry
::
store
(
procFieldPtr
);
}
else
{
...
...
@@ -88,7 +109,14 @@ void Foam::processorField::read(const dictionary& dict)
void
Foam
::
processorField
::
execute
()
{
// Do nothing
if
(
active_
)
{
const
volScalarField
&
procField
=
obr_
.
lookupObject
<
volScalarField
>
(
"processorID"
);
const_cast
<
volScalarField
&>
(
procField
)
==
dimensionedScalar
(
"procI"
,
dimless
,
Pstream
::
myProcNo
());
}
}
...
...
@@ -108,20 +136,8 @@ void Foam::processorField::write()
{
if
(
active_
)
{
const
fvMesh
&
mesh
=
refCast
<
const
fvMesh
>
(
obr_
);
volScalarField
procField
(
IOobject
(
"processorID"
,
mesh
.
time
().
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh
,
dimensionedScalar
(
"procI"
,
dimless
,
Pstream
::
myProcNo
())
);
const
volScalarField
&
procField
=
obr_
.
lookupObject
<
volScalarField
>
(
"processorID"
);
procField
.
write
();
}
...
...
src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C
View file @
5126a6a4
...
...
@@ -125,25 +125,42 @@ void Foam::calcFvcDiv::read(const dictionary& dict)
{
dict
.
lookup
(
"fieldName"
)
>>
fieldName_
;
dict
.
lookup
(
"resultName"
)
>>
resultName_
;
if
(
resultName_
==
"none"
)
{
resultName_
=
"fvc::div("
+
fieldName_
+
")"
;
}
}
}
void
Foam
::
calcFvcDiv
::
execute
()
{
// Do nothing - only valid on write
if
(
active_
)
{
bool
processed
=
false
;
calcDiv
<
surfaceScalarField
>
(
fieldName_
,
resultName_
,
processed
);
calcDiv
<
volVectorField
>
(
fieldName_
,
resultName_
,
processed
);
if
(
!
processed
)
{
WarningIn
(
"void Foam::calcFvcDiv::write()"
)
<<
"Unprocessed field "
<<
fieldName_
<<
endl
;
}
}
}
void
Foam
::
calcFvcDiv
::
end
()
{
// Do nothing
- only valid on write
// Do nothing
}
void
Foam
::
calcFvcDiv
::
timeSet
()
{
// Do nothing
- only valid on write
// Do nothing
}
...
...
@@ -151,15 +168,15 @@ void Foam::calcFvcDiv::write()
{
if
(
active_
)
{
bool
processed
=
false
;
if
(
obr_
.
foundObject
<
regIOobject
>
(
resultName_
))
{
const
regIOobject
&
field
=
obr_
.
lookupObject
<
regIOobject
>
(
resultName_
);
calcDiv
<
surfaceScalarField
>
(
fieldName_
,
resultName_
,
processed
);
calcDiv
<
volVectorField
>
(
field
N
ame
_
,
resultName_
,
processed
)
;
Info
<<
type
()
<<
" "
<<
name_
<<
" output:"
<<
nl
<<
" writing field "
<<
field
.
n
ame
()
<<
nl
<<
endl
;
if
(
!
processed
)
{
WarningIn
(
"void Foam::calcFvcDiv::write()"
)
<<
"Unprocessed field "
<<
fieldName_
<<
endl
;
field
.
write
();
}
}
}
...
...
src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C
View file @
5126a6a4
...
...
@@ -38,25 +38,14 @@ void Foam::calcFvcDiv::calcDiv
{
const
fvMesh
&
mesh
=
refCast
<
const
fvMesh
>
(
obr_
);
word
divName
=
resultName
;
if
(
divName
==
"none"
)
{
divName
=
"fvc::div("
+
fieldName
+
")"
;
}
if
(
mesh
.
foundObject
<
FieldType
>
(
fieldName
))
{
const
FieldType
&
vf
=
mesh
.
lookupObject
<
FieldType
>
(
fieldName
);
volScalarField
&
field
=
divField
(
div
Name
,
vf
.
dimensions
());
volScalarField
&
field
=
divField
(
result
Name
,
vf
.
dimensions
());
field
=
fvc
::
div
(
vf
);
Info
<<
type
()
<<
" "
<<
name_
<<
" output:"
<<
nl
<<
" writing field "
<<
field
.
name
()
<<
nl
<<
endl
;
field
.
write
();
processed
=
true
;
}
}
...
...
src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C
View file @
5126a6a4
...
...
@@ -87,25 +87,42 @@ void Foam::calcFvcGrad::read(const dictionary& dict)
{
dict
.
lookup
(
"fieldName"
)
>>
fieldName_
;
dict
.
lookup
(
"resultName"
)
>>
resultName_
;
if
(
resultName_
==
"none"
)
{
resultName_
=
"fvc::grad("
+
fieldName_
+
")"
;
}
}
}
void
Foam
::
calcFvcGrad
::
execute
()
{
// Do nothing - only valid on write
if
(
active_
)
{
bool
processed
=
false
;
calcGrad
<
scalar
>
(
fieldName_
,
resultName_
,
processed
);
calcGrad
<
vector
>
(
fieldName_
,
resultName_
,
processed
);
if
(
!
processed
)
{
WarningIn
(
"void Foam::calcFvcGrad::write()"
)
<<
"Unprocessed field "
<<
fieldName_
<<
endl
;
}
}
}
void
Foam
::
calcFvcGrad
::
end
()
{
// Do nothing
- only valid on write
// Do nothing
}
void
Foam
::
calcFvcGrad
::
timeSet
()
{
// Do nothing
- only valid on write
// Do nothing
}
...
...
@@ -113,15 +130,15 @@ void Foam::calcFvcGrad::write()
{
if
(
active_
)
{
bool
processed
=
false
;
if
(
obr_
.
foundObject
<
regIOobject
>
(
resultName_
))
{
const
regIOobject
&
field
=
obr_
.
lookupObject
<
regIOobject
>
(
resultName_
);
calcGrad
<
scalar
>
(
fieldName_
,
resultName_
,
processed
);
calcGrad
<
vector
>
(
field
N
ame
_
,
resultName_
,
processed
)
;
Info
<<
type
()
<<
" "
<<
name_
<<
" output:"
<<
nl
<<
" writing field "
<<
field
.
n
ame
()
<<
nl
<<
endl
;
if
(
!
processed
)
{
WarningIn
(
"void Foam::calcFvcGrad::write()"
)
<<
"Unprocessed field "
<<
fieldName_
<<
endl
;
field
.
write
();
}
}
}
...
...
src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C
View file @
5126a6a4
...
...
@@ -91,40 +91,25 @@ void Foam::calcFvcGrad::calcGrad
const
fvMesh
&
mesh
=
refCast
<
const
fvMesh
>
(
obr_
);
word
gradName
=
resultName
;
if
(
gradName
==
"none"
)
{
gradName
=
"fvc::grad("
+
fieldName
+
")"
;
}
if
(
mesh
.
foundObject
<
vfType
>
(
fieldName
))
{
const
vfType
&
vf
=
mesh
.
lookupObject
<
vfType
>
(
fieldName
);
vfGradType
&
field
=
gradField
<
Type
>
(
grad
Name
,
vf
.
dimensions
());
vfGradType
&
field
=
gradField
<
Type
>
(
result
Name
,
vf
.
dimensions
());
field
=
fvc
::
grad
(
vf
);
Info
<<
type
()
<<
" output:"
<<
nl
<<
" writing "
<<
field
.
name
()
<<
" field"
<<
nl
<<
endl
;
field
.
write
();
processed
=
true
;
}
else
if
(
mesh
.
foundObject
<
sfType
>
(
fieldName
))
{
const
sfType
&
sf
=
mesh
.
lookupObject
<
sfType
>
(
fieldName
);
vfGradType
&
field
=
gradField
<
Type
>
(
grad
Name
,
sf
.
dimensions
());
vfGradType
&
field
=
gradField
<
Type
>
(
result
Name
,
sf
.
dimensions
());
field
=
fvc
::
grad
(
sf
);
Info
<<
type
()
<<
" "
<<
name_
<<
" output:"
<<
nl
<<
" writing field "
<<
field
.
name
()
<<
nl
<<
endl
;
field
.
write
();
processed
=
true
;
}
}
...
...
src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C
View file @
5126a6a4
...
...
@@ -87,25 +87,45 @@ void Foam::calcMag::read(const dictionary& dict)
{
dict
.
lookup
(
"fieldName"
)
>>
fieldName_
;
dict
.
lookup
(
"resultName"
)
>>
resultName_
;
if
(
resultName_
==
"none"
)
{
resultName_
=
"mag("
+
fieldName_
+
")"
;
}
}
}
void
Foam
::
calcMag
::
execute
()
{
// Do nothing - only valid on write
if
(
active_
)
{
bool
processed
=
false
;
calc
<
scalar
>
(
fieldName_
,
resultName_
,
processed
);
calc
<
vector
>
(
fieldName_
,
resultName_
,
processed
);
calc
<
sphericalTensor
>
(
fieldName_
,
resultName_
,
processed
);
calc
<
symmTensor
>
(
fieldName_
,
resultName_
,
processed
);
calc
<
tensor
>
(
fieldName_
,
resultName_
,
processed
);
if
(
!
processed
)
{
WarningIn
(
"void Foam::calcMag::write()"
)
<<
"Unprocessed field "
<<
fieldName_
<<
endl
;
}
}
}
void
Foam
::
calcMag
::
end
()
{
// Do nothing
- only valid on write
// Do nothing
}
void
Foam
::
calcMag
::
timeSet
()
{
// Do nothing
- only valid on write
// Do nothing
}
...
...
@@ -113,18 +133,15 @@ void Foam::calcMag::write()
{
if
(
active_
)
{
bool
processed
=
false
;
if
(
obr_
.
foundObject
<
regIOobject
>
(
resultName_
))
{
const
regIOobject
&
field
=
obr_
.
lookupObject
<
regIOobject
>
(
resultName_
);
calc
<
scalar
>
(
fieldName_
,
resultName_
,
processed
);
calc
<
vector
>
(
fieldName_
,
resultName_
,
processed
);
calc
<
sphericalTensor
>
(
fieldName_
,
resultName_
,
processed
);
calc
<
symmTensor
>
(
fieldName_
,
resultName_
,
processed
);
calc
<
tensor
>
(
fieldName_
,
resultName_
,
processed
);
Info
<<
type
()
<<
" "
<<
name_
<<
" output:"
<<
nl
<<
" writing field "
<<
field
.
name
()
<<
nl
<<
endl
;
if
(
!
processed
)
{
WarningIn
(
"void Foam::calcMag::write()"
)
<<
"Unprocessed field "
<<
fieldName_
<<
endl
;
field
.
write
();
}
}
}
...
...
src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C
View file @
5126a6a4
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -80,26 +80,15 @@ void Foam::calcMag::calc
const
fvMesh
&
mesh
=
refCast
<
const
fvMesh
>
(
obr_
);
word
magName
=
resultName
;
if
(
magName
==
"none"
)
{
magName
=
"mag("
+
fieldName
+
")"
;
}
if
(
mesh
.
foundObject
<
vfType
>
(
fieldName
))
{
const
vfType
&
vf
=
mesh
.
lookupObject
<
vfType
>
(
fieldName
);
volScalarField
&
field
=
magField
<
volScalarField
>
(
mag
Name
,
vf
.
dimensions
());
magField
<
volScalarField
>
(
result
Name
_
,
vf
.
dimensions
());
field
=
mag
(
vf
);
Info
<<
type
()
<<
" output:"
<<
nl
<<
" writing "
<<
field
.
name
()
<<
" field"
<<
nl
<<
endl
;
field
.
write
();
processed
=
true
;
}
else
if
(
mesh
.
foundObject
<
sfType
>
(
fieldName
))
...
...
@@ -107,15 +96,10 @@ void Foam::calcMag::calc
const
sfType
&
sf
=
mesh
.
lookupObject
<
sfType
>
(
fieldName
);
surfaceScalarField
&
field
=
magField
<
surfaceScalarField
>
(
mag
Name
,
sf
.
dimensions
());
magField
<
surfaceScalarField
>
(
result
Name
_
,
sf
.
dimensions
());
field
=
mag
(
sf
);
Info
<<
type
()
<<
" output:"
<<
nl
<<
" writing "
<<
field
.
name
()
<<
" field"
<<
nl
<<
endl
;
field
.
write
();
processed
=
true
;
}
}
...
...
src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C
View file @
5126a6a4
...
...
@@ -154,24 +154,6 @@ void Foam::CourantNo::read(const dictionary& dict)
void
Foam
::
CourantNo
::
execute
()
{
// Do nothing - only valid on write
}
void
Foam
::
CourantNo
::
end
()
{
// Do nothing - only valid on write
}
void
Foam
::
CourantNo
::
timeSet
()
{
// Do nothing - only valid on write
}
void
Foam
::
CourantNo
::
write
()
{
if
(
active_
)