Skip to main content

Differentiable RCWA in PyTorch, based on TORCWA

Project description

solwa-0.1.0

  • License: LGPL

Differentiable Rigorous Coupled-Wave Analysis (RCWA) package based on PyTorch


Features

solwa (solar + rcwa) is a PyTorch implementation of rigorous coupled-wave analysis (RCWA) based on torcwa https://github.com/kch3782/torcwa

  • GPU-accelerated simulation

  • Supporting automatic differentiation for optimization

  • Units: Lorentz-Heaviside units

    • Speed of light: 1

    • Permittivity and permeability of vacuum: both 1

  • Notation: exp(-jωt)


Installation

Install from PyPI using pip:

pip install solwa

Alternatively, install from source by cloning this repository and running:

pip install .

PyTorch ≥ 2.10 is recommended for improved CUDA performance (see PR: https://github.com/pytorch/pytorch/pull/166715)


significant changes from the original torcwa

  1. Constants are loaded from standard libraries instead of defining them again in the code.
  2. Major cleanup of the code structure for better readability and maintainability.
  3. Better error handling and messages.
  4. Addition of functions for calculation of the poynting vector and power flux.

solwa Examples

  1. Example 0: Fresnel equation

  2. Example 1: Simulation with rectangular meta-atom
    Normal incidence / Parametric sweep on wavelength / View electromagnetic field

  3. Example 1-1: Simulation with stacked meta-atom
    Normal incidence / View electromagnetic field

  4. Example 2: Simulation with square meta-atom
    Oblique incidence / View electromagnetic field

  5. Example 3: Simulation with rectangular meta-atom
    Normal incidence / Parametric sweep on geometric parameters

  6. Example 4: Gradient calculation of cylindrical meta-atom
    Differentiation of transmittance with respect to radius

  7. Example 5: Shape optimization
    Maximize anisotropy

  8. Example 6: Topology optimization
    Maximize 1st order diffraction


Acknowledgements

The fundamental implementation, including mathematical formulation, was implemented in the torcwa package by Changhyun Kim and Byoungho Lee.

This solwa package is a modified version of torcwa for better usability. It will be continuously updated to include more features and improvements.

If this package is useful for your research, please cite the following paper:

@article{
	title = {TORCWA: GPU-accelerated Fourier modal method and gradient-based optimization for metasurface design},
	journal = {Computer Physics Communications},
	volume = {282},
	pages = {108552},
	year = {2023},
	doi = {https://doi.org/10.1016/j.cpc.2022.108552},
	author = {Changhyun Kim and Byoungho Lee},
}

Work on the solwa package is supported by the ERC Consolidator Grant (No. 101125948, PHASE).

Furthermore, the authors acknowledge support by the state of Baden-Württemberg through bwHPC through providing computational resources.

The work on the original torcwa was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. 2020R1A2B5B02002730) and Samsung Electronics Co., Ltd (IO201214-08164-01).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solwa-0.2.0rc1.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solwa-0.2.0rc1-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file solwa-0.2.0rc1.tar.gz.

File metadata

  • Download URL: solwa-0.2.0rc1.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for solwa-0.2.0rc1.tar.gz
Algorithm Hash digest
SHA256 f39866fb1619a75526f2ec1d971481e5127a858495848d290a5f30b70a172b3a
MD5 0c49c89788992286d1cdf77be5b24ca7
BLAKE2b-256 ad3ba107c2fd7132d8e100a36163b2157bc66707b77c9e39146c668cdb27f7e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for solwa-0.2.0rc1.tar.gz:

Publisher: publish.yml on johannesz-codes/solwa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file solwa-0.2.0rc1-py3-none-any.whl.

File metadata

  • Download URL: solwa-0.2.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for solwa-0.2.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6d189cfb7e6cd6d84ba005d7dbd3004b3b63b6c072305f5ba303e71920b8c3f
MD5 c3b5836a572c43110e23ef410a77d4ac
BLAKE2b-256 952fa41d1bb78ecdc32c716b297576ea552f5a56247af98334d8a7dccdf28857

See more details on using hashes here.

Provenance

The following attestation bundles were made for solwa-0.2.0rc1-py3-none-any.whl:

Publisher: publish.yml on johannesz-codes/solwa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page