.claude/skills/driftfusion-analysis-plotting/SKILL.md
Analyze simulation solutions, calculate physical quantities, and generate plots. Use this skill when processing completed simulations, extracting currents/densities, or visualizing results.
npx skillsauth add ShaneLogic/SolarLab driftfusion-analysis-plottingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Access solution structures, calculate physical quantities, and generate visualization plots.
Access solution structure sol with components:
u: 3D matrix [time, space, variable]x: Spatial mesht: Time meshpar: Parameters objectVariable Order in u:
Use dfana class to calculate physical quantities:
result = dfana.my_calculation(sol)
Common calculations:
CRITICAL WARNING: The physical model in Equation Editor is NOT coupled to analysis functions. Users must manually ensure models in dfana and df are consistent.
Use dfplot class for visualization:
dfplot.my_plot(sol, optional_arguments)
dfplot.n(sol, [t1, t2, ... tm]) % Plot at specific time points
dfplot.J(sol, x_position) % Plot at specific position
dfplot.Q(sol, [x1, x2]) % Integrate over spatial range
dfplot.x2d(sol, 'variable_name')
Example: Cyclic Voltammogram
Initialize system:
init_driftfusion
Create parameters object:
par = pci('path/to/Spiro-OMeTAD_perovskite_TiO2.csv')
Find equilibrium:
soleq = equilibrate(par)
Run protocol:
sol = doCV(soleq.ion, 0, 1.2, -0.2, 0, 50e-3)
% Parameters: input, V_start, V_max, V_min, V_end, scan_rate
Plot results:
dfplot.JVapp(sol, d_midactive)
d_midactive: Position at midpoint of active layern, p: Electron and hole densitiesV: Electrostatic potentialJ: Current densityEfn, Efp: Quasi-Fermi levelsdevelopment
Understand and comply with Driftfusion software licensing terms, including the open-source AGPL v3.0 frontend and proprietary MATLAB pdepe solver backend. Use when using, modifying, or distributing Driftfusion code.
development
Initialize the Driftfusion simulation environment and create parameter objects. Use this skill when starting a new MATLAB session or setting up device properties for simulation.
development
Define device layer structure, configure spatial and time meshes, and build device structures with interface grading. Use this skill when setting up the physical geometry and discretization of a simulation device.
data-ai
Model charge transport in perovskite solar cells using drift-diffusion equations. Apply conservation equations, flux equations, and Poisson's equation for perovskite, ETL, and HTL regions. Use when setting up the core physics model for PSC simulations.