diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 573ab73acf..5c53fdef42 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -303,10 +303,9 @@ def run(self): self.data.physics.b_plasma_surface_poloidal_average = ( self.fields.calculate_surface_averaged_poloidal_field( i_plasma_current=self.data.physics.i_plasma_current, - ip=self.data.physics.plasma_current, + cur_plasma=self.data.physics.plasma_current, q95=self.data.physics.q95, aspect=self.data.physics.aspect, - eps=self.data.physics.eps, b_plasma_toroidal_on_axis=self.data.physics.b_plasma_toroidal_on_axis, kappa=self.data.physics.kappa, delta=self.data.physics.triang, diff --git a/process/models/physics/plasma_current.py b/process/models/physics/plasma_current.py index 8f3ae395be..b25ecd9249 100644 --- a/process/models/physics/plasma_current.py +++ b/process/models/physics/plasma_current.py @@ -276,26 +276,26 @@ def calculate_plasma_current( References ---------- - - J D Galambos, STAR Code : Spherical Tokamak Analysis and Reactor Code, - unpublished internal Oak Ridge document + [1] J D Galambos, STAR Code : Spherical Tokamak Analysis and Reactor Code, + unpublished internal Oak Ridge document - - Peng, Y. K. M., Galambos, J. D., & Shipe, P. C. (1992). - 'Small Tokamaks for Fusion Technology Testing'. Fusion Technology, - 21(3P2A), 1729-1738. https://doi.org/10.13182/FST92-A29971 + [2] Peng, Y. K. M., Galambos, J. D., & Shipe, P. C. (1992). + 'Small Tokamaks for Fusion Technology Testing'. Fusion Technology, + 21(3P2A), 1729-1738. https://doi.org/10.13182/FST92-A29971 - - ITER Physics Design Guidelines: 1989 [IPDG89], N. A. Uckan et al, - ITER Documentation Series No.10, IAEA/ITER/DS/10, IAEA, Vienna, 1990 + [3] ITER Physics Design Guidelines: 1989 [IPDG89], N. A. Uckan et al, + ITER Documentation Series No.10, IAEA/ITER/DS/10, IAEA, Vienna, 1990 - - M. Kovari et al, 2014, "PROCESS": A systems code for fusion power plants - - Part 1: Physics + [4] M. Kovari et al, 2014, "PROCESS": A systems code for fusion power plants + - Part 1: Physics - - H. Zohm et al, 2013, On the Physics Guidelines for a Tokamak DEMO + [5] H. Zohm et al, 2013, On the Physics Guidelines for a Tokamak DEMO - - T. Hartmann, 2013, Development of a modular systems code to analyse the - implications of physics assumptions on the design of a demonstration - fusion power plant + [6] T. Hartmann, 2013, Development of a modular systems code to analyse the + implications of physics assumptions on the design of a demonstration + fusion power plant - - Sauter, Geometric formulas for systems codes..., FED 2016 + [7] Sauter, Geometric formulas for systems codes..., FED 2016 """ # Aspect ratio aspect_ratio = 1.0 / eps @@ -315,19 +315,18 @@ def calculate_plasma_current( # Peng analytical fit if model == PlasmaCurrentModel.PENG_ANALYTIC_FIT: fq = self.calculate_current_coefficient_peng( - eps, len_plasma_poloidal, rminor + eps=eps, len_plasma_poloidal=len_plasma_poloidal, rminor=rminor ) # Peng scaling for double null divertor; TARTs [STAR Code] elif model == PlasmaCurrentModel.PENG_DIVERTOR_SCALING: plasma_current = 1.0e6 * self.calculate_plasma_current_peng( - q95, - aspect_ratio, - eps, - rminor, - b_plasma_toroidal_on_axis, - kappa, - triang, + q95=q95, + aspect=aspect_ratio, + rminor=rminor, + b_plasma_toroidal_on_axis=b_plasma_toroidal_on_axis, + kappa=kappa, + triang=triang, ) # Simple ITER scaling (simply the cylindrical case) @@ -336,7 +335,9 @@ def calculate_plasma_current( # ITER formula (IPDG89) elif model == PlasmaCurrentModel.IPDG89_SCALING: - fq = self.calculate_current_coefficient_ipdg89(eps, kappa95, triang95) + fq = self.calculate_current_coefficient_ipdg89( + eps=eps, kappa95=kappa95, triang95=triang95 + ) # Todd empirical scalings # D.C.Robinson and T.N.Todd, Plasma and Contr Fusion 28 (1986) 1181 @@ -345,37 +346,41 @@ def calculate_plasma_current( PlasmaCurrentModel.TODD_EMPIRICAL_SCALING_II, }: fq = self.calculate_current_coefficient_todd( - eps, kappa95, triang95, model=1 + eps=eps, kappa95=kappa95, triang95=triang95, model=1 ) if model == PlasmaCurrentModel.TODD_EMPIRICAL_SCALING_II: fq = self.calculate_current_coefficient_todd( - eps, kappa95, triang95, model=2 + eps=eps, kappa95=kappa95, triang95=triang95, model=2 ) # Connor-Hastie asymptotically-correct expression elif model == PlasmaCurrentModel.CONNOR_HASTIE_MODEL: fq = self.calculate_current_coefficient_hastie( - alphaj, - alphap, - b_plasma_toroidal_on_axis, - triang95, - eps, - kappa95, - pres_plasma_on_axis, - constants.RMU0, + alphaj=alphaj, + alphap=alphap, + b_plasma_toroidal_on_axis=b_plasma_toroidal_on_axis, + triang95=triang95, + eps=eps, + kappa95=kappa95, + pres_plasma_on_axis=pres_plasma_on_axis, + rmu0=constants.RMU0, ) # Sauter scaling allowing negative triangularity [FED May 2016] # https://doi.org/10.1016/j.fusengdes.2016.04.033. elif model == PlasmaCurrentModel.SAUTER_SCALING: # Assumes zero squareness, note takes kappa, delta at separatrix not _95 - fq = self.calculate_current_coefficient_sauter(eps, kappa, triang) + fq = self.calculate_current_coefficient_sauter( + eps=eps, kappa=kappa, triang=triang + ) # FIESTA ST scaling # https://doi.org/10.1016/j.fusengdes.2020.111530. elif model == PlasmaCurrentModel.FIESTA_ST_SCALING: - fq = self.calculate_current_coefficient_fiesta(eps, kappa, triang) + fq = self.calculate_current_coefficient_fiesta( + eps=eps, kappa=kappa, triang=triang + ) except ValueError as e: raise ProcessValueError( @@ -619,7 +624,7 @@ def calculate_cyclindrical_plasma_current( @staticmethod def plascar_bpol( - aspect: float, eps: float, kappa: float, delta: float + aspect: float, eps: float, kappa: float, triang: float ) -> tuple[float, float, float, float]: """Calculate the poloidal field coefficients for determining the plasma current and poloidal field. @@ -646,33 +651,34 @@ def plascar_bpol( References ---------- - - Peng, Y. K. M., Galambos, J. D., & Shipe, P. C. (1992). - 'Small Tokamaks for Fusion Technology Testing'. Fusion Technology, 21(3P2A), - 1729-1738. https://doi.org/10.13182/FST92-A29971 - - J D Galambos, STAR Code : Spherical Tokamak Analysis and Reactor Code, - unpublished internal Oak Ridge document + [1] Peng, Y. K. M., Galambos, J. D., & Shipe, P. C. (1992). + 'Small Tokamaks for Fusion Technology Testing'. Fusion Technology, 21(3P2A), + 1729-1738. https://doi.org/10.13182/FST92-A29971 + + [2] J D Galambos, STAR Code : Spherical Tokamak Analysis and Reactor Code, + unpublished internal Oak Ridge document """ # Original coding, only suitable for TARTs [STAR Code] - c1 = (kappa**2 / (1.0 + delta)) + delta - c2 = (kappa**2 / (1.0 - delta)) - delta + c1 = (kappa**2 / (1.0 + triang)) + triang + c2 = (kappa**2 / (1.0 - triang)) - triang - d1 = (kappa / (1.0 + delta)) ** 2 + 1.0 - d2 = (kappa / (1.0 - delta)) ** 2 + 1.0 + d1 = (kappa / (1.0 + triang)) ** 2 + 1.0 + d2 = (kappa / (1.0 - triang)) ** 2 + 1.0 c1_aspect = ((c1 * eps) - 1.0) if aspect < c1 else (1.0 - (c1 * eps)) - y1 = np.sqrt(c1_aspect / (1.0 + eps)) * ((1.0 + delta) / kappa) - y2 = np.sqrt((c2 * eps + 1.0) / (1.0 - eps)) * ((1.0 - delta) / kappa) + y1 = np.sqrt(c1_aspect / (1.0 + eps)) * ((1.0 + triang) / kappa) + y2 = np.sqrt((c2 * eps + 1.0) / (1.0 - eps)) * ((1.0 - triang) / kappa) h2 = (1.0 + (c2 - 1.0) * (eps / 2.0)) / np.sqrt((1.0 - eps) * (c2 * eps + 1.0)) - f2 = (d2 * (1.0 - delta) * eps) / ((1.0 - eps) * ((c2 * eps) + 1.0)) - g = (eps * kappa) / (1.0 - (eps * delta)) + f2 = (d2 * (1.0 - triang) * eps) / ((1.0 - eps) * ((c2 * eps) + 1.0)) + g = (eps * kappa) / (1.0 - (eps * triang)) ff2 = f2 * (g + 2.0 * h2 * np.arctan(y2)) h1 = (1.0 + (1.0 - c1) * (eps / 2.0)) / np.sqrt((1.0 + eps) * c1_aspect) - f1 = (d1 * (1.0 + delta) * eps) / ((1.0 + eps) * (c1 * eps - 1.0)) + f1 = (d1 * (1.0 + triang) * eps) / ((1.0 + eps) * (c1 * eps - 1.0)) if aspect < c1: ff1 = f1 * (g - h1 * np.log((1.0 + y1) / (1.0 - y1))) @@ -681,72 +687,6 @@ def plascar_bpol( return ff1, ff2, d1, d2 - def calculate_poloidal_field( - self, - i_plasma_current: int, - ip: float, - q95: float, - aspect: float, - eps: float, - b_plasma_toroidal_on_axis: float, - kappa: float, - delta: float, - perim: float, - ) -> float: - """Function to calculate poloidal field from the plasma current - - This function calculates the poloidal field from the plasma current in Tesla, - using a simple calculation using Ampere's law for conventional - tokamaks, or for TARTs, a scaling from Peng, Galambos and - Shipe (1992). - - Parameters - ---------- - i_plasma_current : - current scaling model to use - ip : - plasma current (A) - q95 : - 95% flux surface safety factor - aspect : - plasma aspect ratio - eps : - inverse aspect ratio - b_plasma_toroidal_on_axis : - toroidal field on axis (T) - kappa : - plasma elongation - delta : - plasma triangularity - perim : - plasma perimeter (m) - - Returns - ------- - : - poloidal field in Tesla - - - References - ---------- - - J D Galambos, STAR Code : Spherical Tokamak Analysis and Reactor Code, - unpublished internal Oak Ridge document - - Peng, Y. K. M., Galambos, J. D., & Shipe, P. C. (1992). - 'Small Tokamaks for Fusion Technology Testing'. Fusion Technology, 21(3P2A), - 1729-1738. https://doi.org/10.13182/FST92-A29971 - - """ - # Use Ampere's law using the plasma poloidal cross-section - if i_plasma_current != 2: - return constants.RMU0 * ip / perim - # Use the relation from Peng, Galambos and Shipe (1992) [STAR code] otherwise - ff1, ff2, _, _ = self.plascar_bpol(aspect, eps, kappa, delta) - - # Transform q95 to qbar - qbar = q95 * 1.3e0 * (1.0e0 - self.data.physics.eps) ** 0.6e0 - - return b_plasma_toroidal_on_axis * (ff1 + ff2) / (2.0 * np.pi * qbar) - @staticmethod def calculate_current_coefficient_peng( eps: float, len_plasma_poloidal: float, rminor: float @@ -783,11 +723,10 @@ def calculate_plasma_current_peng( self, q95: float, aspect: float, - eps: float, rminor: float, b_plasma_toroidal_on_axis: float, kappa: float, - delta: float, + triang: float, ) -> float: """ Function to calculate plasma current (Peng scaling from the STAR code) @@ -796,11 +735,10 @@ def calculate_plasma_current_peng( ---------- - q95: float, 95% flux surface safety factor - aspect: float, plasma aspect ratio - - eps: float, inverse aspect ratio - rminor: float, plasma minor radius (m) - b_plasma_toroidal_on_axis: float, toroidal field on axis (T) - kappa: float, plasma elongation - - delta: float, plasma triangularity + - triang: float, plasma triangularity Returns ------- @@ -813,19 +751,22 @@ def calculate_plasma_current_peng( References ---------- - - J D Galambos, STAR Code : Spherical Tokamak Analysis and Reactor Code, + [1] J D Galambos, STAR Code : Spherical Tokamak Analysis and Reactor Code, unpublished internal Oak Ridge document - - Peng, Y. K. M., Galambos, J. D., & Shipe, P. C. (1992). + + [2] Peng, Y. K. M., Galambos, J. D., & Shipe, P. C. (1992). 'Small Tokamaks for Fusion Technology Testing'. Fusion Technology, 21(3P2A), 1729-1738. https://doi.org/10.13182/FST92-A29971 """ # Transform q95 to qbar - qbar = q95 * 1.3e0 * (1.0e0 - self.data.physics.eps) ** 0.6e0 + qbar = q95 * 1.3e0 * (1.0e0 - (1.0 / aspect)) ** 0.6e0 - ff1, ff2, d1, d2 = self.plascar_bpol(aspect, eps, kappa, delta) + ff1, ff2, d1, d2 = self.plascar_bpol( + aspect=aspect, eps=(1.0 / aspect), kappa=kappa, triang=triang + ) - e1 = (2.0 * kappa) / (d1 * (1.0 + delta)) - e2 = (2.0 * kappa) / (d2 * (1.0 - delta)) + e1 = (2.0 * kappa) / (d1 * (1.0 + triang)) + e2 = (2.0 * kappa) / (d2 * (1.0 - triang)) return ( rminor @@ -861,9 +802,10 @@ def calculate_current_coefficient_ipdg89( References ---------- - - N.A. Uckan and ITER Physics Group, 'ITER Physics Design Guidelines: 1989' - - T.C.Hender et.al., 'Physics Assesment of the European Reactor Study', - AEA FUS 172, 1992 + [1] N.A. Uckan and ITER Physics Group, 'ITER Physics Design Guidelines: 1989' + + [2] T.C.Hender et.al., 'Physics Assesment of the European Reactor Study', + AEA FUS 172, 1992 """ return ( 0.5 @@ -899,9 +841,10 @@ def calculate_current_coefficient_todd( References ---------- - - D.C.Robinson and T.N.Todd, Plasma and Contr Fusion 28 (1986) 1181 - - T.C.Hender et.al., 'Physics Assesment of the European Reactor Study', - AEA FUS 172, 1992 + [1] D.C.Robinson and T.N.Todd, Plasma and Contr Fusion 28 (1986) 1181 + + [2] T.C.Hender et.al., 'Physics Assesment of the European Reactor Study', + AEA FUS 172, 1992 """ # Calculate the Todd scaling based on the model base_scaling = ( @@ -925,7 +868,7 @@ def calculate_current_coefficient_hastie( alphaj: float, alphap: float, b_plasma_toroidal_on_axis: float, - delta95: float, + triang95: float, eps: float, kappa95: float, pres_plasma_on_axis: float, @@ -940,7 +883,7 @@ def calculate_current_coefficient_hastie( - alphaj: float, the current profile index - alphap: float, the pressure profile index - b_plasma_toroidal_on_axis: float, the toroidal field on axis (T) - - delta95: float, the plasma triangularity 95% + - triang95: float, the plasma triangularity 95% - eps: float, the inverse aspect ratio - kappa95: float, the plasma elongation 95% - pres_plasma_on_axis: float, the central plasma pressure (Pa) @@ -953,11 +896,13 @@ def calculate_current_coefficient_hastie( This routine calculates the f_q coefficient used for scaling the plasma current, using the Connor-Hastie scaling - Reference: - - J.W.Connor and R.J.Hastie, Culham Lab Report CLM-M106 (1985). - https://scientific-publications.ukaea.uk/wp-content/uploads/CLM-M106-1.pdf - - T.C.Hender et.al., 'Physics Assesment of the European Reactor Study', - AEA FUS 172, 1992 + References + ---------- + [1] J.W.Connor and R.J.Hastie, Culham Lab Report CLM-M106 (1985). + https://scientific-publications.ukaea.uk/wp-content/uploads/CLM-M106-1.pdf + + [2] T.C.Hender et.al., 'Physics Assesment of the European Reactor Study', + AEA FUS 172, 1992 """ # Exponent in Connor-Hastie current profile lamda = alphaj @@ -974,7 +919,7 @@ def calculate_current_coefficient_hastie( # T/r in AEA FUS 172 kap1 = kappa95 + 1.0 - tr = kappa95 * delta95 / kap1**2 + tr = kappa95 * triang95 / kap1**2 # E/r in AEA FUS 172 er = (kappa95 - 1.0) / kap1 @@ -1025,8 +970,9 @@ def calculate_current_coefficient_sauter( ------- - float, the fq coefficient - Reference: - - O. Sauter, Geometric formulas for system codes including the effect of + References + ---------- + [1] O. Sauter, Geometric formulas for system codes including the effect of negative triangularity, Fusion Engineering and Design, Volume 112, 2016, Pages 633-645, ISSN 0920-3796, https://doi.org/10.1016/j.fusengdes.2016.04.033. """ @@ -1063,9 +1009,9 @@ def calculate_current_coefficient_fiesta( References ---------- - - S.Muldrew et.al,“PROCESS”: Systems studies of spherical tokamaks, - Fusion Engineering and Design, Volume 154, 2020, 111530, ISSN 0920-3796, - https://doi.org/10.1016/j.fusengdes.2020.111530. + [1] S.Muldrew et.al,“PROCESS”: Systems studies of spherical tokamaks, + Fusion Engineering and Design, Volume 154, 2020, 111530, ISSN 0920-3796, + https://doi.org/10.1016/j.fusengdes.2020.111530. """ return 0.538 * (1.0 + 2.440 * eps**2.736) * kappa**2.154 * triang**0.060 diff --git a/process/models/physics/plasma_fields.py b/process/models/physics/plasma_fields.py index fe1a3e78c8..d60355a6e8 100644 --- a/process/models/physics/plasma_fields.py +++ b/process/models/physics/plasma_fields.py @@ -8,7 +8,7 @@ from process.core import constants from process.core import process_output as po from process.core.model import Model -from process.models.physics.plasma_current import PlasmaCurrent +from process.models.physics.plasma_current import PlasmaCurrent, PlasmaCurrentModel logger = logging.getLogger(__name__) @@ -27,10 +27,9 @@ def run(self): def calculate_surface_averaged_poloidal_field( self, i_plasma_current: int, - ip: float, + cur_plasma: float, q95: float, aspect: float, - eps: float, b_plasma_toroidal_on_axis: float, kappa: float, delta: float, @@ -48,14 +47,12 @@ def calculate_surface_averaged_poloidal_field( ---------- i_plasma_current : current scaling model to use - ip : + cur_plasma : plasma current (A) q95 : 95% flux surface safety factor aspect : plasma aspect ratio - eps : - inverse aspect ratio b_plasma_toroidal_on_axis : toroidal field on axis (T) kappa : @@ -73,22 +70,25 @@ def calculate_surface_averaged_poloidal_field( References ---------- - - J D Galambos, STAR Code : Spherical Tokamak Analysis and Reactor Code, - unpublished internal Oak Ridge document - - Peng, Y. K. M., Galambos, J. D., & Shipe, P. C. (1992). - 'Small Tokamaks for Fusion Technology Testing'. Fusion Technology, 21(3P2A), - 1729-1738. https://doi.org/10.13182/FST92-A29971 + [1] J D Galambos, STAR Code : Spherical Tokamak Analysis and Reactor Code, + unpublished internal Oak Ridge document + + [2] Peng, Y. K. M., Galambos, J. D., & Shipe, P. C. (1992). + 'Small Tokamaks for Fusion Technology Testing'. Fusion Technology, 21(3P2A), + 1729-1738. https://doi.org/10.13182/FST92-A29971 """ # Use Ampere's law using the plasma poloidal cross-section this simply returns # ⟨Bₚ(a)⟩ - if i_plasma_current != 2: - return constants.RMU0 * ip / perim + if i_plasma_current != PlasmaCurrentModel.PENG_DIVERTOR_SCALING: + return constants.RMU0 * cur_plasma / perim # Use the relation from Peng, Galambos and Shipe (1992) [STAR code] otherwise - ff1, ff2, _, _ = self.current.plascar_bpol(aspect, eps, kappa, delta) + ff1, ff2, _, _ = self.current.plascar_bpol( + aspect=aspect, eps=(1 / aspect), kappa=kappa, triang=delta + ) # Transform q95 to qbar - qbar = q95 * 1.3e0 * (1.0e0 - self.data.physics.eps) ** 0.6e0 + qbar = q95 * 1.3e0 * (1.0e0 - (1 / aspect)) ** 0.6e0 return b_plasma_toroidal_on_axis * (ff1 + ff2) / (2.0 * np.pi * qbar) diff --git a/tests/unit/models/physics/test_physics.py b/tests/unit/models/physics/test_physics.py index b41e11b9b8..84d249937e 100644 --- a/tests/unit/models/physics/test_physics.py +++ b/tests/unit/models/physics/test_physics.py @@ -1238,25 +1238,23 @@ def test_calculate_plasma_current(plasmacurrentparam, monkeypatch, physics): { "q95": 2.5, "aspect": 2.7, - "eps": 0.37037037, "rminor": 1.5, "b_plasma_toroidal_on_axis": 12, "kappa": 1.85, - "delta": 0.5, + "triang": 0.5, }, - 37.08247253247967, + 38.00677211030666, ), ( { "q95": 2.5, "aspect": 3.0, - "eps": 0.33333333, "rminor": 1.5, "b_plasma_toroidal_on_axis": 12, "kappa": 1.85, - "delta": 0.5, + "triang": 0.5, }, - 31.594671010223617, + 31.290463480745593, ), ], ) @@ -1272,38 +1270,35 @@ def test_calculate_plasma_current_peng(arguments, expected, physics): ( { "i_plasma_current": 2, - "ip": 1.6e7, + "cur_plasma": 1.6e7, "q95": 2.5, "aspect": 2.7, - "eps": 0.37037037, "b_plasma_toroidal_on_axis": 12, "kappa": 1.85, "delta": 0.5, "perim": 24, }, - 3.4401302177092803, + 3.5258772213675047, ), ( { "i_plasma_current": 2, - "ip": 1.6e7, + "cur_plasma": 1.6e7, "q95": 2.5, "aspect": 3.0, - "eps": 0.33333333, "b_plasma_toroidal_on_axis": 12, "kappa": 1.85, "delta": 0.5, "perim": 24, }, - 2.9310284627233205, + 2.902807218476584, ), ( { "i_plasma_current": 3, - "ip": 1.6e7, + "cur_plasma": 1.6e7, "q95": 2.5, "aspect": 3.0, - "eps": 0.33333333, "b_plasma_toroidal_on_axis": 12, "kappa": 1.85, "delta": 0.5, @@ -3826,7 +3821,6 @@ def test_calculate_polidal_field( q95, b_plasma_toroidal_on_axis, aspect, - eps, kappa, delta, perim,