3D thermal simulation of a building
1. Description
Based on the solution of the stationary heat equation, we create a reduced order model for the simulation of heat exchanges in a 3D building.
The building is composed of a corridor and 5 rooms, each of which contains a heating unit. Internal walls and doors are modelled as having finite thickness, while external walls properties (thickness and insulation) are encoded in the boundary conditions of the problem.
1.1. Mathematical model
Let Ω⊂R3 be the region occupied by the building, and denote Ωi, i=0,1,2 its subregions occupied by the air, the internal walls and the internal doors, such that Ω=∪2i=0Ωi. Let ki be the thermal conductivities associated with the subregions.
The external boundary of the domain ∂Ω is decomposed into two parts: ∂Ωext, which corresponds to external walls, and ∂ΩD which corresponds to the front door. We denote by Γi the boundary of the i−th heating unit, i=0,...,4. The problem writes as
where σ is the convective heat exchange coefficient associated with the front door.
The parameters μi correspond to
-
μi∈(300,340), for i=0,...,4, are the surface temperatures of the heating units (in Kelvin);
-
μ5∈(270,290) is the external temperature (in Kelvin);
-
μ6 is a function of the external wall thickness. The wall is composed of two layers: a cinder layer of thickness lcinder∈(0.1,0.3)m and an insulation layer of thickness linsulation∈(0.1,0.2)m, and
1.2. Construction of the affine decomposition
The problem presents an affine dependence on the parameters, hence we can explicity compute the terms of the correspondent affine decomposition
where NA=1 and NF=6.
The first product on the left-hand side is given by θA0(μ)=1 and
where γ is the Nitsche penalty parameter and h is the local mesh size.
The second product is given by θA1(μ)=μ6 and
The terms on the right-hand side are θFi(μ)=μi for i=0,...,4, corresponding to the temperatures of the heating units, θF5(μ)=μ5μ6, corresponding to the temperature on the internal surface of the external walls, and θF6(μ)=μ5, corresponding to the external temperature. The corresponding linear forms are
3. Parameters
The table displays the various fixed and variables parameters of this test-case.
Name |
Description |
Range |
Units |
μ0 |
Heater temperature living room |
[300,340] |
K |
μ1 |
Heater temperature kitchen |
[300,340] |
K |
μ2 |
Heater temperature bedroom 1 |
[300,340] |
K |
μ3 |
Heater temperature bedroom 2 |
[300,340] |
K |
μ4 |
Heater temperature bathroom |
[300,340] |
K |
μ5 |
External temperature |
[270,290] |
K |
μ6 |
Exchange coefficient external walls |
Name |
Description |
Value |
γ |
Boundary conditions using Nitsche method |
10 |
k0 |
Air conductivity |
1 |
k1 |
Conductivity - internal walls |
0.25 |
k2 |
Conductivity - internal doors |
0.13 |
σ |
Heat transfer coefficient - front door |
1.00.06+0.060.150+0.10.029+0.14 |
4. Setup for the notebook simulation
girder_path = "https://girder.math.unistra.fr/api/v1/item/64d60522b0e9570499e1eaa1/download"
fpp_name = 'thermalbuilding.fpp'
time = 0
Results
5. Downloading the reduced order model from Girder
The offline creation of the reduced basis has already been performed, and an archive is downloaded from Girder. It contains the basis, the model and the configuration files that are necessary for the online simulation. The following code snippet performs the download.
import requests
r=requests.get(girder_path)
with open(fpp_name,'wb') as f:
f.write(r.content)
Results
6. Running the case using a Jupyter notebook
It is possible to download this page as a Jupyter notebook and run it in an environment that contains a local installation of Feel++ and its Python wrappers.
import feelpp
from feelpp.mor import *
ms=feelpp.mor.MORModels(fpp_name)
muspace = ms.parameterSpace()
sampling = muspace.sampling()
sampling.sample(4, "random")
r=ms.run(sampling,{"N":10})
Results
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) File:1 ----> 1 import feelpp 2 from feelpp.mor import * 3 ms=feelpp.mor.MORModels(fpp_name) ModuleNotFoundError: No module named 'feelpp'
from pandas import DataFrame as df
from pandas import options as op
from pandas import set_option
outputs={}
errors={}
output_dataframes = list()
errors_dataframes = list()
for i in range(len(r)):
outputs={}
errors={}
for o in range(len(r[i])):
str_time = "Time"
str_output = "Output "+str(o)
str_error = "Error "+str(o)
outputs[str_time] = time
outputs[str_output] = np.array(r[i][o].outputs())
outputs[str_error] = [np.array(r[i][o].errors())]
output_frame = df(data=outputs)
set_option('display.float_format', '{:.2E}'.format)
output_dataframes.append(output_frame)
op.display.max_colwidth = 100
i=0
for frame in output_dataframes:
print("Parameters :",sampling[i])
print(frame)
print("\n")
i=i+1
Results
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) File:1 ----> 1 from pandas import DataFrame as df 2 from pandas import options as op 3 from pandas import set_option ModuleNotFoundError: No module named 'pandas'