1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Steady-state solver for 1D turbulent flow, typically to generate boundary
29 layer conditions at an inlet, for use in a simulation.
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.
36 \*---------------------------------------------------------------------------*/
39 #include "singlePhaseTransportModel.H"
41 #include "wallFvPatch.H"
42 #include "makeGraph.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 int main(int argc, char *argv[])
49 # include "setRootCase.H"
51 # include "createTime.H"
52 # include "createMesh.H"
53 # include "createFields.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 Info<< "\nStarting time loop\n" << endl;
59 while (runTime.loop())
61 Info<< "Time = " << runTime.timeName() << nl << endl;
63 fvVectorMatrix divR = turbulence->divDevReff(U);
64 divR.source() = flowMask & divR.source();
76 // Correct driving force for a constant mass flow rate
78 dimensionedVector UbarStar = flowMask & U.weightedAverage(mesh.V());
80 U += (Ubar - UbarStar);
81 gradP += (Ubar - UbarStar)/(1.0/UEqn.A())().weightedAverage(mesh.V());
83 label id = y.size() - 1;
85 scalar wallShearStress =
86 flowDirection & turbulence->R()()[id] & wallNormal;
89 // = Foam::sqrt(mag(wallShearStress))*y[id]/laminarTransport.nu()()[id];
90 = Foam::sqrt(mag(wallShearStress))*y[id]/turbulence->nuEff()()[id];
92 Info<< "Uncorrected Ubar = " << (flowDirection & UbarStar.value())<< tab
93 << "pressure gradient = " << (flowDirection & gradP.value()) << tab
94 << "min y+ = " << yplusWall << endl;
97 turbulence->correct();
100 if (runTime.outputTime())
117 const word& gFormat = runTime.graphFormat();
119 makeGraph(y, flowDirection & U, "Uf", gFormat);
121 makeGraph(y, laminarTransport.nu(), gFormat);
123 makeGraph(y, turbulence->k(), gFormat);
124 makeGraph(y, turbulence->epsilon(), gFormat);
126 //makeGraph(y, flowDirection & R & flowDirection, "Rff", gFormat);
127 //makeGraph(y, wallNormal & R & wallNormal, "Rww", gFormat);
128 //makeGraph(y, flowDirection & R & wallNormal, "Rfw", gFormat);
130 //makeGraph(y, sqrt(R.component(tensor::XX)), "u", gFormat);
131 //makeGraph(y, sqrt(R.component(tensor::YY)), "v", gFormat);
132 //makeGraph(y, sqrt(R.component(tensor::ZZ)), "w", gFormat);
133 makeGraph(y, R.component(tensor::XY), "uv", gFormat);
135 makeGraph(y, mag(fvc::grad(U)), "gammaDot", gFormat);
138 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
139 << " ClockTime = " << runTime.elapsedClockTime() << " s"
143 Info<< "End\n" << endl;
149 // ************************************************************************* //