atmAlphatkWallFunctionFvPatchScalarField.H 7.14 KB
Newer Older
1 2 3 4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
OpenFOAM bot's avatar
OpenFOAM bot committed
5
    \\  /    A nd           | www.openfoam.com
6
     \\/     M anipulation  |
OpenFOAM bot's avatar
OpenFOAM bot committed
7
-------------------------------------------------------------------------------
8 9
    Copyright (C) 2020 ENERCON GmbH
    Copyright (C) 2020 OpenCFD Ltd.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Class
28
    Foam::atmAlphatkWallFunctionFvPatchScalarField
29 30

Group
31
    grpAtmWallFunctions
32 33

Description
34
    This boundary condition provides a wall constraint on the kinematic
35
    turbulent thermal conductivity (i.e. \c alphat) for atmospheric boundary
36 37
    layer modelling.  It assumes a logarithmic distribution of the potential
    temperature within the first cell.
38

39 40 41 42
    Required fields:
    \verbatim
      alphat    | Kinematic turbulent thermal conductivity    [m2/s]
    \endverbatim
43

44
Usage
45 46
    Example of the boundary condition specification:
    \verbatim
47
    <patchName>
48
    {
49
        // Mandatory entries (unmodifiable)
50
        type            atmAlphatkWallFunction;
51 52 53 54 55 56 57 58 59 60 61 62

        // Mandatory entries (runtime modifiable)
        Pr              0.90;
        Prt             uniform 0.85;
        z0              uniform 0.001;

        // Optional entries (unmodifiable)
        Cmu             0.09;
        kappa           0.41;

        // Optional (inherited) entries
        ...
63 64 65
    }
    \endverbatim

66 67
    where the entries mean:
    \table
68 69
      Property | Description                       | Type   | Reqd     | Dflt
      type     | Type name: atmAlphatkWallFunction | word   | yes      | -
70 71 72 73 74 75 76 77 78 79 80 81
      Pr       | Molecular Prandtl number     | TimeFunction1<scalar>  | yes | -
      Prt      | Turbulent Prandtl number     | PatchFunction1<scalar> | yes | -
      z0       | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
      Cmu      | Empirical model constant         | scalar | no        | 0.09
      kappa    | von Kármán constant              | scalar | no        | 0.41
    \endtable

    The inherited entries are elaborated in:
      - \link fixedValueFvPatchField.H \endlink
      - \link TimeFunction1.H \endlink
      - \link PatchFunction1.H \endlink

82
See also
83
    - Foam::fixedValueFvPatchField
84 85

SourceFiles
86
    atmAlphatkWallFunctionFvPatchScalarField.C
87 88 89

\*---------------------------------------------------------------------------*/

90 91
#ifndef atmAlphatkWallFunctionFvPatchScalarField_H
#define atmAlphatkWallFunctionFvPatchScalarField_H
92

93 94 95
#include "fixedValueFvPatchFields.H"
#include "TimeFunction1.H"
#include "PatchFunction1.H"
96 97 98 99 100 101

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

102 103
class turbulenceModel;

104
/*---------------------------------------------------------------------------*\
105
       Class atmAlphatkWallFunctionFvPatchScalarField Declaration
106 107
\*---------------------------------------------------------------------------*/

108
class atmAlphatkWallFunctionFvPatchScalarField
109
:
110
    public fixedValueFvPatchScalarField
111 112 113
{
protected:

114
    // Protected Data
115

116 117
        //- Empirical model constant
        const scalar Cmu_;
118

119 120
        //- von Kármán constant
        const scalar kappa_;
121

122 123 124 125 126 127 128 129
        //- Molecular Prandtl number
        TimeFunction1<scalar> Pr_;

        //- Turbulent Prandtl number field
        autoPtr<PatchFunction1<scalar>> Prt_;

        //- Surface roughness length [m]
        autoPtr<PatchFunction1<scalar>> z0_;
130 131


132 133 134 135 136 137 138 139 140 141
        //- Solution parameters

            static scalar tolerance_;
            static label maxIters_;


    // Protected Member Functions

        //- Check the type of the patch
        virtual void checkType();
142 143 144 145 146


public:

    //- Runtime type information
147
    TypeName("atmAlphatkWallFunction");
148 149 150 151 152


    // Constructors

        //- Construct from patch and internal field
153
        atmAlphatkWallFunctionFvPatchScalarField
154 155 156 157 158 159
        (
            const fvPatch&,
            const DimensionedField<scalar, volMesh>&
        );

        //- Construct from patch, internal field and dictionary
160
        atmAlphatkWallFunctionFvPatchScalarField
161 162 163 164 165 166 167
        (
            const fvPatch&,
            const DimensionedField<scalar, volMesh>&,
            const dictionary&
        );

        //- Construct by mapping given
168 169 170
        //- atmAlphatkWallFunctionFvPatchScalarField
        //- onto a new patch
        atmAlphatkWallFunctionFvPatchScalarField
171
        (
172
            const atmAlphatkWallFunctionFvPatchScalarField&,
173 174 175 176 177 178
            const fvPatch&,
            const DimensionedField<scalar, volMesh>&,
            const fvPatchFieldMapper&
        );

        //- Construct as copy
179
        atmAlphatkWallFunctionFvPatchScalarField
180
        (
181
            const atmAlphatkWallFunctionFvPatchScalarField&
182 183 184 185 186 187 188
        );

        //- Construct and return a clone
        virtual tmp<fvPatchScalarField> clone() const
        {
            return tmp<fvPatchScalarField>
            (
189
                new atmAlphatkWallFunctionFvPatchScalarField(*this)
190 191 192 193
            );
        }

        //- Construct as copy setting internal field reference
194
        atmAlphatkWallFunctionFvPatchScalarField
195
        (
196
            const atmAlphatkWallFunctionFvPatchScalarField&,
197 198 199 200 201 202 203 204 205 206 207
            const DimensionedField<scalar, volMesh>&
        );

        //- Construct and return a clone setting internal field reference
        virtual tmp<fvPatchScalarField> clone
        (
            const DimensionedField<scalar, volMesh>& iF
        ) const
        {
            return tmp<fvPatchScalarField>
            (
208
                new atmAlphatkWallFunctionFvPatchScalarField(*this, iF)
209 210 211 212
            );
        }


213
    // Member Functions
214

215
        // Evaluation
216

217 218
            //- Update the coefficients associated with the patch field
            virtual void updateCoeffs();
219 220


221
        // Mapping
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249

            //- Map (and resize as needed) from self given a mapping object
            virtual void autoMap(const fvPatchFieldMapper&);

            //- Reverse map the given fvPatchField onto this fvPatchField
            virtual void rmap
            (
                const fvPatchScalarField&,
                const labelList&
            );


        // I-O

            //- Write
            virtual void write(Ostream&) const;
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //