createFields.H
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 \*---------------------------------------------------------------------------*/
25 
26 Info<< "Reading field U\n" << endl;
28 (
29  IOobject
30  (
31  "U",
32  runTime.timeName(),
33  mesh,
34  IOobject::MUST_READ,
35  IOobject::NO_WRITE
36  ),
37  mesh
38 );
39 
40 Info<< "Calculating wall distance field" << endl;
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.timeName(),
67  mesh,
68  IOobject::NO_READ,
69  IOobject::NO_WRITE
70  ),
71  mesh,
72  dimensionedScalar("zero", dimless, 0.0),
73  zeroGradientFvPatchScalarField::typeName
74 );
75 
76 
77 // ************************************************************************* //
T optionRead(const word &opt) const
Read a value from the named option.
Definition: argListI.H:187
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
scalar y
dynamicFvMesh & mesh
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:108
volVectorField U(IOobject("U", runTime.timeName(), runTime, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedVector("zero", dimVelocity, Zero))
static const char nl
Definition: Ostream.H:262
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Type gAverage(const FieldField< Field, Type > &f)
messageStream Info
Foam::argList args(argc, argv)