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
3c44f08d
Commit
3c44f08d
authored
May 22, 2016
by
Henry Weller
Browse files
functionObjects::blendingFactor: simplified, standardized, rationalized
parent
15773bf1
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/postProcessing/functionObjects/field/Make/files
View file @
3c44f08d
...
...
@@ -41,5 +41,6 @@ Q/Q.C
Lambda2/Lambda2.C
CourantNo/CourantNo.C
PecletNo/PecletNo.C
blendingFactor/blendingFactor.C
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
src/postProcessing/functionObjects/
utilities
/blendingFactor/blendingFactor.C
→
src/postProcessing/functionObjects/
field
/blendingFactor/blendingFactor.C
View file @
3c44f08d
...
...
@@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "blendingFactor.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
...
...
@@ -48,7 +47,7 @@ Foam::functionObjects::blendingFactor::blendingFactor
const
dictionary
&
dict
)
:
f
vMeshFunctionObject
(
name
,
runTime
,
dict
)
f
ieldExpression
(
name
,
runTime
,
dict
)
{
read
(
dict
);
}
...
...
@@ -64,36 +63,30 @@ Foam::functionObjects::blendingFactor::~blendingFactor()
bool
Foam
::
functionObjects
::
blendingFactor
::
read
(
const
dictionary
&
dict
)
{
phiName_
=
dict
.
lookupOrDefault
<
word
>
(
"phi"
,
"phi"
);
dict
.
lookup
(
"field"
)
>>
fieldName_
;
return
true
;
}
fieldExpression
::
read
(
dict
);
phiName_
=
dict
.
lookupOrDefault
<
word
>
(
"phi"
,
"phi"
);
bool
Foam
::
functionObjects
::
blendingFactor
::
execute
(
const
bool
postProcess
)
{
calc
<
scalar
>
();
calc
<
vector
>
();
resultName_
=
"blendingFactor:"
+
fieldName_
;
return
true
;
}
bool
Foam
::
functionObjects
::
blendingFactor
::
wri
te
(
const
bool
postProcess
)
bool
Foam
::
functionObjects
::
blendingFactor
::
execu
te
(
const
bool
postProcess
)
{
const
word
fieldName
=
"blendingFactor:"
+
fieldName_
;
bool
processed
=
false
;
const
volScalarField
&
blendingFactor
=
obr_
.
lookupObject
<
volScalarField
>
(
fieldName
);
processed
=
processed
||
calc
<
scalar
>
();
processed
=
processed
||
calc
<
vector
>
(
);
Info
<<
type
()
<<
" "
<<
name
()
<<
" output:"
<<
nl
<<
" writing field "
<<
blendingFactor
.
name
()
<<
nl
<<
endl
;
if
(
!
processed
)
{
WarningInFunction
<<
"Unprocessed field "
<<
fieldName_
<<
endl
;
}
blendingFactor
.
write
();
return
true
;
return
processed
;
}
...
...
src/postProcessing/functionObjects/
utilities
/blendingFactor/blendingFactor.H
→
src/postProcessing/functionObjects/
field
/blendingFactor/blendingFactor.H
View file @
3c44f08d
...
...
@@ -33,6 +33,7 @@ Description
value is calculated via the maximum blending factor for any cell face.
SeeAlso
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
SourceFiles
...
...
@@ -43,17 +44,12 @@ SourceFiles
#ifndef functionObjects_blendingFactor_H
#define functionObjects_blendingFactor_H
#include "fvMeshFunctionObject.H"
#include "volFieldsFwd.H"
#include "fieldExpression.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
// Forward declaration of classes
class
objectRegistry
;
namespace
functionObjects
{
...
...
@@ -63,35 +59,19 @@ namespace functionObjects
class
blendingFactor
:
public
f
vMeshFunctionObject
public
f
ieldExpression
{
// Private data
//- Name of flux field, default is "phi"
word
phiName_
;
//- Field name
word
fieldName_
;
// Private Member Functions
//- Disallow default bitwise copy construct
blendingFactor
(
const
blendingFactor
&
);
//- Disallow default bitwise assignment
void
operator
=
(
const
blendingFactor
&
);
//- Return the blending factor field from the database
template
<
class
Type
>
volScalarField
&
factor
(
const
GeometricField
<
Type
,
fvPatchField
,
volMesh
>&
field
);
//- Calculate the blending factor
template
<
class
Type
>
void
calc
();
bool
calc
();
public:
...
...
@@ -122,9 +102,6 @@ public:
//- Calculate the blending-factor
virtual
bool
execute
(
const
bool
postProcess
=
false
);
//- Write the blending-factor
virtual
bool
write
(
const
bool
postProcess
=
false
);
};
...
...
src/postProcessing/functionObjects/
utilities
/blendingFactor/blendingFactorTemplates.C
→
src/postProcessing/functionObjects/
field
/blendingFactor/blendingFactorTemplates.C
View file @
3c44f08d
...
...
@@ -26,64 +26,25 @@ License
#include "gaussConvectionScheme.H"
#include "blendedSchemeBase.H"
#include "fvcCellReduce.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
<
class
Type
>
Foam
::
volScalarField
&
Foam
::
functionObjects
::
blendingFactor
::
factor
(
const
GeometricField
<
Type
,
fvPatchField
,
volMesh
>&
field
)
bool
Foam
::
functionObjects
::
blendingFactor
::
calc
()
{
const
word
fieldName
=
"blendingFactor:"
+
field
.
name
()
;
typedef
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
FieldType
;
if
(
!
mesh_
.
foundObject
<
volScalar
Field
>
(
fieldName
))
if
(
!
foundField
<
Field
Type
>
(
fieldName
_
))
{
volScalarField
*
factorPtr
=
new
volScalarField
(
IOobject
(
fieldName
,
mesh_
.
time
().
timeName
(),
mesh_
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh_
,
dimensionedScalar
(
"0"
,
dimless
,
0
.
0
),
zeroGradientFvPatchScalarField
::
typeName
);
obr_
.
store
(
factorPtr
);
return
false
;
}
return
const_cast
<
volScalarField
&>
(
mesh_
.
lookupObject
<
volScalarField
>
(
fieldName
)
);
}
template
<
class
Type
>
void
Foam
::
functionObjects
::
blendingFactor
::
calc
()
{
typedef
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
fieldType
;
if
(
!
mesh_
.
foundObject
<
fieldType
>
(
fieldName_
))
{
return
;
}
const
fieldType
&
field
=
mesh_
.
lookupObject
<
fieldType
>
(
fieldName_
);
const
FieldType
&
field
=
lookupField
<
FieldType
>
(
fieldName_
);
const
word
divScheme
(
"div("
+
phiName_
+
','
+
fieldName_
+
')'
);
ITstream
&
its
=
mesh_
.
divScheme
(
divScheme
);
const
surfaceScalarField
&
phi
=
mesh_
.
lookupObject
<
surfaceScalarField
>
(
phiName_
);
const
surfaceScalarField
&
phi
=
lookupField
<
surfaceScalarField
>
(
phiName_
);
tmp
<
fv
::
convectionScheme
<
Type
>>
cs
=
fv
::
convectionScheme
<
Type
>::
New
(
mesh_
,
phi
,
its
);
...
...
@@ -101,15 +62,17 @@ void Foam::functionObjects::blendingFactor::calc()
<<
exit
(
FatalError
);
}
//
r
etrieve the face-based blending factor
//
R
etrieve the face-based blending factor
const
blendedSchemeBase
<
Type
>&
blendedScheme
=
refCast
<
const
blendedSchemeBase
<
Type
>>
(
interpScheme
);
const
surfaceScalarField
factorf
(
blendedScheme
.
blendingFactor
(
field
));
// convert into vol field whose values represent the local face maxima
volScalarField
&
factor
=
this
->
factor
(
field
);
factor
=
fvc
::
cellReduce
(
factorf
,
maxEqOp
<
scalar
>
());
factor
.
correctBoundaryConditions
();
tmp
<
surfaceScalarField
>
factorf
(
blendedScheme
.
blendingFactor
(
field
));
// Convert into vol field whose values represent the local face maxima
return
store
(
resultName_
,
fvc
::
cellReduce
(
factorf
,
maxEqOp
<
scalar
>
())
);
}
...
...
src/postProcessing/functionObjects/utilities/Make/files
View file @
3c44f08d
...
...
@@ -9,7 +9,6 @@ writeDictionary/writeDictionary.C
writeRegisteredObject/writeRegisteredObject.C
scalarTransport/scalarTransport.C
blendingFactor/blendingFactor.C
dsmcFields/dsmcFields.C
turbulenceFields/turbulenceFields.C
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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