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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 Info<< "Reading field U\n" << endl;
30 (
31  IOobject
32  (
33  "U",
34  runTime.timeName(),
35  mesh,
36  IOobject::MUST_READ,
37  IOobject::NO_WRITE
38  ),
39  mesh
40 );
41 
42 Info<< "Calculating wall distance field" << endl;
44 (
45  IOobject
46  (
47  "y",
48  runTime.timeName(),
49  mesh,
50  IOobject::NO_READ,
51  IOobject::NO_WRITE
52  ),
53  mesh,
55  zeroGradientFvPatchScalarField::typeName
56 );
57 y.primitiveFieldRef() = wallDist::New(mesh).y().primitiveField();
58 y.correctBoundaryConditions();
59 
60 
61 // Set the mean boundary-layer thickness
62 dimensionedScalar ybl("ybl", dimLength, Zero);
63 
64 if (args.found("ybl"))
65 {
66  // If the boundary-layer thickness is provided use it
67  ybl.value() = args.get<scalar>("ybl");
68 }
69 else if (args.found("Cbl"))
70 {
71  // Calculate boundary layer thickness as Cbl*mean distance to wall
72  ybl.value() = gAverage(y)*args.get<scalar>("Cbl");
73 }
74 
75 Info<< "\nCreating boundary-layer for U of thickness "
76  << ybl.value() << " m" << nl << endl;
77 
78 Info<< "Creating mask field" << endl;
79 volScalarField mask
80 (
81  IOobject
82  (
83  "mask",
84  runTime.timeName(),
85  mesh,
86  IOobject::NO_READ,
87  IOobject::NO_WRITE
88  ),
89  mesh,
91  zeroGradientFvPatchScalarField::typeName
92 );
93 
94 
95 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
U
volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedVector(dimVelocity, Zero))
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::gAverage
Type gAverage(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:604
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::argList::get
T get(const label index) const
Get a value from the argument at index.
Definition: argListI.H:278
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:62
Foam::nl
constexpr char nl
Definition: Ostream.H:404
args
Foam::argList args(argc, argv)
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189
Foam::argList::found
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:178
y
scalar y
Definition: LISASMDCalcMethod1.H:14