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

25 statements  

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

1import tempfile 

2from pathlib import Path 

3 

4import bim2sim 

5from bim2sim import Project, run_project, ConsoleDecisionHandler 

6from bim2sim.kernel.decision.decisionhandler import DebugDecisionHandler 

7from bim2sim.utilities.types import IFCDomain 

8 

9 

10def run_example_10(): 

11 """ 

12 Prepare an OpenFOAM case with ventilation and zero gradient heatflux. 

13 

14 This example runs a BPS with the EnergyPlus backend and a CFD simulation 

15 with the OpenFOAM backend. It specifies project 

16 directory and location of the IFC file. Then, it creates a bim2sim 

17 project with the EnergyPlus backend. Simulation settings are specified 

18 (EnergyPlus location needs to be specified according to your system, 

19 other settings are set to default if not specified otherwise), 

20 before the project is executed with the previously specified settings. 

21 

22 The EnergyPlus simulation is followed by the setup of the OpenFOAM 

23 CFD use case, which bases on the same IFC input as the previously set 

24 up EnergyPlus use case. 

25 """ 

26 # Create a temp directory for the project, feel free to use a "normal" 

27 # directory 

28 project_path = Path( 

29 tempfile.TemporaryDirectory(prefix='bim2sim_openfoam10_').name) 

30 

31 # Set the ifc path to use and define which domain the IFC belongs to 

32 ifc_paths = { 

33 IFCDomain.arch: 

34 Path(bim2sim.__file__).parent.parent / 

35 'test/resources/arch/ifc/AC20-FZK-Haus.ifc', 

36 } 

37 

38 # Create a project including the folder structure for the project with 

39 # energyplus as backend 

40 project = Project.create(project_path, ifc_paths, 'openfoam') 

41 

42 # set weather file data 

43 project.sim_settings.weather_file_path = ( 

44 Path(bim2sim.__file__).parent.parent / 

45 'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.epw') 

46 # Set the install path to your EnergyPlus installation according to your 

47 # system requirements 

48 # project.sim_settings.ep_install_path = 'C://EnergyPlusV9-4-0/' 

49 

50 # run annual simulation for EnergyPlus 

51 # project.sim_settings.run_full_simulation = True 

52 

53 # Set other simulation settings, otherwise all settings are set to default 

54 project.sim_settings.cfd_export = True 

55 project.sim_settings.select_space_guid = '2RSCzLOBz4FAK$_wE8VckM' 

56 project.sim_settings.run_meshing = False 

57 project.sim_settings.run_cfd_simulation = False 

58 project.sim_settings.add_heating = False 

59 project.sim_settings.add_floorheating = False 

60 project.sim_settings.ignore_heatloss = True 

61 project.sim_settings.add_airterminals = True 

62 answers = ('ArchiCAD', 'ArchiCAD', *('Single office',)*4) 

63 project.sim_settings.inlet_type = 'SimpleStlDiffusor' 

64 project.sim_settings.outlet_type = 'SimpleStlDiffusor' 

65 # Run the project with the ConsoleDecisionHandler. This allows interactive 

66 # input to answer upcoming questions regarding the imported IFC. 

67 run_project(project, DebugDecisionHandler(answers)) 

68 

69 

70if __name__ == '__main__': 

71 run_example_10()