Complex-valued functions for index in object defined dielectric material


For simulations where the refractive index of a material depends on position, you can use the “object defined dielectric” option in the material tab and provide an expression for the refractive index as a function of the spatial coordinates:

However, this tool is meant for specifying a real refractive index, and so it is important to make sure that the expression you provide is a real-valued function, otherwise you might find that the index interpreted by the solver is not quite what you expect.

For example, imagine you wanted to use the function:

n(x,y) = 1.5+0.3*sqrt(1-(x^2+y^2))

for the refractive index of a fiber. The argument of the square root becomes negative for values of the radial distance, r = sqrt(x^2 + y^2), greater than 1. Therefore, for r>1 the function n(x,y) takes complex values:

What you really want to use for defining the index is the real part of n(x,y) so the index for r>1 is uniform (n=1.5). However, if you provide the function as given before, the index profile in the eigensolver analysis won’t be as expected:

In order to get the right profile you need to make sure that the function for the index is real-valued. To do that you can add a “step function”


that makes sure the argument of the square root is not negative:

n(x,y) = 1.5+0.3sqrt(((1-(x^2+y^2))>=0)(1-(x^2+y^2)))

This expression works because (1-(x^2+y^2))>=0 will return 0 whenever the argument of the square root is negative. If you use this function you will get the desired profile in the eigenmode solver:

I have attached a simulation file where you can check this:
graded_example.lms (233 KB)


A post was split to a new topic: Is it possible to define complex refractive index?