Skip to content
GitLab
Menu
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
b78e8b6e
Commit
b78e8b6e
authored
Mar 20, 2012
by
andy
Browse files
ENH: Created log output for yPlusRAS/LES function objects
parent
ce7a93a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C
View file @
b78e8b6e
...
...
@@ -39,12 +39,57 @@ defineTypeNameAndDebug(Foam::yPlusLES, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void
Foam
::
yPlusLES
::
makeFile
()
{
// Create the output file if not already created
if
(
outputFilePtr_
.
empty
())
{
if
(
debug
)
{
Info
<<
"Creating output file."
<<
endl
;
}
// File update
if
(
Pstream
::
master
())
{
fileName
outputDir
;
word
startTimeName
=
obr_
.
time
().
timeName
(
obr_
.
time
().
startTime
().
value
());
if
(
Pstream
::
parRun
())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir
=
obr_
.
time
().
path
()
/
".."
/
name_
/
startTimeName
;
}
else
{
outputDir
=
obr_
.
time
().
path
()
/
name_
/
startTimeName
;
}
// Create directory if does not exist
mkDir
(
outputDir
);
// Open new file at start up
outputFilePtr_
.
reset
(
new
OFstream
(
outputDir
/
(
type
()
+
".dat"
)));
// Add headers to output data
outputFilePtr_
()
<<
"# y+ (LES)"
<<
nl
<<
"# time "
<<
token
::
TAB
<<
"patch"
<<
token
::
TAB
<<
"min"
<<
token
::
TAB
<<
"max"
<<
token
::
TAB
<<
"average"
<<
endl
;
}
}
}
void
Foam
::
yPlusLES
::
calcIncompressibleYPlus
(
const
fvMesh
&
mesh
,
const
volVectorField
&
U
,
volScalarField
&
yPlus
)
const
)
{
const
incompressible
::
LESModel
&
model
=
mesh
.
lookupObject
<
incompressible
::
LESModel
>
(
"LESProperties"
);
...
...
@@ -56,8 +101,6 @@ void Foam::yPlusLES::calcIncompressibleYPlus
const
volScalarField
nuLam
(
model
.
nu
());
Info
<<
type
()
<<
" output:"
<<
nl
;
bool
foundPatch
=
false
;
forAll
(
patches
,
patchI
)
{
...
...
@@ -77,13 +120,28 @@ void Foam::yPlusLES::calcIncompressibleYPlus
const
scalarField
&
Yp
=
yPlus
.
boundaryField
()[
patchI
];
Info
<<
" patch "
<<
currPatch
.
name
()
<<
" y+ : min = "
<<
min
(
Yp
)
<<
", max = "
<<
max
(
Yp
)
<<
", average = "
<<
average
(
Yp
)
<<
nl
;
scalar
minYp
=
min
(
Yp
);
scalar
maxYp
=
max
(
Yp
);
scalar
avgYp
=
average
(
Yp
);
if
(
log_
)
{
Info
<<
" patch "
<<
currPatch
.
name
()
<<
" y+ : min = "
<<
min
(
Yp
)
<<
", max = "
<<
max
(
Yp
)
<<
", average = "
<<
average
(
Yp
)
<<
nl
;
}
if
(
Pstream
::
master
())
{
outputFilePtr_
()
<<
obr_
.
time
().
value
()
<<
token
::
TAB
<<
currPatch
.
name
()
<<
token
::
TAB
<<
minYp
<<
token
::
TAB
<<
maxYp
<<
token
::
TAB
<<
avgYp
<<
endl
;
}
}
}
if
(
!
foundPatch
)
if
(
log_
&&
!
foundPatch
)
{
Info
<<
" no "
<<
wallFvPatch
::
typeName
<<
" patches"
<<
endl
;
}
...
...
@@ -95,7 +153,7 @@ void Foam::yPlusLES::calcCompressibleYPlus
const
fvMesh
&
mesh
,
const
volVectorField
&
U
,
volScalarField
&
yPlus
)
const
)
{
const
compressible
::
LESModel
&
model
=
mesh
.
lookupObject
<
compressible
::
LESModel
>
(
"LESProperties"
);
...
...
@@ -128,13 +186,28 @@ void Foam::yPlusLES::calcCompressibleYPlus
const
scalarField
&
Yp
=
yPlus
.
boundaryField
()[
patchI
];
Info
<<
" patch "
<<
currPatch
.
name
()
<<
" y+ : min = "
<<
min
(
Yp
)
<<
", max = "
<<
max
(
Yp
)
<<
", average = "
<<
average
(
Yp
)
<<
nl
;
}
scalar
minYp
=
min
(
Yp
);
scalar
maxYp
=
max
(
Yp
);
scalar
avgYp
=
average
(
Yp
);
if
(
log_
)
{
Info
<<
" patch "
<<
currPatch
.
name
()
<<
" y+ : min = "
<<
min
(
Yp
)
<<
", max = "
<<
max
(
Yp
)
<<
", average = "
<<
average
(
Yp
)
<<
nl
;
}
if
(
Pstream
::
master
())
{
outputFilePtr_
()
<<
obr_
.
time
().
value
()
<<
token
::
TAB
<<
currPatch
.
name
()
<<
token
::
TAB
<<
minYp
<<
token
::
TAB
<<
maxYp
<<
token
::
TAB
<<
avgYp
<<
endl
;
}
}
}
if
(
!
foundPatch
)
if
(
log_
&&
!
foundPatch
)
{
Info
<<
" no "
<<
wallFvPatch
::
typeName
<<
" patches"
<<
endl
;
}
...
...
@@ -154,8 +227,10 @@ Foam::yPlusLES::yPlusLES
name_
(
name
),
obr_
(
obr
),
active_
(
true
),
log_
(
false
),
phiName_
(
"phi"
),
UName_
(
"U"
)
UName_
(
"U"
),
outputFilePtr_
(
NULL
)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if
(
!
isA
<
fvMesh
>
(
obr_
))
...
...
@@ -173,6 +248,8 @@ Foam::yPlusLES::yPlusLES
)
<<
"No fvMesh available, deactivating."
<<
nl
<<
endl
;
}
makeFile
();
}
...
...
@@ -188,6 +265,7 @@ void Foam::yPlusLES::read(const dictionary& dict)
{
if
(
active_
)
{
log_
=
dict
.
lookupOrDefault
<
Switch
>
(
"log"
,
false
);
phiName_
=
dict
.
lookupOrDefault
<
word
>
(
"phiName"
,
"phi"
);
}
}
...
...
@@ -229,6 +307,11 @@ void Foam::yPlusLES::write()
dimensionedScalar
(
"0"
,
dimless
,
0
.
0
)
);
if
(
log_
)
{
Info
<<
type
()
<<
" output:"
<<
nl
;
}
if
(
phi
.
dimensions
()
==
dimMass
/
dimTime
)
{
calcCompressibleYPlus
(
mesh
,
U
,
yPlusLES
);
...
...
@@ -238,7 +321,10 @@ void Foam::yPlusLES::write()
calcIncompressibleYPlus
(
mesh
,
U
,
yPlusLES
);
}
Info
<<
endl
;
if
(
log_
)
{
Info
<<
endl
;
}
yPlusLES
.
write
();
}
...
...
src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H
View file @
b78e8b6e
...
...
@@ -39,7 +39,8 @@ SourceFiles
#include
"volFieldsFwd.H"
#include
"pointFieldFwd.H"
#include
"fvMesh.H"
#include
"Switch.H"
#include
"OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -50,6 +51,7 @@ namespace Foam
class
objectRegistry
;
class
dictionary
;
class
mapPolyMesh
;
class
fvMesh
;
/*---------------------------------------------------------------------------*\
Class yPlusLES Declaration
...
...
@@ -67,22 +69,31 @@ class yPlusLES
//- on/off switch
bool
active_
;
//- Switch to send output to Info as well as to file
Switch
log_
;
//- Name of mass/volume flux field (optional, default = phi)
word
phiName_
;
//- Name of velocity field
word
UName_
;
//- Output file pointer
autoPtr
<
OFstream
>
outputFilePtr_
;
// Private Member Functions
//- Make the output file
virtual
void
makeFile
();
//- Calculate incompressible form of y+
void
calcIncompressibleYPlus
(
const
fvMesh
&
mesh
,
const
volVectorField
&
U
,
volScalarField
&
yPlus
)
const
;
);
//- Calculate compressible form of y+
void
calcCompressibleYPlus
...
...
@@ -90,7 +101,7 @@ class yPlusLES
const
fvMesh
&
mesh
,
const
volVectorField
&
U
,
volScalarField
&
yPlus
)
const
;
);
//- Disallow default bitwise copy construct
yPlusLES
(
const
yPlusLES
&
);
...
...
src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C
View file @
b78e8b6e
...
...
@@ -41,11 +41,56 @@ defineTypeNameAndDebug(Foam::yPlusRAS, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void
Foam
::
yPlusRAS
::
makeFile
()
{
// Create the output file if not already created
if
(
outputFilePtr_
.
empty
())
{
if
(
debug
)
{
Info
<<
"Creating output file."
<<
endl
;
}
// File update
if
(
Pstream
::
master
())
{
fileName
outputDir
;
word
startTimeName
=
obr_
.
time
().
timeName
(
obr_
.
time
().
startTime
().
value
());
if
(
Pstream
::
parRun
())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir
=
obr_
.
time
().
path
()
/
".."
/
name_
/
startTimeName
;
}
else
{
outputDir
=
obr_
.
time
().
path
()
/
name_
/
startTimeName
;
}
// Create directory if does not exist
mkDir
(
outputDir
);
// Open new file at start up
outputFilePtr_
.
reset
(
new
OFstream
(
outputDir
/
(
type
()
+
".dat"
)));
// Add headers to output data
outputFilePtr_
()
<<
"# y+ (RAS)"
<<
nl
<<
"# time "
<<
token
::
TAB
<<
"patch"
<<
token
::
TAB
<<
"min"
<<
token
::
TAB
<<
"max"
<<
token
::
TAB
<<
"average"
<<
endl
;
}
}
}
void
Foam
::
yPlusRAS
::
calcIncompressibleYPlus
(
const
fvMesh
&
mesh
,
volScalarField
&
yPlus
)
const
)
{
typedef
incompressible
::
RASModels
::
nutkWallFunctionFvPatchScalarField
wallFunctionPatchField
;
...
...
@@ -57,28 +102,41 @@ void Foam::yPlusRAS::calcIncompressibleYPlus
const
volScalarField
::
GeometricBoundaryField
&
nutPatches
=
nut
.
boundaryField
();
Info
<<
type
()
<<
" output:"
<<
nl
;
bool
foundPatch
=
false
;
forAll
(
nutPatches
,
patch
i
)
forAll
(
nutPatches
,
patch
I
)
{
if
(
isA
<
wallFunctionPatchField
>
(
nutPatches
[
patch
i
]))
if
(
isA
<
wallFunctionPatchField
>
(
nutPatches
[
patch
I
]))
{
foundPatch
=
true
;
const
wallFunctionPatchField
&
nutPw
=
dynamic_cast
<
const
wallFunctionPatchField
&>
(
nutPatches
[
patchi
]);
yPlus
.
boundaryField
()[
patchi
]
=
nutPw
.
yPlus
();
const
scalarField
&
Yp
=
yPlus
.
boundaryField
()[
patchi
];
Info
<<
" patch "
<<
nutPw
.
patch
().
name
()
<<
" y+ : min = "
<<
min
(
Yp
)
<<
", max = "
<<
max
(
Yp
)
<<
", average = "
<<
average
(
Yp
)
<<
nl
;
dynamic_cast
<
const
wallFunctionPatchField
&>
(
nutPatches
[
patchI
]);
yPlus
.
boundaryField
()[
patchI
]
=
nutPw
.
yPlus
();
const
scalarField
&
Yp
=
yPlus
.
boundaryField
()[
patchI
];
scalar
minYp
=
min
(
Yp
);
scalar
maxYp
=
max
(
Yp
);
scalar
avgYp
=
average
(
Yp
);
if
(
log_
)
{
Info
<<
" patch "
<<
nutPw
.
patch
().
name
()
<<
" y+ : min = "
<<
minYp
<<
", max = "
<<
maxYp
<<
", average = "
<<
avgYp
<<
nl
;
}
if
(
Pstream
::
master
())
{
outputFilePtr_
()
<<
obr_
.
time
().
value
()
<<
token
::
TAB
<<
nutPw
.
patch
().
name
()
<<
token
::
TAB
<<
minYp
<<
token
::
TAB
<<
maxYp
<<
token
::
TAB
<<
avgYp
<<
endl
;
}
}
}
if
(
!
foundPatch
)
if
(
log_
&&
!
foundPatch
)
{
Info
<<
" no "
<<
wallFunctionPatchField
::
typeName
<<
" patches"
<<
endl
;
...
...
@@ -90,7 +148,7 @@ void Foam::yPlusRAS::calcCompressibleYPlus
(
const
fvMesh
&
mesh
,
volScalarField
&
yPlus
)
const
)
{
typedef
compressible
::
RASModels
::
mutkWallFunctionFvPatchScalarField
wallFunctionPatchField
;
...
...
@@ -102,28 +160,41 @@ void Foam::yPlusRAS::calcCompressibleYPlus
const
volScalarField
::
GeometricBoundaryField
&
mutPatches
=
mut
.
boundaryField
();
Info
<<
type
()
<<
" output:"
<<
nl
;
bool
foundPatch
=
false
;
forAll
(
mutPatches
,
patch
i
)
forAll
(
mutPatches
,
patch
I
)
{
if
(
isA
<
wallFunctionPatchField
>
(
mutPatches
[
patch
i
]))
if
(
isA
<
wallFunctionPatchField
>
(
mutPatches
[
patch
I
]))
{
foundPatch
=
true
;
const
wallFunctionPatchField
&
mutPw
=
dynamic_cast
<
const
wallFunctionPatchField
&>
(
mutPatches
[
patchi
]);
yPlus
.
boundaryField
()[
patchi
]
=
mutPw
.
yPlus
();
const
scalarField
&
Yp
=
yPlus
.
boundaryField
()[
patchi
];
Info
<<
" patch "
<<
mutPw
.
patch
().
name
()
<<
" y+ : min = "
<<
min
(
Yp
)
<<
", max = "
<<
max
(
Yp
)
<<
", average = "
<<
average
(
Yp
)
<<
nl
;
dynamic_cast
<
const
wallFunctionPatchField
&>
(
mutPatches
[
patchI
]);
yPlus
.
boundaryField
()[
patchI
]
=
mutPw
.
yPlus
();
const
scalarField
&
Yp
=
yPlus
.
boundaryField
()[
patchI
];
scalar
minYp
=
min
(
Yp
);
scalar
maxYp
=
max
(
Yp
);
scalar
avgYp
=
average
(
Yp
);
if
(
log_
)
{
Info
<<
" patch "
<<
mutPw
.
patch
().
name
()
<<
" y+ : min = "
<<
minYp
<<
", max = "
<<
maxYp
<<
", average = "
<<
avgYp
<<
nl
;
}
if
(
Pstream
::
master
())
{
outputFilePtr_
()
<<
obr_
.
time
().
value
()
<<
token
::
TAB
<<
mutPw
.
patch
().
name
()
<<
token
::
TAB
<<
minYp
<<
token
::
TAB
<<
maxYp
<<
token
::
TAB
<<
avgYp
<<
endl
;
}
}
}
if
(
!
foundPatch
)
if
(
log_
&&
!
foundPatch
)
{
Info
<<
" no "
<<
wallFunctionPatchField
::
typeName
<<
" patches"
<<
endl
;
...
...
@@ -144,7 +215,9 @@ Foam::yPlusRAS::yPlusRAS
name_
(
name
),
obr_
(
obr
),
active_
(
true
),
phiName_
(
"phi"
)
log_
(
false
),
phiName_
(
"phi"
),
outputFilePtr_
(
NULL
)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if
(
!
isA
<
fvMesh
>
(
obr_
))
...
...
@@ -162,6 +235,8 @@ Foam::yPlusRAS::yPlusRAS
)
<<
"No fvMesh available, deactivating."
<<
nl
<<
endl
;
}
makeFile
();
}
...
...
@@ -177,6 +252,7 @@ void Foam::yPlusRAS::read(const dictionary& dict)
{
if
(
active_
)
{
log_
=
dict
.
lookupOrDefault
<
Switch
>
(
"log"
,
false
);
phiName_
=
dict
.
lookupOrDefault
<
word
>
(
"phiName"
,
"phi"
);
}
}
...
...
@@ -216,6 +292,11 @@ void Foam::yPlusRAS::write()
dimensionedScalar
(
"0"
,
dimless
,
0
.
0
)
);
if
(
log_
)
{
Info
<<
type
()
<<
" output:"
<<
nl
;
}
if
(
phi
.
dimensions
()
==
dimMass
/
dimTime
)
{
calcCompressibleYPlus
(
mesh
,
yPlusRAS
);
...
...
@@ -225,7 +306,10 @@ void Foam::yPlusRAS::write()
calcIncompressibleYPlus
(
mesh
,
yPlusRAS
);
}
Info
<<
endl
;
if
(
log_
)
{
Info
<<
endl
;
}
yPlusRAS
.
write
();
}
...
...
src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H
View file @
b78e8b6e
...
...
@@ -39,7 +39,8 @@ SourceFiles
#include
"volFieldsFwd.H"
#include
"pointFieldFwd.H"
#include
"fvMesh.H"
#include
"Switch.H"
#include
"OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -50,6 +51,7 @@ namespace Foam
class
objectRegistry
;
class
dictionary
;
class
mapPolyMesh
;
class
fvMesh
;
/*---------------------------------------------------------------------------*\
Class yPlusRAS Declaration
...
...
@@ -67,25 +69,26 @@ class yPlusRAS
//- on/off switch
bool
active_
;
//- Switch to send output to Info as well as to file
Switch
log_
;
//- Name of mass/volume flux field (optional, default = phi)
word
phiName_
;
//- Output file pointer
autoPtr
<
OFstream
>
outputFilePtr_
;
// Private Member Functions
//- Make the output file
virtual
void
makeFile
();
//- Calculate incompressible form of y+
void
calcIncompressibleYPlus
(
const
fvMesh
&
mesh
,
volScalarField
&
yPlus
)
const
;
void
calcIncompressibleYPlus
(
const
fvMesh
&
mesh
,
volScalarField
&
yPlus
);
//- Calculate compressible form of y+
void
calcCompressibleYPlus
(
const
fvMesh
&
mesh
,
volScalarField
&
yPlus
)
const
;
void
calcCompressibleYPlus
(
const
fvMesh
&
mesh
,
volScalarField
&
yPlus
);
//- Disallow default bitwise copy construct
yPlusRAS
(
const
yPlusRAS
&
);
...
...
Write
Preview
Supports
Markdown
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