Skip to content

Samarjithbiswas/AcoustoSolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Python PyTorch NumPy Streamlit License CI

πŸ”Š AcoustoSolver

Real-Time Acoustic Metamaterial Simulator with Physics-Informed Neural Networks

AcoustoSolver is a Python framework for designing, simulating, and optimizing acoustic metamaterials. It combines rigorous computational physics (Plane Wave Expansion, FDTD) with physics-informed neural surrogates for real-time band structure prediction and interactive design exploration.

Features β€’ Quick Start β€’ App β€’ Architecture β€’ Theory β€’ Citation


✨ Features

Feature Description
πŸ“Š Band Structure Solver Plane Wave Expansion (PWE) method for 2D phononic crystals with automatic bandgap detection
πŸ”— SSH Model Su-Schrieffer-Heeger chain with Zak phase computation for topological invariant classification
🌊 FDTD Simulator 2D Finite-Difference Time-Domain wave propagation with PML boundaries
🧠 Neural Surrogate Residual MLP with physics-informed loss for real-time band prediction (100Γ— faster than PWE)
🧱 Material Database 12+ built-in materials including GST phase-change materials, piezoelectrics, and polymers
πŸ–₯️ Interactive App Streamlit-based GUI for real-time design exploration
βœ… Test Suite 35+ unit tests with CI/CD via GitHub Actions

πŸš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/Samarjithbiswas/AcoustoSolver.git
cd AcoustoSolver

# Install with all dependencies
pip install -e ".[all]"

# Or install minimal (core only)
pip install -e .

Basic Usage

from acoustosolver.core.materials import MaterialDatabase
from acoustosolver.core.unit_cell import SquareCell
from acoustosolver.core.band_structure import BandStructureSolver

# Initialize material database
db = MaterialDatabase()

# Create a phononic crystal unit cell
cell = SquareCell(
    lattice_constant=0.01,              # 10 mm
    host_material=db.get("epoxy"),      # Polymer matrix
    inclusion_material=db.get("steel"), # Steel inclusions
    filling_fraction=0.30,              # 30% filling
)

# Compute band structure
solver = BandStructureSolver(cell, n_bands=6, n_kpoints=100)
result = solver.solve()

# Analyze bandgaps
print(f"Found {len(result.bandgaps)} bandgaps:")
for gap in result.bandgaps:
    print(f"  {gap.lower_freq:.0f} - {gap.upper_freq:.0f} Hz "
          f"(relative width: {gap.relative_width:.1%})")

SSH Model β€” Topological Phase Analysis

# Compute SSH dispersion with topological phase
result = solver.solve_ssh_1d(t1=1.0, t2=1.5, n_kpoints=200)
zak_phase = solver.compute_zak_phase(t1=1.0, t2=1.5)

print(f"Zak phase: {zak_phase:.4f} rad")
print(f"Topological phase: {'YES (Ο€)' if zak_phase > 1.5 else 'NO (0)'}")
print(f"Edge states: {'Protected' if zak_phase > 1.5 else 'None'}")

Wave Propagation

from acoustosolver.core.wave_propagation import (
    WavePropagationFDTD, SimulationConfig, SourceType
)

config = SimulationConfig(
    grid_size=(200, 200),
    domain_size=(0.5, 0.5),
    total_time=0.003,
    source_frequency=5000.0,
    source_type=SourceType.POINT,
)

sim = WavePropagationFDTD(config)
sim.create_phononic_crystal(n_cells_x=5, n_cells_y=5)
snapshots = sim.run(save_every=50)

Neural Surrogate Training

from acoustosolver.ml.surrogate_model import BandSurrogate
from acoustosolver.ml.dataset import DatasetGenerator, DatasetConfig

# Generate training data
gen = DatasetGenerator(DatasetConfig(n_samples=1000))
X, y = gen.generate()

# Train surrogate model
surrogate = BandSurrogate(n_bands=6, n_kpoints=50)
print(surrogate.summary())
history = surrogate.train(X, y, epochs=200)

# Real-time inference (100Γ— faster than PWE)
predictions = surrogate.predict(X[:5])

πŸ–₯️ Interactive App

Launch the Streamlit-powered interactive simulator:

streamlit run app.py

App Features:

  • πŸ”§ Unit cell parameter sliders (lattice constant, filling fraction, materials)
  • πŸ“Š Real-time band structure computation with interactive Plotly charts
  • πŸ”— SSH model with Zak phase classification (topological vs. trivial)
  • 🌊 FDTD wave propagation with snapshot slider
  • 🧱 12+ material presets with full property display

πŸ“ Architecture

AcoustoSolver/
β”œβ”€β”€ acoustosolver/
β”‚   β”œβ”€β”€ core/                    # Computational engines
β”‚   β”‚   β”œβ”€β”€ materials.py         # Material database (12+ materials)
β”‚   β”‚   β”œβ”€β”€ unit_cell.py         # Square & hexagonal lattice cells
β”‚   β”‚   β”œβ”€β”€ band_structure.py    # PWE solver + SSH model + Zak phase
β”‚   β”‚   └── wave_propagation.py  # 2D FDTD with PML boundaries
β”‚   β”œβ”€β”€ ml/                      # Machine learning
β”‚   β”‚   β”œβ”€β”€ surrogate_model.py   # Residual MLP + physics-informed loss
β”‚   β”‚   └── dataset.py           # Synthetic dataset generation
β”‚   β”œβ”€β”€ viz/                     # Visualization
β”‚   β”‚   └── plotting.py          # matplotlib + plotly figures
β”‚   └── utils/
β”‚       └── physics_constants.py # Physical constants & conversions
β”œβ”€β”€ app.py                       # Streamlit interactive app
β”œβ”€β”€ tests/
β”‚   └── test_core.py             # 35+ unit tests
β”œβ”€β”€ examples/
β”‚   └── quick_start.py           # End-to-end demonstration
β”œβ”€β”€ .github/workflows/ci.yml     # GitHub Actions CI/CD
β”œβ”€β”€ pyproject.toml               # Modern Python packaging
└── README.md

πŸ“– Theory

Plane Wave Expansion (PWE)

The acoustic wave equation in a periodic medium:

$$\nabla \cdot \left[\frac{1}{\rho(\mathbf{r})} \nabla p(\mathbf{r})\right] = -\frac{\omega^2}{\kappa(\mathbf{r})} p(\mathbf{r})$$

is solved by expanding pressure and material properties in Fourier series, yielding an eigenvalue problem at each wave vector k.

SSH Model

The Su-Schrieffer-Heeger (SSH) model with alternating couplings $t_1$ and $t_2$:

$$E(k) = \pm|t_1 + t_2 e^{ika}|$$

The Zak phase (Berry phase across the Brillouin zone) is the topological invariant:

  • $\gamma = 0$ β†’ Trivial phase ($t_1 > t_2$)
  • $\gamma = \pi$ β†’ Topological phase ($t_2 > t_1$), supports protected edge states

Physics-Informed Loss

The neural surrogate is trained with a composite loss:

$$\mathcal{L} = \mathcal{L}_{\text{MSE}} + \lambda_s \mathcal{L}_{\text{symmetry}} + \lambda_o \mathcal{L}_{\text{ordering}} + \lambda_r \mathcal{L}_{\text{smoothness}}$$

where:

  • Symmetry: $\omega(\mathbf{k}) = \omega(-\mathbf{k})$ (time-reversal invariance)
  • Ordering: $\omega_{n+1}(\mathbf{k}) \geq \omega_n(\mathbf{k})$ (no band crossings)
  • Smoothness: Penalizes discontinuous frequency variations

πŸ—οΈ Built With

Technology Purpose
NumPy / SciPy Core numerical computation
PyTorch Neural surrogate models
Matplotlib / Plotly Static & interactive visualization
Streamlit Web-based interactive app
pytest Testing framework
GitHub Actions CI/CD pipeline

πŸ“ Citation

If you use AcoustoSolver in your research, please cite:

@software{biswas2026acoustosolver,
  author = {Biswas, Samarjith},
  title = {AcoustoSolver: Real-Time Acoustic Metamaterial Simulator with Physics-Informed Neural Networks},
  year = {2026},
  publisher = {GitHub},
  url = {https://github.com/Samarjithbiswas/AcoustoSolver}
}

Related Publications

  • Biswas, S., Krawczyk, Z., & Manimala, J.M. "Multifunctional Characterization of a Thermoacoustic Meta-Structure." Int. J. Thermofluids (2025).
  • Biswas, S., Kresl, W., & Manimala, J.M. "On the relationship between acoustic absorption and temperature gradient in a thermoacoustic liner." Int. J. Aeroacoustics, 24(1-2), 42-67 (2025).
  • Manimala, J. & Biswas, S. "Thermoacoustic Meta-Structure." US Patent WO 2025/128,348 A1 (2025).

πŸ‘€ Author

Samarjith Biswas, PhD
Research Scientist III Β· University of Arizona
New Frontiers of Sound (NewFoS) Science & Technology Center

πŸ“„ License

This project is licensed under the MIT License β€” see LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors