PDRsetFields.H
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) 2016 Shell Research Ltd.
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 Description
28  Preparation of fields for PDRFoam
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef PDRsetFields_H
33 #define PDRsetFields_H
34 
35 #include "PDRarrays.H"
36 #include "PDRblock.H"
37 #include "PDRmeshArrays.H"
38 #include "PDRobstacle.H"
39 #include "PDRpatchDef.H"
40 #include "PDRparams.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 using namespace Foam;
45 
46 
47 //YCYCLIC is set to 1 for running the test cases with a cyclic boundry condition in the y direction
48 //TWO_D is set to 1 for running the 2D test cases (no z direction) - usually same case as YCYCLIC
49 //Now specified in CAD_PDRDict and read in as globals.
50 
51 // The program also labels intersection obstacles as types 96 and 86, but not then use these values
52 // Obstacles in group definitions have a multiple of 100 added to the type number
53 
54 #define floatSMALL 1.e-10
55 
56 // Default initial values of field variables, used outside congested area,
57 //and everywhere for uniform fields. They atre strings because same routines
58 //are used to create b.c.s for scalars and tensors.
59 #define DEFAULT_K 0.00015
60 #define DEFAULT_EPS 1e-5
61 #define DEFAULT_T 300
62 #define DEFAULT_P 100000
63 #define DEFAULT_SU 0.5
64 #define DEFAULT_LOBS 0.1 // Does not matter what it is outside congestion
65  // but zero would cause problems with Ep
66 #define DEFAULT_EP 0.01 // Gives length scale 0.1, calc. as (Xp-0.999)/Ep with Xp=1
67 
68 // Boundary conditions on walls for all variables where it is not "zero_gradient"
69 #define K_WALL_FN "kqRWallFunction"
70 #define EPS_WALL_FN "epsilonWallFunction"
71 #define ALPHAT_WALL "nutkWallFunction"
72 #define MUT_WALL_FN "mutkWallFunction"
73 #define NUT_WALL_FN "nutkWallFunction"
74 
75 #define K_WALL_FN_LEGACY "compressible::kqRWallFunction"
76 #define EPS_WALL_FN_LEGACY "compressible::epsilonWallFunction"
77 #define ALPHAT_WALL_FN_LEGACY "alphatWallFunction;\n\t\tPrt\t0.85"
78 
79 
80 // The following parameters are used to decide when there arMAX_Ne sufficient (parts of)
81 // obstacles ina cell for them to define the length scale of the generated turbulence.
82 #define MIN_AB_FOR_SIZE 0.002
83 #define MAX_VB_FOR_SIZE 0.9
84 #define COUNT_FOR_SIZE 0.1
85 #define MIN_COUNT_FOR_SIZE 0.05
86 
87 // These define how blocked a face or cell has to be for removal from the mesh
88 //#define BLOCKED_CELL_PAR 0.05 //<- Now pars.blockedCellPoros
89 //#define BLOCKED_FACE_PAR 0.95 //<- Now pars.blockedFacePar
90 
91 
92 //- Calculate block/block overlaps
93 //
94 // Binary self-intersections are to be checked for blocks.
95 // Resulting negative blocks are appended to blocks.
96 // These new blocks have the opposite sign from input blocks, and
97 // blockage multiplied by multiplier.
98 //
99 // If the number of newly generated blocks is required, check the size
100 // of blocks on output vs input to see how many have been added.
101 //
102 // \param[in,out] blocks
103 // \param[in] range - the range within blocks to be examined
104 //
105 // \return overlap volume
106 scalar block_overlap
107 (
108  DynamicList<PDRobstacle>& blocks,
109  const labelRange& range,
110  const scalar multiplier = 1.0
111 );
112 
113 
114 //- Calculate block/cylinder overlaps
115 //
116 // Binary intersections are to be checked for blocks and cylinders.
117 // Resulting negative blocks are appended to blocks.
118 // These new blocks have the opposite sign from input blocks, and
119 // blockage multiplied by multiplier.
120 //
121 // If the number of newly generated blocks is required, check the size
122 // of blocks on output vs input to see how many have been added.
123 //
124 // \param[in,out] arrp
125 // \param[in,out] blocks
126 // \param[in] range - the range within blocks to be examined
127 // \param[in] cylinders - the cylinders to be examined
128 //
129 // \return overlap volume
131 (
132  DynamicList<PDRobstacle>& blocks,
133  const labelRange& range,
134  const UList<PDRobstacle>& cylinders
135 );
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:51
scalar block_cylinder_overlap(DynamicList< PDRobstacle > &blocks, const labelRange &range, const UList< PDRobstacle > &cylinders)
Calculate block/cylinder overlaps.
scalar range
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:51
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:99
scalar block_overlap(DynamicList< PDRobstacle > &blocks, const labelRange &range, const scalar multiplier=1.0)
Calculate block/block overlaps.
Namespace for OpenFOAM.