Physics-Stellarator

Computational plasma dynamics in Perl, with a full model and 3‑D visualisation of the Wendelstein 7‑X stellarator.

The distribution provides two modules:

| Module | Role | |--------|------| | Physics::CPD | Pure‑Perl Computational Plasma Dynamics engine — fundamental magnetised‑plasma parameters from density, temperature, magnetic field and ion species. | | Physics::CPD::Stellarator | Extends Physics::CPD with stellarator geometry and physics, using Wendelstein 7‑X (W7‑X, IPP Greifswald) as the default configuration, plus plotting and 3‑D design diagrams. |

Features

Physics::CPD — plasma physics engine (no heavy dependencies)

Physics::CPD::Stellarator — Wendelstein 7‑X model

Installation

perl Makefile.PL
make
make test
make install

Requirements:

Quick start

Plasma parameters

use Physics::CPD;

my $plasma = Physics::CPD->new(
    electron_density     => 1e20,   # m^-3
    electron_temperature => 5000,   # eV
    ion_temperature      => 3000,   # eV
    magnetic_field       => 3.0,    # T
    ion_species          => 'D',
);

print $plasma->report;
printf "beta = %.2f %%\n", 100 * $plasma->plasma_beta;

Wendelstein 7‑X

use Physics::CPD::Stellarator;

my $w7x = Physics::CPD::Stellarator->new(
    electron_density     => 8e19,
    electron_temperature => 4000,
    ion_temperature      => 2500,
    magnetic_field       => 2.5,
    heating_power        => 10,     # MW
);

print $w7x->device_report;

printf "ISS04 tau_E = %.3f s\n",  $w7x->confinement_time_iss04;
printf "stored W    = %.1f MJ\n", $w7x->stored_energy_MJ;

# Visualisations (PNG files)
$w7x->plot_3d( output => 'w7x_3d.png' );              # 3-D design diagram
$w7x->plot_cross_sections( output => 'w7x_cross.png');# flux-surface sections
$w7x->plot_profiles( output => 'w7x_profiles.png' );  # radial profiles
$w7x->plot_confinement_scan( output => 'w7x_conf.png',
                             parameter => 'heating_power', from => 1, to => 20 );

The 3‑D diagram shows the twisted, bean‑shaped plasma boundary (the five field periods), the helical magnetic axis and the tilted modular coils.

Examples

Runnable scripts in examples/:

Wendelstein 7‑X reference parameters (defaults)

| Quantity | Value | |----------|-------| | Major radius R0 | 5.5 m | | Minor radius a | 0.53 m | | Aspect ratio | ≈ 10.4 | | Field periods | 5 | | Magnetic field | up to 3 T (2.5 T typical) | | Plasma volume | ≈ 30 m³ | | Non‑planar / planar coils | 50 / 20 | | Rotational transform ι | ≈ 0.8 – 1.2 | | ECRH | 140 GHz, 2nd‑harmonic X‑mode → 2.5 T | | Design β limit | ≈ 5 % |

Physics references

License

Released under the GNU General Public License v3.0 — see the LICENSE file for the full text.