classCFD

Room model with air heat and mass balance computed using Computational Fluid Dynamics

Extends from Modelica.Icons.Information (Icon for general information packages).

Information

The model Buildings.ThermalZones.Detailed.CFD is a room model in which the room air heat and mass balance is computed using the Computational Fluid Dynamics (CFD).

The model is identical with Buildings.ThermalZones.Detailed.MixedAir, except for the following points:

  • The heat and mass balance of the air is computed using CFD.
  • To match surfaces and fluid ports between the Modelica model and the CFD model, users must declare a unique name for each surface and for each fluid port. The same names must be used in the CFD input file.
  • To get access to properties of the control volumes in the CFD simulation, this model allows declaring a sensor using the parameter sensorName. This parameter is an array of strings. The same strings must be used in the CFD input file when declaring the sensor in order to send the CFD results to the output signal of Modelica.
  • To link the fluid ports in Modelica to the boundary conditions of CFD, this model requires declaring names for the fluid ports ports using the parameter portName. This parameter is an array of strings. The same strings must be used in the CFD input file when declaring the inlet and outlet boundary conditions.
  • The control signal of window shades is a constant rather than an input. Its value cannot be changed during the simulation as the FFD implemementation does not support moving areas for the boundary conditions.
  • The initial conditions for temperature, mass fraction and trace substances are declared in the CFD input file rather than in Modelica. In Modelica, an initial value for the pressure can be defined. This is used for a pressure balance of the room volume, and is implemented in Buildings.ThermalZones.Detailed.BaseClasses.CFDFluidInterface. However, the FFD implementation uses a constant pressure during the whole simulation and does not use the pressure of the Modelica model.
A description of the model assumptions and the implemention and validation of this room model can be found in Zuo et al. (2016) and in Zuo et al. (2014).

Conventions

The following conventions are made:

  • The port heaPorAir contains the average room air temperature, defined as

    Ta = 1 ⁄ V   ∫V T(dV)   dV,

    where Ta is the average room air temperature, V is the room air volume and T(dV) is the room air temperature in the control volume dV. The average room air temperature Ta is computed by the CFD program.

  • If a model injects heat to heaPorAir, then the heat will be distributed to all cells. The amount of heat flow rate that each cell exchanges with heaPorAir is proportional to its volume.
  • The flow resistance of the diffusor or exhaust grill must be computed in the Modelica HVAC system that is connected to the room model, because the CFD program assumes the same total pressure at all fluid ports.

The quantities that are exchanged between the programs are defined as follows:

  • For the mass flow rate of the fluid port, we exchange me = 1 ⁄ Δ t ∫Δ t m(s) dt.
  • For the temperature, species concentration and trace substances of the fluid port, we exchange X = 1 ⁄ (me   Δ t) ∫Δ t m(s)   X(s) dt. Note that for the first implementation, CFD does only compute a bulk mass balance for Xi. It does not do a moisture balance for each cell. However, for trace substances C, CFD does a contaminant balance for each cell and return C_outflow to be the contaminant concentration of that cell.
  • For the surface temperatures, we exchange Te = 1 ⁄ Δ t ∫Δ t T(s) dt.
  • For the surface heat flow rates, we exchange Qe = 1 ⁄ Δ t ∫Δ t Q(s) dt.

Implementation

This section explains how the data exchange between Modelica and CFD is implemented. The section is only of interest to developers. Users may skip this section.

Interface to Modelica models

Interfacing CFD with the Modelica room air heat and mass balance is done in the model Buildings.ThermalZones.Detailed.BaseClasses.CFDAirHeatMassBalance. To interface variables from Modelica and CFD, the following classes and conventions are used in this model.

  • If a construction is not present, or if no shade is present, or if no air stream is connected to ports, then no variables are exchanged for this quantity with the block cfd.
  • For surfaces, heat flow rates in [W] and temperatures in [K] are exchanged. These variables are connected to the surface heat ports through instances of the model Buildings.ThermalZones.Detailed.BaseClasses.CFDSurfaceInterface. This model has four ports. Depepending on the parameter bouCon, two of these ports are conditionally removed. This allows to use the parameter bouCon to specify whether the surface should be used with a temperature or a heat flow rate boundary condition. Therefore, the inputs and outputs to the instance cfd are either temperatures or heat flow rates. The parameter surIde of this model, which is also propagated to the instance cfd, declares what type of boundary condition is used.
  • The variables of the connector ports are exchanged with the CFD block through the instance intFlu. This interface is implemented in Buildings.ThermalZones.Detailed.BaseClasses.CFDFluidInterface. Its output and input signals are connected to the cfd block as follows:
    • Input to the cfd block is a vector [p, m_flow[nPorts], T_inflow[nPorts], X_inflow[nPorts*Medium.nXi], C_inflow[nPorts*Medium.nC]]. The quantity p is the total pressure of the fluid ports (all fluid ports have the same total pressure). Therefore, the flow resistance of the diffusor or exhaust grill must be computed in the Modelica HVAC system that is connected to the room model. The quantities X_inflow and C_inflow (or X_inflow and C_inflow) are vectors with components X_inflow[1:Medium.nXi] and C_inflow[1:Medium.nC]. For example, for moist air, X_inflow has one element which is equal to the mass fraction of air, relative to the total air mass and not the dry air.
    • Output from the CFD block is a vector [T_outflow[nPorts], X_outflow[nPorts*Medium.nXi], C_outflow[nPorts*Medium.nC]]. The quantities *_outflow are the fluid properties of the cell to which the port is connected.
    • If Medium.nXi=0 (e.g., for dry air) or Medium.nC=0, then these signals are not present as input/output signals of the CFD block.
Data exchange with CFD

The data exchange with the CFD interface is done through the instance cfd, and implemented in Buildings.ThermalZones.Detailed.BaseClasses.CFDExchange. This block exchanges the following data with the CFD simulation:

During the initialzation, the following data are sent from Modelica to CFD:

  • An array of strings where each element is the name of the surface, as declared by the user when instantiating the model Buildings.ThermalZones.Detailed.CFD. Let us call this array name. The orders of elements in this array are as follows:
    1. The first nConExt elements are the names of the exterior constructions declared as datConExt. The order is the same as in the declaration of datConExt.
    2. nConExtWin elements are the names of the exterior constructions declared as datConExtWin. These constructions embed windows and a frame. Therefore, what follows are nConExtWin elements where each string is the same as above, but ' (glass, unshaded)' has been appended, then -- if and only if the window has a shade -- nConExtWin elements follow with ' (glass, shaded)' appended, and, finally, nConExtWin elements follow with ' (frame)' appended.
    3. nConPar elements for the surface a of datConPar. To these names, the string ' (surface a)' is appended. Next, there are nConPar elements with ' (surface b)' appended.
    4. nConBou elements for the surfaces of datConBou.
    5. nSurBou elements for the surfaces of nSurBou.
  • Using the same order, there is also an array for the areas of the surfaces A, an array for the surface tilt til and the type of the boundary conditions bouCon for each of these surfaces. If bouCon[i] = 1, then temperature is sent from Modelica to CFD. If bouCon[i] = 2, then heat flow rate is sent from Modelica to CFD.
  • There is an array sensorName that contains the names of all sensors, in the same order as they are declared when instantiating the model Buildings.ThermalZones.Detailed.CFD. If no sensors are declared in Modelica, then this array will have zero elements. How many sensor are declared in Modelica can be checked through the variable nSen, which is sent from Modelica to CFD.
  • There is also an array AirProperty that contains the properties of the air. The orders of elements in this array are as follows:
    1. The density of air at the initial state (CFD will accept it only when there is a mass exchange between the two programs).

During the time integration, and array u is sent from Modelica to CFD, and Modelica receives an array y from CFD. The elements of the array u are as follows:

  1. Either temperature or heat flow rate boundary conditions, in the same order as the array name. The units are [K] or [W]. The array bouCon that is sent during the initialization declares the type of boundary condition. There are nSur elements for surfaces.
  2. If at least one window in the room has a shade, then the next nConExtWin elements are the shading control signals. u=0 means that the shade is not deployed, and u=1 means that the shade is completely deployed (blocking solar radiation). If there is no window in the room, then these elements are not present.
  3. If at least one window in the room has a shade, then the next nConExtWin elements are the radiations in [W] that are absorbed by the respective shades. If there is no window in the room, then these elements are not present.
  4. The convective sensible heat input into the room in [W], which is a scalar. A positive value means that heat is added to the room.
  5. The latent heat input into the room in [W], which is a scalar. A positive value means that moisture is added to the room.
  6. The next element is the room average static pressure in [Pa].
  7. The next nPorts elements are the mass flow rates into the room in [kg/s]. A positive value is used if the air flows into the room, otherwise the value is negative. The first element is connected to ports[1], the second to ports[2] etc.
  8. The next nPorts elements are the air temperatures that the medium has if it were flowing into the room, e.g., the "inflowing medium" computed based on inStream(h_outflow).
  9. The next nPorts*Medium.nXi elements are the species concentration of the inflowing medium. The first Medium.nXi elements are for port 1, then for port 2 etc. The units are in [kg/kg] total mass, and not in [kg/kg] dry air.
  10. The next nPorts*Medium.nC elements are the trace substances of the inflowing medium. The first Medium.nC elements are for port 1, then for port 2 etc.
The elements of the array y that is sent from CFD to Modelica are as follows:
  1. Either temperature or heat flow rate at the surfaces, in the same order as the array name. The array bouCon that is sent during the initialization declares the type of boundary condition. If bouCon[i] = 1, then heat flow rate in [W] is sent from CFD to Modelica. If bouCon[i] = 2, then temperature in [K] is sent from CFD to Modelica. There are nSur elements for surfaces.
  2. The average room air temperature in [K].
  3. If the room has at least one window with a shade, then the next nConExtWin elements are the temperature of the shade in [K].
  4. The next nPorts elements are the air temperatures in [K] of the cells that are connected to the inlet or outlet diffusor of ports[1], ports[2], etc..
  5. The next nPorts*Medium.nXi elements are the species concentration of the cells to which the ports are connected. The first Medium.nXi elements are for port 1, then for port 2 etc. The units are in [kg/kg] total mass, and not in [kg/kg] dry air.
  6. The next nPorts*Medium.nC elements are the trace substances of the cells to which the ports are connected to. The first Medium.nC elements are for port 1, then for port 2 etc.

References

Wangda Zuo, Michael Wetter, Wei Tian, Dan Li, Mingang Jin, Qingyan Chen.
Coupling Indoor Airflow, HVAC, Control and Building Envelope Heat Transfer in the Modelica Buildings Library.
Journal of Building Performance Simulation, 9(4), pp. 366-381, 2016.
http://dx.doi.org/10.1080/19401493.2015.1062557.

Wangda Zuo, Michael Wetter, Dan Li, Mingang Jin, Wei Tian, Qingyan Chen.
Coupled Simulation of Indoor Environment, HVAC and Control System by Using Fast Fluid Dynamics and the Modelica Buildings Library.
Proc. of the 2014 ASHRAE/IBPSA-USA Building Simulation Conference, Atlanta, GA, September 10-12, 2014.