Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion documentation/source/physics-models/plasma_radiation.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Plasma Radiation
# Plasma Radiation | `PlasmaRadiation()`

## Overview

Expand Down
7 changes: 7 additions & 0 deletions process/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
ElectronTemperatureProfile,
IonTemperatureProfile,
)
from process.models.physics.radiation_power import PlasmaRadiation
from process.models.physics.scrape_off_layer import ScrapeOffLayer
from process.models.power import Power, PumpingPowerModelTypes
from process.models.pulse import Pulse
Expand Down Expand Up @@ -707,6 +708,10 @@ def __init__(self, data: DataStructure):
sauter_bootstrap=self.sauter_bootstrap_current,
)
self.plasma_confinement = PlasmaConfinementTime()
self.plasma_radiation = PlasmaRadiation(
plasma_profile=self.plasma_profile,
data_structure=self.data,
)
self.plasma_transition = PlasmaConfinementTransition()
self.plasma_current = PlasmaCurrent()
self.plasma_fields = PlasmaFields()
Expand All @@ -731,6 +736,7 @@ def __init__(self, data: DataStructure):
scrape_off_layer=self.scrape_off_layer,
plasma_reactions=self.plasma_reactions,
beam_reactions=self.beam_reactions,
plasma_radiation=self.plasma_radiation,
)
self.physics_detailed = DetailedPhysics(
plasma_profile=self.plasma_profile,
Expand Down Expand Up @@ -832,6 +838,7 @@ def models(self) -> tuple[Model, ...]:
self.scrape_off_layer,
self.neoclassics,
self.plasma_inductance,
self.plasma_radiation,
self.ne_profile,
self.te_profile,
self.ti_profile,
Expand Down
7 changes: 7 additions & 0 deletions process/models/physics/impurity_radiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,12 @@ def __init__(self, plasma_profile: PlasmaProfile, data_structure: DataStructure)
"""
self.data = data_structure
self.plasma_profile = plasma_profile
self.reset()

def reset(self) -> None:
"""Reset the impurity element selection and all accumulated profiles
and volume averages so the instance can be reused between evaluations.
"""
self.imp = np.nonzero(
self.data.impurity_radiation.f_nd_impurity_electron_array > 1.0e-30
)[0]
Expand Down Expand Up @@ -859,6 +865,7 @@ def calculate_imprad(self) -> None:
impurity element. Calculate the radiation loss profiles, and integrate them to
find the total values for radiation loss.
"""
self.reset()
self.map_imprad_profile()
self.calculate_radiation_core_edge_profiles()
self.calculate_vol_avg_radiation_loss_profiles()
237 changes: 5 additions & 232 deletions process/models/physics/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import numpy as np

import process.models.physics.fusion_reactions as reactions
import process.models.physics.radiation_power as physics_funcs
from process.core import constants
from process.core import process_output as po
from process.core.exceptions import ProcessValueError
Expand Down Expand Up @@ -54,6 +53,7 @@
from process.models.physics.plasma_fields import PlasmaFields
from process.models.physics.plasma_geometry import PlasmaGeom
from process.models.physics.plasma_profiles import PlasmaProfile
from process.models.physics.radiation_power import PlasmaRadiation
from process.models.physics.scrape_off_layer import ScrapeOffLayer

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -208,6 +208,7 @@ def __init__(
scrape_off_layer: ScrapeOffLayer,
plasma_reactions: PlasmaReactions,
beam_reactions: BeamReactions,
plasma_radiation: PlasmaRadiation,
):
self.outfile = constants.NOUT
self.mfile = constants.MFILE
Expand All @@ -227,6 +228,7 @@ def __init__(
self.scrape_off_layer = scrape_off_layer
self.plasma_reactions = plasma_reactions
self.beam_reactions = beam_reactions
self.plasma_radiation = plasma_radiation

def output(self) -> None:
"""Output plasma physics information."""
Expand Down Expand Up @@ -709,57 +711,7 @@ def run(self):

# Calculate radiation power

radpwrdata = physics_funcs.calculate_radiation_powers(
self.plasma_profile,
self.data.physics.nd_plasma_electron_on_axis,
self.data.physics.rminor,
self.data.physics.b_plasma_toroidal_on_axis,
self.data.physics.aspect,
self.data.physics.alphan,
self.data.physics.alphat,
self.data.physics.tbeta,
self.data.physics.temp_plasma_electron_on_axis_kev,
self.data.physics.f_sync_reflect,
self.data.physics.rmajor,
self.data.physics.kappa,
self.data.physics.vol_plasma,
self.data,
)
self.data.physics.pden_plasma_sync_vol_avg_mw = (
radpwrdata.pden_plasma_sync_vol_avg_mw
)
self.data.physics.pden_plasma_core_rad_reduced_vol_avg_mw = (
radpwrdata.pden_plasma_core_rad_reduced_vol_avg_mw
)
self.data.physics.pden_plasma_core_rad_vol_avg_mw = (
radpwrdata.pden_plasma_core_rad_vol_avg_mw
)
self.data.physics.pden_plasma_edge_rad_vol_avg_mw = (
radpwrdata.pden_plasma_edge_rad_vol_avg_mw
)
self.data.physics.pden_plasma_rad_vol_avg_mw = (
radpwrdata.pden_plasma_rad_vol_avg_mw
)

self.data.physics.p_plasma_sync_mw = (
self.data.physics.pden_plasma_sync_vol_avg_mw * self.data.physics.vol_plasma
)
self.data.physics.p_plasma_core_rad_reduced_mw = (
self.data.physics.pden_plasma_core_rad_reduced_vol_avg_mw
* self.data.physics.vol_plasma
)

self.data.physics.p_plasma_core_rad_mw = (
self.data.physics.pden_plasma_core_rad_vol_avg_mw
* self.data.physics.vol_plasma
)
self.data.physics.p_plasma_edge_rad_mw = (
self.data.physics.pden_plasma_edge_rad_vol_avg_mw
* self.data.physics.vol_plasma
)
self.data.physics.p_plasma_rad_mw = (
self.data.physics.pden_plasma_rad_vol_avg_mw * self.data.physics.vol_plasma
)
self.plasma_radiation.run()

# Calculate ohmic power
(
Expand Down Expand Up @@ -1851,186 +1803,7 @@ def outplas(self):

self.plasma_reactions.output()

po.oheadr(self.outfile, "Plasma Radiation (excluding SOL):")

po.osubhd(self.outfile, "Synchrotron Radiation:")

po.ovarre(
self.outfile,
"Plasma total synchrotron radiation power (Pₛₙ) [MW]",
"(p_plasma_sync_mw)",
self.data.physics.p_plasma_sync_mw,
"OP ",
)
po.ovarre(
self.outfile,
"Plasma volume-averaged synchrotron radiation power density [MW/m³]",
"(pden_plasma_sync_vol_avg_mw)",
self.data.physics.pden_plasma_sync_vol_avg_mw,
"OP ",
)
po.ovarre(
self.outfile,
"Synchrotron wall reflectivity factor",
"(f_sync_reflect)",
self.data.physics.f_sync_reflect,
)
po.ovarre(
self.outfile,
"Fraction of plasma radiation power due to synchrotron radiation",
"(f_p_plasma_rad_sync)",
self.data.physics.f_p_plasma_rad_sync,
"OP ",
)

po.oblnkl(self.outfile)
po.ocmmnt(self.outfile, "----------------------------")
po.osubhd(self.outfile, "Line, Recombination & Bremsstrahlung Radiation:")

self.output_species_radiation_power_density()

po.oblnkl(self.outfile)
po.ovarre(
self.outfile,
"Fraction of plasma radiation power due to presence of ions",
"(f_p_plasma_rad_ions)",
self.data.physics.f_p_plasma_rad_ions,
"OP ",
)
po.oblnkl(self.outfile)
po.ovarre(
self.outfile,
"Plasma radiation power due to impurities, Z>2 (Pᵧ,ᵢₘₚ) [MW]",
"(p_plasma_rad_impurities_mw)",
self.data.physics.p_plasma_rad_impurities_mw,
"OP ",
)
po.ovarre(
self.outfile,
"Fraction of plasma radiation power due to impurities, Z>2",
"(f_p_plasma_rad_impurities)",
self.data.physics.f_p_plasma_rad_impurities,
"OP ",
)

po.oblnkl(self.outfile)
po.ocmmnt(self.outfile, "----------------------------")
po.osubhd(self.outfile, "Core region:")

po.ocmmnt(
self.outfile, "Note: Only the core region contains the synchrotron radiation"
)
po.oblnkl(self.outfile)
po.ovarre(
self.outfile,
"Plasma normalised minor radius defining 'core' region (ρᵢₙₙₑᵣ)",
"(radius_plasma_core_norm)",
self.data.impurity_radiation.radius_plasma_core_norm,
)
po.ovarre(
self.outfile,
"Fractional scaling of radiation power along core profile",
"(f_p_plasma_core_rad_reduction)",
self.data.impurity_radiation.f_p_plasma_core_rad_reduction,
)
po.oblnkl(self.outfile)
po.ovarre(
self.outfile,
"Plasma reduced core radiation power (Pᵧ,ᵢₙₙₑᵣ) [MW]",
"(p_plasma_core_rad_reduced_mw)",
self.data.physics.p_plasma_core_rad_reduced_mw,
"OP ",
)
po.ovarre(
self.outfile,
"Plasma core radiation power (Pᵧ,ᵢₙₙₑᵣ) [MW]",
"(p_plasma_core_rad_mw)",
self.data.physics.p_plasma_core_rad_mw,
"OP ",
)
po.oblnkl(self.outfile)
po.ocmmnt(
self.outfile,
"Note: Volume-averaged quantities are calculated over the whole plasma",
)
po.oblnkl(self.outfile)
po.ovarre(
self.outfile,
"Volume-averaged total reduced core radiation power per volume [MW/m³]",
"(pden_plasma_core_rad_reduced_vol_avg_mw)",
self.data.physics.pden_plasma_core_rad_reduced_vol_avg_mw,
"OP ",
)
po.ovarre(
self.outfile,
"Volume-averaged total core radiation power per volume [MW/m³]",
"(pden_plasma_core_rad_vol_avg_mw)",
self.data.physics.pden_plasma_core_rad_vol_avg_mw,
"OP ",
)
po.oblnkl(self.outfile)
po.ocmmnt(self.outfile, "----------------------------")
po.osubhd(self.outfile, "Edge region:")
po.ovarre(
self.outfile,
"Plasma total radiation power from edge region (Pᵧ,ₒᵤₜₑᵣ) [MW] ",
"(p_plasma_edge_rad_mw)",
self.data.physics.p_plasma_edge_rad_mw,
"OP ",
)
po.oblnkl(self.outfile)
po.ocmmnt(
self.outfile,
"Note: Volume-averaged quantities are calculated over the whole plasma",
)
po.oblnkl(self.outfile)
po.ovarre(
self.outfile,
"Volume-averaged total edge radiation power per volume [MW/m³]",
"(pden_plasma_edge_rad_vol_avg_mw)",
self.data.physics.pden_plasma_edge_rad_vol_avg_mw,
"OP ",
)

if self.data.stellarator.istell != StellaratorModel.DISABLED:
po.ovarre(
self.outfile,
"SOL radiation power as imposed by f_rad (MW)",
"(psolradmw)",
self.data.physics.psolradmw,
"OP ",
)

po.oblnkl(self.outfile)
po.ocmmnt(self.outfile, "----------------------------")
po.osubhd(self.outfile, "Totals:")

po.ovarre(
self.outfile,
"Plasma total radiation power from inside last closed flux surface "
"(Pᵧ) [MW]",
"(p_plasma_rad_mw)",
self.data.physics.p_plasma_rad_mw,
"OP ",
)
po.ovarre(
self.outfile,
"Separatrix radiation fraction (fᵧ)",
"(f_p_plasma_separatrix_rad)",
self.data.physics.f_p_plasma_separatrix_rad,
"OP ",
)
po.oblnkl(self.outfile)
po.ovarre(
self.outfile,
"Plasma total volume-averaged radiation power per unit volume [MW/m³]",
"(pden_plasma_rad_vol_avg_mw)",
self.data.physics.pden_plasma_rad_vol_avg_mw,
"OP ",
)

po.oblnkl(self.outfile)
po.ocmmnt(self.outfile, "----------------------------")
self.plasma_radiation.output()

po.oblnkl(self.outfile)
po.ovarre(
Expand Down
Loading
Loading