1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Steady-state solver for 1D turbulent flow, typically to generate boundary
30 layer conditions at an inlet, for use in a simulation.
32 Boundary layer code to calculate the U, k and epsilon distributions.
33 Used to create inlet boundary conditions for experimental comparisons
34 for which U and k have not been measured.
35 Turbulence model is runtime selectable.
37 \*---------------------------------------------------------------------------*/
40 #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
41 #include "incompressible/RASModel/RASModel.H"
42 #include "wallFvPatch.H"
43 #include "makeGraph.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 int main(int argc, char *argv[])
51 # include "setRootCase.H"
53 # include "createTime.H"
54 # include "createMesh.H"
55 # include "createFields.H"
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 Info<< "\nStarting time loop\n" << endl;
61 for (runTime++; !runTime.end(); runTime++)
63 Info<< "Time = " << runTime.timeName() << nl << endl;
65 fvVectorMatrix divR = turbulence->divDevReff(U);
66 divR.source() = flowMask & divR.source();
78 // Correct driving force for a constant mass flow rate
80 dimensionedVector UbarStar = flowMask & U.weightedAverage(mesh.V());
82 U += (Ubar - UbarStar);
83 gradP += (Ubar - UbarStar)/(1.0/UEqn.A())().weightedAverage(mesh.V());
85 scalar wallShearStress =
86 flowDirection & turbulence->R()()[0] & wallNormal;
89 = ::sqrt(mag(wallShearStress))*y[0]/laminarTransport.nu()()[0];
91 Info<< "Uncorrected Ubar = " << (flowDirection & UbarStar.value())<< tab
92 << "pressure gradient = " << (flowDirection & gradP.value()) << tab
93 << "min y+ = " << yplusWall << endl;
96 turbulence->correct();
99 if (runTime.outputTime())
116 const word& gFormat = runTime.graphFormat();
118 makeGraph(y, flowDirection & U, "Uf", gFormat);
120 makeGraph(y, laminarTransport.nu(), gFormat);
122 makeGraph(y, turbulence->k(), gFormat);
123 makeGraph(y, turbulence->epsilon(), gFormat);
125 //makeGraph(y, flowDirection & R & flowDirection, "Rff", gFormat);
126 //makeGraph(y, wallNormal & R & wallNormal, "Rww", gFormat);
127 //makeGraph(y, flowDirection & R & wallNormal, "Rfw", gFormat);
129 //makeGraph(y, sqrt(R.component(tensor::XX)), "u", gFormat);
130 //makeGraph(y, sqrt(R.component(tensor::YY)), "v", gFormat);
131 //makeGraph(y, sqrt(R.component(tensor::ZZ)), "w", gFormat);
132 makeGraph(y, R.component(tensor::XY), "uv", gFormat);
134 makeGraph(y, mag(fvc::grad(U)), "gammaDot", gFormat);
137 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
138 << " ClockTime = " << runTime.elapsedClockTime() << " s"
142 Info<< "End\n" << endl;
148 // ************************************************************************* //