turbulentOmegaFvPatchScalarField.C
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-2026 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 
28 #include "fieldMapper.H"
29 #include "surfaceFields.H"
30 #include "volFields.H"
31 #include "momentumTransportModel.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
42 (
43  const fvPatch& p,
45  const dictionary& dict
46 )
47 :
48  inletOutletFvPatchScalarField(p, iF),
49  mixingLength_(dict.lookup<scalar>("mixingLength", dimLength)),
50  kName_(dict.lookupOrDefault<word>("k", "k")),
51  Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09))
52 {
53  this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
54 
56  (
57  scalarField("value", iF.dimensions(), dict, p.size())
58  );
59 
60  this->refValue() = 0.0;
61  this->refGrad() = 0.0;
62  this->valueFraction() = 0.0;
63 }
64 
65 
68 (
70  const fvPatch& p,
72  const fieldMapper& mapper
73 )
74 :
75  inletOutletFvPatchScalarField(ptf, p, iF, mapper),
76  mixingLength_(ptf.mixingLength_),
77  kName_(ptf.kName_),
78  Cmu_(ptf.Cmu_)
79 {}
80 
81 
84 (
87 )
88 :
89  inletOutletFvPatchScalarField(ptf, iF),
90  mixingLength_(ptf.mixingLength_),
91  kName_(ptf.kName_),
92  Cmu_(ptf.Cmu_)
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
99 {
100  if (updated())
101  {
102  return;
103  }
104 
105  const scalar Cmu25 = pow(Cmu_, 0.25);
106 
107  const fvPatchScalarField& kp =
108  patch().lookupPatchField<volScalarField, scalar>(kName_);
109 
110  const fvsPatchScalarField& phip =
111  patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
112 
113  this->refValue() = sqrt(kp)/(Cmu25*mixingLength_);
114  this->valueFraction() = neg(phip);
115 
116  inletOutletFvPatchScalarField::updateCoeffs();
117 }
118 
119 
121 (
122  Ostream& os
123 ) const
124 {
126  writeEntry(os, "mixingLength", mixingLength_);
127  writeEntry(os, "phi", this->phiName_);
128  writeEntry(os, "k", kName_);
129  writeEntry(os, "value", *this);
130 }
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
136 (
139 );
140 
141 // Backwards compatible lookup as turbulentMixingLengthFrequencyInlet
143 (
146  dictionary,
147  turbulentMixingLengthFrequencyInlet
148 );
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 } // End namespace Foam
153 
154 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet & dimensions() const
Return dimensions.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:90
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:235
friend Ostream & operator(Ostream &, const fvPatchField< Type > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:86
This boundary condition provides a turbulence specific dissipation, (omega) inlet condition based on...
turbulentOmegaFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, fvMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for handling words, derived from string.
Definition: word.H:63
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
Namespace for OpenFOAM.
const dimensionSet & dimLength
Definition: dimensions.C:141
addNamedToRunTimeSelectionTable(fvPatchScalarField, turbulentKineticEnergyFvPatchScalarField, dictionary, turbulentIntensityKineticEnergyInlet)
makePatchTypeField(fvPatchScalarField, atmosphericBoundaryLayerTurbulentEpsilonFvPatchScalarField)
SurfaceField< scalar > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:62
dimensionedScalar neg(const dimensionedScalar &ds)
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dictionary dict
volScalarField & p
Foam::surfaceFields.