| 1 | package Physics::CPD::Stellarator; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 5 | extends 'Physics::CPD'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 5 | our $VERSION = '0.03'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use constant PI => 3.14159265358979; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 15 | # Fusion (deuterium-tritium) reaction data | ||||||||||||||||||||||||||||
| 16 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 17 | # Energy released per D-T fusion reaction T(d,n)4He [MeV] | ||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use constant { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 5 | DT_ENERGY_MEV => 17.59, # total energy per reaction | |||||||||||||||||||||||||||
| 20 | DT_ALPHA_ENERGY_MEV => 3.52, # 4He alpha (charged, heats plasma) | ||||||||||||||||||||||||||||
| 21 | DT_NEUTRON_ENERGY_MEV => 14.07, # neutron (escapes to the blanket) | ||||||||||||||||||||||||||||
| 22 | MEV_TO_JOULE => 1.602176634e-13, | ||||||||||||||||||||||||||||
| 23 | 5 | }; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # Bosch-Hale parametrisation of the Maxwell-averaged reactivity <sigma v> for | ||||||||||||||||||||||||||||
| 26 | # T(d,n)4He (H.-S. Bosch & G.M. Hale, Nucl. Fusion 32 (1992) 611). Valid for | ||||||||||||||||||||||||||||
| 27 | # ion temperatures 0.2-100 keV; accurate to better than ~0.25%. | ||||||||||||||||||||||||||||
| 28 | 5 | my $DT_BG = 34.3827; # Gamow constant [sqrt(keV)] | |||||||||||||||||||||||||||
| 29 | 5 | my $DT_MRC2 = 1124656; # reduced-mass energy m_r c^2 [keV] | |||||||||||||||||||||||||||
| 30 | 5 | my @DT_C = ( # C1 .. C7 | |||||||||||||||||||||||||||
| 31 | 1.17302e-9, 1.51361e-2, 7.51886e-2, 4.60643e-3, | ||||||||||||||||||||||||||||
| 32 | 1.35000e-2, -1.06750e-4, 1.36600e-5, | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 36 | # Default Wendelstein 7-X-like boundary (VMEC-style Fourier series). | ||||||||||||||||||||||||||||
| 37 | # | ||||||||||||||||||||||||||||
| 38 | # R(u,v) = sum Rbc(m,n) cos(m u - n Nfp v) | ||||||||||||||||||||||||||||
| 39 | # Z(u,v) = sum Zbs(m,n) sin(m u - n Nfp v) | ||||||||||||||||||||||||||||
| 40 | # | ||||||||||||||||||||||||||||
| 41 | # u = poloidal angle, v = toroidal angle, Nfp = number of field periods. | ||||||||||||||||||||||||||||
| 42 | # Each element is [ m, n, Rbc, Zbs ] in metres. The m=0 terms define the | ||||||||||||||||||||||||||||
| 43 | # helical magnetic axis; m>=1 terms define the rotating, bean-shaped cross | ||||||||||||||||||||||||||||
| 44 | # section that gives the stellarator its characteristic five-fold twist. | ||||||||||||||||||||||||||||
| 45 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 46 | 10 | ▶ | sub _default_boundary_coeffs { | ||||||||||||||||||||||||||
|
Subroutine
_default_boundary_coeffs: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 47 | return [ | ||||||||||||||||||||||||||||
| 48 | 10 | [ 0, 0, 5.50, 0.00 ], # major radius R0 | |||||||||||||||||||||||||||
| 49 | [ 0, 1, -0.28, -0.18 ], # major-radius breathing + axis excursion | ||||||||||||||||||||||||||||
| 50 | [ 1, 0, 0.50, 0.55 ], # base (elongated) cross section | ||||||||||||||||||||||||||||
| 51 | [ 1, 1, 0.26, -0.28 ], # rotating elongation -> bean shape + twist | ||||||||||||||||||||||||||||
| 52 | [ 2, 0, -0.05, 0.04 ], # triangularity | ||||||||||||||||||||||||||||
| 53 | [ 2, 1, -0.05, 0.04 ], # triangularity modulation | ||||||||||||||||||||||||||||
| 54 | ]; | ||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 58 | # Device attributes (defaults describe Wendelstein 7-X) | ||||||||||||||||||||||||||||
| 59 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 60 | has config_name => ( | ||||||||||||||||||||||||||||
| 61 | is => 'rw', | ||||||||||||||||||||||||||||
| 62 | 10 | ▶ | default => sub { 'Wendelstein 7-X (standard EIM configuration)' }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 63 | 5 | ); | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | has major_radius => ( # R0 [m] | ||||||||||||||||||||||||||||
| 66 | is => 'rw', | ||||||||||||||||||||||||||||
| 67 | 10 | ▶ | default => sub { 5.5 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 68 | 5 | ); | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | has minor_radius => ( # a [m] | ||||||||||||||||||||||||||||
| 71 | is => 'rw', | ||||||||||||||||||||||||||||
| 72 | 10 | ▶ | default => sub { 0.53 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 73 | 5 | ); | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | has num_field_periods => ( # Nfp | ||||||||||||||||||||||||||||
| 76 | is => 'rw', | ||||||||||||||||||||||||||||
| 77 | 10 | ▶ | default => sub { 5 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 78 | 5 | ); | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | has iota => ( # rotational transform (effective, ~2/3 radius) | ||||||||||||||||||||||||||||
| 81 | is => 'rw', | ||||||||||||||||||||||||||||
| 82 | 10 | ▶ | default => sub { 0.96 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 83 | 5 | ); | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | has heating_power => ( # P [MW] | ||||||||||||||||||||||||||||
| 86 | is => 'rw', | ||||||||||||||||||||||||||||
| 87 | 2 | ▶ | default => sub { 10 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 88 | 5 | ); | |||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | has num_nonplanar_coils => ( | ||||||||||||||||||||||||||||
| 91 | is => 'rw', | ||||||||||||||||||||||||||||
| 92 | 10 | ▶ | default => sub { 50 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 93 | 5 | ); | |||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | has num_planar_coils => ( | ||||||||||||||||||||||||||||
| 96 | is => 'rw', | ||||||||||||||||||||||||||||
| 97 | 10 | ▶ | default => sub { 20 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 98 | 5 | ); | |||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | has beta_limit => ( # design MHD beta limit | ||||||||||||||||||||||||||||
| 101 | is => 'rw', | ||||||||||||||||||||||||||||
| 102 | 10 | ▶ | default => sub { 0.05 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 103 | 5 | ); | |||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | has pulse_length => ( # [s] | ||||||||||||||||||||||||||||
| 106 | is => 'rw', | ||||||||||||||||||||||||||||
| 107 | 10 | ▶ | default => sub { 1800 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 108 | 5 | ); | |||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | has gyrotron_frequency => ( # ECRH gyrotron frequency [Hz] | ||||||||||||||||||||||||||||
| 111 | is => 'rw', | ||||||||||||||||||||||||||||
| 112 | 10 | ▶ | default => sub { 140e9 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 113 | 5 | ); | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | has dt_fuel_fraction => ( # D-T fuel-ion fraction of n_e (0..1) | ||||||||||||||||||||||||||||
| 116 | is => 'rw', # 1.0 = pure 50:50 D-T; lower models dilution | ||||||||||||||||||||||||||||
| 117 | 9 | ▶ | default => sub { 1.0 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 118 | 5 | ); | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 5 | has boundary_coeffs => ( | |||||||||||||||||||||||||||
| 121 | is => 'rw', | ||||||||||||||||||||||||||||
| 122 | default => \&_default_boundary_coeffs, | ||||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | # --- coil-geometry styling (used by the 3-D diagram) --- | ||||||||||||||||||||||||||||
| 126 | 10 | ▶ | has coil_radius => ( is => 'rw', default => sub { 0.95 } ); # [m] | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 127 | 10 | ▶ | has coil_elongation => ( is => 'rw', default => sub { 1.25 } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 128 | 10 | ▶ | has coil_tilt => ( is => 'rw', default => sub { 0.16 } ); # rad | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | # W7-X runs a strong field; override the CPD default of 1 T. | ||||||||||||||||||||||||||||
| 131 | 3 | ▶ | has '+magnetic_field' => ( default => sub { 2.5 } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 134 | # Basic device geometry | ||||||||||||||||||||||||||||
| 135 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 136 | 3 | ▶ | sub aspect_ratio { | ||||||||||||||||||||||||||
|
Subroutine
aspect_ratio: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 137 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||
| 138 | 3 | return $self->major_radius / $self->minor_radius; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | # Toroidal angle spanned by one field period [rad] | ||||||||||||||||||||||||||||
| 142 | 1 | ▶ | sub field_period_angle { | ||||||||||||||||||||||||||
|
Subroutine
field_period_angle: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 143 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 144 | 1 | return 2 * PI / $self->num_field_periods; | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | # Plasma volume of the toroidal plasma V = 2 pi^2 R0 a^2 [m^3] | ||||||||||||||||||||||||||||
| 148 | 35 | ▶ | sub plasma_volume { | ||||||||||||||||||||||||||
|
Subroutine
plasma_volume: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 149 | 35 | my ($self) = @_; | |||||||||||||||||||||||||||
| 150 | 35 | return 2 * PI**2 * $self->major_radius * $self->minor_radius**2; | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | # Plasma surface area (approx.) S = 4 pi^2 R0 a [m^2] | ||||||||||||||||||||||||||||
| 154 | 5 | ▶ | sub plasma_surface_area { | ||||||||||||||||||||||||||
|
Subroutine
plasma_surface_area: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 155 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||
| 156 | 5 | return 4 * PI**2 * $self->major_radius * $self->minor_radius; | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | # Rotational transform and its inverse, the stellarator "safety factor" | ||||||||||||||||||||||||||||
| 160 | 0 | ▶ | sub rotational_transform { $_[0]->iota } | ||||||||||||||||||||||||||
|
Subroutine
rotational_transform: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 161 | 2 | ▶ | sub safety_factor { 1 / $_[0]->iota } | ||||||||||||||||||||||||||
|
Subroutine
safety_factor: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 164 | # Confinement, limits and fusion figures of merit | ||||||||||||||||||||||||||||
| 165 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 166 | # ISS04 international stellarator energy-confinement scaling [s] | ||||||||||||||||||||||||||||
| 167 | # tau_E = 0.134 a^2.28 R^0.64 P^-0.61 n19^0.54 B^0.84 iota^0.41 | ||||||||||||||||||||||||||||
| 168 | # a,R in m; P in MW; n19 = line-averaged density in 1e19 m^-3; B in T. | ||||||||||||||||||||||||||||
| 169 | 10 | ▶ | sub confinement_time_iss04 { | ||||||||||||||||||||||||||
|
Subroutine
confinement_time_iss04: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 170 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||
| 171 | 10 | my $a = $self->minor_radius; | |||||||||||||||||||||||||||
| 172 | 10 | my $R = $self->major_radius; | |||||||||||||||||||||||||||
| 173 | 10 | my $P = $self->heating_power; | |||||||||||||||||||||||||||
| 174 | 10 | my $n19 = $self->electron_density / 1e19; | |||||||||||||||||||||||||||
| 175 | 10 | my $B = $self->magnetic_field; | |||||||||||||||||||||||||||
| 176 | 10 | my $iota = $self->iota; | |||||||||||||||||||||||||||
| 177 | 10 | return 0.134 | |||||||||||||||||||||||||||
| 178 | * $a**2.28 | ||||||||||||||||||||||||||||
| 179 | * $R**0.64 | ||||||||||||||||||||||||||||
| 180 | * $P**-0.61 | ||||||||||||||||||||||||||||
| 181 | * $n19**0.54 | ||||||||||||||||||||||||||||
| 182 | * $B**0.84 | ||||||||||||||||||||||||||||
| 183 | * $iota**0.41; | ||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | # Stored thermal plasma energy W = (3/2) p V [J] | ||||||||||||||||||||||||||||
| 187 | 2 | ▶ | sub stored_energy { | ||||||||||||||||||||||||||
|
Subroutine
stored_energy: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 188 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 189 | 2 | return 1.5 * $self->plasma_pressure * $self->plasma_volume; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | 1 | ▶ | sub stored_energy_MJ { $_[0]->stored_energy / 1e6 } | ||||||||||||||||||||||||||
|
Subroutine
stored_energy_MJ: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | # Sudo density limit for stellarators [m^-3] | ||||||||||||||||||||||||||||
| 194 | # n_max = 0.25 * sqrt( P B / (a^2 R) ) * 1e20 ; P in MW, B in T, a,R in m. | ||||||||||||||||||||||||||||
| 195 | 5 | ▶ | sub sudo_density_limit { | ||||||||||||||||||||||||||
|
Subroutine
sudo_density_limit: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 196 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||
| 197 | 5 | return 0.25 | |||||||||||||||||||||||||||
| 198 | * sqrt( $self->heating_power * $self->magnetic_field | ||||||||||||||||||||||||||||
| 199 | / ( $self->minor_radius**2 * $self->major_radius ) ) | ||||||||||||||||||||||||||||
| 200 | * 1e20; | ||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | # Fraction of the design beta limit currently used | ||||||||||||||||||||||||||||
| 204 | 2 | ▶ | sub beta_fraction { | ||||||||||||||||||||||||||
|
Subroutine
beta_fraction: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 205 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 206 | 2 | return $self->plasma_beta / $self->beta_limit; | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | # Fraction of the Sudo density limit currently used | ||||||||||||||||||||||||||||
| 210 | 2 | ▶ | sub density_fraction { | ||||||||||||||||||||||||||
|
Subroutine
density_fraction: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 211 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 212 | 2 | return $self->electron_density / $self->sudo_density_limit; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | # Lawson triple product n T_i tau_E [keV s m^-3] | ||||||||||||||||||||||||||||
| 216 | 2 | ▶ | sub triple_product { | ||||||||||||||||||||||||||
|
Subroutine
triple_product: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 217 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 218 | 2 | return $self->electron_density | |||||||||||||||||||||||||||
| 219 | * ( $self->ion_temperature / 1000 ) # eV -> keV | ||||||||||||||||||||||||||||
| 220 | * $self->confinement_time_iss04; | ||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | # Resonant field for electron-cyclotron heating at the gyrotron frequency | ||||||||||||||||||||||||||||
| 224 | # f = n * (e B) / (2 pi m_e) -> B_res = 2 pi m_e f / (n e) | ||||||||||||||||||||||||||||
| 225 | 2 | ▶ | sub ecrh_resonance_field { | ||||||||||||||||||||||||||
|
Subroutine
ecrh_resonance_field: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 226 | 2 | my ( $self, $harmonic ) = @_; | |||||||||||||||||||||||||||
| 227 | 2 | ▶ | $harmonic ||= 2; # W7-X uses 2nd-harmonic X-mode at 2.5 T / 140 GHz | ||||||||||||||||||||||||||
|
Condition50%1/2
$harmonic ||= 2
MC/DC0%0/1
$harmonic ||= 2
$harmonic
Truth table50%1/2
A
A= $harmonic
| |||||||||||||||||||||||||||||
| 228 | 2 | return 2 * PI * Physics::CPD::ELECTRON_MASS() * $self->gyrotron_frequency | |||||||||||||||||||||||||||
| 229 | / ( $harmonic * Physics::CPD::ELEMENTARY_CHARGE() ); | ||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 233 | # Theoretical fusion power production (assumes a 50:50 D-T plasma) | ||||||||||||||||||||||||||||
| 234 | # | ||||||||||||||||||||||||||||
| 235 | # W7-X itself is a hydrogen/deuterium research device and produces negligible | ||||||||||||||||||||||||||||
| 236 | # fusion power; these methods estimate the power a stellarator of this design | ||||||||||||||||||||||||||||
| 237 | # *would* deliver if fuelled with deuterium-tritium at the given operating | ||||||||||||||||||||||||||||
| 238 | # point. The model is a 0-D estimate that treats n_e and T_i as uniform over | ||||||||||||||||||||||||||||
| 239 | # the plasma volume, using the Bosch-Hale reactivity above. | ||||||||||||||||||||||||||||
| 240 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 241 | # Maxwell-averaged D-T reactivity <sigma v> [m^3/s] at ion temperature | ||||||||||||||||||||||||||||
| 242 | # $Ti_keV (defaults to the model ion temperature). | ||||||||||||||||||||||||||||
| 243 | 46 | ▶ | sub dt_reactivity { | ||||||||||||||||||||||||||
|
Subroutine
dt_reactivity: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 244 | 46 | my ( $self, $Ti_keV ) = @_; | |||||||||||||||||||||||||||
| 245 | 46 | ▶ | $Ti_keV = $self->ion_temperature / 1000 unless defined $Ti_keV; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | 46 | ▶ | return 0 if $Ti_keV <= 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 247 | 45 | my $T = $Ti_keV; | |||||||||||||||||||||||||||
| 248 | 45 | my $num = $T * ( $DT_C[1] + $T * ( $DT_C[3] + $T * $DT_C[5] ) ); | |||||||||||||||||||||||||||
| 249 | 45 | my $den = 1 + $T * ( $DT_C[2] + $T * ( $DT_C[4] + $T * $DT_C[6] ) ); | |||||||||||||||||||||||||||
| 250 | 45 | my $theta = $T / ( 1 - $num / $den ); | |||||||||||||||||||||||||||
| 251 | 45 | my $xi = ( $DT_BG**2 / ( 4 * $theta ) )**( 1 / 3 ); | |||||||||||||||||||||||||||
| 252 | 45 | my $sv_cm3 = $DT_C[0] * $theta | |||||||||||||||||||||||||||
| 253 | * sqrt( $xi / ( $DT_MRC2 * $T**3 ) ) * exp( -3 * $xi ); | ||||||||||||||||||||||||||||
| 254 | 45 | return $sv_cm3 * 1e-6; # cm^3/s -> m^3/s | |||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | # Total D-T fuel-ion density n_fuel = f * n_e [m^-3] | ||||||||||||||||||||||||||||
| 258 | 35 | ▶ | sub fuel_ion_density { | ||||||||||||||||||||||||||
|
Subroutine
fuel_ion_density: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 259 | 35 | my ($self) = @_; | |||||||||||||||||||||||||||
| 260 | 35 | return $self->dt_fuel_fraction * $self->electron_density; | |||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | # Volumetric fusion power density P/V = n_D n_T <sv> E_DT [W/m^3] | ||||||||||||||||||||||||||||
| 264 | # For a 50:50 mix n_D = n_T = n_fuel/2, so n_D n_T = n_fuel^2 / 4. | ||||||||||||||||||||||||||||
| 265 | 32 | ▶ | sub fusion_power_density { | ||||||||||||||||||||||||||
|
Subroutine
fusion_power_density: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 266 | 32 | my ($self) = @_; | |||||||||||||||||||||||||||
| 267 | 32 | my $nfuel = $self->fuel_ion_density; | |||||||||||||||||||||||||||
| 268 | 32 | return 0.25 * $nfuel**2 * $self->dt_reactivity | |||||||||||||||||||||||||||
| 269 | * DT_ENERGY_MEV * MEV_TO_JOULE; | ||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | # Total fusion power [W] and [MW] | ||||||||||||||||||||||||||||
| 273 | 28 | ▶ | sub fusion_power { $_[0]->fusion_power_density * $_[0]->plasma_volume } | ||||||||||||||||||||||||||
|
Subroutine
fusion_power: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 274 | 26 | ▶ | sub fusion_power_MW { $_[0]->fusion_power / 1e6 } | ||||||||||||||||||||||||||
|
Subroutine
fusion_power_MW: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | # 14.07 MeV neutron power carried to the blanket [MW] | ||||||||||||||||||||||||||||
| 277 | 8 | ▶ | sub neutron_power_MW { | ||||||||||||||||||||||||||
|
Subroutine
neutron_power_MW: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 278 | 8 | my ($self) = @_; | |||||||||||||||||||||||||||
| 279 | 8 | return $self->fusion_power_MW * ( DT_NEUTRON_ENERGY_MEV / DT_ENERGY_MEV ); | |||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | # 3.52 MeV alpha (charged-particle) power retained to heat the plasma [MW] | ||||||||||||||||||||||||||||
| 283 | 4 | ▶ | sub alpha_power_MW { | ||||||||||||||||||||||||||
|
Subroutine
alpha_power_MW: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 284 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||
| 285 | 4 | return $self->fusion_power_MW * ( DT_ALPHA_ENERGY_MEV / DT_ENERGY_MEV ); | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | # Average neutron wall loading over the plasma surface [MW/m^2] | ||||||||||||||||||||||||||||
| 289 | 3 | ▶ | sub neutron_wall_load { | ||||||||||||||||||||||||||
|
Subroutine
neutron_wall_load: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 290 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||
| 291 | 3 | return $self->neutron_power_MW / $self->plasma_surface_area; | |||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | # Fusion energy gain Q = P_fusion / P_heating (dimensionless) | ||||||||||||||||||||||||||||
| 295 | 3 | ▶ | sub fusion_gain_Q { | ||||||||||||||||||||||||||
|
Subroutine
fusion_gain_Q: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 296 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||
| 297 | 3 | my $p = $self->heating_power; | |||||||||||||||||||||||||||
| 298 | 3 | ▶ | return $p > 0 ? $self->fusion_power_MW / $p : 'inf'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 302 | # Radial profiles (illustrative, peaked shapes) | ||||||||||||||||||||||||||||
| 303 | # x = r/a in [0,1]; f(x) = f0 (1 - x^2)^alpha | ||||||||||||||||||||||||||||
| 304 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 305 | 0 | ▶ | sub density_profile { | ||||||||||||||||||||||||||
|
Subroutine
density_profile: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 306 | 0 | my ( $self, $x, $alpha ) = @_; | |||||||||||||||||||||||||||
| 307 | 0 | ▶ | $alpha = defined $alpha ? $alpha : 0.5; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 308 | 0 | my $v = 1 - $x * $x; | |||||||||||||||||||||||||||
| 309 | 0 | ▶ | $v = 0 if $v < 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 310 | 0 | return $self->electron_density * $v**$alpha; | |||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 0 | ▶ | sub temperature_profile { | ||||||||||||||||||||||||||
|
Subroutine
temperature_profile: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 314 | 0 | my ( $self, $x, $alpha ) = @_; | |||||||||||||||||||||||||||
| 315 | 0 | ▶ | $alpha = defined $alpha ? $alpha : 2.0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 316 | 0 | my $v = 1 - $x * $x; | |||||||||||||||||||||||||||
| 317 | 0 | ▶ | $v = 0 if $v < 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 318 | 0 | return $self->electron_temperature * $v**$alpha; | |||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | #=========================================================================== | ||||||||||||||||||||||||||||
| 322 | # GEOMETRY (pure Perl; returns array references so no PDL is required) | ||||||||||||||||||||||||||||
| 323 | #=========================================================================== | ||||||||||||||||||||||||||||
| 324 | # Evaluate the Fourier boundary at (u,v). A scale in [0,1] shrinks the | ||||||||||||||||||||||||||||
| 325 | # poloidal (m>=1) modes toward the axis, generating nested flux surfaces. | ||||||||||||||||||||||||||||
| 326 | 1254 | ▶ | sub boundary_point { | ||||||||||||||||||||||||||
|
Subroutine
boundary_point: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 327 | 1254 | my ( $self, $u, $v, $scale ) = @_; | |||||||||||||||||||||||||||
| 328 | 1254 | ▶ | $scale = 1 unless defined $scale; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 329 | 1254 | my $Nfp = $self->num_field_periods; | |||||||||||||||||||||||||||
| 330 | 1254 | my ( $R, $Z ) = ( 0, 0 ); | |||||||||||||||||||||||||||
| 331 | 1254 | for my $c ( @{ $self->boundary_coeffs } ) { | |||||||||||||||||||||||||||
| 332 | 7524 | my ( $m, $n, $rbc, $zbs ) = @$c; | |||||||||||||||||||||||||||
| 333 | 7524 | ▶ | my $sc = $m == 0 ? 1 : $scale; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 334 | 7524 | my $ang = $m * $u - $n * $Nfp * $v; | |||||||||||||||||||||||||||
| 335 | 7524 | $R += $sc * $rbc * cos($ang); | |||||||||||||||||||||||||||
| 336 | 7524 | $Z += $sc * $zbs * sin($ang); | |||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||
| 338 | 1254 | return ( $R, $Z ); | |||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | # Cartesian point on a flux surface at (u,v). | ||||||||||||||||||||||||||||
| 342 | 632 | ▶ | sub surface_point_xyz { | ||||||||||||||||||||||||||
|
Subroutine
surface_point_xyz: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 343 | 632 | my ( $self, $u, $v, $scale ) = @_; | |||||||||||||||||||||||||||
| 344 | 632 | my ( $R, $Z ) = $self->boundary_point( $u, $v, $scale ); | |||||||||||||||||||||||||||
| 345 | 632 | return ( $R * cos($v), $R * sin($v), $Z ); | |||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | # Magnetic axis: the m=0 part of the boundary (scale = 0). | ||||||||||||||||||||||||||||
| 349 | # Returns ($x_aref, $y_aref, $z_aref) for $n samples over the full torus. | ||||||||||||||||||||||||||||
| 350 | 1 | ▶ | sub magnetic_axis { | ||||||||||||||||||||||||||
|
Subroutine
magnetic_axis: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 351 | 1 | my ( $self, $n ) = @_; | |||||||||||||||||||||||||||
| 352 | 1 | ▶ | $n ||= 400; | ||||||||||||||||||||||||||
|
Condition50%1/2
$n ||= 400
MC/DC0%0/1
$n ||= 400
$n
Truth table50%1/2
A
A= $n
| |||||||||||||||||||||||||||||
| 353 | 1 | my ( @X, @Y, @Z ); | |||||||||||||||||||||||||||
| 354 | 1 | for my $i ( 0 .. $n ) { | |||||||||||||||||||||||||||
| 355 | 401 | my $v = 2 * PI * $i / $n; | |||||||||||||||||||||||||||
| 356 | 401 | my ( $x, $y, $z ) = $self->surface_point_xyz( 0, $v, 0 ); | |||||||||||||||||||||||||||
| 357 | 401 | push @X, $x; | |||||||||||||||||||||||||||
| 358 | 401 | push @Y, $y; | |||||||||||||||||||||||||||
| 359 | 401 | push @Z, $z; | |||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||
| 361 | 1 | return ( \@X, \@Y, \@Z ); | |||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | # One poloidal cross section (R,Z) at toroidal angle $v. | ||||||||||||||||||||||||||||
| 365 | # Returns ($R_aref, $Z_aref). | ||||||||||||||||||||||||||||
| 366 | 5 | ▶ | sub cross_section { | ||||||||||||||||||||||||||
|
Subroutine
cross_section: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 367 | 5 | my ( $self, $v, $nu, $scale ) = @_; | |||||||||||||||||||||||||||
| 368 | 5 | ▶ | $nu ||= 200; | ||||||||||||||||||||||||||
|
Condition50%1/2
$nu ||= 200
MC/DC0%0/1
$nu ||= 200
$nu
Truth table50%1/2
A
A= $nu
| |||||||||||||||||||||||||||||
| 369 | 5 | my ( @R, @Z ); | |||||||||||||||||||||||||||
| 370 | 5 | for my $i ( 0 .. $nu ) { | |||||||||||||||||||||||||||
| 371 | 605 | my $u = 2 * PI * $i / $nu; | |||||||||||||||||||||||||||
| 372 | 605 | my ( $r, $z ) = $self->boundary_point( $u, $v, $scale ); | |||||||||||||||||||||||||||
| 373 | 605 | push @R, $r; | |||||||||||||||||||||||||||
| 374 | 605 | push @Z, $z; | |||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||
| 376 | 5 | return ( \@R, \@Z ); | |||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | # Flux-surface grid as arrays-of-arrays [nu+1][nv+1] for X, Y, Z. | ||||||||||||||||||||||||||||
| 380 | 1 | ▶ | sub surface_grid { | ||||||||||||||||||||||||||
|
Subroutine
surface_grid: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 381 | 1 | my ( $self, $nu, $nv, $scale ) = @_; | |||||||||||||||||||||||||||
| 382 | 1 | ▶ | $nu ||= 60; | ||||||||||||||||||||||||||
|
Condition50%1/2
$nu ||= 60
MC/DC0%0/1
$nu ||= 60
$nu
Truth table50%1/2
A
A= $nu
| |||||||||||||||||||||||||||||
| 383 | 1 | ▶ | $nv ||= 180; | ||||||||||||||||||||||||||
|
Condition50%1/2
$nv ||= 180
MC/DC0%0/1
$nv ||= 180
$nv
Truth table50%1/2
A
A= $nv
| |||||||||||||||||||||||||||||
| 384 | 1 | my ( @X, @Y, @Z ); | |||||||||||||||||||||||||||
| 385 | 1 | for my $i ( 0 .. $nu ) { | |||||||||||||||||||||||||||
| 386 | 11 | my $u = 2 * PI * $i / $nu; | |||||||||||||||||||||||||||
| 387 | 11 | my ( @xr, @yr, @zr ); | |||||||||||||||||||||||||||
| 388 | 11 | for my $j ( 0 .. $nv ) { | |||||||||||||||||||||||||||
| 389 | 231 | my $v = 2 * PI * $j / $nv; | |||||||||||||||||||||||||||
| 390 | 231 | my ( $x, $y, $z ) = $self->surface_point_xyz( $u, $v, $scale ); | |||||||||||||||||||||||||||
| 391 | 231 | push @xr, $x; | |||||||||||||||||||||||||||
| 392 | 231 | push @yr, $y; | |||||||||||||||||||||||||||
| 393 | 231 | push @zr, $z; | |||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||
| 395 | 11 | push @X, \@xr; | |||||||||||||||||||||||||||
| 396 | 11 | push @Y, \@yr; | |||||||||||||||||||||||||||
| 397 | 11 | push @Z, \@zr; | |||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||
| 399 | 1 | return ( \@X, \@Y, \@Z ); | |||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | # Modular coils as tilted, elongated rings following the magnetic axis. | ||||||||||||||||||||||||||||
| 403 | # Returns a list of coil loops, each an arrayref [ $x_aref, $y_aref, $z_aref ]. | ||||||||||||||||||||||||||||
| 404 | 2 | ▶ | sub modular_coils { | ||||||||||||||||||||||||||
|
Subroutine
modular_coils: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 405 | 2 | my ( $self, $count, $npts ) = @_; | |||||||||||||||||||||||||||
| 406 | 2 | ▶ | $count ||= 2 * $self->num_field_periods; # readable subset of the 50 coils | ||||||||||||||||||||||||||
|
Condition66%2/3
$count ||= 2 * $self->num_field_periods
MC/DC0%0/2
$count ||= 2 * $self->num_field_periods
$count
2 * $self->num_field_periods
Truth table66%2/3
A ||= B
A= $countB= 2 * $self->num_field_periods
| |||||||||||||||||||||||||||||
| 407 | 2 | ▶ | $npts ||= 120; | ||||||||||||||||||||||||||
|
Condition100%2/2
$npts ||= 120
MC/DC100%1/1
$npts ||= 120
$npts
Truth table100%2/2
A
A= $npts
| |||||||||||||||||||||||||||||
| 408 | 2 | my $rc = $self->coil_radius; | |||||||||||||||||||||||||||
| 409 | 2 | my $elong = $self->coil_elongation; | |||||||||||||||||||||||||||
| 410 | 2 | my $tilt = $self->coil_tilt; | |||||||||||||||||||||||||||
| 411 | 2 | my @coils; | |||||||||||||||||||||||||||
| 412 | 2 | for my $k ( 0 .. $count - 1 ) { | |||||||||||||||||||||||||||
| 413 | 15 | my $phic = ( $k + 0.5 ) * 2 * PI / $count; | |||||||||||||||||||||||||||
| 414 | 15 | my ( $Rc0, $Zc0 ) = $self->boundary_point( 0, $phic, 0 ); # axis centre | |||||||||||||||||||||||||||
| 415 | 15 | my ( @X, @Y, @Z ); | |||||||||||||||||||||||||||
| 416 | 15 | for my $i ( 0 .. $npts ) { | |||||||||||||||||||||||||||
| 417 | 1465 | my $u = 2 * PI * $i / $npts; | |||||||||||||||||||||||||||
| 418 | 1465 | my $dR = $rc * cos($u); | |||||||||||||||||||||||||||
| 419 | 1465 | my $dZ = $rc * $elong * sin($u); | |||||||||||||||||||||||||||
| 420 | 1465 | my $phi = $phic + $tilt * sin($u) / $Rc0; | |||||||||||||||||||||||||||
| 421 | 1465 | my $R = $Rc0 + $dR; | |||||||||||||||||||||||||||
| 422 | 1465 | my $Z = $Zc0 + $dZ; | |||||||||||||||||||||||||||
| 423 | 1465 | push @X, $R * cos($phi); | |||||||||||||||||||||||||||
| 424 | 1465 | push @Y, $R * sin($phi); | |||||||||||||||||||||||||||
| 425 | 1465 | push @Z, $Z; | |||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||
| 427 | 15 | push @coils, [ \@X, \@Y, \@Z ]; | |||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||
| 429 | 2 | return @coils; | |||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | #=========================================================================== | ||||||||||||||||||||||||||||
| 433 | # PLOTTING (lazily loads PDL + PDL::Graphics::Gnuplot; writes to a file) | ||||||||||||||||||||||||||||
| 434 | #=========================================================================== | ||||||||||||||||||||||||||||
| 435 | 4 | ▶ | sub _new_gpwin { | ||||||||||||||||||||||||||
|
Subroutine
_new_gpwin: called CC=5 SCAR=17.1
| |||||||||||||||||||||||||||||
| 436 | 4 | my ( $self, %o ) = @_; | |||||||||||||||||||||||||||
| 437 | 4 | ▶ | eval { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 438 | 4 | require PDL; | |||||||||||||||||||||||||||
| 439 | 4 | require PDL::Graphics::Gnuplot; | |||||||||||||||||||||||||||
| 440 | 4 | 1; | |||||||||||||||||||||||||||
| 441 | } or croak | ||||||||||||||||||||||||||||
| 442 | "Plotting requires PDL and PDL::Graphics::Gnuplot to be installed: $@"; | ||||||||||||||||||||||||||||
| 443 | 4 | ▶ | my $output = $o{output} || 'stellarator.png'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$o{'output'} || 'stellarator.png'
MC/DC0%0/1
$o{'output'} || 'stellarator.png'
$o{'output'}
Truth table50%1/2
A
A= $o{'output'}
| |||||||||||||||||||||||||||||
| 444 | 4 | ▶ | my $term = $o{terminal} || 'pngcairo'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$o{'terminal'} || 'pngcairo'
MC/DC0%0/1
$o{'terminal'} || 'pngcairo'
$o{'terminal'}
Truth table50%1/2
A
A= $o{'terminal'}
| |||||||||||||||||||||||||||||
| 445 | 4 | ▶ | my $size = $o{size} || [ 10, 8 ]; | ||||||||||||||||||||||||||
|
Condition50%1/2
$o{'size'} || [10, 8]
MC/DC0%0/1
$o{'size'} || [10, 8]
$o{'size'}
Truth table50%1/2
A
A= $o{'size'}
| |||||||||||||||||||||||||||||
| 446 | 4 | my $w = PDL::Graphics::Gnuplot->new( | |||||||||||||||||||||||||||
| 447 | $term, | ||||||||||||||||||||||||||||
| 448 | output => $output, | ||||||||||||||||||||||||||||
| 449 | size => $size, | ||||||||||||||||||||||||||||
| 450 | ); | ||||||||||||||||||||||||||||
| 451 | 0 | return $w; | |||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | # turn an arrayref (or array-of-arrays) into a PDL piddle | ||||||||||||||||||||||||||||
| 455 | 0 | ▶ | sub _pdl { require PDL; return PDL->pdl( $_[0] ); } | ||||||||||||||||||||||||||
|
Subroutine
_pdl: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | # --- 3-D diagram of the stellarator design ------------------------------- | ||||||||||||||||||||||||||||
| 458 | # Draws the last-closed flux surface, the helical magnetic axis and a set of | ||||||||||||||||||||||||||||
| 459 | # modular field coils. Options: output, title, size, view [az,el], | ||||||||||||||||||||||||||||
| 460 | # show_axis, show_coils, coil_count, nu, nv, surface_scale. | ||||||||||||||||||||||||||||
| 461 | 1 | ▶ | sub plot_3d { | ||||||||||||||||||||||||||
|
Subroutine
plot_3d: called CC=12 SCAR=49.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 462 | 1 | my ( $self, %o ) = @_; | |||||||||||||||||||||||||||
| 463 | 1 | my $w = $self->_new_gpwin(%o); | |||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | 0 | ▶ | my $nu = $o{nu} || 54; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'nu'} || 54
MC/DC0%0/1
$o{'nu'} || 54
$o{'nu'}
Truth table0%0/2
A
A= $o{'nu'}
| |||||||||||||||||||||||||||||
| 466 | 0 | ▶ | my $nv = $o{nv} || 170; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'nv'} || 170
MC/DC0%0/1
$o{'nv'} || 170
$o{'nv'}
Truth table0%0/2
A
A= $o{'nv'}
| |||||||||||||||||||||||||||||
| 467 | 0 | ▶ | my $scale = defined $o{surface_scale} ? $o{surface_scale} : 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 468 | 0 | ▶ | my $view = $o{view} || [ 62, 25 ]; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'view'} || [62, 25]
MC/DC0%0/1
$o{'view'} || [62, 25]
$o{'view'}
Truth table0%0/2
A
A= $o{'view'}
| |||||||||||||||||||||||||||||
| 469 | my $title = defined $o{title} ? $o{title} | ||||||||||||||||||||||||||||
| 470 | 0 | ▶ | : $self->config_name . ' - 3D design'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | 0 | my @items; | |||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||
| 474 | # last-closed flux surface (wireframe) | ||||||||||||||||||||||||||||
| 475 | 0 | my ( $X, $Y, $Z ) = $self->surface_grid( $nu, $nv, $scale ); | |||||||||||||||||||||||||||
| 476 | 0 | push @items, | |||||||||||||||||||||||||||
| 477 | ( { with => 'lines', lc => '#c8b0e8' }, | ||||||||||||||||||||||||||||
| 478 | _pdl($X), _pdl($Y), _pdl($Z) ); | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | # helical magnetic axis | ||||||||||||||||||||||||||||
| 481 | 0 | ▶ | if ( !defined $o{show_axis} || $o{show_axis} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $o{"show_axis"} or $o{"show_axis"}
MC/DC0%0/2
not defined $o{"show_axis"} or $o{"show_axis"}
not defined $o{"show_axis"}
$o{"show_axis"}
Truth table0%0/3
not(A) or B
A= not defined $o{"show_axis"}B= $o{"show_axis"}
| |||||||||||||||||||||||||||||
| 482 | 0 | my ( $ax, $ay, $az ) = $self->magnetic_axis( 400 ); | |||||||||||||||||||||||||||
| 483 | 0 | push @items, | |||||||||||||||||||||||||||
| 484 | ( { with => 'lines', lw => 3, lc => '#000000' }, | ||||||||||||||||||||||||||||
| 485 | _pdl($ax), _pdl($ay), _pdl($az) ); | ||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | # modular coils | ||||||||||||||||||||||||||||
| 489 | 0 | ▶ | if ( !defined $o{show_coils} || $o{show_coils} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $o{"show_coils"} or $o{"show_coils"}
MC/DC0%0/2
not defined $o{"show_coils"} or $o{"show_coils"}
not defined $o{"show_coils"}
$o{"show_coils"}
Truth table0%0/3
not(A) or B
A= not defined $o{"show_coils"}B= $o{"show_coils"}
| |||||||||||||||||||||||||||||
| 490 | 0 | for my $coil ( $self->modular_coils( $o{coil_count} ) ) { | |||||||||||||||||||||||||||
| 491 | 0 | push @items, | |||||||||||||||||||||||||||
| 492 | ( { with => 'lines', lw => 2, lc => '#d83010' }, | ||||||||||||||||||||||||||||
| 493 | _pdl( $coil->[0] ), _pdl( $coil->[1] ), _pdl( $coil->[2] ) ); | ||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||
| 497 | $w->plot3d( | ||||||||||||||||||||||||||||
| 498 | 0 | { trid => 1, | |||||||||||||||||||||||||||
| 499 | title => $title, | ||||||||||||||||||||||||||||
| 500 | view => $view, | ||||||||||||||||||||||||||||
| 501 | xlabel => 'X (m)', | ||||||||||||||||||||||||||||
| 502 | ylabel => 'Y (m)', | ||||||||||||||||||||||||||||
| 503 | zlabel => 'Z (m)', | ||||||||||||||||||||||||||||
| 504 | }, | ||||||||||||||||||||||||||||
| 505 | @items, | ||||||||||||||||||||||||||||
| 506 | ); | ||||||||||||||||||||||||||||
| 507 | 0 | $w->close; | |||||||||||||||||||||||||||
| 508 | 0 | ▶ | return $o{output} || 'stellarator.png'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'output'} || 'stellarator.png'
MC/DC0%0/1
$o{'output'} || 'stellarator.png'
$o{'output'}
Truth table0%0/2
A
A= $o{'output'}
| |||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||
| 511 | # --- nested flux-surface cross sections over one field period ------------ | ||||||||||||||||||||||||||||
| 512 | # Options: output, title, size, n_angles, n_surfaces, nu. | ||||||||||||||||||||||||||||
| 513 | 1 | ▶ | sub plot_cross_sections { | ||||||||||||||||||||||||||
|
Subroutine
plot_cross_sections: called CC=10 SCAR=43.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 514 | 1 | my ( $self, %o ) = @_; | |||||||||||||||||||||||||||
| 515 | 1 | ▶ | $o{output} ||= 'stellarator_cross_sections.png'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$o{"output"} ||= "stellarator_cross_sections.png"
MC/DC0%0/1
$o{"output"} ||= "stellarator_cross_sections.png"
$o{"output"}
Truth table50%1/2
A
A= $o{"output"}
| |||||||||||||||||||||||||||||
| 516 | 1 | my $w = $self->_new_gpwin(%o); | |||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | 0 | ▶ | my $nang = $o{n_angles} || 5; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'n_angles'} || 5
MC/DC0%0/1
$o{'n_angles'} || 5
$o{'n_angles'}
Truth table0%0/2
A
A= $o{'n_angles'}
| |||||||||||||||||||||||||||||
| 519 | 0 | ▶ | my $nsurf = $o{n_surfaces} || 6; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'n_surfaces'} || 6
MC/DC0%0/1
$o{'n_surfaces'} || 6
$o{'n_surfaces'}
Truth table0%0/2
A
A= $o{'n_surfaces'}
| |||||||||||||||||||||||||||||
| 520 | 0 | ▶ | my $nu = $o{nu} || 200; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'nu'} || 200
MC/DC0%0/1
$o{'nu'} || 200
$o{'nu'}
Truth table0%0/2
A
A= $o{'nu'}
| |||||||||||||||||||||||||||||
| 521 | my $title = defined $o{title} ? $o{title} | ||||||||||||||||||||||||||||
| 522 | 0 | ▶ | : 'Flux-surface cross sections over one field period'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||
| 524 | 0 | my @plots; | |||||||||||||||||||||||||||
| 525 | 0 | my @palette = ( | |||||||||||||||||||||||||||
| 526 | '#1f77b4', '#d62728', '#2ca02c', '#9467bd', | ||||||||||||||||||||||||||||
| 527 | '#ff7f0e', '#17becf', '#8c564b', '#e377c2', | ||||||||||||||||||||||||||||
| 528 | ); | ||||||||||||||||||||||||||||
| 529 | 0 | for my $a ( 0 .. $nang - 1 ) { | |||||||||||||||||||||||||||
| 530 | 0 | ▶ | my $v = ( $nang > 1 ? $a / ( $nang - 1 ) : 0 ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 531 | * $self->field_period_angle; | ||||||||||||||||||||||||||||
| 532 | 0 | my $color = $palette[ $a % @palette ]; | |||||||||||||||||||||||||||
| 533 | 0 | for my $s ( 1 .. $nsurf ) { | |||||||||||||||||||||||||||
| 534 | 0 | my $scale = $s / $nsurf; | |||||||||||||||||||||||||||
| 535 | 0 | my ( $R, $Z ) = $self->cross_section( $v, $nu, $scale ); | |||||||||||||||||||||||||||
| 536 | 0 | my %style = ( with => 'lines', lc => $color ); | |||||||||||||||||||||||||||
| 537 | 0 | ▶ | $style{legend} = sprintf( 'phi = %.0f deg', $v * 180 / PI ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 538 | if $s == $nsurf; # label only the outermost surface | ||||||||||||||||||||||||||||
| 539 | 0 | push @plots, ( \%style, _pdl($R), _pdl($Z) ); | |||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | $w->plot( | ||||||||||||||||||||||||||||
| 544 | 0 | { title => $title, | |||||||||||||||||||||||||||
| 545 | xlabel => 'R (m)', | ||||||||||||||||||||||||||||
| 546 | ylabel => 'Z (m)', | ||||||||||||||||||||||||||||
| 547 | }, | ||||||||||||||||||||||||||||
| 548 | @plots, | ||||||||||||||||||||||||||||
| 549 | ); | ||||||||||||||||||||||||||||
| 550 | 0 | $w->close; | |||||||||||||||||||||||||||
| 551 | 0 | return $o{output}; | |||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | # --- radial density and temperature profiles ----------------------------- | ||||||||||||||||||||||||||||
| 555 | 1 | ▶ | sub plot_profiles { | ||||||||||||||||||||||||||
|
Subroutine
plot_profiles: called CC=6 SCAR=32.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 556 | 1 | my ( $self, %o ) = @_; | |||||||||||||||||||||||||||
| 557 | 1 | ▶ | $o{output} ||= 'stellarator_profiles.png'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$o{"output"} ||= "stellarator_profiles.png"
MC/DC0%0/1
$o{"output"} ||= "stellarator_profiles.png"
$o{"output"}
Truth table50%1/2
A
A= $o{"output"}
| |||||||||||||||||||||||||||||
| 558 | 1 | my $w = $self->_new_gpwin(%o); | |||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||
| 560 | 0 | ▶ | my $n = $o{n_points} || 100; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'n_points'} || 100
MC/DC0%0/1
$o{'n_points'} || 100
$o{'n_points'}
Truth table0%0/2
A
A= $o{'n_points'}
| |||||||||||||||||||||||||||||
| 561 | 0 | ▶ | my $alpha_n = defined $o{alpha_n} ? $o{alpha_n} : 0.5; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 562 | 0 | ▶ | my $alpha_T = defined $o{alpha_T} ? $o{alpha_T} : 2.0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||
| 564 | 0 | my ( @x, @ne, @te ); | |||||||||||||||||||||||||||
| 565 | 0 | for my $i ( 0 .. $n ) { | |||||||||||||||||||||||||||
| 566 | 0 | my $xr = $i / $n; | |||||||||||||||||||||||||||
| 567 | 0 | push @x, $xr; | |||||||||||||||||||||||||||
| 568 | 0 | push @ne, $self->density_profile( $xr, $alpha_n ) / 1e19; # 1e19 m^-3 | |||||||||||||||||||||||||||
| 569 | 0 | push @te, $self->temperature_profile( $xr, $alpha_T ) / 1000; # keV | |||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||
| 572 | $w->plot( | ||||||||||||||||||||||||||||
| 573 | 0 | { title => 'W7-X radial profiles (illustrative)', | |||||||||||||||||||||||||||
| 574 | xlabel => 'normalised minor radius r/a', | ||||||||||||||||||||||||||||
| 575 | ylabel => 'n_e (1e19 m^-3) / T_e (keV)', | ||||||||||||||||||||||||||||
| 576 | }, | ||||||||||||||||||||||||||||
| 577 | ( { with => 'lines', lw => 2, legend => 'n_e (1e19 m^-3)' }, | ||||||||||||||||||||||||||||
| 578 | _pdl( \@x ), _pdl( \@ne ) ), | ||||||||||||||||||||||||||||
| 579 | ( { with => 'lines', lw => 2, legend => 'T_e (keV)' }, | ||||||||||||||||||||||||||||
| 580 | _pdl( \@x ), _pdl( \@te ) ), | ||||||||||||||||||||||||||||
| 581 | ); | ||||||||||||||||||||||||||||
| 582 | 0 | $w->close; | |||||||||||||||||||||||||||
| 583 | 0 | return $o{output}; | |||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | # --- ISS04 confinement-time parameter scan -------------------------------- | ||||||||||||||||||||||||||||
| 587 | # Scans one attribute (default 'heating_power') and plots tau_E(ISS04). | ||||||||||||||||||||||||||||
| 588 | 1 | ▶ | sub plot_confinement_scan { | ||||||||||||||||||||||||||
|
Subroutine
plot_confinement_scan: called CC=7 SCAR=36.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 589 | 1 | my ( $self, %o ) = @_; | |||||||||||||||||||||||||||
| 590 | 1 | ▶ | $o{output} ||= 'stellarator_confinement.png'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$o{"output"} ||= "stellarator_confinement.png"
MC/DC0%0/1
$o{"output"} ||= "stellarator_confinement.png"
$o{"output"}
Truth table50%1/2
A
A= $o{"output"}
| |||||||||||||||||||||||||||||
| 591 | 1 | my $w = $self->_new_gpwin(%o); | |||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||
| 593 | 0 | ▶ | my $param = $o{parameter} || 'heating_power'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'parameter'} || 'heating_power'
MC/DC0%0/1
$o{'parameter'} || 'heating_power'
$o{'parameter'}
Truth table0%0/2
A
A= $o{'parameter'}
| |||||||||||||||||||||||||||||
| 594 | 0 | ▶ | my $from = defined $o{from} ? $o{from} : 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 595 | 0 | ▶ | my $to = defined $o{to} ? $o{to} : 20; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 596 | 0 | ▶ | my $n = $o{n_points} || 60; | ||||||||||||||||||||||||||
|
Condition0%0/2
$o{'n_points'} || 60
MC/DC0%0/1
$o{'n_points'} || 60
$o{'n_points'}
Truth table0%0/2
A
A= $o{'n_points'}
| |||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||
| 598 | 0 | my $saved = $self->$param; # restore afterwards | |||||||||||||||||||||||||||
| 599 | 0 | my ( @x, @tau ); | |||||||||||||||||||||||||||
| 600 | 0 | for my $i ( 0 .. $n ) { | |||||||||||||||||||||||||||
| 601 | 0 | my $val = $from + ( $to - $from ) * $i / $n; | |||||||||||||||||||||||||||
| 602 | 0 | $self->$param($val); | |||||||||||||||||||||||||||
| 603 | 0 | push @x, $val; | |||||||||||||||||||||||||||
| 604 | 0 | push @tau, $self->confinement_time_iss04; | |||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||
| 606 | 0 | $self->$param($saved); | |||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | 0 | ( my $plabel = $param ) =~ s/_/ /g; # avoid gnuplot subscripting | |||||||||||||||||||||||||||
| 609 | 0 | $w->plot( | |||||||||||||||||||||||||||
| 610 | { title => "ISS04 confinement time vs $plabel", | ||||||||||||||||||||||||||||
| 611 | xlabel => $plabel, | ||||||||||||||||||||||||||||
| 612 | ylabel => 'tau_E (s)', | ||||||||||||||||||||||||||||
| 613 | }, | ||||||||||||||||||||||||||||
| 614 | ( { with => 'lines', lw => 2, legend => 'tau_E (ISS04)' }, | ||||||||||||||||||||||||||||
| 615 | _pdl( \@x ), _pdl( \@tau ) ), | ||||||||||||||||||||||||||||
| 616 | ); | ||||||||||||||||||||||||||||
| 617 | 0 | $w->close; | |||||||||||||||||||||||||||
| 618 | 0 | return $o{output}; | |||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||
| 621 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 622 | # Reporting | ||||||||||||||||||||||||||||
| 623 | #--------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 624 | 1 | ▶ | sub device_report { | ||||||||||||||||||||||||||
|
Subroutine
device_report: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 625 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 626 | 1 | my @l; | |||||||||||||||||||||||||||
| 627 | 1 | push @l, "== Stellarator device: " . $self->config_name . " =="; | |||||||||||||||||||||||||||
| 628 | 1 | push @l, sprintf( " major radius R0 = %.3f m", $self->major_radius ); | |||||||||||||||||||||||||||
| 629 | 1 | push @l, sprintf( " minor radius a = %.3f m", $self->minor_radius ); | |||||||||||||||||||||||||||
| 630 | 1 | push @l, sprintf( " aspect ratio R0/a = %.2f", $self->aspect_ratio ); | |||||||||||||||||||||||||||
| 631 | 1 | push @l, sprintf( " field periods Nfp = %d", $self->num_field_periods ); | |||||||||||||||||||||||||||
| 632 | 1 | push @l, sprintf( " rotational transf. iota = %.3f (q = %.3f)", | |||||||||||||||||||||||||||
| 633 | $self->iota, $self->safety_factor ); | ||||||||||||||||||||||||||||
| 634 | 1 | push @l, sprintf( " magnetic field B = %.2f T", $self->magnetic_field ); | |||||||||||||||||||||||||||
| 635 | 1 | push @l, sprintf( " plasma volume V = %.2f m^3", $self->plasma_volume ); | |||||||||||||||||||||||||||
| 636 | 1 | push @l, sprintf( " plasma surface S = %.2f m^2", $self->plasma_surface_area ); | |||||||||||||||||||||||||||
| 637 | 1 | push @l, sprintf( " non-planar coils = %d", $self->num_nonplanar_coils ); | |||||||||||||||||||||||||||
| 638 | 1 | push @l, sprintf( " planar coils = %d", $self->num_planar_coils ); | |||||||||||||||||||||||||||
| 639 | 1 | push @l, " -- operating point --"; | |||||||||||||||||||||||||||
| 640 | 1 | push @l, sprintf( " heating power P = %.1f MW", $self->heating_power ); | |||||||||||||||||||||||||||
| 641 | 1 | push @l, sprintf( " electron density n_e = %.3e m^-3", $self->electron_density ); | |||||||||||||||||||||||||||
| 642 | 1 | push @l, sprintf( " electron temp. T_e = %.2f keV", $self->electron_temperature / 1000 ); | |||||||||||||||||||||||||||
| 643 | 1 | push @l, sprintf( " ion temperature T_i = %.2f keV", $self->ion_temperature / 1000 ); | |||||||||||||||||||||||||||
| 644 | 1 | push @l, " -- derived performance --"; | |||||||||||||||||||||||||||
| 645 | 1 | push @l, sprintf( " ISS04 confinement tau_E = %.3f s", $self->confinement_time_iss04 ); | |||||||||||||||||||||||||||
| 646 | 1 | push @l, sprintf( " stored energy W = %.2f MJ", $self->stored_energy_MJ ); | |||||||||||||||||||||||||||
| 647 | 1 | push @l, sprintf( " plasma beta beta = %.2f %% (%.0f%% of limit)", | |||||||||||||||||||||||||||
| 648 | 100 * $self->plasma_beta, 100 * $self->beta_fraction ); | ||||||||||||||||||||||||||||
| 649 | 1 | push @l, sprintf( " Sudo density limit n_max = %.3e m^-3 (%.0f%% used)", | |||||||||||||||||||||||||||
| 650 | $self->sudo_density_limit, 100 * $self->density_fraction ); | ||||||||||||||||||||||||||||
| 651 | 1 | push @l, sprintf( " triple product n T tau = %.3e keV s m^-3", $self->triple_product ); | |||||||||||||||||||||||||||
| 652 | 1 | push @l, sprintf( " ECRH 2nd-harm. res. field = %.2f T (at %.0f GHz)", | |||||||||||||||||||||||||||
| 653 | $self->ecrh_resonance_field(2), $self->gyrotron_frequency / 1e9 ); | ||||||||||||||||||||||||||||
| 654 | 1 | return join( "\n", @l ) . "\n"; | |||||||||||||||||||||||||||
| 655 | } | ||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||
| 657 | # Theoretical fusion-power summary for a 50:50 D-T operating point. | ||||||||||||||||||||||||||||
| 658 | 2 | ▶ | sub power_report { | ||||||||||||||||||||||||||
|
Subroutine
power_report: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 659 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 660 | 2 | my @l; | |||||||||||||||||||||||||||
| 661 | 2 | push @l, "== Theoretical fusion power (50:50 D-T): " . $self->config_name . " =="; | |||||||||||||||||||||||||||
| 662 | 2 | push @l, " -- operating point --"; | |||||||||||||||||||||||||||
| 663 | 2 | push @l, sprintf( " electron density n_e = %.3e m^-3", $self->electron_density ); | |||||||||||||||||||||||||||
| 664 | 2 | push @l, sprintf( " D-T fuel fraction f = %.2f (n_fuel = %.3e m^-3)", | |||||||||||||||||||||||||||
| 665 | $self->dt_fuel_fraction, $self->fuel_ion_density ); | ||||||||||||||||||||||||||||
| 666 | 2 | push @l, sprintf( " ion temperature T_i = %.2f keV", $self->ion_temperature / 1000 ); | |||||||||||||||||||||||||||
| 667 | 2 | push @l, sprintf( " heating power P_heat = %.1f MW", $self->heating_power ); | |||||||||||||||||||||||||||
| 668 | 2 | push @l, " -- fusion output --"; | |||||||||||||||||||||||||||
| 669 | 2 | push @l, sprintf( " D-T reactivity <sv> = %.3e m^3/s", $self->dt_reactivity ); | |||||||||||||||||||||||||||
| 670 | 2 | push @l, sprintf( " fusion power density = %.3e MW/m^3", $self->fusion_power_density / 1e6 ); | |||||||||||||||||||||||||||
| 671 | 2 | push @l, sprintf( " total fusion power P_fus = %.2f MW", $self->fusion_power_MW ); | |||||||||||||||||||||||||||
| 672 | 2 | push @l, sprintf( " neutrons (14.07 MeV) = %.2f MW", $self->neutron_power_MW ); | |||||||||||||||||||||||||||
| 673 | 2 | push @l, sprintf( " alphas (3.52 MeV) = %.2f MW", $self->alpha_power_MW ); | |||||||||||||||||||||||||||
| 674 | 2 | push @l, sprintf( " neutron wall load = %.3f MW/m^2", $self->neutron_wall_load ); | |||||||||||||||||||||||||||
| 675 | 2 | push @l, sprintf( " fusion gain Q = %.2f", $self->fusion_gain_Q ); | |||||||||||||||||||||||||||
| 676 | 2 | return join( "\n", @l ) . "\n"; | |||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||
| 679 | 5 | 1; | |||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||
| 681 | __END__ | ||||||||||||||||||||||||||||