Skip to content
System Status: All systems are operational • Services are available and operational.
Click for detailed status

Ansys FDTD

FDTD is a software for modeling photonic components, processes, and materials.

Ansys FDTD on Euler

On Euler the following versions are available via modules:

Version Module command
Ansys Research 2025 R2 module load FDTD/2025R2

Licenses are available in the ETH IT Shop.

Example job scripts and Python API

With FDTD, you can either run a single .fsp file, an .lsf script or use the bundled Python API

Running a .fsp file

To run the file simulation.fsp on 4 cores, you can use the following runscript

#!/bin/bash
#SBATCH -n 4
#SBATCH --time=1:00:00
#SBATCH --mem-per-cpu=4000

module load fdtd/2025R2
srun fdtd-engine-ompi-lcl Simulation.fsp

Running a .lsf script

lsf script need to be run with a different script in batch mode as otherwise the software would try to start the FDTD GUI. To run the script testscript.lsf, you can use the following runscript

#!/bin/bash
#SBATCH -n 1
#SBATCH --time=1:00:00
#SBATCH --mem-per-cpu=4000

module load fdtd/2025R2
fdtd-solutions-batch testscript.lsf

Using the Python API of FDTD

Python script (test.py) that uses the FDTD Python API

import sys, os


sys.path.append("/cluster/software/commercial/ansys252/v252/Lumerical/api/python/")
sys.path.append(os.path.dirname(__file__)) #Current directory

import lumapi

with lumapi.FDTD(hide=True) as fdtd:
    fdtd.addfdtd(dimension="2D", x=0, y=0, x_span=4e-6, y_span=4e-6)
    fdtd.set("simulation time", 1000e-15)

    fdtd.addgaussian(name="source", injection_axis="y", direction="forward",
                     x=0, x_span=3e-6, y=-1e-6)
    fdtd.setglobalsource("wavelength start", 1.5e-6)
    fdtd.setglobalsource("wavelength stop", 1.6e-6)

    fdtd.addpower(name="transmission", monitor_type="2D Y-normal",
                  x=0, x_span=3e-6, y=1e-6)

    fdtd.save("test.fsp")
    fdtd.run()

    print(fdtd.getresult("transmission", "T"))

    fdtd.save("test.fsp")

The FDTD Python API does not use $LD_LIBRARY_PATH to locate its dependencies. Instead, it uses the environment variable $LUMERICAL_LD_LIBRARY_PATH.

Since some dependencies are loaded through environment modules, you must append the contents of $LD_LIBRARY_PATH to $LUMERICAL_LD_LIBRARY_PATH in your job script (in this example, run.sh).

#!/bin/bash
#SBATCH --ntasks=1
#SBATCH --time=1:00:00
#SBATCH --mem-per-cpu=4g

module load fdtd/2025R2

export LUMERICAL_LD_LIBRARY_PATH=$LUMERICAL_LD_LIBRARY_PATH:$LD_LIBRARY_PATH

python test.py

The job is then submitted with the command

sbatch run.sh