Home > SPlaC v1_0 > Mie > PWE > PweSolveSingleSphere.m

PweSolveSingleSphere

PURPOSE ^

Solves the problem of PWE of single sphere with Mie theory

SYNOPSIS ^

function stMieRes=PweSolveSingleSphere(nNmax,a,lambda,epsilonM,epsilonIn,sPlot,sCoeff)

DESCRIPTION ^

 Solves the problem of PWE of single sphere with Mie theory
 The parameters are given as arguments or may also be given in a
 structure stMP when called as PweSolveSingleSphere(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
 - a:         integer [1 x 1]
              radius of sphere (typically in NANOMETERS)
 - lambda:    possibly column vector [L x 1]
              wavelengths (typically in NANOMETERS)
 - epsilonM:  scalar or column vector [L x 1]
              epsilon of embedding medium (possibly
              wavelength-dependent)
 - epsilonIn: scalar or column vector [L x 1]
              epsilon of sphere material (possibly
              wavelength-dependent)
 - 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 alphan1, betan1, cn1, and
              dn1 as fields of the result structure
              'suscep' will return the Mie susceptibilities Gamma, Delta,
              A, and B as fields of the result structure
              '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.epsilonIn: scalar or [L x 1]
 - stMieRes.x: [L x 1]
 - stMieRes.s: [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.alphan1 (if sCoeff='coeff' or 'both'): [L x nNmax]
 - stMieRes.betan1 (if sCoeff='coeff' or 'both'): [L x nNmax]
 - stMieRes.cn1 (if sCoeff='coeff' or 'both'): [L x nNmax]
 - stMieRes.dn1 (if sCoeff='coeff' or 'both'): [L x nNmax]
 - stMieRes.Gamma (if sCoeff='suscep' or 'both'): [L x nNmax]
 - stMieRes.Delta (if sCoeff='suscep' or 'both'): [L x nNmax]
 - stMieRes.A (if sCoeff='suscep' or 'both'): [L x nNmax]
 - stMieRes.B (if sCoeff='suscep' 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 'PweSolveSingleSphere: Solving Mie for single sphere - CheckSum ON'
0005 else
0006     disp 'PweSolveSingleSphere: Solving Mie for single sphere - 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 5,6, or 7 if nMax,a,lambda,epsilonM,epsilonIn,sOption,sCoeff
0012 nNbParam=nargin;
0013 if ((nNbParam==1) || (nNbParam==5))
0014     sPlot='No';
0015     sCoeff='No';
0016 end
0017 if ((nNbParam==2) || (nNbParam==6))
0018     sCoeff='No';
0019 end
0020 if (nNbParam<4)
0021     nNmax=stMP.nNmax;
0022     a=stMP.a;
0023     lambda=stMP.lambda;
0024     epsilonM=stMP.epsilonM;
0025     epsilonIn=stMP.epsilonIn;
0026 end
0027 
0028 % Calculate x=k_M a where k_M is wavevector outside the sphere
0029 % see Eq. H.45
0030 x=2*pi* sqrt(epsilonM) *a ./ lambda; % [L x 1]
0031 % Calculate s=k_in/k_M where k_in  is wavevector inside sphere
0032 % see Eq. H.45
0033 % 0*lambda is used to ensure that s is [L x 1] even when both epsilon are
0034 % scalar
0035 s=sqrt(epsilonIn+0*lambda)./sqrt(epsilonM); % [L x 1]
0036 
0037 % Calculate susceptibilities Gamma_n, Delta_n, A_n, and B_n
0038 % (defined in Eqs. H.12 and H.13)
0039 % for all n and all lambda
0040 % Gamma, Delta, A, and B are matrices [L x Nmax]
0041 stGDAB=GenSuscepGDAB(nNmax,s,x);
0042 
0043 % Calculate Q coeffs and average local field for PWEs
0044 stMieRes=PweQcoeff(x,stGDAB);
0045 stMieRes.MLocAve=PweMLocAve(x,stGDAB);
0046 
0047 % return results
0048 stMieRes.nNmax=nNmax;
0049 stMieRes.a=a;
0050 stMieRes.lambda=lambda;
0051 stMieRes.epsilonM=epsilonM;
0052 stMieRes.epsilonIn=epsilonIn;
0053 stMieRes.x=x;
0054 stMieRes.s=s;
0055 
0056 if (strcmpi(sCoeff,'suscep') || strcmpi(sCoeff,'both'))
0057     stMieRes.Gamma=stGDAB.Gamma;
0058     stMieRes.Delta=stGDAB.Delta;
0059     stMieRes.A=stGDAB.A;
0060     stMieRes.B=stGDAB.B;
0061 end
0062 
0063 if (strcmpi(sCoeff,'coeff') || strcmpi(sCoeff,'both'))
0064     % calculate incident PW coefficient an1 and bn1
0065     stIncEabn1=PweIncEabn1(nNmax);
0066     an1mat=repmat(stIncEabn1.an1,length(lambda),1); % [L x nNmax]
0067     bn1mat=repmat(stIncEabn1.bn1,length(lambda),1); % [L x nNmax]
0068     % Eq. H.12
0069     stMieRes.cn1=stGDAB.Gamma .* an1mat;
0070     stMieRes.dn1=stGDAB.Delta .* bn1mat;
0071     % Eq. H.13
0072     stMieRes.alphan1=stGDAB.A .* an1mat;
0073     stMieRes.betan1=stGDAB.B .* bn1mat;
0074 end
0075 
0076 % plot if required
0077 if strcmpi(sPlot,'plot')
0078     disp 'Drawing plot...'
0079     PwePlotQandM(stMieRes);
0080 end
0081 
0082 disp 'PweSolveSingleSphere: done.'
0083 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)