Examples#

Choose a task below to find a complete, executable example. New to MomentRT? Start with an analytical calculation, then try a finite sample. The values are illustrative; each example describes its physical assumptions and limits.

Getting started#

Run a first simulation and construct a structured sample.

Fluence in a three-layer skin sample with contact source and detector
Model a skin contact sensor

Build a layered skin sample, refine a tetrahedral mesh, and solve for fluence.

Simulate a contact sensor on layered skin
Infinite-medium MomentRT fluence field
Infinite-medium diffusion

Configure a point source and observation mesh, solve the analytical P1 Green function, and explore its 3D fluence field.

Infinite-medium diffusion
Fluence produced by a diffuse circular surface source
Circular surface illumination

Inspect fluence, flux, and energy accounting for a finite-element solve with a disk source.

Surface illumination and FEM diffusion
Fluence volume in a layered sample with inclusions
Build a heterogeneous sample

Combine layers, spheres, and a box, solve the illuminated sample, and explore its 3D fluence volume.

A heterogeneous layered sample

Samples and meshes#

Use named sample models, then create Cartesian or tetrahedral meshes.

Fluence in an explicitly configured two-layer skin sample
Build samples with named models

Build a two-layer skin sample and a layered phantom from explicit materials.

Build samples with named models
Regular Cartesian grid shown inside its sample bounds
Cartesian mesh from node counts

Set explicit node counts for a regular grid and plot its cell edges.

Create a Cartesian mesh from node counts
Cartesian grid with different spacing by axis
Cartesian mesh from physical resolution

Request spacing in physical units, including anisotropic spacing by axis.

Create a Cartesian mesh from physical resolution
Tetrahedral elements inside the sample boundary
Uniform tetrahedral mesh

Generate and plot an unstructured tetrahedral mesh at a global target size.

Create a uniform tetrahedral mesh
Tetrahedral mesh refined around a skin layer and fiber contacts
Locally refined tetrahedral mesh

Refine a named layer and the neighborhoods around a source and detector.

Refine a tetrahedral mesh near layers and contacts

Sources and detectors#

Configure diffuse illumination and contact apertures, and check detector mesh convergence.

Finite-sample fluence under uniform face illumination
Uniform face illumination

Use UniformSurfaceSource to illuminate an entire sample face and render the resulting field in 3D.

Uniform illumination on a sample face
Finite-sample fluence with source and detector apertures
Collect light with finite apertures

Define detector positions and acceptance cones, inspect the system, and calculate reflection and transmission signals.

Collect light with finite apertures
Six illumination fibers and a central detector on layered skin
Seven-fiber skin probe

Simulate simultaneous illumination from six fibers around a central collection fiber in a layered skin model.

Seven-fiber bundle on a three-layer skin sample
Finest-mesh fluence with source and detector overlays
Check detector mesh convergence

Compare detector signals and sampled source and aperture areas over successively finer meshes.

Choose a mesh for detector collection

Spectral calculations#

Sweep wavelength-dependent materials and integrate source spectra and detector responsivity.

Infinite-medium fluence for an analytical source spectrum
Build analytical source spectra

Compare Gaussian and Lorentzian wavelength profiles and attach one to a source.

Build analytical source spectra
Monochromatic fluence from a spectral sensor sweep
Sweep a spectral sensor

Interpolate material spectra and plot collected power across wavelengths with fixed sample and instrument geometry.

Sweep wavelengths with a fixed sensor geometry
Incoming and collected spectral power and detector photocurrent
Integrate source and detector spectra

Configure the existing source with a power density and the detector with responsivity, then integrate optical power and electrical current.

Integrate a source spectrum and detector response
SP3 fluence from wavelength-dependent material tables
Sweep spectral anisotropy

Interpolate layer-specific anisotropy and detector power across wavelengths.

Sweep wavelength-dependent scattering anisotropy

Transport models#

Compare angular approximations and explore phase functions and layer anisotropy.

Transient P1 fluence in a layered sample with source and detector
Follow a diffuse pulse through layered tissue

Calculate a pulsed time response and inspect the contact detector trace.

Follow a diffuse pulse through layered tissue
SP3 fluence volume with contact source and detector
Compare P1 and SP3 transport

Compare detector signals from P1 and SP3 on the same sample.

Compare P1 and SP3 transport
Full P3 fluence with source and contact detector
Compare P1, SP3, and full P3

Solve the same sensor geometry with three angular approximations.

Compare full P3 with SP3 and P1
SP3 fluence for a Rayleigh scattering example
Compare scattering phase functions

Compare phase functions with matching anisotropy but different higher moments.

Compare scattering phase functions
SP3 fluence in a layered sample with a source and detector
Assign anisotropy by layer

Give each material its own scattering anisotropy and solve with SP3.

Use different anisotropies in a layered sample

Parameter studies#

Vary optical properties, fiber separation, and boundary reflectance, and examine computational scaling.

Infinite-medium fluence at several absorption values
How absorption changes fluence

Compare fluence profiles while holding reduced scattering and source configuration fixed.

How absorption changes fluence
Fluence volume for an intermediate boundary reflectance
Change boundary reflectance

Compare centerline fluence and escaping power as diffuse reflectance changes.

Changing the diffuse boundary reflectance
Three-layer skin with one illumination fiber and collection positions along the surface
Two-fiber reflectance and dermal absorption

Move a collection fiber away from one illumination fiber and compare collected power as absorption increases in the middle skin layer.

Two-fiber reflectance and dermal absorption
Three-layer skin with a scanning collection fiber and increased hypodermal absorption
Which skin layer changes the fiber signal?

Compare equal absorption increments in epidermis, dermis, and hypodermis to explore how each layer changes the distance response.

Which skin layer changes the fiber signal?
Fiber contacts on skin with an extended absorbing dermis
How dermis thickness changes a two-fiber scan

Move the dermis-hypodermis interface while keeping the outer sample and probe fixed, and compare collected power with a 1.5 mm dermis.

How dermis thickness changes a two-fiber scan
Solve time and peak process memory versus tetrahedron count
Benchmark P1, SP3, and P3 scaling

Measure solve time and peak process memory across tetrahedral mesh sizes, and use the results to decide whether iterative P3 solvers warrant study.

Benchmark P1, SP3, and P3 solver scaling

Validation#

Assess mesh refinement and compare calculations with independent references.

Finite-sample fluence on the finest mesh
Mesh refinement and FEM timings

Compare fluence over three grids and inspect recorded FEM preparation, assembly, factorization, and solve timings.

Check finite-element mesh refinement
Compare against planar slab references

Compare P1 diffusion and SP3 FEM profiles with independent closed-form and matrix-exponential slab solutions.

Compare P1 and SP3 with independent planar slab references
P1, SP3, and P3 detector-power errors across eight sensor cases
Vary layered sensor validation cases

Explore published comparisons while varying layer thickness, optical properties, source size, detector radius, and source-detector separation.

Compare sensor-validation cases

Inverse problems#

Explore synthetic inverse calculations and their numerical and model limitations.

Fluence field in the layered sample used for mesh convergence
Check a mesh before fitting

Check how refinement affects detector powers for a layered sample before attempting a synthetic fit.

Check detector mesh convergence
Infinite-medium fluence for a synthetic absorption example
Explore an objective landscape

Plot the mismatch between synthetic fluence observations and candidate absorption values under the same analytical model.

Explore a synthetic objective landscape
Fluence field in a sample used for a synthetic epidermis fit
Fit a simulated epidermis change

Recover a model parameter from ideal simulated measurements using SciPy; the same forward model generates and fits the data.

Recover an epidermis change

Plotly figures embedded in the example pages are interactive: rotate, zoom, and hover to inspect the generated MomentRT data.