laminar.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 -------------------------------------------------------------------------------
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 #include "laminar.H"
30 #include "fvMesh.H"
31 #include "fvMatrices.H"
32 #include "Time.H"
33 #include "volFields.H"
34 #include "fvmSup.H"
35 #include "kinematicSingleLayer.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 namespace regionModels
43 {
44 namespace surfaceFilmModels
45 {
46 
47 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
48 
51 
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53 
54 laminar::laminar
55 (
57  const dictionary& dict
58 )
59 :
61  Cf_(coeffDict_.get<scalar>("Cf"))
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
66 
68 {}
69 
70 
71 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
72 
74 {
76  (
77  new volVectorField
78  (
79  IOobject
80  (
81  typeName + ":Us",
86  ),
90  )
91  );
92 
93  // apply quadratic profile
94  tUs.ref() = Foam::sqrt(2.0)*filmModel_.U();
95  tUs.ref().correctBoundaryConditions();
96 
97  return tUs;
98 }
99 
100 
102 {
104  (
105  IOobject
106  (
107  typeName + ":mut",
112  ),
115  );
116 }
117 
118 
119 void laminar::correct()
120 {}
121 
122 
124 {
125  // local reference to film model
126  const kinematicSingleLayer& film =
127  static_cast<const kinematicSingleLayer&>(filmModel_);
128 
129  // local references to film fields
130  const volScalarField& mu = film.mu();
131  const volVectorField& Uw = film.Uw();
132  const volScalarField& delta = film.delta();
133  const volVectorField& Up = film.UPrimary();
134  const volScalarField& rhop = film.rhoPrimary();
135 
136  // employ simple coeff-based model
137  volScalarField Cs("Cs", Cf_*rhop*mag(Up - U));
138  volScalarField Cw("Cw", mu/((1.0/3.0)*(delta + film.deltaSmall())));
139  Cw.clamp_max(5000.0);
140 
141  return
142  (
143  - fvm::Sp(Cs, U) + Cs*Up // surface contribution
144  - fvm::Sp(Cw, U) + Cw*Uw // wall contribution
145  );
146 }
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace surfaceFilmModels
152 } // End namespace regionModels
153 } // End namespace Foam
154 
155 // ************************************************************************* //
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
scalar delta
dictionary dict
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ignore writing from objectRegistry::writeObject()
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:360
addToRunTimeSelectionTable(surfaceFilmRegionModel, kinematicSingleLayer, mesh)
Macros for easy insertion into run-time selection tables.
const surfaceFilmRegionModel & film() const
Return const access to the film surface film model.
virtual const volVectorField & Uw() const =0
Return the film wall velocity [m/s].
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
Film laminar turbulence model.
Definition: laminar.H:50
virtual const volScalarField & delta() const =0
Return the film thickness [m].
const fvMesh & regionMesh() const
Return the region mesh database.
Definition: regionModelI.H:26
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:206
virtual tmp< fvVectorMatrix > Su(volVectorField &U) const
Return the source for the film momentum equation.
Definition: laminar.C:116
virtual const volVectorField & U() const =0
Return the film velocity [m/s].
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Definition: Time.C:714
virtual tmp< volVectorField > Us() const
Return the film surface velocity.
Definition: laminar.C:66
void clamp_max(const Type &upper)
Impose upper (ceiling) clamp on the field values (in-place)
const dimensionedScalar mu
Atomic mass unit.
U
Definition: pEqn.H:72
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual tmp< volScalarField > mut() const
Return the film turbulence viscosity.
Definition: laminar.C:94
Nothing to be read.
virtual void correct()
Correct/update the model.
Definition: laminar.C:112
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
surfaceFilmRegionModel & filmModel_
Reference to the film surface film model.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
A class for managing temporary objects.
Definition: HashPtrTable.H:50
static const word & extrapolatedCalculatedType() noexcept
The type name for extrapolatedCalculated patch fields combines zero-gradient and calculated.
Definition: fvPatchField.H:213
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Calculate the finiteVolume matrix for implicit and explicit sources.
const scalarField & Cs
Namespace for OpenFOAM.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127
const dimensionSet dimVelocity