createFields.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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 \*---------------------------------------------------------------------------*/
25 
26 Info<< "Reading field U\n" << endl;
28 (
29  IOobject
30  (
31  "U",
32  runTime.name(),
33  mesh,
34  IOobject::MUST_READ,
35  IOobject::NO_WRITE
36  ),
37  mesh
38 );
39 
40 Info<< "Calculating wall distance field" << endl;
41 const volScalarField& y(wallDist::New(mesh).y());
42 
43 // Set the mean boundary-layer thickness
44 dimensionedScalar ybl("ybl", dimLength, 0);
45 
46 if (args.optionFound("ybl"))
47 {
48  // If the boundary-layer thickness is provided use it
49  ybl.value() = args.optionRead<scalar>("ybl");
50 }
51 else if (args.optionFound("Cbl"))
52 {
53  // Calculate boundary layer thickness as Cbl*mean distance to wall
54  ybl.value() = gAverage(y)*args.optionRead<scalar>("Cbl");
55 }
56 
57 Info<< "\nCreating boundary-layer for U of thickness "
58  << ybl.value() << " m" << nl << endl;
59 
60 Info<< "Creating mask field" << endl;
61 volScalarField mask
62 (
63  IOobject
64  (
65  "mask",
66  runTime.name(),
67  mesh,
68  IOobject::NO_READ,
69  IOobject::NO_WRITE
70  ),
71  mesh,
73  zeroGradientFvPatchScalarField::typeName
74 );
75 
76 
77 // ************************************************************************* //
scalar y
T optionRead(const word &opt) const
Read a value from the named option.
Definition: argListI.H:193
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:114
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
VolField< vector > volVectorField
Definition: volFieldsFwd.H:65
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
const dimensionSet dimless
messageStream Info
const dimensionSet dimLength
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:64
Type gAverage(const FieldField< Field, Type > &f)
static const char nl
Definition: Ostream.H:266
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Foam::argList args(argc, argv)
volVectorField U(IOobject("U", runTime.name(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedVector(dimVelocity, Zero))