Ansys Lumerical

This node allows you to use Lumerical projects (*.ldev, *.fsp, *.icp, *.lms) and Lumerical scripts (*.lsf) within an optiSLang workflow. Open a file in the node and the parameters and results are displayed in the editor.

Lumerical's DEVICE Suite of component-level simulation products use multiphysics-style simulation workflows to model optical, electrical and thermal effects at the physical level. This custom integration of Lumerical in optiSLang provides an easy and convenient way of creating automated workflows involving not only various Lumerical solvers but also other tools that are available in optiSLang and also perform variation analysis and/or optimization of such workflows.

Setup

When the integration is used for the first time, the local Lumerical installation paths will be automatically localized utilizing "AWP_ROOT" environmental variables and "Lumerical" registry values.

You are also able to manually enter a path pointing to the bin folder of the Lumerical installation by selecting Browse for custom solver path and then choosing the Lumerical bin folder in the invoked file explorer via the Browse… button (for example, C:\Program Files\ANSYS Inc\v261\bin).

It is important that the Lumerical project is solved once and saved (in Analysis Mode) before it can be used in optiSLang. If the project is not solved and no results are available, no results are shown in optiSLang.

Automatic detection of the suitable solver is implemented; therefore it is not necessary to manually select the solver in the Settings dialog box under the General tab before loading the project. The selection of the solver is important because the parameters and the results must be read from the correct objects which depend on the type of solver. It is possible that a project has more than a single solver, then it is necessary to select the solver to be run.

Parameters and Responses

The integration can access all the parameters and results from the model (or Root Element in case of the INTERCONNECT solver), solvers, subgroups and monitors. All of these values are available to be used inside optiSLang. Complex values are not supported in optiSLang, so any complex parameters or results must be split into real and imaginary parts and can be used separately.

Scripting

You can run a custom Lumerical script file (.lsf) after every simulation run. This feature is only available if the Lumerical script file (.lsf) is not used as an input file in the main integration dialog box. This feature can be used to perform postprocessing of results from the simulation using Lumerical's API functions. This allows you to transfer non-scalar values (or complex values as a whole) from one Lumerical node to another and even to other tools inside optiSLang by saving them into files.

To run a custom script file, select the Use custom *.lsf script check box in the Settings dialog box under the General tab and select the required script file using the Browse... button.

Each path to script supports the option of definition via optiSLang path styles. If a file path is selected and the path style is changed, the path will be converted to the newly selected style. If path in the text field is edited, the file must be reselected using the Browse… button to restore proper conversion between path styles.

The following options are available:

  • Relative to working dir

  • Relative to project

  • Absolute path (default)

  • Relative to reference files dir

  • Relative to project working dir

The integration can only handle custom script files with the following requirements. The script should have the following three functions defined, irrespective of whether or not they are used:

  • listScriptParameters(): A function that returns a struct with parameters used in the script with their reference values. An example for this function:

    # returns a list of parameters with its reference values this script uses function listScriptParameters(){ return {param_1_name: param_1_value, param_2_name: param_2_value}; }

  • listScriptResults(): A function that returns a struct with results used in the script with their reference values. An example for this function:

    # returns a list of results with its reference values this script produces function listScriptResults(){ return {result_1_name: result_1_value, result_2_name: result_2_value}; }

  • computeScriptResults(parameters): A function that computes the script results with script parameters. This function should always take in only one struct argument (parameters) irrespective of whether or not it is used inside the function. An example for this function:

    # compute and returns a new list of results function computeScriptResults(parameters){ # perform the required computations result_1_value = parameters.param_1_name + parameters.param_2_name; result_2_value = parameters.param_1_name - parameters.param_2_name; return {result_1_name: result_1_value, result_2_name: result_2_value}; }

Other than these three mandatory functions, the run script can have any number of other functions if required.

Scripting Example

The following simple example shows how to set up a custom script file with all required functions for direct usage. Copy the script and save it as an .lsf file. This file can then be used with the Custom script setting.

# Copyright Ansys Inc
##Prepare workspace
clear;
closeall;
clearfunctions;

## Declare Results
function listScriptResults(){
    return {'D': 0,'E': 0};
}

## Declare Parameters
function listScriptParameters(){
    A = 1; B = 2; C = 3;
    return {'A': A, 'B': B, 'C': C};
}

## optiSLang Calculate Results
function computeScriptResults(parameters){ 

A = parameters.A; 
B = parameters.B;
C = parameters.C;

D = parameters.A+parameters.B+parameters.C;
E = parameters.A*parameters.B*parameters.C;
return {'D': D,'E': E};
}

parameters = listScriptParameters();
F = computeScriptResults(parameters);
Python scripts

The node supports running custom Python scripts inside Lumerical. Two options are available: script pre-update of the project and script post-update of the project. To run a python script file, select the Use Python script pre-update or Use Python script post-update check boxes in the Settings dialog box under the General tab and select the required script files using the Browse... button.

Use Cases

The following table lists the supported use cases and how to set them up.

Use CaseSetup
Project file by itself
  1. In the Lumerical dialog box, click  .

  2. Browse to the project file, select it, and click Open.

  3. Switch to the Settings tab.

  4. Click Change settings.

  5. Clear the Run custom script check box.

  6. Click OK.

Project file followed by a script file
  1. In the Lumerical dialog box, click  .

  2. Browse to the project file, select it, and click Open.

  3. Switch to the Settings tab.

  4. Select the Run custom script check box..

  5. Next to the Custom script field, click  .

  6. Browse to the script file, select it, and click Open.

  7. Clear the Skip solve check box.

  8. Click OK.

Script file by itself
  1. In the Lumerical dialog box, click  .

  2. Browse to the script file, select it, and click Open.

  3. Switch to the Settings tab.

  4. Clear the Run custom script check box.

  5. Click OK.

Script driven project file
  1. In the Lumerical dialog box, click  .

  2. Browse to the project file, select it, and click Open.

  3. Switch to the Settings tab.

  4. Select the Run custom script check box.

  5. Next to the Custom script field, click  .

  6. Browse to the script file, select it, and click Open.

  7. Select the Skip solve check box.

  8. Click OK.

Export

The node offers various export options which can be found in the Settings dialog box under the Export tab. Exporting any images require GUI invocation.

Settings

The node provides the following settings:

TabNameDefault valueDescription
GeneralPath to executableBrowse for custom solver pathPath to the bin folder where the all solvers are placed.
SolverFDTDSolver to run the simulation with.
Skip solveFalseWhen selected, only runs the custom script file and skips the solver.
GPU solveFalseUtilizes GPU for solution (available only for solvers FDTD and RCWA).
Use custom *.lsf scriptFalseWhen selected, enables the Custom *.lsf script field for selection of the script.
Custom *.lsf script-Custom *.lsf script file to run. Supports multiple file path styles.
Use Python script pre-updateFalseWhen selected, enables the Python pre-update script field for selection of the script.
Python script pre-update-Custom Python script which is run in Lumerical before the solution of the project. Supports multiple file path styles.
Use Python script post-updateFalseWhen selected, enables the Python post-update script field for selection of the script.
Python script post-update-Custom Python script which is run in Lumerical after the solution of the project. Supports multiple file path styles.
ExportExport material database (*.mdf)FalseWhen selected, material database is exported to the .optislang folder. Available for solvers FDTD, RCWA, STACK, FDE, EME, varFDTD.
Export results (*.hdf5)FalseWhen selected, results are exported to the .optislang folder in the HDF format. Available for all the solvers except INTERCONNECT.
Export results (.*json)FalseWhen selected, results are exported to the .optislang folder in the JSON format. Available for all the solvers.
Export results (*.csv)FalseWhen selected, results are exported to the .optislang folder in the CSV format. Available for solver INTERCONNECT.
Export perspective view (*.png)FalseWhen selected, perspective view is exported to the .optislang folder in the PNG format. This setting initializes GUI during the export. Available for all the solvers except INTERCONNECT.
Export XY view (*.png)FalseWhen selected, XY view is exported to the .optislang folder in the PNG format. This setting initializes GUI during the export. Available for all the solvers except INTERCONNECT.
Export XZ view (*.png)FalseWhen selected, XZ view is exported to the .optislang folder in the PNG format. This setting initializes GUI during the export. Available for all the solvers except INTERCONNECT.
Export YZ view (*.png)FalseWhen selected, YZ view is exported to the .optislang folder in the PNG format. This setting initializes GUI during the export. Available for all the solvers except INTERCONNECT.
Run Options

This node has general Run Options. Supported options are:

  • Auto-save behavior

  • Read mode

  • Distinct working dir

  • HPC licensing

  • Maximum execution runtime

  • Maximum simultaneous executions

  • Designs per execution

  • Retry execution

Versions and Requirements
Known issues and limitations
  • The Maximum simultaneous executions run option does not function reliably when used in combination with a custom *.lsf script. Therefore, it is recommended to avoid using this combination of settings.