Skip to main content

PVSim — Semiconductor Physics Analysis and Research Code

v1.0 · MIT · Python 3.10+ · Sesame (NIST)

PyPI Python License: MIT Docker

Simulateur TCAD 1D/2D drift-diffusion pour cellules solaires, avec optimisation bayésienne automatique et assistant LLM. Fonctionne 100 % localement — aucune clé API requise en configuration minimale.


Installation

Via pip

pip install pvsim-pv

# Stack complète pour la recherche (recommandé)
pip install "pvsim-pv[tcad,botorch]"
pip install git+https://github.com/usnistgov/sesame.git

Note Sesame : le solveur TCAD NIST n'est pas publié sur PyPI. L'installation via git est requise séparément.

Extras disponibles :

Extra Contenu
tcad Numba (JIT pour Sesame)
botorch PyTorch CPU + BoTorch (optimisation GP avancée)
workers Celery + Redis (simulations asynchrones distribuées)
llm-local Ollama (assistant LLM local, 0 clé API)
llm-cloud Anthropic / OpenAI / Mistral / Gemini
materials mp-api + pymatgen (Materials Project en ligne)
all Tout ce qui précède

Commandes disponibles après installation :

pvsim-web        # Serveur web Flask → http://localhost:5000
pvsim-tui        # CLI interactif (TUI Rich)
pvsim run config.json  # Simulation batch depuis un fichier JSON

# 🔑 Gestion des clés API et de la configuration
pvsim-config     # Assistant interactif pour générer le fichier .env
pvsim-config --set MP_API_KEY=votre_cle  # Configurer rapidement Materials Project
pvsim-config --set OPENAI_API_KEY=xxx    # Configurer l'assistant LLM

Via Docker

Avec Docker Compose (Recommandé pour le développement)

git clone https://github.com/Quantum-ARISE-Acad/PVSim.git
cd PVSim
pvsim-config --env  # Génère un fichier .env propre
# Éditer .env — définir SESAME_WEB_SECRET
docker compose up
# → http://localhost:5000

La stack Docker Compose inclut : serveur web Flask, 2 workers Celery, Redis, scheduler Beat, et Flower (monitoring). Le solveur Sesame et toutes les dépendances scientifiques sont pré-installés dans l'image.

# Modes alternatifs
docker compose run --rm cli                          # CLI interactif
docker compose run --rm ai pvsim run cfg.json   # Batch
docker compose --profile llm up                      # + Ollama LLM local
docker compose up --scale worker=4                   # Scaler les workers

Avec l'image Docker Hub (Production)

Si vous ne voulez pas cloner le dépôt, vous pouvez utiliser l'image pré-construite publiée sur Docker Hub (via le pipeline automatisé) :

# Télécharger la dernière image publiée
docker pull <DOCKERHUB_USERNAME>/pvsim:latest

# Lancer le serveur web
docker run -p 5000:5000 -e SESAME_WEB_SECRET=votre_secret <DOCKERHUB_USERNAME>/pvsim:latest

Depuis les sources

git clone https://github.com/Quantum-ARISE-Acad/PVSim.git
cd PVSim
python -m venv .venv && source .venv/bin/activate
pip install git+https://github.com/usnistgov/sesame.git
pip install -r requirements.txt
cp .env.example .env
pvsim-web      # ou : pvsim run configs/silicon_homo.json

Ce que PVSim fait

PVSim est un pipeline complet : config JSON → solveur Sesame → métriques IV → optimisation bayésienne → rapport PDF.

Le solveur résout le système Poisson + continuité (drift-diffusion) en 1D ou 2D pour 27 types de simulation différents, sur 15 matériaux semiconducteurs validés. L'optimiseur Bayésien (Optuna / BoTorch) explore automatiquement l'espace des paramètres physiques pour maximiser l'efficacité.


Types de simulation (27 routés)

Catégorie Types
Jonctions simples homojunction, homojunction_2d, heterojunction, heterojunction_2d, graded_heterojunction
Multicouches multi_layer (jusqu'à 7 couches)
Multi-jonctions tandem, triple_junction
Défauts with_defects, continuous_defects, grain_boundaries, grain_boundary_2d
Études paramétriques parametric_sweep, optimize_thickness, temperature_study, variable_illumination, spectrum_study
Couplages avancés electro_thermal_study, degradation_study, transient_photovoltage
Caractérisations quantum_efficiency, spectral_response, capacitance_voltage, luminescence, ebic_simulation, contact_study, equivalent_circuit

Matériaux intégrés

15 matériaux avec paramètres validés (Nc, Nv, μ, τ, Cn/p Auger, B_rad, χ, Eg) :

Matériau Eg (eV) Type de gap Référence
Si 1.1247 Indirect Richter 2012, Klaassen 1992
Ge 0.664 Indirect NREL
GaAs 1.424 Direct NREL
GaP 2.272 Indirect NREL
InP 1.344 Direct NREL
CdTe 1.50 Direct NREL
CdS 2.42 Direct NREL
CIGS 1.30 Direct Ramanathan 2003
CZTS 1.50 Direct Kauk-Kuusik 2017
MAPbI3 1.58 Direct Richter 2016
CsPbI3 1.73 Direct Katan 2019
FAPbI3 1.48 Direct Littérature
GaInP 1.87 Direct Vurgaftman 2001
AlGaAs 1.80 Direct Vurgaftman 2001
GaN 3.43 Direct Monemar 1974

Extension en ligne via Materials Project (clé MATERIALS_PROJECT_API_KEY) et OPTIMADE.


Format de configuration JSON

{
  "simulation_name": "si_homo_baseline",
  "simulation_type": "homojunction",
  "materials": { "active": "Si" },
  "geometry": {
    "thickness_n": 5e-5,
    "thickness_p": 2e-4,
    "nx": 100
  },
  "doping": {
    "n_region": 1e17,
    "p_region": 1e15
  },
  "voltages": { "start": 0.0, "stop": 0.7, "points": 50 },
  "illumination": {
    "enabled": true,
    "photon_flux": 2.5e17,
    "absorption_coefficient": 1e4
  }
}

39+ configurations d'exemple dans configs/. La notation pointée "doping.n_region" est utilisée par l'optimiseur pour mapper les paramètres sur la config.


Optimisation bayésienne

# Via l'API REST
curl -X POST http://localhost:5000/api/optimize/create \
  -H "Content-Type: application/json" \
  -d '{
    "name": "opt_si",
    "sim_type": "homojunction",
    "engine": "optuna", "sampler": "tpe",
    "n_trials": 200,
    "objectives": ["efficiency"],
    "param_ranges": [
      {"name": "doping.n_region", "type": "log_float", "low": 1e15, "high": 1e18},
      {"name": "geometry.thickness_p", "type": "log_float", "low": 5e-5, "high": 2e-3}
    ]
  }'

Moteurs : Optuna TPE (défaut), Optuna GP, BoTorch qLogEI, CMA-ES, Random.

Post-optimisation : surrogate ML (Random Forest / GBM / GP), analyse de sensibilité Sobol (SALib), prédiction inverse (~1 ms vs ~5 s pour Sesame).


API REST — routes principales

POST /api/simulate                      → Lancer une simulation
GET  /api/results/<id>                  → Résultats JSON
GET  /api/simulation/<id>/progress-stream  → SSE temps réel
POST /api/optimize/create               → Job d'optimisation
POST /api/optimize/<id>/run
GET  /api/optimize/<id>/results
POST /api/optimize/<id>/sensitivity     → Analyse Sobol
POST /api/optimize/<id>/predict         → Prédiction surrogate
GET  /api/health                        → État des services
GET  /api/docs/                         → Swagger interactif

Architecture

PVSim/
├── router.py              SesameRouter — dispatch vers 27 modules (~115 kB)
├── main.py                CLI batch (entrée fichier JSON)
├── simulations/           ~55 modules (physique, matériaux, validation)
├── optimization/          Optuna + BoTorch + SALib + Surrogate
├── web/                   Flask + SQLite + ReportLab
├── cli/                   11 commandes batch
├── cli_interactif/        TUI Rich (17 écrans)
├── pvsim_agent/           Agent LLM multi-provider
├── workers/               Celery distribué
└── configs/               39+ configurations JSON d'exemple

Variables d'environnement clés

SESAME_WEB_SECRET=<clé-32-hex>          # Obligatoire en production
PVSim_WEB_PORT=5000
PVSim_DB_PATH=/app/data/pvsim.db
REDIS_URL=redis://redis:6379/0
PVSim_LLM_PROVIDER=ollama               # ollama | anthropic | openai | mistral | gemini
PVSim_LLM_MODEL=llama3.2
MATERIALS_PROJECT_API_KEY=              # Optionnel

Voir .env.example pour la liste complète.


Tests

python -m pytest tests/ -v
python -m pytest tests/ -v -m unit        # Sans Sesame
pvsim run configs/silicon_homo.json --verbose

204+ tests. Marqueurs : unit, integration, slow, benchmark.


Citer

@software{PVSim2026,
  title   = {PVSim — Semiconductor Physics Analysis and Research Code},
  version = {2.1.0},
  year    = {2026},
  url     = {https://github.com/Quantum-ARISE-Acad/PVSim},
  license = {MIT}
}

Citer également : Sesame (NIST) — https://pages.nist.gov/sesame/


Liens : Documentation · Guide développeur · Déploiement · Changelog · Manuel utilisateur

Download files

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

Source Distribution

pvsim_pv-1.0.2.tar.gz (681.2 kB view details)

Uploaded Source

Built Distribution

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

pvsim_pv-1.0.2-py3-none-any.whl (737.5 kB view details)

Uploaded Python 3

File details

Details for the file pvsim_pv-1.0.2.tar.gz.

File metadata

  • Download URL: pvsim_pv-1.0.2.tar.gz
  • Upload date:
  • Size: 681.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pvsim_pv-1.0.2.tar.gz
Algorithm Hash digest
SHA256 7d5b24e1dfd03443cb948b73036f8008c162b964002aaf12691946508bc9a138
MD5 309edb59a4498904a811140571ea2e41
BLAKE2b-256 331aca5ad4222fa573268479532d77a3b629af3ea4cbb80e88c9082c3a74c2df

See more details on using hashes here.

File details

Details for the file pvsim_pv-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pvsim_pv-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 737.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pvsim_pv-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2806d8601c81c766f34985bd18c93f9701a40cae9cb506671f1ff777f226faa2
MD5 d19ece72e0cbf0f6d25515d890766a5f
BLAKE2b-256 2e702d956631023af367558077f6642d81817c6e9c7fed649628302684b5cfbe

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

This release

1.0.2 This release

2 files

1.0.1

2 files

1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page