Lumerical products provide interoperability for importing data from and exporting data to TDR files, which is the standard file exchange format for Synopsys Sentaurus™ tools.
This interoperability facilitates combined workflows for applications such as CMOS image sensors.
Core commands
To interact with TDR files, use the following built-in script commands:
Note: These built-in script commands are only available on Linux.
- tdrinfo – Returns information stored in a TDR file as a struct.
- tdraddregion – Adds a geometry region from a TDR file as a simulation object in Lumerical.
- tdrwritedataset – Writes a Lumerical dataset to a TDR file.
- tdrimportdataset – Imports datasets into FDTD, MODE, and Multiphysics, such as np density and doping concentration.
Utility functions
To ease the experience of using the script commands to interact with TDR files, we also provide a set of user-defined script functions for utility purposes. These functions are attached to this Knowledge Base article as a script file. These functions are available in the attached lsf script file in this Knowledge Base article.
Available commands
The list of utility functions available are as follows, and the release version of Lumerical products they are compatible with are shown below. For specific syntax and documentation of input parameters of each function, please see the comments above each function in tdr_utility_functions.lsf.
Compatible with Lumerical 2026 R1 and newer:
- tdrinfoString: This function is a wrapper around tdrinfo and it extracts information from a TDR file as a formatted string suitable for viewing in the script prompt or in a text editor if saved to file.
- addGeometry: This function is a wrapper around tdraddregion and it adds all regions from one geometry in a TDR file.
- tdrWriteOpticalGeneration: This function is a wrapper around tdrwritedataset and it specifically writes an FDTD optical generation dataset to a TDR file.
Compatible with Lumerical 2026 R1.2 and newer:
- tdrImportDoping: This function is a wrapper around tdrimportdataset and it specifically imports doping concentrations from a TDR file into CHARGE.
- tdrImportNPDensity: This function is a wrapper around tdrimportdataset and it specifically imports electron and hole densities from a TDR file into FDTD and MODE.
Select examples of using these functions are shown below.
Example – Extract information from a TDR file as a string and save to a text file.
# Import user-defined functions
tdr_utility_functions;
tdrFileName = "test_file.tdr";
formattedOutput = "File: " + tdrFileName + "\n";
res = tdrinfo(tdrFileName); #built-in script command, returns structures stored in a tdr file as struct
formattedOutput = formattedOutput + tdrinfoString(res); #utility function defined in tdr_utility_functions to convert struct to string
#Inspect file content in the script prompt and save to text file.
print(formattedOutput);
write("tdrinfo.txt",formattedOutput,"overwrite");
Example – Add geometry from a TDR file, and output the regions added
# Import user-defined functions
tdr_utility_functions;
tdrFileName = "test_file.tdr";
# Struct that represents a map from TDR material (output of tdrinfo for one geometry) to Lumerical material.
# Lumerical material must exist. To avoid setting material do not include it in the map or set Lumerical material
# as empty string. For materials that Lumerical does not already have, first add them to the material database.
materialMap = {"Aluminum" : "Al (Aluminium) - CRC",
"Silicon" : "Si (Silicon) - Palik",
"Oxide" : "SiO2 (Glass) - Palik"};
# Add geometry from TDR file.
# Utility function defined in tdr_utility_functions. It calls tdraddregion built-in function for all regions in one geometry.
res = addGeometry(tdrFileName, "geometry_0", materialMap, "cs_3d_z_y_x_neg");
if(!isstruct(res)) {
assert("Error adding geometry from TDR: " + res,false);
} else {
formattedOutput = "File: " + tdrFileName + "\n";
formattedOutput = formattedOutput + tdrinfoString(res.tdrinfo); #utility function defined in tdr_utility_functions to convert struct to string
#Inspect file content and added regions.
print(formattedOutput);
print(res.regionsAdded);
write("tdrinfo.txt",formattedOutput,"overwrite");
write("regions.txt",res.regionsAdded,"overwrite");
}Example – Export the FDTD optical generation rate
# Import utility functions
tdr_utility_functions;
# Run after FDTD simulation (Omitted here)
# After simulation, run CW generation analysis script
runanalysis("CW_generation");
## Save optical generation rate using the utility function
G = getresult("CW_generation","G"); # Get result dataset
# Zero negative values (interpolation in CW_generation analysis script may cause artifacts at boundaries)
Gpos = rectilineardataset("G",G.x,G.y,G.z);
Gpos_mat = G.G;
negInd = find(Gpos_mat < 0);
if(all(negInd)) { #make sure there are indices with negative values
Gpos_mat(negInd) = 0;
Gpos.addattribute("G",Gpos_mat);
G = Gpos;
}
# Define options structure, including the region for CW generation, and coordinate systems
opt = {"region_name" : "CW_generation",
"source_cs" : "cs_3d_z_y_x_neg",
"destination_cs" : "cs_3d_x_y_z"};
# Call utility function to write to TDR file
err = tdrWriteOpticalGeneration(datasetname + ".tdr",G,opt);
assert("Error writing optical generation to tdr file: " + err, err == "");
Example – Add a doping concentration from a TDR file into CHARGE
# Import utility functions
tdr_utility_functions;
# Define TDR file name
tdrFileName = "my_tdr.tdr";
# Import n doping profiles in semiconductor regions.
tdrDsName = {"state_0/PhosphorusActiveConcentration/active"}; #list of state name/quantity name/region name
dopingType = "n";
destinationCoordSys = "cs_2d_y_x_neg"; #should be the same as used in geometry import
res = tdrImportDoping(tdrFileName,tdrDsName,dopingType,destinationCoordSys); #wrapper around built-in script command tdrimportdataset
assert("Error adding doping from TDR: " + res, res == "");
# Import p doping profiles in semiconductor regions.
tdrDsName = {"state_0/BoronActiveConcentration/active"};
dopingType = "p";
destinationCoordSys = "cs_2d_y_x_neg";
res = tdrImportDoping(tdrFileName,tdrDsName,dopingType,destinationCoordSys);
assert("Error adding doping from TDR: " + res, res == "");
Example – Add electron and hole concentration from a TDR file into FDTD/MODE
# Import utility functions
tdr_utility_functions;
# Define TDR file name
tdrFileName = "my_tdr.tdr";
# The first dataset in the inner cell should be electron (n) and the second hole (p) density.
tdrDsName = { {"state_0/eDensity/active", "state_0/hDensity/active" } };
# Define destination coordinate system
destination_cs = "cs_2d_y_x_neg";
# Run utility import command, report error if present
res = tdrImportNPDensity(tdrFileName,tdrDsName,destination_cs);
assert("Error adding doping from TDR: " + res, res == "");