kinematicSingleLayer.H 16.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2009-2010 OpenCFD Ltd.
     \\/     M anipulation  |
-------------------------------------------------------------------------------
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
    Foam::kinematicSingleLayer

Description
    Kinematic form of single-cell layer surface film model

SourceFiles
    kinematicSingleLayer.C

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

#ifndef kinematicSingleLayer_H
#define kinematicSingleLayer_H

#include "surfaceFilmModel.H"
#include "fvMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvMatrices.H"

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

namespace Foam
{
namespace surfaceFilmModels
{

// Forward declaration of classes
class injectionModel;

/*---------------------------------------------------------------------------*\
                   Class kinematicSingleLayer Declaration
\*---------------------------------------------------------------------------*/

class kinematicSingleLayer
:
    public surfaceFilmModel
{
private:

    // Private member functions

        //- Disallow default bitwise copy construct
        kinematicSingleLayer(const kinematicSingleLayer&);

        //- Disallow default bitwise assignment
        void operator=(const kinematicSingleLayer&);


protected:

    // Protected data

        // Mesh databases

            //- Film region mesh database
            fvMesh filmRegion_;

            //- Patch normal vectors
            volVectorField nHat_;

            //- Face area magnitudes / [m2]
            volScalarField magSf_;

            //- List of patch IDs on the primary region coupled with the film
            //  region
            labelList primaryPatchIDs_;

            //- List of patch IDs on oppositte side of the film region
            labelList filmTopPatchIDs_;

            //- List of patch IDs on the film region coupled with the primary
            //  region
            labelList filmBottomPatchIDs_;


        // Solution parameters

            //- Momentum predictor
            Switch momentumPredictor_;

            //- Number of outer correctors
            label nOuterCorr_;

            //- Number of PISO-like correctors
            label nCorr_;

            //- Number of non-orthogonal correctors
            label nNonOrthCorr_;

            //- Cumulative continuity error
            scalar cumulativeContErr_;


        // Model parameters

            //- Skin frition coefficient for film/primary region interface
            scalar Cf_;


        // Thermo properties

            // Fields

                //- Initiliased thermo flag
                bool initialisedThermo_;

                //- Density / [kg/m3]
                volScalarField rho_;

                //- Dynamic viscosity / [Pa.s]
                volScalarField mu_;

                //- Surface tension / [m/s2]
                volScalarField sigma_;


        // Fields

            //- Film thickness / [m]
            volScalarField delta_;

            //- Velocity - mean / [m/s]
            volVectorField U_;

            //- Velocity - surface / [m/s]
            volVectorField Us_;

            //- Velocity - wall / [m/s]
            volVectorField Uw_;

            //- Film thickness*density (helper field) / [kg/m2]
            volScalarField deltaRho_;

            //- Mass flux (includes film thickness) / [kg.m/s]
            surfaceScalarField phi_;


            // Transfer fields - to the primary region

                //- Film mass available for transfer
                volScalarField massForPrimary_;

                //- Parcel diameters originating from film
                volScalarField diametersForPrimary_;

                //- Film mass evolved via phase change
                volScalarField massPhaseChangeForPrimary_;


        // Source term fields

            // Film region - registered to the film region mesh
            // Note: need boundary value mapped from primary region, and then
            // pushed into the patch internal field

                //- Momementum / [kg/m/s2]
                volVectorField USp_;

                //- Pressure / [Pa]
                volScalarField pSp_;

                //- Mass / [kg/m2/s]
                volScalarField rhoSp_;


            // Primary region - registered to the primary region mesh
            // Internal use only - not read-in

                //- Momementum / [kg/m/s2]
                volVectorField USpPrimary_;

                //- Pressure / [Pa]
                volScalarField pSpPrimary_;

                //- Mass / [kg/m2/s]
                volScalarField rhoSpPrimary_;


        // Fields mapped from primary region - registered to the film region
        // Note: need both boundary AND patch internal fields to be mapped

            //- Velocity / [m/s]
            volVectorField UPrimary_;

            //- Pressure / [Pa]
            volScalarField pPrimary_;

212
213
214
215
216
217
            //- Density / [kg/m3]
            volScalarField rhoPrimary_;

            //- Viscosity / [Pa.s]
            volScalarField muPrimary_;

218
219
220
221
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345

        // Sub-models

            //- Injection
            autoPtr<injectionModel> injection_;


       // Checks

           //- Cumulative mass added via sources [kg]
           scalar addedMass_;


    // Protected member functions

        //- Initialise the film model - called on construction
        void initialise();

        //- Read control parameters from dictionary
        virtual bool read();

        //- Correct the thermo fields
        virtual void correctThermoFields();

        //- Reset source term fields
        virtual void resetPrimaryRegionSourceTerms();

        //- Transfer fields from the primary region to the film region
        virtual void transferPrimaryRegionFields();

        // Explicit pressure source contribution
        virtual tmp<volScalarField> pu();

        // Implicit pressure source coefficient
        virtual tmp<volScalarField> pp();

        //- Update the film sub-models
        virtual void updateSubmodels();

        //- Courant number evaluation
        virtual scalar CourantNumber() const;

        //- Continuity check
        virtual void continuityCheck();

        //- Update film surface velocities
        virtual void updateSurfaceVelocities();

        //- Return the stress term for the momentum equation
        virtual tmp<fvVectorMatrix> tau(volVectorField& dU) const;

        //- Constrain a film region master/slave boundaries of a field to a
        //  given value
        template<class Type>
        void constrainFilmField
        (
            Type& field,
            const typename Type::cmptType& value
        );


        // Equations

            //- Solve continuity equation
            virtual void solveContinuity();

            //- Solve for film velocity
            virtual tmp<fvVectorMatrix> solveMomentum
            (
                const volScalarField& pu,
                const volScalarField& pp
            );

            //- Solve coupled velocity-thickness equations
            virtual void solveThickness
            (
                const volScalarField& pu,
                const volScalarField& pp,
                const fvVectorMatrix& UEqn
            );


public:

    //- Runtime type information
    TypeName("kinematicSingleLayer");


    // Constructors

        //- Construct from components
        kinematicSingleLayer
        (
            const word& modelType,
            const fvMesh& mesh,
            const dimensionedVector& g
        );


    //- Destructor
    virtual ~kinematicSingleLayer();


    // Member Functions

        // Access

            //- Return the film mesh database
            virtual const fvMesh& film() const;

            //- Return the patch normal vectors
            inline const volVectorField& nHat() const;

            //- Return the face area magnitudes / [m2]
            inline const volScalarField& magSf() const;

            //- Return the list of coupled patches on the film region
            virtual const labelList& filmBottomPatchIDs() const;

            //- Return the list of patches oppositte coupled patches
            virtual const labelList& filmTopPatchIDs() const;

            //- Return the list of coupled patches on the primary region
            virtual const labelList& primaryPatchIDs() const;


        // Solution parameters

346
347
348
            //- Return the film region solution dictionary
            inline const dictionary& solution() const;

349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
            //- Return the momentum predictor
            inline const Switch& momentumPredictor() const;

            //- Return the number of outer correctors
            inline label nOuterCorr() const;

            //- Return the number of PISO correctors
            inline label nCorr() const;

            //- Return the number of non-orthogonal correctors
            inline label nNonOrthCorr() const;


        // Model parameters

            //- Return the skin friction coefficient
            inline scalar Cf() const;


        // Thermo properties

            //- Return const access to the dynamic viscosity / [Pa.s]
            inline const volScalarField& mu() const;

            //- Return const access to the surface tension / [m/s2]
            inline const volScalarField& sigma() const;


        // Fields

            //- Return const access to the film thickness / [m]
            inline const volScalarField& delta() const;

            //- Return the film velocity [m/s]
            virtual const volVectorField& U() const;

            //- Return the film surface velocity [m/s]
            virtual const volVectorField& Us() const;

            //- Return the film wall velocity [m/s]
            virtual const volVectorField& Uw() const;

            //- Return the film density [kg/m3]
            virtual const volScalarField& rho() const;

            //- Return the film mean temperature [K]
            virtual const volScalarField& T() const;

            //- Return the film surface temperature [K]
            virtual const volScalarField& Ts() const;

            //- Return the film wall temperature [K]
            virtual const volScalarField& Tw() const;

            //- Return the film specific heat capacity [J/kg/K]
            virtual const volScalarField& cp() const;

            //- Return the film thermal conductivity [W/m/K]
            virtual const volScalarField& kappa() const;


           // Transfer fields - to the primary region

               //- Return the film mass available for transfer
               virtual const volScalarField& massForPrimary() const;

               //- Return the parcel diameters originating from film
               virtual const volScalarField& diametersForPrimary() const;

               //- Return the film mass evolved via phase change
               virtual const volScalarField& massPhaseChangeForPrimary() const;


        // External helper functions

            //- Return true if patchI on the primary region is a coupled patch
            //  to the film region
            virtual bool isFilmPatch(const label patchI) const;

            //- External hook to add sources to the film
            virtual void addSources
            (
                const label patchI,            // patchI on primary region
                const label faceI,             // faceI of patchI
                const scalar massSource,       // [kg]
Andrew Heather's avatar
Andrew Heather committed
434
                const vector& momentumSource,  // [kg.m/s] (tang'l momentum)
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
                const scalar pressureSource,   // [kg.m/s] (normal momentum)
                const scalar energySource = 0  // [J]
            );


         // Source fields (read/write access)

            // Primary region

                //- Momementum / [kg/m/s2]
                inline volVectorField& USpPrimary();

                //- Pressure / [Pa]
                inline volScalarField& pSpPrimary();

                //- Mass / [kg/m2/s]
                inline volScalarField& rhoSpPrimary();


            // Film region

                //- Momentum / [kg/m/s2]
                inline volVectorField& USp();

                //- Pressure / [Pa]
                inline volScalarField& pSp();

                //- Mass / [kg/m2/s]
                inline volScalarField& rhoSp();

                //- Momentum / [kg/m/s2]
                inline const volVectorField& USp() const;

                //- Pressure / [Pa]
                inline const volScalarField& pSp() const;

                //- Mass / [kg/m2/s]
                inline const volScalarField& rhoSp() const;


        // Fields mapped from primary region

            //- Velocity / [m/s]
            inline const volVectorField& UPrimary() const;

            //- Pressure / [Pa]
            inline const volScalarField& pPrimary() const;

483
484
485
486
487
488
            //- Density / [kg/m3]
            inline const volScalarField& rhoPrimary() const;

            //- Viscosity / [Pa.s]
            inline const volScalarField& muPrimary() const;

489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561

        // Sub-models

            //- Injection
            inline injectionModel& injection();


        // Helper functions

            //- Return the gravity tangential component contributions
            inline tmp<volVectorField> gTan() const;

            //- Return the gravity normal-to-patch component contribution
            inline tmp<volScalarField> gNorm() const;

            //- Return the gravity normal-to-patch component contribution
            //  Clipped so that only non-zero if g & nHat_ < 0
            inline tmp<volScalarField> gNormClipped() const;


        // Evolution

            //- Pre-evolve film hook
            virtual void preEvolveFilm();

            //- Evolve the film equations
            virtual void evolveFilm();


        // Source fields

            // Mapped into primary region

                //- Return total mass source - Eulerian phase only
                virtual tmp<DimensionedField<scalar, volMesh> > Srho() const;

                //- Return mass source for specie i - Eulerian phase only
                virtual tmp<DimensionedField<scalar, volMesh> > Srho
                (
                    const label i
                ) const;

                //- Return enthalpy source - Eulerian phase only
                virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;


       // I-O

            //- Provide some feedback
            virtual void info() const;
};


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

} // End namespace surfaceFilmModels
} // End namespace Foam

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

#ifdef NoRepository
#   include "kinematicSingleLayerTemplates.C"
#endif

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

#include "kinematicSingleLayerI.H"

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

#endif

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