PDRparams.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) 2019-2021 OpenCFD Ltd.
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 "PDRparams.H"
29 #include "stringOps.H"
30 
31 // * * * * * * * * * * * * * * * * Global Data * * * * * * * * * * * * * * * //
32 
33 // Global parameter settings
35 
36 
37 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
38 
39 void Foam::PDRparams::readDefaults(const dictionary& dict)
40 {
41  dict.readIfPresent("legacyMeshSpec", legacyMeshSpec);
42  dict.readIfPresent("legacyObsSpec", legacyObsSpec);
43 
44  dict.readIfPresent("two_d", two_d);
45  dict.readIfPresent("yCyclic", yCyclic);
46  dict.readIfPresent("ySymmetry", ySymmetry);
47  dict.readIfPresent("deluge", deluge);
48 
49  dict.readIfPresent("newFields", new_fields);
50  dict.readIfPresent("noIntersectN", noIntersectN);
51 
52  dict.readIfPresent("blockedFacesWallFn", blockedFacesWallFn);
53  dict.readIfPresent("ignoreGratings", ignoreGratings);
54 
55  outer_orthog = dict.found("outer_orthog");
56 
57  dict.readIfPresent("debug.level", debugLevel);
58  dict.readIfPresent("nFacesToBlockC", nFacesToBlockC);
59  dict.readIfPresent("nPairsToBlockC", nPairsToBlockC);
60  dict.readIfPresent("overlaps", overlaps);
61 
62  dict.readIfPresent("gridPointTol", gridPointTol);
63 
64  dict.readIfPresent("Cb_r", cb_r);
65  dict.readIfPresent("Cb_s", cb_s);
66 
67  dict.readIfPresent("Cd_r", cd_r);
68  dict.readIfPresent("Cd_s", cd_s);
69 
70  dict.readIfPresent("congRegionMaxBetav", cong_max_betav);
71 
72  dict.readIfPresent("min_overlap_vol", min_overlap_vol);
73  dict.readIfPresent("min_overlap_area", min_overlap_area);
74  dict.readIfPresent("min_width", min_width);
75  dict.readIfPresent("empty_lobs_fac", empty_lobs_fac);
76  dict.readIfPresent("outerCombFac", outerCombFac);
77  dict.readIfPresent("obs_expand", obs_expand);
78 
79  dict.readIfPresent("def_grating_slat_w", def_grating_slat_w);
80  dict.readIfPresent("blockedCellPoros", blockedCellPoros);
81  dict.readIfPresent("blockedFacePar", blockedFacePar);
82  dict.readIfPresent("maxCR", maxCR);
83 
84  dict.readIfPresent("blockageNoCT", blockageNoCT);
85  dict.readIfPresent("scale", scale);
86 
87 
88  const dictionary* dictptr;
89 
90  groundPatchName = "ground";
91  outerPatchName = "outer";
92 
93  if ((dictptr = dict.findDict("patchNames")) != nullptr)
94  {
95  const dictionary& d = *dictptr;
96 
97  d.readIfPresent("ground", groundPatchName);
98  d.readIfPresent("outer", outerPatchName);
99  }
100 
101  UPatchBc = "fixedValue;value uniform (0 0 0)";
102  if (dict.readIfPresent("UPatchBc", UPatchBc))
103  {
105  }
106 }
107 
108 
109 void Foam::PDRparams::read(const dictionary& dict)
110 {
111  readDefaults(dict);
112 
113  dict.readEntry("obsFileDir", obsfile_dir);
114  dict.readEntry("obsFileNames", obsfile_names);
115 
116  stringOps::inplaceExpand(obsfile_dir);
117 
118  for (auto& f : obsfile_names)
119  {
121  }
122 }
123 
124 
125 // ************************************************************************* //
word outerPatchName
The name for the "outer" patch.
Definition: PDRparams.H:69
scalar blockedFacePar
Faces with area blockage greater than this are blocked.
Definition: PDRparams.H:148
dictionary dict
bool legacyObsSpec
Definition: PDRparams.H:74
bool ignoreGratings
Definition: PDRparams.H:83
bool legacyMeshSpec
Definition: PDRparams.H:73
scalar blockageNoCT
If a single obstacle blocks a cell by more than this, then no CT in that direction.
Definition: PDRparams.H:159
void read(const dictionary &dict)
Read program parameters from dictionary.
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
Definition: stringOps.C:1053
scalar def_grating_slat_w
Default slat thickness grating.
Definition: PDRparams.H:138
scalar obs_expand
Definition: PDRparams.H:133
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect...
scalar maxCR
Upper limit on CR (CT also gets limited)
Definition: PDRparams.H:153
scalar min_width
Ignore obstacles with second dimension (or diameter) less than this.
Definition: PDRparams.H:121
bool noIntersectN
Definition: PDRparams.H:81
word groundPatchName
The name for the "ground" patch.
Definition: PDRparams.H:64
int overlaps
Flag to control which overlap calculations are performed.
Definition: PDRparams.H:103
scalar min_overlap_vol
Definition: PDRparams.H:115
scalar outerCombFac
Value for outer region.
Definition: PDRparams.H:131
string UPatchBc
"fixedValue;value uniform (0 0 0)"
Definition: PDRparams.H:71
void inplaceExpand(std::string &s, const HashTable< string > &mapping, const char sigil='$')
Inplace expand occurrences of variables according to the mapping. Does not use environment values...
Definition: stringOps.C:717
int nPairsToBlockC
Min number of blocked cell face pairs (on opposite faces of a cell) for a cell to be marked as blocke...
Definition: PDRparams.H:98
labelList f(nPoints)
scalar min_overlap_area
Definition: PDRparams.H:116
Parameters for PDRsetFields.
Definition: PDRparams.H:51
Foam::PDRparams pars
Globals for program parameters (ugly hack)
scalar cong_max_betav
Definition: PDRparams.H:113
bool outer_orthog
Definition: PDRparams.H:84
bool blockedFacesWallFn
Definition: PDRparams.H:82
scalar empty_lobs_fac
Lobs in empty cell is this * cube root of cell volume.
Definition: PDRparams.H:126
int nFacesToBlockC
Min number of blocked cell faces for a cell to be marked as blocked.
Definition: PDRparams.H:92
scalar scale
Overall scale factor.
Definition: PDRparams.H:164
scalar gridPointTol
Definition: PDRparams.H:105
scalar blockedCellPoros
Cells with porosity less than this are blocked.
Definition: PDRparams.H:143
void readDefaults(const dictionary &dict)
Set or read defaults from dictionary.