## 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-2022 The MathWorks, Inc. parameters trace_gas_model = foundation.enum.trace_gas_model.none; % Trace gas model % 1 - none % 2 - track_fraction % 3 - track_properties 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.537480914463376 1.37059832527040 ... 16.4965444877527 16.6206369090880]; % Log of water vapor saturation pressure vector in Pa h_w_vap_TLU = {[ 2836.88241275372 2837.81392500514 ... 1027.62017777647 892.733785613825], 'kJ/kg'}; % Water specific enthalpy of vaporization vector h_a_TLU = {[ -56.8710331799620 -50.2816483520700 ... 347.971615037026 358.525852363658], 'kJ/kg'}; % Dry air specific enthalpy vector h_w_TLU = {[ -104.435185072500 -92.3081941529104 ... 347.971615037026 358.525852363658], 'kJ/kg'}; % Water vapor specific enthalpy vector h_g_TLU = {[ -56.8710331799620 -50.2816483520700 ... 747.258774447567 757.813011774199], 'kJ/kg'}; % Trace gas specific enthalpy vector mu_a_TLU = {[ 14.2568883320012 14.6140127728333 ... 31.2307628592324 31.5791070262086], 'uPa*s'}; % Dry air dynamic viscosity vector mu_w_TLU = {[ 6.81365662228272 7.04953750742707 ... 21.1317199525111 21.4937680016671], 'uPa*s'}; % Water vapor dynamic viscosity vector mu_g_TLU = {[ 14.2568883320012 14.6140127728333 ... 31.2307628592324 31.5791070262086], 'uPa*s'}; % Trace gas dynamic viscosity vector k_a_TLU = {[ 19.8808489374933 20.4162454629695 ... 46.7832370779530 47.3667074066625], 'mW/(m*K)'}; % Dry air thermal conductivity vector k_w_TLU = {[ 11.4628821597600 11.9419974889350 ... 43.1675775109350 44.0380174089350], 'mW/(m*K)'}; % Water vapor thermal conductivity vector k_g_TLU = {[ 19.8808489374933 20.4162454629695 ... 46.7832370779530 47.3667074066625], 'mW/(m*K)'}; % Trace gas thermal conductivity vector cp_a_coeff = {[ 1.02664779928781 -0.000177515573577911 3.66581785159269e-07], 'kJ/(kg*K)'}; % Dry air specific heat polynomial coefficients cp_w_coeff = {[ 1.47965047747103 0.00120021143370507 -3.86145131678391e-07], 'kJ/(kg*K)'}; % Water vapor specific heat polynomial coefficients cp_g_coeff = {[ 1.02664779928781 -0.000177515573577911 3.66581785159269e-07], 'kJ/(kg*K)'}; % Trace gas specific heat polynomial coefficients Pr_a_TLU = [ 0.720986465349271 0.719589372441350 ... 0.704694042255749 0.705614770118245]; % Dry air Prandtl number pressure vector Pr_w_TLU = [ 1.02327757654022 ... 1.01351190334830 1.01402827396757]; % Water vapor Prandtl number pressure vector Pr_g_TLU = [ 0.720986465349271 0.719589372441350 ... 0.704694042255749 0.705614770118245]; % Trace gas Prandtl number pressure vector int_dh_T_a_TLU = {[ 0 0.0299709934765051 ... 1.05826245662507 1.07533673877425], 'kJ/(kg*K)'}; % Dry air integral of dh/T vector int_dh_T_w_TLU = {[ 0 0.0551581028022933 ... 1.96804836665268 2.00100413885432], 'kJ/(kg*K)'}; % Water vapor integral of dh/T vector int_dh_T_g_TLU = {[ 0 0.0299709934765051 ... 1.05826245662507 1.07533673877425], 'kJ/(kg*K)'}; % Trace gas 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 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.00611201935459, 'kJ/(kg*K)'}; % Dry air specific heat at reference condition k_a_atm = {25.8738283029331, 'mW/(m*K)' }; % Dry air thermal conductivity at reference condition end variables p = {0.1, 'MPa'}; % Pressure T = {300, 'K' }; % Temperature x_w = 0; % Specific humidity x_g = 0; % Trace gas mass fraction end variables (Balancing=true) mdot = {0, 'kg/s'}; % Mixture mass flow rate Phi = {0, 'kW' }; % Mixture energy flow rate mdot_w = {0, 'kg/s'}; % Water vapor mass flow rate mdot_g = {0, 'kg/s'}; % Trace gas 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

• 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` — None

• `foundation.enum.trace_gas_model.track_fraction` — Track mass fraction only

• `foundation.enum.trace_gas_model.track_properties` — Track mass fraction and gas properties

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. 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 `