1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 "singlePhaseTransportModel.H"
42 #include "wallFvPatch.H"
43 #include "makeGraph.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 int main(int argc, char *argv[])
50 #include "setRootCase.H"
52 #include "createTime.H"
53 #include "createMesh.H"
54 #include "createFields.H"
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 Info<< "\nStarting time loop\n" << endl;
60 while (runTime.loop())
62 Info<< "Time = " << runTime.timeName() << nl << endl;
64 fvVectorMatrix divR = turbulence->divDevReff(U);
65 divR.source() = flowMask & divR.source();
77 // Correct driving force for a constant mass flow rate
79 dimensionedVector UbarStar = flowMask & U.weightedAverage(mesh.V());
81 U += (Ubar - UbarStar);
82 gradP += (Ubar - UbarStar)/(1.0/UEqn.A())().weightedAverage(mesh.V());
84 label id = y.size() - 1;
86 scalar wallShearStress =
87 flowDirection & turbulence->R()()[id] & wallNormal;
90 // = ::sqrt(mag(wallShearStress))*y[id]/laminarTransport.nu()()[id];
91 = ::sqrt(mag(wallShearStress))*y[id]/turbulence->nuEff()()[id];
93 Info<< "Uncorrected Ubar = " << (flowDirection & UbarStar.value())<< tab
94 << "pressure gradient = " << (flowDirection & gradP.value()) << tab
95 << "min y+ = " << yplusWall << endl;
98 turbulence->correct();
101 if (runTime.outputTime())
118 const word& gFormat = runTime.graphFormat();
120 makeGraph(y, flowDirection & U, "Uf", gFormat);
122 makeGraph(y, laminarTransport.nu(), gFormat);
124 makeGraph(y, turbulence->k(), gFormat);
125 makeGraph(y, turbulence->epsilon(), gFormat);
127 //makeGraph(y, flowDirection & R & flowDirection, "Rff", gFormat);
128 //makeGraph(y, wallNormal & R & wallNormal, "Rww", gFormat);
129 //makeGraph(y, flowDirection & R & wallNormal, "Rfw", gFormat);
131 //makeGraph(y, sqrt(R.component(tensor::XX)), "u", gFormat);
132 //makeGraph(y, sqrt(R.component(tensor::YY)), "v", gFormat);
133 //makeGraph(y, sqrt(R.component(tensor::ZZ)), "w", gFormat);
134 makeGraph(y, R.component(tensor::XY), "uv", gFormat);
136 makeGraph(y, mag(fvc::grad(U)), "gammaDot", gFormat);
139 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
140 << " ClockTime = " << runTime.elapsedClockTime() << " s"
144 Info<< "End\n" << endl;
150 // ************************************************************************* //