Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
applications
solvers
incompressible
boundaryFoam
boundaryFoam.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Application
25
boundaryFoam
26
27
Description
28
Steady-state solver for 1D turbulent flow, typically to generate boundary
29
layer conditions at an inlet, for use in a simulation.
30
31
Boundary layer code to calculate the U, k and epsilon distributions.
32
Used to create inlet boundary conditions for experimental comparisons
33
for which U and k have not been measured.
34
Turbulence model is runtime selectable.
35
36
Usage
37
- boundaryFoam [OPTION]
38
39
@param -case <dir> \n
40
Specify the case directory
41
42
@param -parallel \n
43
Run the case in parallel
44
45
@param -help \n
46
Display short usage message
47
48
@param -doc \n
49
Display Doxygen documentation page
50
51
@param -srcDoc \n
52
Display source code
53
54
\*---------------------------------------------------------------------------*/
55
56
#include <
finiteVolume/fvCFD.H
>
57
#include <
incompressibleTransportModels/singlePhaseTransportModel.H
>
58
#include <
incompressibleRASModels/RASModel.H
>
59
#include <
finiteVolume/wallFvPatch.H
>
60
#include <
sampling/makeGraph.H
>
61
62
63
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64
65
int
main
(
int
argc,
char
*argv[])
66
{
67
#include <
OpenFOAM/setRootCase.H
>
68
69
#include <
OpenFOAM/createTime.H
>
70
#include <
OpenFOAM/createMesh.H
>
71
#include "
createFields.H
"
72
73
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74
75
Info
<<
"\nStarting time loop\n"
<<
endl
;
76
77
while
(runTime.loop())
78
{
79
Info
<<
"Time = "
<< runTime.timeName() <<
nl
<<
endl
;
80
81
fvVectorMatrix
divR =
turbulence
->divDevReff(
U
);
82
divR.
source
() =
flowMask
& divR.
source
();
83
84
fvVectorMatrix
UEqn
85
(
86
divR ==
gradP
87
);
88
89
UEqn
.
relax
();
90
91
UEqn
.
solve
();
92
93
94
// Correct driving force for a constant mass flow rate
95
96
dimensionedVector
UbarStar =
flowMask
&
U
.weightedAverage(
mesh
.
V
());
97
98
U
+= (
Ubar
- UbarStar);
99
gradP
+= (
Ubar
- UbarStar)/(1.0/
UEqn
.
A
())().weightedAverage(
mesh
.
V
());
100
101
label
id
=
y
.
size
() - 1;
102
103
scalar wallShearStress =
104
flowDirection
&
turbulence
->R()()[
id
] &
wallNormal
;
105
106
scalar yplusWall
107
// = ::sqrt(mag(wallShearStress))*y[id]/laminarTransport.nu()()[id];
108
=
::sqrt
(
mag
(wallShearStress))*
y
[id]/
turbulence
->nuEff()()[
id
];
109
110
Info
<<
"Uncorrected Ubar = "
<< (
flowDirection
& UbarStar.
value
())<<
tab
111
<<
"pressure gradient = "
<< (
flowDirection
&
gradP
.
value
()) <<
tab
112
<<
"min y+ = "
<< yplusWall << endl;
113
114
115
turbulence
->correct();
116
117
118
if
(runTime.outputTime())
119
{
120
volSymmTensorField
R
121
(
122
IOobject
123
(
124
"R"
,
125
runTime.timeName(),
126
mesh
,
127
IOobject::NO_READ,
128
IOobject::AUTO_WRITE
129
),
130
turbulence
->R()
131
);
132
133
runTime.write();
134
135
const
word
& gFormat = runTime.graphFormat();
136
137
makeGraph
(
y
,
flowDirection
&
U
,
"Uf"
, gFormat);
138
139
makeGraph
(
y
,
laminarTransport
.
nu
(), gFormat);
140
141
makeGraph
(
y
,
turbulence
->k(), gFormat);
142
makeGraph
(
y
,
turbulence
->epsilon(), gFormat);
143
144
//makeGraph(y, flowDirection & R & flowDirection, "Rff", gFormat);
145
//makeGraph(y, wallNormal & R & wallNormal, "Rww", gFormat);
146
//makeGraph(y, flowDirection & R & wallNormal, "Rfw", gFormat);
147
148
//makeGraph(y, sqrt(R.component(tensor::XX)), "u", gFormat);
149
//makeGraph(y, sqrt(R.component(tensor::YY)), "v", gFormat);
150
//makeGraph(y, sqrt(R.component(tensor::ZZ)), "w", gFormat);
151
makeGraph
(
y
,
R
.component(tensor::XY),
"uv"
, gFormat);
152
153
makeGraph
(
y
,
mag
(
fvc::grad
(
U
)),
"gammaDot"
, gFormat);
154
}
155
156
Info
<<
"ExecutionTime = "
<< runTime.elapsedCpuTime() <<
" s"
157
<<
" ClockTime = "
<< runTime.elapsedClockTime() <<
" s"
158
<<
nl
<<
endl
;
159
}
160
161
Info
<<
"End\n"
<<
endl
;
162
163
return
0;
164
}
165
166
167
// ************************ vim: set sw=4 sts=4 et: ************************ //