cubeRootVolDelta.C
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-2017 OpenFOAM Foundation
9 Copyright (C) 2016-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "cubeRootVolDelta.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
36namespace LESModels
37{
40}
41}
42
43
44// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45
47{
49
50 label nD = mesh.nGeometricD();
51
52 if (nD == 3)
53 {
54 delta_.primitiveFieldRef() = deltaCoeff_ * cbrt(mesh.V());
55 }
56 else if (nD == 2)
57 {
59 << "Case is 2D, LES is not strictly applicable\n"
60 << endl;
61
63
64 scalar thickness = 0.0;
65 for (direction dir=0; dir<directions.nComponents; dir++)
66 {
67 if (directions[dir] == -1)
68 {
69 thickness = mesh.bounds().span()[dir];
70 break;
71 }
72 }
73
74 delta_.primitiveFieldRef() = deltaCoeff_*sqrt(mesh.V()/thickness);
75 }
76 else
77 {
78 if (debug)
79 {
81 << "Case is not 3D or 2D, LES is not applicable"
82 << exit(FatalError);
83 }
84 }
85
86 // Handle coupled boundaries
88}
89
90
91// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
92
94(
95 const word& name,
96 const turbulenceModel& turbulence,
97 const dictionary& dict
98)
99:
101 deltaCoeff_
102 (
103 dict.optionalSubDict(type() + "Coeffs").getOrDefault<scalar>
104 (
105 "deltaCoeff",
106 1
107 )
108 )
109{
110 calcDelta();
111}
112
113
114// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115
117{
118 dict.optionalSubDict(type() + "Coeffs").readIfPresent<scalar>
119 (
120 "deltaCoeff",
121 deltaCoeff_
122 );
123
124 calcDelta();
125}
126
127
129{
130 if (turbulenceModel_.mesh().changing())
131 {
132 calcDelta();
133 }
134}
135
136
137// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
void correctBoundaryConditions()
Correct boundary field.
void calcDelta()
Calculate the delta values.
Abstract base class for LES deltas.
Definition: LESdelta.H:54
volScalarField delta_
Definition: LESdelta.H:61
const turbulenceModel & turbulenceModel_
Definition: LESdelta.H:59
virtual bool read()
Re-read model coefficients if they have changed.
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:65
vector span() const
The bounding box span (from minimum to maximum)
Definition: boundBoxI.H:127
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
Definition: directions.H:70
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
label nGeometricD() const
Return the number of valid geometric dimensions in the mesh.
Definition: polyMesh.C:883
const boundBox & bounds() const
Return mesh bounding box.
Definition: polyMesh.H:462
const Vector< label > & geometricD() const
Return the vector of geometric directions in mesh.
Definition: polyMesh.C:872
Abstract base class for turbulence models (RAS, LES and laminar).
const fvMesh & mesh() const
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
compressible::turbulenceModel & turbulence
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
dimensionedScalar sqrt(const dimensionedScalar &ds)
uint8_t direction
Definition: direction.H:56
error FatalError
dimensionedScalar cbrt(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
dictionary dict