Home > SPlaC v1_0 > Mie > MUL > MulPweSolveMultiSphere.m

MulPweSolveMultiSphere

PURPOSE ^

Solves the problem of PWE of a multilayer spherical system with Mie theory

SYNOPSIS ^

function stMieRes=MulPweSolveMultiSphere(nNmax,Ca,lambda,Cepsilon,sPlot,sCoeff)

DESCRIPTION ^

 Solves the problem of PWE of a multilayer spherical system with Mie theory
 The parameters are given as arguments or may also be given in a
 structure stMP when called as MulPweSolveMultiSphere(stMP,sPlot,sCoeff)
 where stMP contains the parameter fields.
 Note that for PWE, we have for the Mie coefficients:
 |m|=1 only; a,c even in m; b,d odd in m.
 For example, the scattered field is entirely defined by
 c_{n,1} and d_{n,1}
 (c_{n,-1}=c_{n,1}, d_{n,-1}=-d_{n,1}, and
 all other coefficients are zero).

 Parameters:
 - nNmax:     integer [1 x 1]
              number of n in series
 - Ca:        cell of integer {K x [1 x 1]}
              K is number of interfaces (K=1 for single sphere)
              radii of spherical interfaces (typically in NANOMETERS)
              Ca{K} is outer interface (largest sphere)
 - lambda:    possibly column vector [L x 1]
              wavelengths (typically in NANOMETERS)
 - Cepsilon:  cell of scalars or column vectors {K+1 x [L x 1]}
              epsilon of media (possibly
              wavelength-dependent) for k=0 (inside sphere)
              to k=K (embedding medium).
 - sPlot:     optional (default does nothing)
              'plot' will produce a new figure with a plot
              of Qext, Qabs, Qsca, and MLocAve
 - sCoeff:    optional (default does nothing)
              'coeff' will return the Mie coefficients
              alphakn1, betakn1, gammakn1, and deltakn1 
              'suscep' will return the Mie susceptibilities Gamma^k, Delta^k,
              A^, and B^k
              'both' will return both Mie coefficients and
              susceptibilities 

 Returns: structure stMieRes with fields containing the parameters for
          future reference and additional fields for the results
 - stMieRes.nNmax: scalar
 - stMieRes.a: scalar
 - stMieRes.lambda: [L x 1]
 - stMieRes.epsilonM: scalar or [L x 1]
 - stMieRes.x: [L x 1]
 - stMieRes.nK: scalar, number of interfaces
 - stMieRes.Ca: cell of {K scalars}
 - stMieRes.CepsilonM: cell of {K+1 x (scalar or [L x 1])}
 - stMieRes.Cx: cell of {K x [L x 1]}
 - stMieRes.Cs: cell of {K x [L x 1]}
 - stMieRes.Qext: [L x 1] wavelength-dependent extinction coefficient
 - stMieRes.Qsca: [L x 1] wavelength-dependent scattering coefficient
 - stMieRes.Qabs: [L x 1] wavelength-dependent absorption coefficient
 - stMieRes.MLocAve: [L x 1] wavelength-dependent average LFIEF
 - stMieRes.Gamma (if sCoeff='suscep' or 'both'): [L x nNmax]
 - stMieRes.Delta (if sCoeff='suscep' or 'both'): [L x nNmax]
 - stMieRes.CstMulGDAB (if sCoeff='suscep' or 'both'): [L x nNmax]
 - stMieRes.Cgammakn1 (if sCoeff='coeff' or 'both'): cell {K+1 x [L x nNmax]}
 - stMieRes.Cdeltakn1 (if sCoeff='coeff' or 'both'): cell {K+1 x [L x nNmax]}
 - stMieRes.Calphakn1 (if sCoeff='coeff' or 'both'): cell {K+1 x [L x nNmax]}
 - stMieRes.Cbetakn1 (if sCoeff='coeff' or 'both'): cell {K+1 x [L x nNmax]}
 - stMieRes.cn1 (if sCoeff='coeff' or 'both'): [L x nNmax]
 - stMieRes.dn1 (if sCoeff='coeff' or 'both'): [L x nNmax]

 This file is part of the SPlaC v1.0 package (copyright 2008)
 Check the README file for further information

EXAMPLE OF OUTPUT ^

Example figure output

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 disp ' ';
0002 global noCheckSum;
0003 if (isempty(noCheckSum) || ~noCheckSum)
0004     disp 'MulPweSolveMultiSphere: Solving Mie for sphere multilayer - CheckSum ON'
0005 else
0006     disp 'MulPweSolveMultiSphere: Solving Mie for sphere multilayer - CheckSum OFF'
0007 end
0008 
0009 % rearrange function parameters and define optional parameters
0010 % number of parameters is 1,2, or 3 if called as stMP,sOption,sCoeff
0011 % or 4,5, or 6 if nMax,Ca,lambda,Cepsilon,sOption,sCoeff
0012 nNbParam=nargin;
0013 if ((nNbParam==1) || (nNbParam==4))
0014     sPlot='No';
0015     sCoeff='No';
0016 end
0017 if ((nNbParam==2) || (nNbParam==5))
0018     sCoeff='No';
0019 end
0020 if (nNbParam<4)
0021     nNmax=stMP.nNmax;
0022     Ca=stMP.Ca;
0023     lambda=stMP.lambda;
0024     Cepsilon=stMP.Cepsilon;
0025 end
0026 
0027 nK=length(Ca); % number of spherical interfaces K
0028 
0029 % Get s_k and x_k for k=1..nK
0030 [Cs,Cx]=MulGetCsCx(lambda,Ca,Cepsilon);
0031 
0032 % Calculate susceptibilities Gamma^k_n, Delta^k_n, A^k_n, and B^k_n
0033 % (defined in Eqs. H.108 and H.117)
0034 % for all n,k and all lambda
0035 CstMulGDAB=MulSuscepGDAB(nNmax,Cs,Cx);
0036 % CstMulGDAB is a cell of K structures, each with the corresponding
0037 % susceptibilities
0038 % Gamma^k_n, Delta^k_n, A^k_n, and B^_n as matrices [L x Nmax]
0039 
0040 
0041 % Calculate Q coeffs and average local field on outside sphere
0042 stMieRes=PweQcoeff(Cx{nK},CstMulGDAB{nK});
0043 stMieRes.MLocAve=PweMLocAve(Cx{nK},CstMulGDAB{nK});
0044 
0045 % return results
0046 stMieRes.nNmax=nNmax;
0047 stMieRes.a=Ca{nK}; % for compatibility with single spheres
0048 stMieRes.lambda=lambda;
0049 stMieRes.epsilonM=Cepsilon{nK+1}; % for compatibility with single spheres
0050 stMieRes.x=Cx{nK}; % for compatibility with single spheres
0051 
0052 stMieRes.nK=nK;
0053 stMieRes.Ca=Ca;
0054 stMieRes.Cepsilon=Cepsilon;
0055 stMieRes.Cx=Cx;
0056 stMieRes.Cs=Cs;
0057 
0058 if (strcmpi(sCoeff,'suscep') || strcmpi(sCoeff,'both'))
0059     stMieRes.Gamma=CstMulGDAB{nK}.Gamma; % for compatibility with single spheres
0060     stMieRes.Delta=CstMulGDAB{nK}.Delta; % for compatibility with single spheres
0061     stMieRes.CstMulGDAB=CstMulGDAB; 
0062 end
0063 
0064 if (strcmpi(sCoeff,'coeff') || strcmpi(sCoeff,'both'))
0065     % calculate incident PW coefficient an1 and bn1 [1 x nNmax]
0066     stIncEabn1=PweIncEabn1(nNmax);
0067     an1mat=repmat(stIncEabn1.an1,length(lambda),1); % [L x nNmax]
0068     bn1mat=repmat(stIncEabn1.bn1,length(lambda),1); % [L x nNmax]
0069     % calculate Mie coefficients using a downward recurrence (pp. 623,624)
0070     % each cell of coeff corresponds to a given kk=0..nK
0071     stMieRes.Cgammakn1=cell(1,nK+1);
0072     stMieRes.Cdeltakn1=cell(1,nK+1);
0073     stMieRes.Calphakn1=cell(1,nK+1);
0074     stMieRes.Cbetakn1=cell(1,nK+1);
0075     stMieRes.Cgammakn1{1}=0; % no scattered field inside the smallest sphere
0076     stMieRes.Cdeltakn1{1}=0;
0077     % Initialize recurrence
0078     stMieRes.Calphakn1{nK+1}=an1mat;
0079     stMieRes.Cbetakn1{nK+1}=bn1mat;
0080     for kk=nK:-1:1
0081         % Eq. H.108 gamma^k=Gamma^k * alpha^k
0082         stMieRes.Cgammakn1{kk+1}=CstMulGDAB{kk}.Gamma .* stMieRes.Calphakn1{kk+1};
0083         stMieRes.Cdeltakn1{kk+1}=CstMulGDAB{kk}.Delta .* stMieRes.Cbetakn1{kk+1};
0084         % Eq. H.117 alpha^{k-1}=A^k alpha^k
0085         stMieRes.Calphakn1{kk}=CstMulGDAB{kk}.A .* stMieRes.Calphakn1{kk+1};
0086         stMieRes.Cbetakn1{kk}=CstMulGDAB{kk}.B .* stMieRes.Cbetakn1{kk+1};
0087     end
0088     stMieRes.cn1=stMieRes.Cgammakn1{nK+1}; % for compatibility with single spheres
0089     stMieRes.dn1=stMieRes.Cdeltakn1{nK+1}; % for compatibility with single spheres
0090 end
0091 
0092 % plot if required
0093 if strcmpi(sPlot,'plot')
0094     disp 'Drawing plot...'
0095     PwePlotQandM(stMieRes);
0096 end
0097 
0098 disp 'MulPweSolveMultiSphere: done.'
0099 disp ' '

This web page is part of the SPlaC package © 2008. Contact: Eric Le Ru
Generated on Wed 03-Dec-2008 11:10:14 by m2html © 2003 (adapted)