Skip to content

Samarjithbiswas/MetaMaterialGAN

Repository files navigation

MetaMaterialGAN

Python 3.9+ PyTorch License: MIT CI

Conditional Generative Adversarial Network for Acoustic Metamaterial Inverse Design

MetaMaterialGAN solves the acoustic metamaterial inverse design problem: given a target absorption or transmission spectrum, it generates the unit cell geometry that produces it. The system combines a conditional GAN with a differentiable Transfer Matrix Method (TMM) forward solver to ensure physical consistency of generated designs.


The Problem

Designing acoustic metamaterials for targeted noise control requires solving an inverse problem: what geometry produces a desired absorption spectrum? Traditional approaches (genetic algorithms, topology optimization) require thousands of forward simulations, taking hours to days. MetaMaterialGAN generates physically valid designs in milliseconds.

Approach

Target Spectrum ──┐
                  ├──> Generator ──> Geometry Parameters ──> TMM Forward Check
Latent Noise ─────┘                        │
                                           v
                                    Discriminator
                                    (real vs. fake pairs)

The pipeline has three components:

  1. Differentiable TMM Forward Solver: Computes absorption/transmission spectra from geometry parameters using the Transfer Matrix Method. Implements Helmholtz resonator, quarter-wavelength resonator, and micro-perforated panel impedance models with correct acoustic boundary conditions.

  2. Conditional Generator: Maps (target spectrum + latent noise) to metamaterial geometry parameters. Multiple valid geometries can produce similar spectra (non-unique inverse), so the latent noise captures this design space diversity.

  3. Physics-Augmented Discriminator: Evaluates (spectrum, geometry) pairs for realism, augmented with a forward-consistency loss that penalizes generated geometries whose TMM-computed spectra deviate from the conditioning target.

Key Features

  • Physically correct TMM solver: Implements the standard transfer matrix formulation (Allard & Atalla, 2009) with proper impedance matching, complex wavenumber propagation, and rigid-backed termination
  • Three resonator types: Helmholtz resonators (Ingard, 1953), quarter-wavelength tubes, and micro-perforated panels (Maa, 1998) with frequency-dependent viscous/thermal losses
  • Forward-consistency loss: Generated designs are validated against the TMM solver during training, ensuring physical realizability
  • Design diversity: Latent space interpolation reveals multiple valid geometries for the same target, capturing the non-uniqueness of the inverse problem
  • Interactive dashboard: Streamlit app for drawing target spectra and generating designs in real time
  • Fabrication constraints: Generator outputs are bounded to manufacturable dimensions (minimum wall thickness, maximum aspect ratios)

Physics

Transfer Matrix Method

For a stack of N acoustic layers, the total transfer matrix relates pressure and velocity at the input to those at the output:

[p_in ]   [T11  T12] [p_out ]
[     ] = [        ] [      ]
[v_in ]   [T21  T22] [v_out ]

Each layer contributes a 2x2 matrix based on its characteristic impedance Z_c = rho*c and propagation constant k = omega/c:

T_layer = [cos(k*d)         j*Z_c*sin(k*d)]
          [j*sin(k*d)/Z_c   cos(k*d)      ]

The absorption coefficient for a rigid-backed configuration is:

alpha(omega) = 1 - |R(omega)|^2

where R = (Z_surface - Z_0) / (Z_surface + Z_0)

Resonator Models

Helmholtz Resonator (Ingard, 1953):

  • Neck impedance accounts for viscous losses and end corrections
  • Cavity modeled as lumped compliance

Quarter-Wavelength Resonator:

  • Resonance at f = c/(4*L_eff) with end correction
  • Thermo-viscous losses via complex wavenumber

Micro-Perforated Panel (Maa, 1998):

  • Impedance from perforation ratio, hole diameter, and panel thickness
  • Includes viscous and edge effects per Maa's analytical model

Installation

git clone https://github.com/yourusername/MetaMaterialGAN.git
cd MetaMaterialGAN
pip install -e .

Quick Start

1. Generate Training Data

python data/generate_dataset.py --n_samples 10000 --output data/training_data.npz

2. Train the cGAN

from metamaterialgan.training.trainer import MetaMaterialTrainer
from metamaterialgan.training.config import TrainingConfig

config = TrainingConfig(epochs=300, physics_weight=10.0)
trainer = MetaMaterialTrainer(config)
trainer.fit("data/training_data.npz")

3. Inverse Design

from metamaterialgan.models.generator import MetaMaterialGenerator
import torch

generator = MetaMaterialGenerator.load("checkpoints/generator.pt")
target_spectrum = torch.tensor([...])  # 128-point absorption spectrum
designs = generator.generate(target_spectrum, n_designs=5)

4. Interactive Dashboard

streamlit run app/streamlit_app.py

Dataset

Training pairs (geometry, spectrum) are generated by:

  1. Sampling geometry parameters uniformly within fabrication bounds
  2. Computing absorption spectra via TMM at 128 frequency points (100-4000 Hz)
  3. Storing as (geometry_vector, spectrum_vector) pairs

No external data or COMSOL licenses required.

Citation

@software{biswas2025metamaterialgan,
  author = {Biswas, Samarjith},
  title = {MetaMaterialGAN: Conditional GAN for Acoustic Metamaterial Inverse Design},
  year = {2025},
  url = {https://github.com/yourusername/MetaMaterialGAN}
}

References

  • Allard, J.F. & Atalla, N. (2009). Propagation of Sound in Porous Media. Wiley.
  • Ingard, U. (1953). On the theory and design of acoustic resonators. JASA, 25(6), 1037-1061.
  • Maa, D.Y. (1998). Potential of microperforated panel absorber. JASA, 104(5), 2861-2866.
  • Mirza, M. & Osindero, S. (2014). Conditional Generative Adversarial Nets. arXiv:1411.1784.

License

MIT License

Author

Samarjith Biswas, Ph.D. Research Scientist III, University of Arizona, New Frontiers of Sound (NewFoS) Center samarjithbiswas.com | LinkedIn

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages