Home > atmlab > h2o > parametrisations > ice_psd_gamma.m

ice_psd_gamma

PURPOSE ^

ice_psd_gamma returns gamma particle size distribution

SYNOPSIS ^

function [y]=ice_psd_gamma(IWC1,IWC2,D,mu1,mu2,lambda1,lambda2,alfa,beta)

DESCRIPTION ^

 ice_psd_gamma returns gamma particle size distribution

    Returns a vector or matrix with a gamma particle size distribution
    n(D)=N*D^(mu)*exp(-lambda*D) 
    with the mass of the particles m(D)=alfa*D^beta.
    The input can be either scalars or vectors.


 FORMAT   [y] = ice_psd_gamma(IWC1,IWC2,D,mu1,mu2,lambda1,lambda2,alfa,beta)
  

 OUT      y is a vector or matrix depending on input with the particle 
          size distribution calculated at D [#/m^3/m]

 IN       IWC1    Ice water content in mode 1 [g/m^3]
          IWC2    Ice water content in mode 2 [g/m^3]
          D       the size vector of the ice particles [m]
                  where the concentration will be calculated  
          mu1     gamma parameter mu1>=0 in mode 1
          mu2     gamma parameter mu2>=0 in mode 2
          lambda1 gamma parameter [m^-1] in mode 1
          lambda2 gamma parameter [m^-1] in mode 2
          alfa    m(D)=alfa*D^beta [g/m^beta]
          beta    exponent in mass-dimension power law

 History: 2005-05-24  Created by Bengt Rydberg

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

ice_psd_gamma.m

SOURCE CODE ^

0001 % ice_psd_gamma returns gamma particle size distribution
0002 %
0003 %    Returns a vector or matrix with a gamma particle size distribution
0004 %    n(D)=N*D^(mu)*exp(-lambda*D)
0005 %    with the mass of the particles m(D)=alfa*D^beta.
0006 %    The input can be either scalars or vectors.
0007 %
0008 %
0009 % FORMAT   [y] = ice_psd_gamma(IWC1,IWC2,D,mu1,mu2,lambda1,lambda2,alfa,beta)
0010 %
0011 %
0012 % OUT      y is a vector or matrix depending on input with the particle
0013 %          size distribution calculated at D [#/m^3/m]
0014 %
0015 % IN       IWC1    Ice water content in mode 1 [g/m^3]
0016 %          IWC2    Ice water content in mode 2 [g/m^3]
0017 %          D       the size vector of the ice particles [m]
0018 %                  where the concentration will be calculated
0019 %          mu1     gamma parameter mu1>=0 in mode 1
0020 %          mu2     gamma parameter mu2>=0 in mode 2
0021 %          lambda1 gamma parameter [m^-1] in mode 1
0022 %          lambda2 gamma parameter [m^-1] in mode 2
0023 %          alfa    m(D)=alfa*D^beta [g/m^beta]
0024 %          beta    exponent in mass-dimension power law
0025 %
0026 % History: 2005-05-24  Created by Bengt Rydberg
0027 
0028 function [y]=ice_psd_gamma(IWC1,IWC2,D,mu1,mu2,lambda1,lambda2,alfa,beta)
0029 
0030 min_nargin( 9, nargin );       
0031 IWC1=vec2col(IWC1);
0032 D=vec2col(D);
0033 mu1=vec2col(mu1);
0034 lambda1=vec2col(lambda1);
0035 
0036 l1=length(IWC1);
0037 l2=length(mu1);
0038 l3=length(lambda1);
0039 if (l1~=l2 | l1~=l3 | l2~=l3)
0040   error('length of IWC1, mu1, and, lambda1 must be equal')
0041 end 
0042 
0043 w1=ones(length(mu1),1);
0044 w2=ones(1,length(D));
0045 rho=0.92*1e6;
0046 N1=IWC1'.*(lambda1'.^(beta+mu1'+1)/alfa./gamma(beta+mu1'+1));
0047 n=(N1'*w2).*((w1*D').^(mu1*w2).*exp(-lambda1*D'));
0048 
0049 
0050 if (isempty(IWC2)==0 & isempty(lambda2)==0 & isempty(mu2)==0)
0051    IWC2=vec2col(IWC2);
0052    mu2=vec2col(mu2);
0053    lambda2=vec2col(lambda2);
0054    l1=length(IWC2);
0055    l2=length(mu2);
0056    l3=length(lambda2);
0057    if (l1~=l2 | l1~=l3 | l2~=l3)
0058       error('length of IWC2, mu2, and, lambda2 must be equal')
0059    end 
0060    N2=IWC2'.*(lambda2'.^(beta+mu2'+1)/alfa./gamma(beta+mu2'+1));
0061    n=n+(N2'*w2).*((w1*D').^(mu2*w2).*exp(-lambda2*D'));
0062 end
0063 y=vec2col(n);
0064

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005