In this example, a distributed optical fiber sensor (DFOS) is demonstrated. In this proposed workflow, we couple Ansys Mechanical TM with Ansys Lumerical TM , creating an innovative workflow that can detect the position of a random mechanical strain along an optical fiber.
Overview
Understand the simulation workflow and key results
In this proposed workflow, DFOS utilizes standard single mode optical fiber as a sensing element capable of detecting strain along its entire length. Any mechanical deformation alters the fiber's dimensions and refractive index. While Rayleigh scattering is considered the dominant noise source, the model can also account for additional disturbances such as temperature and vibrational fluctuations [1]. DFOS’s sensitivity is analyzed, by evaluating the minimum detectable strain perturbation with regards to the system’s noise floor. This simulation workflow enables accurate prediction of distributed sensing behavior under realistic mechanical or thermal conditions [2, 5].
Step 1: Rayleigh scattering noise calculation (Python)
The first step involves determination of noise used as input to the DFOS element in INTERCONNECT. Rayleigh scattering in optical fiber arises from microscopic refractive index fluctuations that scatter light elastically. An optical fiber sensing system exhibits a dynamic range which is the difference between the initial backscattered power level and the noise level of a measurement time. For higher detection accuracy, meaning increasing the dynamic range of the sensing system, it is either to enhance the backscattered power or to decrease the noise level. At this step we create random noise level, as standard deviation input, and introduce it at the DFOS element in INTERCONNECT. An alternative is to introduce measured noise pattern data described in detail at Noise patterns . Backscattered power measured for distance z is described by the equation below:
$$P_{b} (z) = 2 P_{0} C_{R} e^ {-2 \alpha z}$$
where P 0 is launched power, C R is the Rayleigh backscatter coefficient and α is the fiber attenuation. Rayleigh scattering strength is scaled with wavelength as ∝ λ -4 , thus shorter wavelengths scatter more compared with longer wavelengths [3].
Step 2: Mechanical strain simulation (Ansys Mechanical WB)
The next step involves the simulation of localized mechanical loading on the fiber to compute the resulting strain-induced changes in the refractive index. Using ANSYS Mechanical TM Workbench (WB) we simulate the strain distribution of an optical fiber segment (15mm) embedded in stainless steel (SS360). The setup can be modified according to user’s needs, thus for this example we chose the simplest form of embedded optical fiber under various pressures applied. Pressure values (MPa) that represent real-life scenarios (more information at section "Use case pressure scenarios" ) are imported in WB where a script loop calculates, and exports in “.txt” format, the strain distribution of an optical fiber’s cross section. The following image portrays strain distribution of DFOS’s cross section taken from Mechanical simulation.
Step 3 Induced Phase (φ) and Refractive index (n eff ) calculation (Lumerical MODE)
In this step, we import the simulated strain data in Lumerical MODE structure group to calculate the refractive index variation based on stress-strain Hook’s law equations. The change of fundamental mode’s effective refractive index and mode profile is calculated, as depicted in the following image:
Then the phase change, induced by strain variation, is calculated and exported in “.txt” format. The relation that connects the phase variation (Δφ) with the effective refractive index is given by the equation below [4]:
$$\Delta \phi = \frac {2 \pi \Delta n_{eff}}{\lambda}$$
Step 4: Perturbation location and noise analysis (Lumerical INTERCONNECT)
The last step includes a DFOS scripted element that applies an algorithm to detect variations in the reflected power spectrum, caused by the modulated refractive index. We import the perturbed phase in to a scripted element created in INTERCONNECT, that represents the sensing optical fiber in a simple circuit. A PRBS generator drives the optical Gaussian pulse generator that launches a pulse into the DFOS optical fiber. The complete circuit is depicted in the following image.
The DFOS scripted element will calculate the location of the fiber where the perturbation takes place. A sensitivity analysis for various noise levels is performed where the sensor capability is examined. A series of sensor parameters can be modified by the user, such as fiber length, dispersion, attenuation etc.
Run and Results
Instructions for running the model and discussion of key results
Step 1: Rayleigh scattering noise calculation
- Open and Run “rayleigh_noise.py”.
The script will calculate and plot a random noise pattern based on Rayleigh scattering with regards to optical fiber length. The random noise is saved ( "rayleigh_noise.txt” ) and exported in “.txt” format to be used at DFOS scripted element at step 4 as a pattern, or as a std deviation. The following figure portrays a noise plot, with regards to fiber length. In this workflow we used std random noise introduction. For more information visit “Noise pattern”.
Step 2: Mechanical simulation - strain vs pressure
- Open a workbench project and import the simulation file “dfos_pressure_force_sensor.wbpz”.
- Load and Run the script “pressure_sweep.wbjn” to run the simulation.
Script calculates the strain of an optical fiber, embedded in stainless steel (SS360), under pressure. The optical fiber consists of a core, a cladding and a stainless-steel layer. No further materials are added to this model, such as jacket and protective coatings. Users can modify the model and run further analysis on this step. For more information how to use the script “pressure_sweep.wbjn” in Ansys Workbench TM , please check “Running Mechanical Workbench” .
Images below portray the interface of Ansys Mechanical TM (left) with the sensing structure under pressure, and the simulated strain map of cross section (right). The surface tension from the pressure is transferred radially towards the core of the optical fiber, where the maximum strain takes place at its center.
Step 3: Induced Phase (φ) and Refractive index (neff) calculation
- Open the simulation file “mode_perturbation.lms”.
- Open and run the script “strain_to_phase.lsf”.
The raw strain data ( “pressure_mechanical_strain.txt” ) are imported in “mode_perturbation.lms” and are converted to refractive index, using stress-strain Hook’s law equations. The calculated refractive index is added as perturbation to fiber’s core unperturbed refractive index. The script file “strain_to_phase.lsf” will calculate, using the FDE solver, the phase and the effective refractive index of the fundamental mode. Τhe script obtains the strain ( “pressure_mechanical_strain.txt") and pressure ( "pressure_values_MPa.txt" ) data files in the same folder where the “mode_perturbation.lms” file is saved. Users can change the paths at script lines 20 and 21 depending on their saving folder they prefer.
The following image (left plot) depicts the effective refractive index printed in “Script prompt” for a series of perturbations due to pressure. The script also plots, and exports in “phase_difference.txt” file, the linear behavior of phase shift with regards to pressure, depicted below (right image). It also exports in the change of n eff for the same pressure values in the “effective_refractive_index.txt” file. The phase change results agree with references where a linear correlation with the increasing pressure is reported [6,7].
Step 4: Perturbation location and noise analysis
At this step, we use the calculated phase change as a measure of perturbation detection. We created a scripted element in INTC that functions as a DFOS. The DFOS scripted element uses a specific function that detects a peak in the power with regards to distance plot. More information regarding the peak detection function can be found at “ Important model settings: Detection filter function ” section. The DFOS element also consists of many parameters that characterize an optical fiber sensor, more information at “ Important model settings: DFOS element important parameters ”.
- Open the simulation file “dfos_intc.icp”.
- Open script “dfos_intc.lsf”
- Uncomment script lines 11, 20 and 36 and set "fixed perturb" of DFOS element to 1112.
- Run script “dfos_intc.lsf”.
We analyze the capability of the sensor to detect a perturbation at a predefined location along the fiber (1.112 km) and specific perturbation (Δφ). The predefined location can be controlled by the parameter "fixed perturb" where the user can choose any location along the fiber length. First, open script “ dfos_intc.lsf ” and uncomment script lines 11, 20 and 36 (figure below). This introduces a series of noise values (line 11), that can be edited by the user, where the model runs in a loop. In that way we increase the noise in the backscattered power signal and the algorithm attempts to detect a perturbation set at a fixed location. The user can Run the script and the simulation model will run the noise analysis. If the script does not run due to error please advice section Error troubleshooting .
The following animation (left) depicts the output power (mW) with regards to sensor fiber length (km), where perturbation stays constant and noise levels increase. The legend (orange box) at the top right of the animation exhibits the location of the detected perturbation, where correct perturbation detection takes place for std dev at 0.495 mW (noise_scale_factor = 1). The right figure below shows all noise level results plotted together in the same graph.
- Comment script lines 11, 20 and 36.
- Uncomment script lines 12, 21 and 37.
- Set DFOS parameter noise_scale_factor to 1.
- Run script “dfos_intc.lsf”.
Next, we use a specific noise level from previous step (std dev = 0.495 mW) to test various perturbations and characterize DFOS sensor’s detection capability. Then, we use the same predefined location placed between the vertical dotted lines and increase the perturbation. For that test, script lines 12, 21 and 37 should be uncommented. The following animation (left) animates a perturbation increase for a series of pressure (weight) scenarios. The label of the plot portrays the locations where the perturbation is detected, and it seems that a correct detection is achieved for pressures more than 35 MPa.
A perturbation caused by a small pressure can cause a phase change at the Power vs distance plot, where an increase is visible in the vertical dotted lines space. However, the detected location is not correct due to the noise level that has the same amplitude as the small perturbation. Thus, higher perturbations are needed to lead to correct detection. The right plot above demonstrates the results of both tests where the detection area where DFOS sensor functions with accuracy is portrayed.
- Set "fixed_perturb" parameter of DFOS element to 0.
- Open and Run script “dfos_intc_runs.lsf”.
After estimating the noise and perturbation level, we tested the DFOS element for perturbation at random locations along the fiber. First set the "fixed_perturb" parameter to 0, to enable introduction of various perturbations at random locations along the optical fiber sensor. A script is created where single or multiple perturbations are introduced using “perturbation number” property of DFOS element. More information can be found at “Property View – DFOS element: DFOS element important parameters ”. The image below depicts a case scenario where a single DFOS sensor is installed to a XY area to map the surface for strain detection.
The script uses a rand script command to add various perturbations at random locations, and the DFOS sensor calculates the location of any perturbation detected. The locations are printed at the legend of the power plot, depicted in the left figure below. Users can modify the circuit and add multiple DFOS elements of specific length to map an area under test. The right image below portrays the perturbation peaks with red arrows.
Important model settings
Description of important objects and settings used in model.
DFOS element important parameters
The DFOS element consists of a series of parameters that customize the sensor. Below the most important parameters are quoted:
-
Power: sets the optical power of input light pulse
-
noise_option: setting this parameter to 1 will introduce a noise pattern, while 2 will add a Std dev noise.
-
ptrb_scale_factor: it is a scaling factor that increases/decreases the level of perturbation by multiplying it to the maximum phase value (“phase difference.txt”) introduced from Step 2.
-
noise_scale_factor: it is a scaling factor that increases/decreases the level of perturbation by multiplying it to the maximum noise value (“rayleigh_noise.txt”) introduced from Step 1.
-
perturbation number: number of perturbations introduced in the model.
-
random_noise : 1 will set the noise generator pattern to a stable specific one, while 2 creates a new noise pattern on each run.
-
smoothing_window: number of points used in detection function that defines how many points on either side of central point (more information at Detection filter function ).
-
w_gauss: number of surrounding data points based on the Gaussian distribution to reduce noise (more information at Gaussian window smoothing function ).
-
threshold: peaks standing the number of threshold value above surrounding minima can be detected (more information at Detection filter function ).
-
plot_active: setting that to 1 plots Power vs z graph, while setting it to 0 does not plot it.
-
fixed_perturb: set that to a specific value in meters and it will set a perturbation to that fixed location along the fiber. It is recommended to use locations above 140 m, more information at Error troubleshooting . The fixed location setting is ideal for quick tests on pressure amplitude and noise analysis. Setting that to 0, perturbation is placed to random locations along fiber, ideal for multiple perturbations.
-
perturbation: “.txt” format file imported from Step 3: refractive index perturbation.
-
phase_difference: “.txt” format file imported from Step 3 : phase perturbation.
Gaussian window smoothing function
A gaussian smoothing function is introduced in the DFOS element, where it operates as a weighted average of the surrounding data points to reduce power’s signal noise. This function is called gaussian_smooth(y, sigma) based on the Gaussian distribution. Sigma (std dev) represents the width of the filtering. The animation below animates the filtering of a noisy signal and DFOS sensor’s capability to accurately detect a perturbation. A low smoothing window of 1 shows that the perturbation is distinctly hidden in noise, while increasing the smoothing window the perturbation can be detected as the signal clears out. The left figure shows the results of various smoothing values co-plotted. User can edit the parameter w at script line 13 of "dfos_int.lsf" and run the script to test various smoothing of noise signals and increase sensor's detection capability.
Detection filter function
The detection filter function is scripted and imported in DFOS element. The image below depicts the parameters that define the filter function. It uses four inputs which are power (P), sensor’s distance (z), window and threshold.
This function identifies peaks by analyzing intensity changes across data points. It applies smoothing, thresholding, and local maxima criteria to isolate significant peaks. In that way it enhances the accuracy of peak detection and signal interpretation. The window parameter defines locality, which means how many points on either side of central point are included in the analysis. Small window parameter is recommended for detecting sharp local features without excessive smoothing, minimizing spatial averaging. On the other hand larger values increase smoothing and reduce variance. The threshold parameter detects peaks standing above a specific value. The figure below visualizes the window (orange data points) of a typical Power vs distance plot, where the inset figure depicts the threshold set. The rest of small bumps or local fluctuations below this threshold are ignored, as only peaks standing clearly above their local minima, are detected.
Error troubleshooting
It's common for the simulation to run successfully through a setup and then fail immediately when execution begins. A typical error message is depicted below, where it points to an unsuccessful perturbation detection. That normally happens due to incorrect choice of sensing parameters, causing the detection algorithm to detect failure of the required perturbation in the signal.
|
DFOS_element: setup:
|
Below there are some steps that can help troubleshoot this error:
-
decrease smoothing window to values between 2 and 5: in that way the detection algorithm will increase its sensitivity for steep changes in the Power (mW) vs Distance (km) plot.
-
increase threshold: higher values will elaborate the algorithm to filter out unnecessary peaks that interfere with the actual perturbation peak. Increasing the threshold will be advantageous for peaks in the region close to the source (<6 km)
Another typical error is the following one, where it commonly appears when the "fixed_perturb" parameter is set <140 m. This is due to the "local window" equation that cannot comply with the close to the edge values of the "signal" vector in DFOS element Setup tab. To troubleshoot that the user should use locations larger than 140 m.
|
DFOS_element: setup:
|
Noise patterns
The figure below portrays how the noise is introduced in sensor’s response. The ideal power versus location plot is depicted in blue font. In the latter plot a strain perturbation can be seen at distance roughly 3 km. Then a random noise pattern (ed font) is introduced in the plot and the output sensor’s response can be seen in green font at the figure below.
Choosing a model for pattern generation, the user can decide between using random pattern noise or a fixed pattern introduced through “.txt” input format. Left plot below portrays a random pattern noise that offers unpredictability in the simulation, producing diverse outputs. In contrast, the right plot portrays a fixed pattern that can be produced by experimental or simulation data.
The selection between these options can be done by the parameter “noise_option” at the Property View of the DFOS, depicted below. Setting “noise_option” to 1, the user imports a noise pattern calculated by “rayleigh_noise.py” in Step 1 . If the user sets it to 2, then a standard deviation noise (Std dev) is introduced. The decision depends on the user and the intended application, where random noise patterns can be more adaptable, while fixed pattern can preserve reliability.
Running Mechanical Workbench
The animation below shows an animation how to use Ansys Workbench TM to import and run the “pressure_sweep.wbjn” script.
After the script is finished, the strain values with regards to pressure, are exported in “pressure_mechanical_strain.txt” . Users can alter the pressure values applied on the structure, by modifying file “pressure_values_MPa.txt” where script uses to import it in Mechanical WB. The simulation time of the script corresponds to roughly 10 minutes.
A python script (Python code 1) saves a python both “.txt” format, for each DP in separate files. The files contain strain results that correspond to fiber’s cross section. A second python script (Python code 2) creates a single file ( “pressure_mechanical_strain.txt” ), at a destination folder (“C:\”), that includes a single value of strain for each DP. Users should also update the folder path, at "Python 2" script line 31, to a new one that is suitable for the user’s PC. Omitting to update this path, will cause errors when script “ pressure_sweep.wbjn” will try to save strain files for every DP.
Taking the model further
Information and tips for users that want to further customize the model
Temperature noise input
Users can take the model further and introduce temperature variation or soil vibrations as a noise input of the sensor. These effects are introduced in a sensor and influence its performance and data accuracy. At the image below, the user can edit “temperature” property in Thermal tab. It can also untick the “Hide” box in DFOS element Properties window and introduce a temperature noise variation, like Rayleigh scattering noise .
For the temperature variation the sinusoidal function below describes the annual variation of daily average soil temperature at different depths.
$$(z,t)=T_{a}+ A_0 e^{-z⁄d} cos[ \frac{(2π(t-t_0 ) x^2)}{365} - \frac{z}{d}] $$
- T(z,t) is the soil temperature at time t (d) and depth z (m),
- T a is the average soil temperature ( o C),
- A 0 is the annual amplitude of the surface soil temperature ( o C),
- d is the damping depth (m) of annual fluctuation and
- t 0 is the time lag (days) from an arbitrary starting date [8].
The equation is written in a python script ( “temperature_soil.py” ) where the users can run and visualize its results. The image on the right below describes the temperature variation with regards to soil depth (m) and time of the day (hours). As the soil temperature fluctuates with depth, among other parameters (moisture content, thermal gradients etc.) simulation can be challenging, thus introducing this correction factor can converge to a more accurate solution. The plot on the left depicts the temperature variation for specific depth (dotted region of right image) that is used as fluctuation in temperature noise. Further analysis can incorporate heat transfer equations, soil thermal conductivity, and time-dependent variations to better understand and compensate for temperature-induced sensor deviations [9].
Note: For soil vibrational noise it is suggested to create a Vibration simulation in Ansys Mechanical TM . More information can be found at “ Ansys Mechanical Linear and Nonlinear Dynamics – Module 08: Random Vibration Analysis ”.
Use case pressure scenarios
Real-life pressure values can be integrated into the simulation to improve model’s realism. Users can choose the contact area and weight of the applied pressure in the “pressure_calculation.lsf” script, ensuring that the simulated environment behaves similarly to real-world scenarios. Incorporating authentic pressure readings helps identify potential design issues and increase reliability. Users can modify the pressure values in script and run it. The image below shows Script Prompt output, where the case scenarios and applied pressures in MPa are printed. This script also saves in a “.txt” format (“ pressure_values_MPa.txt” ) a file that is used in Step 2 and Step 3.
The script is based on a function
(“pressure_function.lsf”)
that calculates the applied pressures (MPa) that are introduced in Step 2. The input parameters of the function are the pressure area (m
2
) and the weight (kg) of the applied object. Below is quoted the pressure equation:
$$Pressure = \frac {m g}{A}$$
where F is force in Newtons, m is mass in kilograms, A is the area in m 2 and g is the acceleration (9.81 m/s 2 ).
Nonlinear parameters
The DFOS scripted element incorporates a series of nonlinear parameters (NLP). More information regarding NLP can be found at NLSE Waveguide AG article. A short description includes the effect of self-phase modulation (SPM), two-photon absorption (TPA) and free carriers (FC).
- SPM causes spectral broadening for an unchirped Gaussian pulses.
- TPA affects the pulse amplitude due to the absorption but also narrows the spectral width of the pulse.
- The FC induced by TPA makes the pulse asymmetric, affecting the red part of the spectrum.
As depicted in the image above, users can activate these nonlinear parameters by selecting true in the Property View – NLP tab. If you run the “fwhm_script.lsf” script the spectrum of the pulse before and after the optical fiber is plotted in wavelength domain, as depicted in the left plot below. The right image depicts the full-width half maximum for the input and output pulse, and their difference. This calculates the spread of the pulse due to dispersion in time domain.
Additional resources
Additional documentation, examples, and training material
Related publications
- Xiaoyi Bao and Yuan Wang, “ Recent Advancements in Rayleigh Scattering-Based Distributed Fiber Sensors”. Advanced Devices & Instrumentation, 2021, Vol 2021, DOI: 10.34133/2021/8696571
- Li, J., Zhang, M. "Physics and applications of Raman distributed optical fiber sensing." Light Sci Appl 11, 128 (2022), doi: 10.1038/s41377-022-00811-x
- A. H. Reshak; M. M. Shahimin; S. A.Z. Murad; S. Aziza, “Simulation of Brillouin and Rayleigh scattering in distributed fibre optic for temperature and strain sensing application”, Sensors and Actuators A: Physical,Vol: 190, Page: 191-196, 2013, doi: 10.1016/j.sna.2012.11.034
- https://www.rp-photonics.com/effective_refractive_index.html
- Clément Charliac, Vincent Kemlin, Inès Ghorbel, Luc Pastur, Vincent Crozatier, "Quasi-static pressure sensitivity of single-mode optical fibers," Proc. SPIE 13639, 29th International Conference on Optical Fiber Sensors, 1363946 (22 May 2025); doi: 10.1117/12.3062845
- Manuel Silva-López, Amanda Fender, William N. MacPherson, James S. Barton, Julian D.C. Jones, Donghui Zhao, Helen Dobb, David J. Webb, Lin Zhang, and Ian Bennion, "Strain and temperature sensitivity of a single-mode polymer optical fiber," Opt. Lett. 30, 3129-3131 (2005), doi: 10.1364/OL.30.003129
- Singh, R.K., Sharma, R.V. "Numerical analysis for ground temperature variation." Geotherm Energy 5, 22 (2017), DOI: https://doi.org/10.1186/s40517-017-0082-z
- Nofzinger, D.I., et al. (2003) “Soil Temperature Change with Time and Depth: Theory.”, Department of Plant and Soil Sciences, Oklahoma State University, 2003
Related Ansys Innovation Courses