fabien van mook

all packages "fvm-*"

package "fvm-mollier"

function file "mollier_plotTX.m"

Function mollier_plotTX(T,X,fmt,opt);
         mollier_plotTX(T1,X1,fmt1,T2,X2,fmt2,...,opt);
         mollier_plotTX(T1,X1,pb1,fmt1,...,opt);
         mollier_plotTX(T1,F1,fmt1,...,opt);
         mollier_plotTX(T1,F1,pb1,fmt1,...,opt);

plots a version of the Mollier chart. 

The chart shows properties of humid air (a mixture of dry air and
water vapour):
-- absolute humidity of the air, X, on the x-axis. Lines of equal 
   X are vertical. It is measured in kg of water vapour per kg of 
   dry air;
-- temperature of the air, T, on the y-axis. Lines of equal T
   are horizontal. It is measured in degrees centigrade;
-- relative humidity of the air, F (or phi). Its value ranges 
   from 0 (inclusively) to 1 (inclusively);
-- specific enthalpy of the air, H. It is measured in J per kg of 
   the air mixture.
-- density of the air mixture, rho. It is measured in kg per m3.
A feature of the chart is that the X and T axes are perpendicular.

The data points in the chart are based on the total or barometric 
pressure of opt.pdstandard Pa, if no vector pb (in Pa) is given.

Grid lines for equal relative humidity, for equal specific enthalpy
and equal air mixture density are drawn based on the total or
barometric pressure of opt.pdstandard Pa. 

The points to be plotted in the chart are given by 
-- (default:) vectors T and X (note this particular order!), 
or by
-- (if opt.input = 'TF' is given:) vectors T and F.
or by
-- (if opt.input = 'TXpb' is given:) vectors T, X and pb.
or by
-- (if opt.input = 'TFpb' is given:) vectors T, F and pb.

The format of the points is given by string fmt, of which the
contents has the pattern: "<linestyle><markerstyle><colour><legend_text>", 
as for the function plot().

It is possible to use property/value pairs for the specification
of line and marker styles etc. In that case, a legend text must 
be given by ";<legend_text>" at the argument position of fmt. 

Properties of the chart are controlled by the structure opt. If the 
structure is not given at all, or if a field of the structure is 
not given, a default value will be used. This is the complete 
definition of structure opt with the default values:

 opt.input       = 'TX';
    % sequence of the input quantities: first T, second X. The 
    % alternative is: opt.input = 'TF', 'TXpb' or 'TFpb'. 
 opt.limits_T    = [-5 35]; 
    % lower and higher limits of the T axis.
 opt.limits_X    = [0  0.020];
    % lower and higher limits of the X axis.
 opt.nDeltaT     = [70];
    % number of pieces by which a line is divided between
    % the lower and higher limits of the T axis. This 
    % defines the discretisation of lines of equal F. 
 opt.nDeltaTforH = [10];
    % similar to opt.nDeltaT, but for the discretisation 
    % of lines of equal H. 
 opt.DeltaF      = [0.1];
    % absolute difference of F between each line of equal F.
    % A series of lines is drawn, starting from F=1.
 opt.DeltaH      = [5000];
    % absolute difference of H (in J/kg) between each line of 
    % equal H. A series of lines is drawn, starting from H=0.
 opt.Deltarho    = [0.02];
    % absolute difference of rho (in kg/m3) between each line of 
    % equal rho. A series of lines is drawn, starting from rho=0.
 opt.nDeltaXforrho = [10];
    % number of pieces by which a line is divided between
    % the lower and higher limits of the X axis. This 
    % defines the discretisation of lines of equal rho. 
 opt.linestyle_T = '-';
 opt.linestyle_X = '-';
 opt.linestyle_F = '-';
 opt.linestyle_H = '-';
 opt.linestyle_rho = '-';
    % line style of each line of equal T, X, F, H and rho, 
    % respectively, as used by plot(). 
 opt.color_T     = 'k';
 opt.color_X     = 'k';
opt.color_F     = [ 0.95098   0.74021   1.00000]; % index 50 from brighten(cool,0.8)
opt.color_H     = [ 0.95098   0.74021   1.00000]; % index 50 from brighten(cool,0.8)
opt.color_rho   = [ 0.85714   0.85714   0.85714]; % index 55 from gray
    % colour of each line of equal T, X, F, H and rho, 
    % respectively, as used by plot(). 
opt.labelcolor_T   = 'k';
opt.labelcolor_X   = 'k';
opt.labelcolor_F   = brighten(opt.color_F,-0.4); % i.e. darken
opt.labelcolor_H   = brighten(opt.color_H,-0.4);
opt.labelcolor_rho = brighten(opt.color_rho,-0.4);
    % colour for the labels of T, X, F, H and rho, respectively, 
    % as used by plot(). 
 opt.label_T     = 'T [\deg{}C]';
 opt.label_X     = 'X [kg/kg]';
 opt.label_H     = '-----> h [J/kg]';
    % string with (latex) text for the labels of the T, X and 
    % rho axes, respectively. 
 opt.symbol_F    = '\phi=';
    % string with (latex) text by which the label at each line of 
    % equal F starts. After it, the value of F follows.
 opt.symbol_rho  = '\rho=';
 opt.unit_rho    = ' [kg/m^3]';
    % string with (latex) text by which the label at each line of 
    % equal rho starts and ends, respectively. Between them, the 
    % value of rho is inserted.
 opt.relpos_F    = [0.89 0.95];
    % position of the labels for each line of equal F (measured 
    % relatively to the X and T axis extents, respectively,
    % and seen from the lower left corner of the axes box).
 opt.relpos_H    = [0.3 0.2];
    % position of the label for the H axis (measured 
    % relatively to the sizes in X and T directions, 
    % respectively, of the triangular-like white space 
    % in the lower right corner of the graph, and seen from 
    % the lower left corner of the white space).
 opt.reloff_H    = [0.015];
    % distance between an H value label and the lower right point 
    % of a line of equal H (measured relatively to the T axis 
    % extents). The H value label is shifted towards southeast 
    % in the same direction of the line of equal H.
 opt.relpos_rho  = [0.05];
    % position of the labels for each line of equal rho (measured 
    % relatively to the X axis extents
    % and seen from the lower left corner of the axes box).
 opt.showgrid_T  = 1;
 opt.showgrid_X  = 1;
 opt.showgrid_rho = 1;
    % boolean to indicate whether the grid lines of T, X and rho, 
    % respectively, must be shown. 

At default, the following information in struct opt is taken
from the output of m-file mollier_humidairprop.m (see its help
text):
 opt.Ma          = 28.96; 
    % molar mass of dry air, in kg/kmol 
    % (value from Glueck 1991, table on 
    % page 47).
 opt.Mv          = 18.02; 
    % molar mass of water vapour, in kg/kmol 
    % (value from Glueck 1991, table on 
    % page 47).
 % note the ratio delta = Mv/Ma = Ra/Rv
 opt.ps_fun      = "mollier_ps_magnus";
    % m-file name for function returning ps
    % for given T and pb.
 opt.Td_fun      = "mollier_Td_magnus";
    % m-file name for function returning Td
    % for given pv and pb, or for given T, 
    % F and pb.
 opt.pbstandard  = 101325;
    % standard atmospheric pressure, or 
    % standard total air pressure, in Pa
    % (value from http://en.wikipedia.org/wiki/Pascal_%28unit%29 ).
 opt.cpa         = 1.01e3;
    % specific heat capacity of dry air at
    % constant pressure, in J/(kg K) (value
    % from Glueck 1991, form. 2.24).
 opt.r0          = 2501.0e3;
    % specific heat of vaporisation of water
    % at the triple point, in J/kg (value
    % from Glueck 1991, form. 2.25).
 opt.cpv         = 1.86e3;
    % specific heat capacity of vapour at 
    % constant pressure, in J/(kg K) (value
    % from Glueck 1991, form. 2.26).
 opt.rhoref      = 1.293;
    % density of dry air at Tref and pref,
    % in kg/m3 (value from Jannot 2005).
 opt.Tref      = 0;
    % reference temperature for rhoref, in
    % degrees centigrade (value from Jannot
    % 2005).
 opt.pref      = 101325;
    % reference total pressure for rhoref,
    % in Pa (value from Jannot 2005).

Issue
  demo mollier_plotTX
to get a demonstration.

The following m-files are needed:
   mollier_plotTX.m
   mollier_H.m
   mollier_X.m
   mollier_ps.m
   mollier_rho.m
   mollier_humidairprop.m

The chart is constructed by the following formulas:
   ps(T,pb) is an empiric function of T and pb,
   pv = F * ps(T,pb),
   delta = Mv / Ma,
   X = delta * pv / (pb - pv),
   H = cpa * T + X * (r0 + cpv * T),
   rho = rhoref * (Tref + TK)/(T + TK) * (pb/pref) * delta * (1 + X)/(delta + X),
with:  pv = partial vapour pressure in Pa,
       ps = partial vapour pressure at saturation in Pa,
       pb = barometric or total pressure in Pa,
       Mv = molar mass of vapour = 18.02 kg/kmol,
       Ma = molar mass of dry air = 28.96 kg/kmol,
       TK = 273.15 degrees C.

References:
  Glück, Bernd (1991). Zustands- und Stoffwerte --- Wasser, Dampf, 
    Luft --- Verbrennungsrechnung. 2. bearbeitete und erweiterte 
    Auflage. Berlin: Verlag für Bauwesen GmbH. 
    (Website visited in 2014: http://berndglueck.de/stoffwerte.php ) 

  Jannot, Yves (2005). L'air humide.
    (Website visited in 2017: http://www.thermique55.com/principal/airhumide.pdf )


(c) 2026 fabien van mook

2026.08.20 release of this file within package "fvm-mollier" under GNU GPLv3+