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) 2011-2015 OpenFOAM Foundation
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 incompressible, 1D turbulent flow, typically to
29  generate boundary 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 \*---------------------------------------------------------------------------*/
37 
38 #include "fvCFD.H"
41 #include "wallFvPatch.H"
42 #include "makeGraph.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 int main(int argc, char *argv[])
47 {
48  argList::noParallel();
49 
50  #include "setRootCase.H"
51 
52  #include "createTime.H"
53  #include "createMesh.H"
54  #include "createFields.H"
55  #include "interrogateWallPatches.H"
56 
57  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59  Info<< "\nStarting time loop\n" << endl;
60 
61  while (runTime.loop())
62  {
63  Info<< "Time = " << runTime.timeName() << nl << endl;
64 
65  fvVectorMatrix divR(turbulence->divDevReff(U));
66  divR.source() = flowMask & divR.source();
67 
69  (
70  divR == gradP
71  );
72 
73  UEqn.relax();
74 
75  UEqn.solve();
76 
77 
78  // Correct driving force for a constant volume flow rate
79  dimensionedVector UbarStar = flowMask & U.weightedAverage(mesh.V());
80 
81  U += (Ubar - UbarStar);
82  gradP += (Ubar - UbarStar)/(1.0/UEqn.A())().weightedAverage(mesh.V());
83 
84  laminarTransport.correct();
85  turbulence->correct();
86 
87  Info<< "Uncorrected Ubar = " << (flowDirection & UbarStar.value())
88  << ", pressure gradient = " << (flowDirection & gradP.value())
89  << endl;
90 
91  #include "evaluateNearWall.H"
92 
93  if (runTime.outputTime())
94  {
95  #include "makeGraphs.H"
96  }
97 
98  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
99  << " ClockTime = " << runTime.elapsedClockTime() << " s"
100  << nl << endl;
101  }
102 
103  Info<< "End\n" << endl;
104 
105  return 0;
106 }
107 
108 
109 // ************************************************************************* //
dimensionedVector gradP("gradP", dimensionSet(0, 1,-2, 0, 0), vector::zero)
singlePhaseTransportModel laminarTransport(U, phi)
vector flowDirection
Definition: createFields.H:41
dimensionedVector Ubar("Ubar", dimVelocity, laminarTransport)
tensor flowMask
Definition: createFields.H:42
messageStream Info
autoPtr< compressible::turbulenceModel > turbulence
Definition: createFields.H:23
dynamicFvMesh & mesh
fvMatrix< vector > fvVectorMatrix
Definition: fvMatricesFwd.H:45
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
fvVectorMatrix UEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
int main(int argc, char *argv[])
Definition: postCalc.C:54
U
Definition: pEqn.H:82