Advanced and custom optical material models in FDTD and MODE
The following material models can be used in a variety of advanced applications, such as nonlinear device simulations. Many of the following models have been implemented with the Flexible material plugin framework, and are distributed with the standard FDTD and MODE installation packages. Source code is provided for some models implemented with the Flexible material plugin framework.
Note: In particular, the user should be aware of the following points.

Available material models (come with the software package)
Chi2
This nonlinear model allow users to define the value for the χ(2) term directly. An arbitrary dispersive base material can also be specified, in which case the added polarization will be in addition to the polarization of any base material that is selected. If the χ(1) term is 0 (default), the polarization will be added to the vacuum.
Users that only require a χ(2) term are encouraged to use this model rather than the Chi3/Chi2 model because it uses a more numerically accurate implementation.
Note: Some artificial asymmetry can be introduced by the algorithm. 
Parameters and units
 χ(1) : Chi1 [unitless]
 χ(2) : Chi2 [m/V]
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Examples and more information
Harmonic generation
Source code: chi2.h, chi2.cpp
Storage fields
No storage field specified by default
Chi3/Chi2
The usage for the Chi3/Chi2 material is the same as the Chi2 material, but with the addition of the Chi3 term. Support for higher order terms could be added with some straightforward modifications to the source code for this model (provided below).
Note: Some artificial asymmetry can be introduced by the algorithm. 
Parameters and units
 χ(1) : Chi1 [unitless]
 χ(2) : Chi2 [m/V]
 χ(3) : Chi3 [m^2/V^2]
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Examples and more information
Optical bistability
Source code: chi3.h, chi3.cpp
Storage fields
No storage field specified by default
Chi3 Raman Kerr
This material allows one to model Kerr and Raman interactions.
$$P(t) = \varepsilon_0 \chi^{(1)} E(t) + \varepsilon _0 \alpha \chi_0^{(3)} E^3(t) + \varepsilon_0( 1  \alpha) E(t) (\chi _{Raman}^{(3)}(t) \ast E^2(t))$$
$$\chi _{Raman}^{(3)} (\omega) = \frac{\chi _0^{(3)} \omega _{Raman}^2}{\omega _{Raman}^2 2j\omega\delta _{Raman}  \omega^2}$$
$$\chi _{Raman}^{(3)}(t) = FT(\chi _{Raman}^{(3)}(\omega))$$
Parameters and units
 χ(1) : Chi1 [unitless]
 χ(3) : Chi3 [m^2/V^2]
 α : the alpha term in this model controls the relative weighting between the Kerr and Raman terms. 0 ≤ α ≤ 1. [unitless]
 ωRaman : the nonlinear Raman angular frequency [Hz]
 δRaman : the linewidth of the resonance [Hz]
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Examples and more information
Solitons in SOI waveguide
Source code: chi3ramankerr.h, chi3ramankerr.cpp
Storage fields
storage_0 = Sn: Chi3 Raman term, \\((1  \alpha) (\chi _{Raman}^{(3)}(t) \ast E^2 (t)) \\), for the nth time step
storage_1 = Sn+1: Chi3 Raman term, \\((1  \alpha) (\chi _{Raman}^{(3)}(t) \ast E^2 (t)) \\), for the (n+1)th time step
References
This model was implemented based on:
 Goorjian and Taflove, Optics Letters, 1992, 180182
 Taflove, Computational Electromagnetics: The FiniteDifference TimeDomain Method. Boston: Artech House, (2005).
FourLevel TwoElectron
This model implements a fourlevel twoelectron model that can be used for simulation of gain and lasing. The fourlevel model is described in the following diagram:
Parameters and units
 wa, wb : the angular frequencies corresponding to the energy differences of levels 21 and 30 respectively [Hz]
 ga, gb : the damping coefficients for Pa and Pb respectively which control the nonradiative losses [Hz]
 t30, t32, t21, t10 : the lifetimes of the different decay channels [s]
 N DENSITY : the electron population density [m^3]
 SET INITIAL POPULATIONS : if 0 (false), the initial populations are N0=N1=1, and N2=N3=0. If set to 1 (true), the user can specify the initial populations and use this mechanism to change the number of electrons in the model
 N0(0), N1(0), N2(0), N3(0) : the normalized electron density population at t=0. Set these number only when set initial population=1. [unitless]
 DO NOT ENFORCE ELECTRON CONSERVATION : when set to 0 (false), electron conservation is enforced and the level N0 population is calculated by taking Ninitial  N3  N2  N1. Any remaining electrons are distributed among the other levels. If this property is set to 1 (true), then N0 is calculated from the rate equations but, with higher pump fields, it is possible for the total number of electrons to change over time and even to reach completely unphysical values.
The user can monitor the level populations by looking at the storage fields 47 which correspond to levels 03.
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Examples and more information
Gain and Laser, 4 level 2 electron model, Pump and probe simulation
Source code: fourleveltwoelectron.h, fourleveltwoelectron.cpp
Storage fields
Polarization between levels 1 and 2:
storage_0 = Pan+1: (n+1)th time step
storage_1 = Pan: nth time step
Polarization between levels 0 and 3:
 storage_2 = Pbn+1: (n+1)th time step
 storage_3 = Pbn: nth time step
Population of levels for the nth time step:
 storage_4 = N0: Level 0
 storage_5 = N1: Level 1
 storage_6 = N2: Level 2
 storage_7 = N3: Level 3
References
The fourlevel twoelectron model based on the implementation described in:
 Chang and Taflove, Optics Express, 2004, 38273833.
 Taflove, Computational Electromagnetics: The FiniteDifference TimeDomain Method. Boston: Artech House, (2005).
Kerr nonlinear
In the Kerr nonlinear model, the electric polarization field P will depend on the electric field E in the following manner.
$$P(t) = \varepsilon_0 (\chi ^{(1)} + \chi ^{(3)} \vert E(t) \vert ^2) E(t) $$
Solving for the displacement field D gives
$$D(t) = \varepsilon _0 (\varepsilon _r + \chi ^{(3)} \vert E(t) \vert ^2) E(t) $$
The relative permittivity and \(\chi ^{(3)} \) values must be specified by the user.
This material model does not support the option to select a base material.
Parameters and units
 εr : Relative permittivity [unitless]
 χ(3) : Chi3 [m^2/V^2]
Behavior of Material Explorer and meshing algorithm
The material explorer will display a refractive index of 1, and the meshing algorithm will assume a refractive index of 1 when determining the simulation mesh size.
Examples and more information
Kerr effect example, Spatial Solitons  graphene
Source code: N/A. This is not a plugin material.
Paramagnetic
The paramagnetic material model allows the user to specify both the permittivity and permeability of the material to simulate magnetic materials.
Parameters and units
 εr : Relative permittivity [unitless]
 μr : Relative permeability [unitless]
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Examples and more information
Not available
Source code: paramagnetic.h, paramagnetic.cpp
Storage fields
No storage field specified by default
Magnetic Electric Lorentz
This material allows for a Lorentz term in both the electric and magnetic properties. The material has a relative permittivity and permeability given by
$$\varepsilon (\omega) = \varepsilon _{base} (\omega) + \chi _e + \frac{\Delta \varepsilon \omega _e^2}{\omega _e^2  2i\delta_e\omega  \omega ^2}$$
$$\mu (\omega) = 1 + \chi _m + \frac{\Delta \mu \omega _m^2}{\omega _m^2 2i\delta_m\omega\omega ^2}$$
where the subscript e and m refer to the electric and magnetic properties respectively and w is the angular frequency. The user has the option of disabling either the electric or the magnetic portion of the update by setting the property 'exclude electric' or 'exclude magnetic' to 1 (true).
The properties of this material cannot be seen in the materials explorer, but can be visualized by using the script file magnetic_electric_lorentz.lsf
Parameters and units
 χ(0) electric : Chi0, the susceptibility to add to the base material. If no base material is selected, εbase(ω) = 1. [unitless]
 Δε electric : the change in permittivity [unitless]
 ω0 electric : the angular frequency of the resonance [Hz]
 δ electric : the linewidth of the resonance [Hz]
 χ(0) magnetic : Chi0, the susceptibility [unitless]
 Δμ magnetic : the change in permeability [unitless]
 ω0 magnetic :the angular frequency of the resonance [Hz]
 δ magnetic : the linewidth of the resonance [Hz]
 exclude electric : if the excluded electric is set to 1 (true), then e=ebase.
 exclude magnetic : if the exclude magnetic is set to 1 (true), then m=1.
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Examples and more information
Bulk metamaterials
Source code: magneticelectriclorentz.h, magneticelectriclorentz.cpp
Storage fields
 storage_E_0 = Pn: Polarization for the nth time step
 storage_E_1 = Pn+1: Polarization for the (n+1)th time step
 storage_H_0 = Mn: Magnetization for the nth time step
 storage_H_1 = Mn+1: Magnetization for the (n+1)th time step
Index Perturbation (np Density / temperature)
The Index Perturbation material model is used to convert electron/hole density or temperature data into a change in refractive index. Typically a base material should be selected when using this material model.
Parameters and units
For details on these models, see Index Perturbation (np Density / temperature).
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Examples and more information
Index Perturbation (np Density / temperature)
Source code:>N/A. This is not a plugin material.
Available material models (additional plugins)
Lorentz example
A practical demonstration showing user the basic idea and the implementation of material plugin using a simple Lorentz model, e.g., making the .h, .cpp and .dll files.
$$\varepsilon (\omega) = \varepsilon _{base}(\omega) + \frac{\Delta \varepsilon \omega _0^2}{\omega _0^2  2i\delta\omega \omega ^2}$$
Parameters and units
 ω0 : the angular frequency of the resonance [Hz]
 δ : the linewidth of the resonace [Hz]
 Δε : the change in relative permittivity [unitless]
 εbase(ω) : Base material permittivity. If no base material is selected, εbase(ω) = 1
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Examples and video
Part I  Lorentz example, Presentation slides
Source code: lorentzexample.zip
Twolevel oneelectron example
A practical demonstration showing user the basic idea and the implementation of material plugin using a Twolevel model, e.g., making the .h, .cpp and .dll files.
Parameters and units
 w0: the angular frequencies corresponding to the energy differences of levels 10 [Hz]
 g, g10 : the damping coefficients of P and transition 1>0 respectively which control the nonradiative losses [Hz]
 Nd: the electron population density [m^3]
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Source code: twolevelexample.zip
Step index
A simple plugin material model which modifies the time domain update equations in order to apply a change in permittivity over a time step function, e.g., caused by an input electrical signal.
Parameters and units
 Δε : the change in relative permittivity [unitless]
 time_start, time_stop : the start and stop time of the step function [s]
Behavior of Material Explorer and meshing algorithm
The material explorer will display the refractive index of the base material, if one is selected. If no base material is selected, a refractive index of 1 will be displayed.
The meshing algorithm will use the refractive index of the base material when determining the simulation mesh size. If no base material is selected, a refractive index of 1 will be assumed.
Examples and more information
Ring modulator, Flexible material plugin framework  Basic concept
Source code: stepindex.dll, stepindex.h, stepindex.cpp
Storage fields
Storage_E_0 = time_dt: Raw time data
See Also
Material database (optical) for the definition of other settings in the Material Database window.