Loading...
Searching...
No Matches
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"
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
62 const Vector<label>& directions = mesh.geometricD();
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
87 delta_.correctBoundaryConditions();
88}
89
90
91// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
92
93Foam::LESModels::cubeRootVolDelta::cubeRootVolDelta
94(
95 const word& name,
97 const dictionary& dict
98)
99:
101 deltaCoeff_
102 (
103 dict.optionalSubDict(type() + "Coeffs").getOrDefault<scalar>
104 (
105 "deltaCoeff",
106 1
107 )
108 )
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 values.
void calcDelta()
Calculate the delta values.
virtual void read(const dictionary &)
Read the LESdelta dictionary.
Abstract base class for LES deltas.
Definition LESdelta.H:50
LESdelta(const LESdelta &)=delete
No copy construct.
const turbulenceModel & turbulence() const
Return turbulenceModel reference.
Definition LESdelta.H:146
volScalarField delta_
Definition LESdelta.H:57
const turbulenceModel & turbulenceModel_
Definition LESdelta.H:55
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition Vector.H:61
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
Definition directions.H:67
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
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:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for LES SGS models.
Namespace for handling debugging switches.
Definition debug.C:45
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 POSIX.C:801
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
dimensionedScalar sqrt(const dimensionedScalar &ds)
uint8_t direction
Definition direction.H:49
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensionedScalar cbrt(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
dictionary dict