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-------------------------------------------------------------------------------
10License
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
39void 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
109void 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// ************************************************************************* //
Parameters for PDRsetFields.
Definition: PDRparams.H:56
scalar def_grating_slat_w
Default slat thickness grating.
Definition: PDRparams.H:124
string UPatchBc
"fixedValue;value uniform (0 0 0)"
Definition: PDRparams.H:71
scalar blockedFacePar
Faces with area blockage greater than this are blocked.
Definition: PDRparams.H:130
bool legacyObsSpec
Definition: PDRparams.H:74
scalar gridPointTol
Definition: PDRparams.H:99
scalar scale
Overall scale factor.
Definition: PDRparams.H:140
scalar empty_lobs_fac
Lobs in empty cell is this * cube root of cell volume.
Definition: PDRparams.H:116
scalar maxCR
Upper limit on CR (CT also gets limited)
Definition: PDRparams.H:133
bool outer_orthog
Definition: PDRparams.H:84
word groundPatchName
The name for the "ground" patch.
Definition: PDRparams.H:66
scalar min_overlap_vol
Definition: PDRparams.H:109
bool noIntersectN
Definition: PDRparams.H:81
int overlaps
Flag to control which overlap calculations are performed.
Definition: PDRparams.H:97
scalar obs_expand
Definition: PDRparams.H:121
scalar min_overlap_area
Definition: PDRparams.H:110
bool blockedFacesWallFn
Definition: PDRparams.H:82
scalar blockedCellPoros
Cells with porosity less than this are blocked.
Definition: PDRparams.H:127
scalar blockageNoCT
Definition: PDRparams.H:137
bool ignoreGratings
Definition: PDRparams.H:83
int nPairsToBlockC
Definition: PDRparams.H:94
scalar outerCombFac
Value for outer region.
Definition: PDRparams.H:119
bool legacyMeshSpec
Definition: PDRparams.H:73
int nFacesToBlockC
Definition: PDRparams.H:90
word outerPatchName
The name for the "outer" patch.
Definition: PDRparams.H:69
scalar min_width
Ignore obstacles with second dimension (or diameter) less than this.
Definition: PDRparams.H:113
void readDefaults(const dictionary &dict)
Set or read defaults from dictionary.
scalar cong_max_betav
Definition: PDRparams.H:107
virtual bool read()
Re-read model coefficients if they have changed.
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
Definition: dictionaryI.H:127
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionaryI.H:87
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
void inplaceExpand(std::string &s, const HashTable< string > &mapping, const char sigil='$')
Definition: stringOps.C:731
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
Definition: stringOps.C:1067
Foam::PDRparams pars
Globals for program parameters (ugly hack)
labelList f(nPoints)
dictionary dict