yPlusWriter.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  Copyright : (C) 2011 Symscape
3  Website : www.symscape.com
4 -------------------------------------------------------------------------------
5 License
6  This file is part of OpenFOAM.
7 
8  OpenFOAM is free software: you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
14  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16  for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
20 
21 \*---------------------------------------------------------------------------*/
22 
23 #include "yPlusWriter.H"
24 #include "dictionary.H"
25 #include "Time.H"
26 #include "wallFvPatch.H"
27 #include "nearWallDist.H"
29 #include "turbulenceModel.H"
30 
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(yPlusWriter, 0);
37  const word yPlusWriter::FIELD_NAME("yPlus");
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
45 {}
46 
47 
48 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
49 
50 
52 {
53  const fvMesh& mesh = refCast<const fvMesh>(obr);
54 
56  (
57  IOobject
58  (
59  FIELD_NAME,
60  obr.time().timeName(),
61  mesh,
64  ),
65  mesh,
66  dimensionedScalar(FIELD_NAME, dimless, 0.0)
67  );
68 
70  {
71  const turbulenceModel & tModel =
73 
75 
77  tModel.U().boundaryField();
78 
80  tModel.nut()().boundaryField();
81 
83  tModel.nuEff()().boundaryField();
84 
86  tModel.nu()().boundaryField();
87 
88  const fvPatchList& patches = mesh.boundary();
89 
91  {
92  const fvPatch& patch = patches[patchi];
93 
94  if (isA<nutWallFunctionFvPatchScalarField>(nutBf[patchi]))
95  {
97  dynamic_cast<const nutWallFunctionFvPatchScalarField&>
98  (
99  nutBf[patchi]
100  );
101 
102  yPlus.boundaryField()[patchi] = nutPf.yPlus();
103  const scalarField& Yp = yPlus.boundaryField()[patchi];
104 
105  writeStatistics(Yp, nutPf.patch().name(), FIELD_NAME);
106  }
107  else if (isA<wallFvPatch>(patch))
108  {
109  yPlus.boundaryField()[patchi] =
110  d[patchi]
111  *sqrt
112  (
113  nuEffBf[patchi]
114  *mag(Ub[patchi].snGrad())
115  )/nuBf[patchi];
116  const scalarField& Yp = yPlus.boundaryField()[patchi];
117 
118  writeStatistics(Yp, patch.name(), FIELD_NAME);
119  }
120  }
121  }
122 
123  yPlus.write();
124 }
125 
126 
127 // ************************************************************************* //
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::turbulenceModel::nu
virtual tmp< volScalarField > nu() const =0
Return the laminar viscosity.
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::turbulenceModel::nut
virtual tmp< volScalarField > nut() const =0
Return the turbulence viscosity.
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:117
Foam::turbulenceModel::propertiesName
static const word propertiesName
Default name of the turbulence properties dictionary.
Definition: turbulenceModel.H:97
nutWallFunctionFvPatchScalarField.H
Foam::nutWallFunctionFvPatchScalarField::yPlus
virtual tmp< scalarField > yPlus() const =0
Calculate and return the yPlus at the boundary.
wallFvPatch.H
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
Foam::yPlusWriter::FIELD_NAME
static const word FIELD_NAME
Field file name.
Definition: yPlusWriter.H:54
Foam::yPlus::write
virtual void write()
Calculate the yPlus and write.
Definition: yPlus.C:215
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::fvPatch::name
const word & name() const
Return name.
Definition: fvPatch.H:149
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
nearWallDist.H
yPlusWriter.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::derivedFieldWriter
Basis for writers used in derivedFields e.g., wallShearStressWriter.
Definition: derivedFieldWriter.H:49
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
Foam::nearWallDist::y
const volScalarField::GeometricBoundaryField & y() const
Definition: nearWallDist.H:87
Foam::yPlusWriter::write
virtual void write(const objectRegistry &obr)
Write derived field.
Definition: yPlusWriter.C:51
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::turbulenceModel
Abstract base class for turbulence models (RAS, LES and laminar).
Definition: turbulenceModel.H:60
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
boundaryField
cellIbMask *cellIbMaskExt *faceIbMask *cellIbMask boundaryField().evaluateCoupled()
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:550
Foam::objectRegistry::foundObject
bool foundObject(const word &name) const
Is the named Type found?
Definition: objectRegistryTemplates.C:142
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:142
Foam::yPlus
This function object evaluates and outputs turbulence y+ for turbulence models. The field is stored o...
Definition: yPlus.H:110
patchi
label patchi
Definition: getPatchFieldScalar.H:1
dictionary.H
Foam::nearWallDist
Distance calculation for cells with face on a wall. Searches pointNeighbours to find closest.
Definition: nearWallDist.H:51
patches
patches[0]
Definition: createSingleCellMesh.H:36
yPlus
scalar yPlus
Definition: evaluateNearWall.H:16
Foam::yPlusWriter::yPlusWriter
yPlusWriter(const dictionary &dict)
Definition: yPlusWriter.C:43
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Definition: objectRegistryTemplates.C:165
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::turbulenceModel::nuEff
virtual tmp< volScalarField > nuEff() const =0
Return the effective viscosity.
Foam::nutWallFunctionFvPatchScalarField
This boundary condition provides a turbulent kinematic viscosity condition when using wall functions,...
Definition: nutWallFunctionFvPatchScalarField.H:101
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::GeometricField::GeometricBoundaryField
Definition: GeometricField.H:105
turbulenceModel.H
Foam::turbulenceModel::U
const volVectorField & U() const
Access function to velocity field.
Definition: turbulenceModel.H:142