Moist Air Domain
To view the complete domain source file, at the MATLAB® Command prompt, type:
open([matlabroot '/toolbox/physmod/simscape/library/m/+foundation/+moist_air/moist_air.ssc'])
Abbreviated moist air domain declaration is shown below, with intermediate lookup table values omitted for readability.
domain moist_air
% Moist Air Domain
% Copyright 2017-2024 The MathWorks, Inc.
parameters
trace_gas_model = foundation.enum.trace_gas_model.none; % Trace gas model
% 1 - none
% 2 - track_fraction
% 3 - track_properties
enable_droplets = false; % Enable entrained water droplets
R_a = {287.047, 'J/(kg*K)'}; % Dry air specific gas constant
R_w = {461.523, 'J/(kg*K)'}; % Water vapor specific gas constant
R_g = {188.923, 'J/(kg*K)'}; % Trace gas specific gas constant
T_TLU = {[-56.55, -50:10:-10, -5:1:5, 10:10:350]', 'degC'}; % Temperature vector
log_p_ws_TLU = {[
0.537480914463379
1.37059832527040
...
16.4965784809407
16.6206520873803], '1'}; % Log of water vapor saturation pressure vector in Pa
h_w_vap_TLU = {[
2836.88241275372
2837.81392500514
...
1027.31658328826
892.746804215825], 'kJ/kg'}; % Water specific enthalpy of vaporization vector
h_a_TLU = {[
-56.8706902211881
-50.2813451006832
...
347.969511655333
358.523684329954], 'kJ/kg'}; % Dry air specific enthalpy vector
h_w_TLU = {[
-104.361831315495
-92.2353975846513
...
654.537820276137
674.908986576967], 'kJ/kg'}; % Water vapor specific enthalpy vector
h_g_TLU = {[
-56.8706902211881
-50.2813451006832
...
347.969511655333
358.523684329954], 'kJ/kg'}; % Trace gas specific enthalpy vector
mu_a_TLU = {[
14.2568884161326
14.6140128551699
...
31.2307628665438
31.5791070323335], 'uPa*s'}; % Dry air dynamic viscosity vector
mu_w_TLU = {[
6.98864148577410
7.21462000349698
...
21.9693374358760
22.3836713303269], 'uPa*s'}; % Water vapor dynamic viscosity vector
mu_g_TLU = {[
14.2568884161326
14.6140128551699
...
31.2307628665438
31.5791070323335], 'uPa*s'}; % Trace gas dynamic viscosity vector
k_a_TLU = {[
19.8808491891482
20.4162457047568
...
46.7832371087507
47.3667074352967], 'mW/(m*K)'}; % Dry air thermal conductivity vector
k_w_TLU = {[
12.4916816538045
12.9847788176262
...
47.8689040929333
48.9770898119082], 'mW/(m*K)'}; % Water vapor thermal conductivity vector
k_g_TLU = {[
19.8808491891482
20.4162457047568
...
46.7832371087507
47.3667074352967], 'mW/(m*K)'}; % Trace gas thermal conductivity vector
cp_a_TLU = {[
1.00608854886677
1.00592522838662
...
1.05425061343244
1.05658392149181], 'kJ/(kg*K)'}; % Dry air specific heat vector
cp_w_TLU = {[
1.85149054448685
1.85123731225933
...
2.03428214917861
2.03995111098726], 'kJ/(kg*K)'}; % Water vapor specific heat vector
cp_g_TLU = {[
1.00608854886677
1.00592522838662
...
1.05425061343244
1.05658392149181], 'kJ/(kg*K)'}; % Trace gas specific heat vector
cp_d_TLU = {[
1.85149054448685
1.85123731225933
...
2.03428214917861
2.03995111098726], 'kJ/(kg*K)'}; % Liquid water specific heat vector
Pr_a_TLU = {[
0.721482872359986
0.720044440666024
...
0.703778809351741
0.704418325698712], '1'}; % Dry air Prandtl number pressure vector
Pr_w_TLU = {[
1.03584160950647
1.02858692718863
...
0.933629708512201
0.932305193584043], '1'}; % Water vapor Prandtl number pressure vector
Pr_g_TLU = {[
0.721482872359986
0.720044440666024
...
0.703778809351741
0.704418325698712], '1'}; % Trace gas Prandtl number pressure vector
int_dh_T_a_TLU = {[
0
0.0299708128724171
...
1.05825606477651
1.07533024233389], 'kJ/(kg*K)'}; % Dry air integral of dh/T vector
int_dh_T_w_TLU = {[
0
0.0551555684988988
...
1.96803192003337
2.00098769223782], 'kJ/(kg*K)'}; % Water vapor integral of dh/T vector
int_dh_T_g_TLU = {[
0
0.0299708128724171
...
1.05825606477651
1.07533024233389], 'kJ/(kg*K)'}; % Trace gas integral of dh/T vector
int_dh_T_d_TLU = {[
0
0.0551555684988988
...
1.96803192003337
2.00098769223782], 'kJ/(kg*K)'}; % Liquid water integral of dh/T vector
D_w = {25, 'mm^2/s'}; % Water vapor diffusivity in air
D_g = {1, 'mm^2/s'}; % Trace gas diffusivity in air
p_min = {1, 'kPa' }; % Minimum valid pressure
p_max = {inf, 'MPa' }; % Maximum valid pressure
T_min = {-56.55, 'degC'}; % Minimum valid temperature
T_max = {350, 'degC'}; % Maximum valid temperature
properties_range_check = simscape.enum.assert.action.error; % Pressure and temperature outside valid range
% 0 - none
% 1 - warn
% 2 - error
h_a_ref = {399.284757014822, 'kJ/kg'}; % Dry air specific enthalpy at reference temperature
h_w_ref = {2500.89261781717, 'kJ/kg'}; % Water vapor specific enthalpy at reference temperature
h_g_ref = {399.284757014822, 'kJ/kg'}; % Trace gas specific enthalpy at reference temperature
h_w_vap_ref = {2500.93420564316, 'kJ/kg'}; % Water specific enthalpy of vaporization at reference temperature
p_atm = {0.101325, 'MPa' }; % Atmospheric pressure
T_atm = {20, 'degC'}; % Atmospheric temperature
rho_a_atm = {1.20412924943656, 'kg/m^3' }; % Dry air density at reference condition
cp_a_atm = {1.00615115677232, 'kJ/(kg*K)'}; % Dry air specific heat at reference condition
k_a_atm = {25.8738284673185, 'mW/(m*K)' }; % Dry air thermal conductivity at reference condition
end
variables
p = {0.1, 'MPa'}; % Pressure
T = {300, 'K' }; % Temperature
x_w = {0, '1' }; % Specific humidity
x_g = {0, '1' }; % Trace gas mass fraction
r_d = {0, '1' }; % Mass ratio of water droplets to moist air
end
variables (Balancing = true)
mdot = {0, 'kg/s'}; % Mass flow rate
Phi = {0, 'kW' }; % Energy flow rate
mdot_w = {0, 'kg/s'}; % Water vapor mass flow rate
mdot_g = {0, 'kg/s'}; % Trace gas mass flow rate
mdot_d = {0, 'kg/s'}; % Water droplets mass flow rate
end
end
The domain declaration contains the following variables and parameters:
Across variable p (absolute pressure), in MPa
Through variable mdot (mixture mass flow rate), in kg/s
Across variable T (temperature), in K
Through variable Phi (mixture energy flow rate), in kW
Across variable x_w (specific humidity), unitless
Through variable mdot_w (water vapor mass flow rate), in kg/s
Across variable x_g (trace gas mass fraction), unitless
Through variable mdot_g (trace gas mass flow rate), in kg/s
Across variable r_d (mass ratio of water droplets to moist air), unitless
Through variable mdot_d (water droplets mass flow rate), in kg/s
Parameter p_min, defining the minimum allowable pressure
Parameter p_max, defining the maximum allowable pressure
Parameter T_min, defining the minimum allowable temperature
Parameter T_max, defining the maximum allowable temperature
Parameter p_atm, defining the atmospheric pressure
Parameter T_atm, defining the atmospheric temperature
Parameter trace_gas_model provides a choice of three trace gas models:
foundation.enum.trace_gas_model.none
— Nonefoundation.enum.trace_gas_model.track_fraction
— Track mass fraction onlyfoundation.enum.trace_gas_model.track_properties
— Track mass fraction and gas properties
Parameter enable_droplets provides an option to model water droplets suspended in the moist air flow.
In the Foundation Moist Air library, the Moist Air Properties (MA) block serves as the source for domain parameter values, including the selection of the trace gas model and enabling the water droplet tracking. For more information on propagation of domain parameters, see Working with Domain Parameters.
The moist air mixture is composed of three gas species. The default domain parameter values correspond to dry air, water vapor, and carbon dioxide:
R_a = {287.047, 'J/(kg*K)'}; % Dry air specific gas constant
R_w = {461.523, 'J/(kg*K)'}; % Water vapor specific gas constant
R_g = {188.923, 'J/(kg*K)'}; % Trace gas specific gas constant
You can modify these parameter values in the Moist Air Properties (MA) block to model any three-species gas mixture.
The domain declaration also contains sets of parameters that define various dry air,
water vapor, and trace gas properties in the form of lookup table data. The table lookup
is with respect to the temperature vector, T_TLU. These parameter
declarations propagate to the components connected to the Moist Air domain, and
therefore you can use them in the tablelookup
function in the
component equations.
To refer to this domain in your custom component declarations, use the following syntax:
foundation.moist_air.moist_air