Coverage for bim2sim/plugins/PluginOpenFOAM/bim2sim_openfoam/sim_settings.py: 0%

50 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-10-01 10:24 +0000

1import bim2sim.sim_settings 

2from bim2sim.elements import bps_elements as bps_elements, hvac_elements as hvac_elements 

3from bim2sim.elements.base_elements import Material 

4from bim2sim.plugins.PluginComfort.bim2sim_comfort import ComfortSimSettings 

5from bim2sim.sim_settings import BooleanSetting, ChoiceSetting, NumberSetting 

6 

7 

8class OpenFOAMSimSettings(ComfortSimSettings): 

9 def __init__(self): 

10 super().__init__() 

11 self.relevant_elements = {*bps_elements.items, 

12 hvac_elements.AirTerminal, 

13 hvac_elements.SpaceHeater, 

14 Material} 

15 

16 add_heating = BooleanSetting( 

17 default=True, 

18 description='Whether to add heating devices or not.', 

19 for_frontend=True 

20 ) 

21 add_floorheating = BooleanSetting( 

22 default=False, 

23 description='Whether to add floorheating instead of usual radiators.', 

24 for_frontend=True 

25 ) 

26 add_airterminals = BooleanSetting( 

27 default=True, 

28 description='Whether to add air terminals or not.', 

29 for_frontend=True 

30 ) 

31 ignore_heatloss = BooleanSetting( 

32 default=False, 

33 description='Ignores heat loss through walls if set to True.', 

34 for_frontend=True 

35 ) 

36 inlet_type = ChoiceSetting( 

37 default='Plate', 

38 choices={ 

39 'Original': 'Simplified IFC shape for inlet', 

40 'Plate': 'Simplified plate for inlet', 

41 'StlDiffusor': 'Inlet diffusor from stl file', 

42 'SimpleStlDiffusor': 'Simplified inlet diffusor from stl file', 

43 'IfcDiffusor': 'Inlet diffusor modified from ifc file (if ' 

44 'available), otherwise stl diffusor from file.', 

45 'None': 'No inlet plate, only gap in ceiling.' 

46 }, 

47 description='Choose air terminal inlet type.', 

48 for_frontend=True 

49 ) 

50 outlet_type = ChoiceSetting( 

51 default='Plate', 

52 choices={ 

53 'Original': 'Simplified IFC shape for outlet', 

54 'Plate': 'Simplified plate for outlet', 

55 'StlDiffusor': 'Outlet diffusor from stl file', 

56 'SimpleStlDiffusor': 'Simplified outlet diffusor from stl file', 

57 'IfcDiffusor': 'Outlet diffusor modified from ifc file (if ' 

58 'available), otherwise stl diffusor from ' 

59 'file.', 

60 'None': 'No outlet plate, only gap in ceiling.' 

61 }, 

62 description='Choose air terminal outlet type.', 

63 for_frontend=True 

64 ) 

65 outflow_direction = ChoiceSetting( 

66 default='down', 

67 choices={ 

68 'down': 'Outflow facing downward. Only applicable for original ' 

69 'shapes.', 

70 'side': 'Outflow facing sideways. Only applicable for original ' 

71 'shapes.', 

72 'angle45down': 'Outflow facing downward with a 45 degrees angle. ' 

73 'Only applicable for original shapes.' 

74 }, 

75 description='Choose the outflow direction for original shapes from ' 

76 'IFC that should be automatically processed. Defaults to ' 

77 'downward facing flows.' 

78 ) 

79 select_space_guid = ChoiceSetting( 

80 default='', 

81 choices={ 

82 '': 'No guid selected, first space will be selected.' 

83 }, 

84 description='Select space for OpenFOAM simulation by setting the ' 

85 'space guid.', 

86 for_frontend=True, 

87 any_string=True, 

88 ) 

89 simulation_date = ChoiceSetting( 

90 default='12/21', 

91 description='Select date of simulation according to simulated ' 

92 'timeframe in the PluginEnergyPlus. Insert as string in ' 

93 'format MM/DD.', 

94 choices={ 

95 '12/21': 'Winter design day', 

96 '07/21': 'Summer design day', 

97 }, 

98 for_frontend=True, 

99 any_string=True 

100 ) 

101 simulation_time = NumberSetting( 

102 default=11, 

103 description='Select time of simulation according to simulated timeframe ' 

104 'in the PluginEnergyPlus. Insert as number (time) ' 

105 'for the full hour ranging 1 to 24.', 

106 min_value=1, 

107 max_value=24, 

108 for_frontend=True, 

109 ) 

110 simulation_type = ChoiceSetting( 

111 default='steady', 

112 choices={ 

113 'steady': 'steady-state simulation', 

114 'combined': 'preconditioned transient simulation', 

115 'transient': 'transient simulation' 

116 }, 

117 description='Select simulation type (steady-state, combined or ' 

118 'transient).', 

119 for_frontend=True, 

120 ) 

121 mesh_size = NumberSetting( 

122 default=0.1, 

123 description='Set the mesh size of the blockMesh in [m]. Insert a ' 

124 'number between 0.001 and 0.2.', 

125 min_value=0.001, 

126 max_value=0.4, 

127 for_frontend=True, 

128 ) 

129 mesh_max_global_cells = NumberSetting( 

130 default=3000000, 

131 description='Set the maximum number of global cells for meshing in ' 

132 'snappyHexMesh.', 

133 min_value=2000000, 

134 max_value=50000000, 

135 for_frontend=True, 

136 ) 

137 adjust_refinements = BooleanSetting( 

138 default=False, 

139 description='Whether surface and region refinements of airterminals ' 

140 'and interior elements should be automatically ' 

141 'recomputed or not.', 

142 for_frontend=True 

143 ) 

144 total_iterations = NumberSetting( 

145 default=20000, 

146 min_value=20, 

147 max_value=50000, 

148 description='Total number of iterations for the simulation.', 

149 for_frontend=True 

150 ) 

151 steady_iterations = NumberSetting( 

152 default=2500, 

153 min_value=20, 

154 max_value=15000, 

155 for_frontend=True, 

156 description='Select number of steady iterations for preconditioning ' 

157 'a transient simulation.', 

158 ) 

159 n_procs = NumberSetting( 

160 default=12, 

161 min_value=1, 

162 description='Set the number of processors for decomposition and ' 

163 'simulation.', 

164 for_frontend=True 

165 ) 

166 run_meshing = BooleanSetting( 

167 default=False, 

168 description='Whether to run OpenFOAM meshing or not. Only available for' 

169 ' linux systems.', 

170 for_frontend=True 

171 ) 

172 run_cfd_simulation = BooleanSetting( 

173 default=False, 

174 description='Whether to run the OpenFOAM CFD simulation or not. Only ' 

175 'available for linux systems.', 

176 for_frontend=True 

177 ) 

178 heater_radiation = NumberSetting( 

179 default=0.3, 

180 description='Select the radiative portion of the heating heat transfer.' 

181 ' Choose between 0 and 1.', 

182 min_value=0, 

183 max_value=1, 

184 for_frontend=True, 

185 ) 

186 add_comfort = BooleanSetting( 

187 default=True, 

188 description='Whether to add thermal comfort settings to OpenFOAM', 

189 for_frontend=True 

190 ) 

191 add_furniture = BooleanSetting( 

192 default=False, 

193 description='Whether to add furniture to OpenFOAM', 

194 for_frontend=True 

195 ) 

196 level_heat_balance = BooleanSetting( 

197 default=True, 

198 description='Whether to level heat balance: reduce heating towards ' 

199 'leveled heat balance considering internal gains.' 

200 ) 

201 furniture_setting = ChoiceSetting( 

202 default='Office', 

203 choices={ 

204 'Office': 'Office setup, chair and desk', 

205 'Concert': 'Concert setup, chairs in rows', 

206 'Meeting': 'Meeting setup, large table with chairs', 

207 'TwoSideTable': 'Table with chairs on long side', 

208 'GroupTable': 'Group table with chairs', 

209 'Classroom': 'Classroom setup, individual tables with chairs' 

210 }, 

211 description='Select the type of furniture to add.', 

212 for_frontend=True 

213 ) 

214 furniture_amount = NumberSetting( 

215 default=1, 

216 min_value=0, 

217 max_value=300, 

218 for_frontend=True, 

219 ) 

220 furniture_orientation = ChoiceSetting( 

221 default='short_side', 

222 choices={ 

223 'long_side': 'Long side of a rectangular space', 

224 'short_side': 'short side of a rectangular space', 

225 'window': 'window side of a rectangular space', 

226 'door': 'door side of a rectangular space', 

227 'north': 'North side', 

228 'east': 'East side', 

229 'south': 'South side', 

230 'west': 'West side', 

231 } 

232 ) 

233 add_people = BooleanSetting( 

234 default=False, 

235 for_frontend=True, 

236 description='Choose if people should be added.' 

237 ) 

238 use_energyplus_people_amount = BooleanSetting( 

239 default=False, description='Choose if number of people should be ' 

240 'assigned as defined in the EnergyPlus ' 

241 'simulation. If true, people_amount is not ' 

242 'considered but overwritten with the ' 

243 'rounded up number of people from the ' 

244 'EnergyPlus simulation. ' 

245 ) 

246 people_setting = ChoiceSetting( 

247 default='Seated', 

248 choices={ 

249 'Seated': 'Seated, furniture needs to be provided in sufficient amount. ', 

250 'Standing': 'Standing, no furniture required.' 

251 }, 

252 description='Select type of people positioning to add.', 

253 for_frontend=True 

254 ) 

255 people_amount = NumberSetting( 

256 default=1, 

257 min_value=0, 

258 max_value=300, 

259 for_frontend=True, 

260 ) 

261 radiation_model = ChoiceSetting( 

262 default='P1', 

263 choices={ 

264 'none': 'No radiation', 

265 'P1': 'Use P1 Radiation Model', 

266 'fvDOM': 'Use fvDOM Radiation Model', 

267 'preconditioned_fvDOM': 'Use P1 to precondition fvDOM Radiation', 

268 }, 

269 description='Choose the radiation model', 

270 for_frontend=True 

271 ) 

272 radiation_precondition_time = NumberSetting( 

273 default=1000, 

274 min_value=10, 

275 max_value=5000, 

276 description='Choose number of preconditioning iterations using P1 ' 

277 'radiation for fvDOM radiation', 

278 for_frontend=True 

279 ) 

280 add_solar_radiation=BooleanSetting( 

281 default=True, 

282 description='Add solar radiation. Requires fvDOM as radiation model.', 

283 for_frontend=True 

284 ) 

285 add_air_volume_evaluation = BooleanSetting( 

286 default=False, 

287 description='Add an air volume evaluation. Removes voids of all ' 

288 'people, furniture elements, and heaters, to enhance the ' 

289 'evaluation of the air volume itself. This is ' 

290 'computationally expensive.', 

291 for_frontend=True 

292 ) 

293 scale_person_for_eval = NumberSetting( 

294 default=0.05, 

295 min_value=0.001, 

296 max_value=0.2, 

297 description='Scale shape of person for evaluation in paraview.', 

298 for_frontend=True, 

299 ) 

300 mesh_feature_snapping = BooleanSetting( 

301 default=False, 

302 description='Choose if explicit surface feature snapping should be ' 

303 'applied in snappyHexMesh. ', 

304 for_frontend=True 

305 ) 

306 cluster_jobname = ChoiceSetting( 

307 default="newJob", 

308 choices={"fullRun": "Specify content", "Job1234": "Enumerate"}, 

309 description='Jobname that is used when running the simulation via a ' 

310 'batch script on the RWTH Compute Cluster.', 

311 for_frontend=True, 

312 any_string=True 

313 ) 

314 cluster_compute_account = ChoiceSetting( 

315 default='', 

316 choices={ 

317 '': 'Skip defining compute cluster account.', 

318 "thes1234": "Define thesis account", 

319 "rwth5678": "Define user account" 

320 }, 

321 description=r'Specify the compute account that is used for running ' 

322 r'the simulation on the RWTH Compute Cluster. Specify as ' 

323 r'"thes1234".', 

324 for_frontend=True, 

325 any_string=True 

326 ) 

327 cluster_max_runtime_simulation = ChoiceSetting( 

328 default="23:59:00", 

329 choices={"11:59:00": "12 hours", "06:00:00": "6 hours"}, 

330 description=r'Max runtime for a full simulation in the format of ' 

331 r'"D:HH:MM:SS".', 

332 for_frontend=True, 

333 any_string=True 

334 ) 

335 cluster_max_runtime_meshing = ChoiceSetting( 

336 default="00:59:00", 

337 choices={"00:30:00": "30 minutes", "00:15:00": "15 minutes"}, 

338 description='Max runtime for meshing in the format of ' 

339 'D:HH:MM:SS .', 

340 for_frontend=True, 

341 any_string=True 

342 ) 

343 cluster_cpu_per_node = NumberSetting( 

344 default=96, 

345 min_value=1, 

346 max_value=1024, 

347 description='Number of physical cores per node.', 

348 for_frontend=True 

349 )