classCFD
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
portsusing the parameterportName. 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.
Conventions
The following conventions are made:
-
The port
heaPorAircontains the average room air temperature, defined asTa = 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 withheaPorAiris 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 substancesC, CFD does a contaminant balance for each cell and returnC_outflowto 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 blockcfd. -
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 parameterbouConto specify whether the surface should be used with a temperature or a heat flow rate boundary condition. Therefore, the inputs and outputs to the instancecfdare either temperatures or heat flow rates. The parametersurIdeof this model, which is also propagated to the instancecfd, declares what type of boundary condition is used. -
The variables of the connector
portsare exchanged with the CFD block through the instanceintFlu. This interface is implemented in Buildings.ThermalZones.Detailed.BaseClasses.CFDFluidInterface. Its output and input signals are connected to thecfdblock as follows:-
Input to the
cfdblock is a vector[p, m_flow[nPorts], T_inflow[nPorts], X_inflow[nPorts*Medium.nXi], C_inflow[nPorts*Medium.nC]]. The quantitypis 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 quantitiesX_inflowandC_inflow(orX_inflowandC_inflow) are vectors with componentsX_inflow[1:Medium.nXi]andC_inflow[1:Medium.nC]. For example, for moist air,X_inflowhas 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*_outfloware the fluid properties of the cell to which the port is connected. -
If
Medium.nXi=0(e.g., for dry air) orMedium.nC=0, then these signals are not present as input/output signals of the CFD block.
-
Input to the
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:-
The first
nConExtelements are the names of the exterior constructions declared asdatConExt. The order is the same as in the declaration ofdatConExt. -
nConExtWinelements are the names of the exterior constructions declared asdatConExtWin. These constructions embed windows and a frame. Therefore, what follows arenConExtWinelements where each string is the same as above, but' (glass, unshaded)'has been appended, then -- if and only if the window has a shade --nConExtWinelements follow with' (glass, shaded)'appended, and, finally,nConExtWinelements follow with' (frame)'appended. -
nConParelements for the surfaceaofdatConPar. To these names, the string' (surface a)'is appended. Next, there arenConParelements with' (surface b)'appended. -
nConBouelements for the surfaces ofdatConBou. -
nSurBouelements for the surfaces ofnSurBou.
-
The first
-
Using the same order, there is also an array for the areas of the surfaces
A, an array for the surface tilttiland the type of the boundary conditionsbouConfor each of these surfaces. IfbouCon[i] = 1, then temperature is sent from Modelica to CFD. IfbouCon[i] = 2, then heat flow rate is sent from Modelica to CFD. -
There is an array
sensorNamethat 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 variablenSen, which is sent from Modelica to CFD. -
There is also an array
AirPropertythat contains the properties of the air. The orders of elements in this array are as follows:- 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:
-
Either temperature or heat flow rate boundary conditions,
in the same order as the array
name. The units are [K] or [W]. The arraybouConthat is sent during the initialization declares the type of boundary condition. There arenSurelements for surfaces. -
If at least one window in the room has a shade, then the next
nConExtWinelements are the shading control signals.u=0means that the shade is not deployed, andu=1means that the shade is completely deployed (blocking solar radiation). If there is no window in the room, then these elements are not present. -
If at least one window in the room has a shade, then the next
nConExtWinelements 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. - 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.
- The latent heat input into the room in [W], which is a scalar. A positive value means that moisture is added to the room.
- The next element is the room average static pressure in [Pa].
-
The next
nPortselements 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 toports[1], the second toports[2]etc. -
The next
nPortselements are the air temperatures that the medium has if it were flowing into the room, e.g., the "inflowing medium" computed based oninStream(h_outflow). -
The next
nPorts*Medium.nXielements are the species concentration of the inflowing medium. The firstMedium.nXielements are for port 1, then for port 2 etc. The units are in [kg/kg] total mass, and not in [kg/kg] dry air. -
The next
nPorts*Medium.nCelements are the trace substances of the inflowing medium. The firstMedium.nCelements are for port 1, then for port 2 etc.
y that is sent from CFD to Modelica are as follows:
-
Either temperature or heat flow rate at the surfaces,
in the same order as the array
name. The arraybouConthat is sent during the initialization declares the type of boundary condition. IfbouCon[i] = 1, then heat flow rate in [W] is sent from CFD to Modelica. IfbouCon[i] = 2, then temperature in [K] is sent from CFD to Modelica. There arenSurelements for surfaces. - The average room air temperature in [K].
-
If the room has at least one window with a shade, then the next
nConExtWinelements are the temperature of the shade in [K]. -
The next
nPortselements are the air temperatures in [K] of the cells that are connected to the inlet or outlet diffusor ofports[1], ports[2], etc.. -
The next
nPorts*Medium.nXielements are the species concentration of the cells to which the ports are connected. The firstMedium.nXielements are for port 1, then for port 2 etc. The units are in [kg/kg] total mass, and not in [kg/kg] dry air. -
The next
nPorts*Medium.nCelements are the trace substances of the cells to which the ports are connected to. The firstMedium.nCelements 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.