# Knowledge Base

 Navigation: Scripting Language > Functions stackpurcell We've made some changes. Use 'Ctrl-F5' to clear your browser cache.

Analytically calculates the Purcell factor and far-field emission power density for a multilayer stack. The usage for this command is very similar to stackdipole, but the result returned in this case is a struct that contains the following datasets:

1. power

Attribute: purcell_factor. This is the total power of a monochromatic dipole at the specified position and emission frequency divided by the power that it would radiate in a homogeneous medium.

Parameters: dipole/z, f/lambda

2. density

Attributes: upward, downward, upward_into_air, downward_into_air. This is the power density per steradian by far field emission angle, also in units of the power that would radiate in a homogeneous medium.

Parameters: theta, dipole/z, frequency/wavelength

### Related topics:

To calculate the luminance and radiance of a multi-layer stack, see stackdipole

For simulating the plane wave transmission of a multi-layer stack, see stackrt, stackfield
For mode analysis of an OLED layer structure, see OLED slab mode analysis.
For simulating the dipole emission for arbitrary geometries using the finite-difference time-domain method, see OLED application examples.

 Note: Thickness of first and last layer It is necessary to specify the thickness of each layer, including the first and last layers. Often, a thickness of zero can be used for these layers.

 Syntax Description result = stackpurcell(n,d,f,z,orientation,res) Analytically calculates the Purcell factor and far-field emission power density of a multi-layer stack

 Parameter Default value Type Description n required vector Refractive index of each layer. Size is either Nlayers, or Nlayers x length(f) if dispersive materials are involved. d required vector Thickness of each layer. Size is Nlayers. f required vector Frequency vector. z required vector Position of the dipoles (0 is the bottom of the stack). Size is Ndipoles. orientation optional 0 vector Orientation of the dipoles. The options are Unpolarized: 0 Vertical p-polarized : 1 Horizontal s-polarized: 2 horizontal p-polarized : 3 Size is Ndipoles. res optional 1000 number The resolution for far field emission angle.

Example

Use stackpurcell to explore the positiong of dipole in a multilayer stack

# frequency range

Nfreqs = 101;

lambda = linspace(380e-9,780e-9,Nfreqs); # 380nm to 780nm

f = c/lambda;

# multilayer geometry

n = matrix(5,Nfreqs); d = matrix(5,1);

n(1,1:Nfreqs) = getfdtdindex("Al (Aluminium) - Palik",f,f(1),f(Nfreqs)); d(1) = 0; # bottom substrate

# Note: this reads the material properties from FDTD Solutions material database. If you are using another product, please entire (n,k) explicitly

n(2,1:Nfreqs) = 1.85; d(2) = 60e-9;

n(3,1:Nfreqs) = 1.9; d(3) = 220e-9;

n(4,1:Nfreqs) = 1.8; d(4) = 120e-9;

n(5,1:Nfreqs) = 1.53; d(5) = 0; # top substrate (glass)

# dipole positions/orientations

Ndipole= 51; # number of dipoles

z = linspace( d(2), d(2)+d(3), Ndipole ); # consider positions only within middle dielectric layer

orientation = matrix(Ndipole) * 0; # consider only randomly oriented dipoles

# angular_res: resolution for emission angle (farfield angle)

res = 198;

result = stackpurcell(n,d,f,z,orientation,res); # result is a struct

# plot Purcell factor for dipole located at the middle of the layer

purcell = pinch(result.power.purcell_factor); # size is Ndipole by Nfreqs

plot(lambda*1e9, pinch(purcell,1,round(Ndipole/2)),'wavelength (nm)','Purcell factor');

# plot far field power density at center frequency

theta = result.density.theta;

density = pinch(result.density.upward_into_air); # size is res by Ndipole by Nfreqs

image(theta, z*1e+9, pinch(density,3,round(Nfreqs/2)), "far-field angle (degrees)", "dipole position (nm)", num2str(f(round(Nfreqs/2))*1e-12)+"THz into Air");