KIM-HANJOO / TOY-CFD-for-ground

simple imitation of CFD in MATLAB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TOY-CFD for ground node

written in 2021.

simple 6-6-6 size 3D ground Heat-transfer model

only applicable to the ground node of 1D heat-transfer model suggested, as a module for the ground node.

Coded for 'Building Energy Modeling and Analysis' course of 'Civil, Environmental and Architectural Engineering, Korea .UNIV'


CAUTION

This model can be only used on the 1D heat-transfer room model. The information of the model is at below, 'room_input(2).xlsx' contains the information of the room model. In the room model, 18th node is the ground node, and the heat exchange between the floor and the ground is assumed as 1D heat-transfer instead of 3D heat-transfer.
TOY-CFD is designed to get rid of this inaccuracy appeared by the 1D heat transfer of ground node. In the model, ground node of the existing room model is deleted, and instead 244 nodes (6-6-6 meshed ground and 28 additional surface nodes) are attached to the feet of the building. This model can be only used in this room design.

<left and middle : node and node numbers of the room model / right : mesh >


RUN

  1. MATLAB is required
  2. download and place the files in the same folder
  3. run 'set_up.mat'
  4. run 'Heat_transfer_3Dground_simulation.mat'
  5. run 'Heat_transfer_3Dground_plotter.mat'

'room_input(2)' contains the informations of the room we are modeling
'TMY3' contains the weather data of a whole year (from January 1st to December 31st)


CONCEPT

  1. mesh 12m * 12m * 12m sized ground with 2m interval
  2. cubes will be made by meshing (6 * 6 * 6)
  3. center of every cubes underground represents 'nodes'
  4. every nodes(= cubes) exchange heat with 6 face-to-face attached nodes (= cubes)

KEY ASSUMPTIONS

  1. The ground is made up of homogeneous soil and has the same property at any point, regardless of depth or location.

  2. Ignore the shade effect by the building and surroundings. Temperatures are the same at any point on the surface.

  3. Assume that underground temperature begins constant from the depth of 12 meters

  4. All cubes (=nodes) produced by meshing exchange heat solely through conduction, with six other cubes (=nodes) adjacent to the face.

Algorithm

Here is the explanation of the algorighm. we have to understand that in the basic 1D Heat-transfer model(you can run it with 'basics.mat', further process explaned below) there are 18 nodes represents the room element and boundary conditions. Among the nodes, there is node number 18, which represents the ground node of the model.

What we are trying to do in this TOY-CFD code is to replace this single node with several nodes to express the particles of the 3D-ground. And we still want to use the basic 1D room model we already made. So we have to remove 18th node and add more particle nodes instead(in this code, 216 ground nodes + 28 surface nodes).

Because we assumed the ground as 12m-12m-12m size and meshed with 2m intervals, we will get 6 times 6 times 6 additional nodes(216 nodes) as the ground nodes, and also we need to add 'surface nodes' on top of the ground nodes to explane the convection, longwave radiation, solar heat gain acting on the surface of the ground. That's additionally 28 nodes more(6 times 6 top-ground nodes minus 8 building feet nodes). The M, S matrix we have to make will have the size of 216-by-216 (216 +28 + 17), in case of f matrix 216-by-1.

But before we make M, S and f matrix, first we have to decide what nodes should be set as the boundary conditions. In addition to the Sky node and the Outdoor air node in the basic 1D heat-transfer model, we will set the bottom plane and the side planes of the 6-6-6 space as boundary conditions. Nodes placed on the top plane of the space is not boundary conditions since they have to change their temp and exchange heat with Sky node, Outdoor air node and ground nodes. Than the number of the boundary condition nodes added as the ground nodes are 116. Quite large. These boundary condtions will be considered when making M, S and f matrix.

Here is how I made M, S matrix.

M, S and f matrix is used for making ODE of heat-transfer. M matrix represents the thermal mass of each nodes, S matrix for the heat exchanges occurs with temperature difference, f matrix for the temerature of boundary conditions and the heat exchanges occurs in regardless of temerature differences. You can find more by 'unsteady-state heat transfer model'.

'cubes underground' means the 216 number of ground nodes. By the 'Key Assumptions 1) and 4)', thermal mass of all cubes will be same, and there will be only conduction for cubes to transfer heat. The number of conduction for a node will be same with the number of adjacent cubes the node has. We can make M and S matrix of 'cubes underground' easily with for-loop and if-loops.

'main M' means the M matrix of the basic 1D heat-transfer room model, but it can be also S matrix(So it's main M and main S matrix). At the basic model, the size of M and S matrix is 18-by-18, which width is the same with the number of the nodes contained. But we deleted the 18th node(ground node), so there will be 17 nodes left. Of course, the size of main M and main S matrix will be 17-by-17. We have to merge two M matrix and two S matrix to the final M, S matrix. Two matrixes will be attached diagonally, but between the matrixes we have to add something more(surface nodes).

We also added surface nodes on the top of the surface ground. The number was 28, and these surface nodes will have conduction with ground nodes(which are in the 'cubes underground') and will have convection, longwave radiation with Sky node and Outdoor air node(which are in the 'main S'). So there will be more elements added on the gray section expressed on the image, also these heat-transfer types can be added with simple for-loops and if-loops.

There we go, what is left now is to decide the initial temperature of all nodes, and making ODE. In making ODE, I used ode23t.


ISSUES

The main purpose of heat transfer model is to predict indoor air temp under changing outdoor air temp. ODE starts to calculate from one boundary condition node to another, and the nodes that are at the path of the ODE will get the temperature difference through time as a result. So the result of simulation unconditionally depends on the temp of boundary conditions. In 216 nodes additionally added, 116 nodes are boundary conditions, so the ratio of boundary condition nodes in all nodes is approximately near half. As the number of boundary condition nodes is quite large, and those 116 boundary condtion nodes' temperature are fixed, result of the simulation should be sadly inaccurate. As it is hard to expect that there will be the data of cubes(newly defined by me), we have to simulate the boundary conditions' thermal behavior. What I suggest is to delete building part in the 3D heat transfer model, and simulate with only soil and surface nodes. With this simulation and fixed boundary condition temperature, we can get the temp difference through time and depth of the vertical nodes at the center of 12m * 12m * 12m space(in this case, (3, 3, z) nodes) as a result. Than re-input the temp data to the boundary condition nodes, depending on depth and updating through time intervals and re-simulate. The result of the vertical nodes at the cent, will converge to certain data. This data can be the temperature data of boundary condition nodes. This 'updating simulated temp data to boundary condition nodes' can be one solution.

Also, some nodes' huge thermal mass can be a problem when running simulation model without warmup period. In the simulations, warmup should be the basic function of the simulation because during the time needed for the nodes to reach normal temperature range from T0, accuracy of the simulation is too low. If we design warmup method in the 3D heat transfer model, crucial thing we have to consider while deciding warmup period is that every nodes should have different time period to reach normal temp range from their initial temperature, and this time period mainly depends on their thermal mass. If thermal mass of the node is big, it would need more time to reach normal temp range. If the thermal mass is way too big, one solution to reduce the time needed for warmup is to adjust thermal mass only on warmup period. If we adjust the thermal mass low on the warmup period, the time needed to reach the normal temp range would be short. We can use the result of this warmup to run another warmup with actual thermal mass, or we can just use the average temp of this data as T0. The warmup period dosen't need to be completely accurate, we just want to find the reasonable initial temperature by using warmup method.

These problems were not reflected to the codes. As the assumptions used are way too simple, the accuracy of the simulation is not guarangeed. More updates for the codes are needed.


COMPARE

The image shows the indoor temperature difference with basic room model and 3D-added-room model. At every time interval, Temperature of 3D-added-room model minus Temperature of basic room model is plotted.

At time = 0 , the indoor temperature difference with basic and 3D-add in 0. This is because the warmup is not included to the 3D-added room model, so the initial temperature of indoor air is set to be the same. In december 31th, the temperature difference is approximately 0.5 degC, so we can predict the temperature difference at January 1st is similar to this result. Than, the temperature difference ranges from 0.5 degC to 2.5 degC, temp is similar even in winter, and higher in summer. At all period indoor temp of 3D-added model was higher.

PLOT

the plots shows the result of temperature of the nodes on the x=3 plane(when we define one vertex at the bottom of the 6-6-6 space as origin).

Also, we can see the temp through time and depth. Below is a plot of the temp data of the center nodes with different depths.


PLUS

+) Here is the result of 1D heat-transfer room model. You can actually run the simualaton by :

  1. run 'set_up.mat'
  2. run 'basics.mat'

Made up of a network of 1D heat-transfer models, in below there are two plot results ; 'Outdoor temp - 1st Wall temp - 2nd Wall temp - Indoor temp' with and withoud warmup simulation result for a whole year, and the concept of 'making room modle with the network of 1D heat-transfer models'

<Concept of 'Network of 1D Heat-transfer models>

< with Warmup period, temp data of Jan 1st to Jan 30th>

< without Warmup period, temp data of Jan 1st to Jan 30th>

'With Warmup' and 'without warmup' simulation results are plotted with different scale.


PLUSPLUS

This is the initial 4-4-4 model with same method. Made this TOY-TOY-CFD version first and than enlarged the sclae, up to 6-6-6 heat transfer model.

About

simple imitation of CFD in MATLAB


Languages

Language:MATLAB 100.0%