d0fus 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ from __future__ import annotations
2
+
3
+ """
4
+ D0FUS Import Module
5
+ ===================
6
+ Central import module for the D0FUS (Design 0-dimensional for FUsion Systems) project.
7
+
8
+ Created: December 2023
9
+ Author: Auclair Timothé
10
+ """
11
+
12
+ #%% Environment Configuration
13
+
14
+ import os
15
+ os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
16
+
17
+ #%% Standard Library Imports
18
+
19
+ import json
20
+ import math
21
+ import random
22
+ import re
23
+ import shutil
24
+ import sys
25
+ import time
26
+ import warnings
27
+ import importlib
28
+ from datetime import datetime
29
+ from pathlib import Path
30
+
31
+ #%% Scientific Computing Libraries
32
+
33
+ import numpy as np
34
+ import pandas as pd
35
+ import sympy as sp
36
+
37
+ #%% Scipy - Optimization and Numerical Methods
38
+
39
+ from scipy.integrate import quad
40
+ from scipy.interpolate import interp1d, griddata
41
+ from scipy.optimize import (
42
+ basinhopping,
43
+ bisect,
44
+ brentq,
45
+ differential_evolution,
46
+ fsolve,
47
+ least_squares,
48
+ minimize,
49
+ minimize_scalar,
50
+ root,
51
+ root_scalar,
52
+ shgo
53
+ )
54
+ from scipy.signal import find_peaks
55
+
56
+ #%% Visualization Libraries
57
+
58
+ import matplotlib.pyplot as plt
59
+ import matplotlib.colors as mcolors
60
+ import matplotlib.lines as mlines
61
+ import matplotlib.patches as mpatches
62
+ from matplotlib.colors import Normalize
63
+ from matplotlib.gridspec import GridSpec
64
+ from matplotlib.ticker import MultipleLocator
65
+ from mpl_toolkits.axes_grid1 import make_axes_locatable
66
+ from pandas.plotting import table
67
+ from tqdm import tqdm
68
+ from dataclasses import dataclass
69
+ from typing import Optional, Dict, List, Tuple
70
+
71
+ #%% Genetic Algorithm Libraries
72
+
73
+ from deap import algorithms, base, creator, tools
74
+
75
+ #%%
76
+
77
+ # print("D0FUS_import loaded")
@@ -0,0 +1,130 @@
1
+ """
2
+ D0FUS Parameterization Module
3
+ ==============================
4
+ Physical constants, material properties, and default parameters for tokamak design.
5
+
6
+ Created: December 2023
7
+ Author: Auclair Timothé
8
+ """
9
+
10
+ #%% Imports
11
+
12
+ # When imported as a module (normal usage in production)
13
+ if __name__ != "__main__":
14
+ from .D0FUS_import import *
15
+
16
+ # When executed directly (for testing and development)
17
+ else:
18
+ import sys
19
+ import os
20
+
21
+ # Add parent directory to path to allow absolute imports
22
+ sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
23
+
24
+ # Import using absolute paths for standalone execution
25
+ from D0FUS_BIB.D0FUS_import import *
26
+
27
+ #%% Physical Constants
28
+
29
+ # Fundamental constants
30
+ E_ELEM = 1.6e-19 # Elementary charge [C]
31
+ M_E = 9.1094e-31 # Electron mass [kg]
32
+ M_I = 2 * 1.6726e-27 # Ion mass (deuterium) [kg]
33
+ μ0 = 4.0 * np.pi * 1.0e-7 # Vacuum permeability [H/m]
34
+ EPS_0 = 8.8542e-12 # Vacuum permittivity [F/m]
35
+
36
+ #%% Fusion Reaction Parameters
37
+
38
+ # Energy release per reaction
39
+ E_ALPHA = 3.5 * 1.0e6 * E_ELEM # Alpha particle energy [J]
40
+ E_N = 14.1 * 1.0e6 * E_ELEM # Neutron energy [J]
41
+ E_F = 22.4 * 1.0e6 * E_ELEM # Total fusion energy (assuming all neutrons react with Li) [J]
42
+
43
+ # Plasma composition
44
+ Atomic_mass = 2.5 # Average atomic mass [AMU]
45
+ Zeff = 1 # Effective charge (default: 1)
46
+ r_synch = 0.5 # Synchrotron radiation reflection coefficient
47
+
48
+ #%% Plasma Stability Limits
49
+
50
+ betaN_limit = 2.8 # Troyon beta limit [% m T/MA]
51
+ q_limit = 2.5 # Minimum safety factor (q95 or q*)
52
+ ms = 0.3 # Vertical stability margin parameter
53
+
54
+ #%% Material Properties
55
+
56
+ # Structural steel
57
+ σ_manual = 1500 # Manual stress limit [MPa]
58
+ nu_Steel = 0.29 # Poisson's ratio (CIRCEE model)
59
+ Young_modul_Steel = 200e9 # Young's modulus [Pa] (CIRCEE model)
60
+ Young_modul_Glass_Fiber = 90e9 # Young's modulus for S-glass fiber [Pa]
61
+ # Reference: https://www.engineeringtoolbox.com/polymer-composite-fibers-d_1226.html
62
+
63
+ #%% Plasma Performance Parameters
64
+
65
+ C_Alpha = 5 # Helium ash dilution tuning parameter
66
+
67
+ #%% Magnetic Flux Parameters
68
+
69
+ Ce = 0.45 # Ejima constant (flux consumption)
70
+ ITERPI = 20 # ITER plasma induction flux [Wb]
71
+
72
+ #%% Toroidal Field (TF) Coil Parameters
73
+
74
+ coef_inboard_tension = 1/2 # Stress distribution ratio (inboard/outboard leg)
75
+ F_CClamp = 0e6 # C-Clamp structural limit [N]
76
+ # Typical range: 30e6 N (DDD) to 60e6 N (Bachmann 2023, FED)
77
+ n_TF = 1 # Conductor asymmetry parameter
78
+ c_BP = 0.07 # Backplate thickness [m]
79
+
80
+ #%% Central Solenoid (CS) Parameters
81
+
82
+ Gap = 0.1 # Clearance between CS wedging/bucking and TF [m]
83
+ n_CS = 1 # CS conductor parameter
84
+
85
+ #%% Superconductor Operating Conditions
86
+
87
+ # If manual option: current density fixed
88
+ Jc_Manual = 100e6 # MA/m²
89
+
90
+ # Helium cooling
91
+ T_helium = 4.2 # Liquid helium temperature [K]
92
+ Marge_T_Helium = 0.3 # Temperature margin linked to 10 bar operation [K]
93
+
94
+ # Area fractions
95
+ f_Cu_Non_Cu = 1 - 0.5 # Copper fraction in the strand
96
+ f_Cu_Strand = 1 - 0.3 # Copper stabilizer fraction (n_Cu/(n_Cu+n_Su))
97
+ f_Cool = 1 - 0.3 # Cooling channel fraction
98
+ f_In = 1 - 0.2 # Insulation fraction
99
+
100
+ # Temperature margins [K]
101
+ # Added to T_He to obtain T_operating (conservative design approach)
102
+ Marge_T_Nb3Sn = 2.0 # Safety margin for Nb3Sn
103
+ Marge_T_NbTi = 1.7 # Safety margin for NbTi
104
+ Marge_T_Rebco = 5.0 # Safety margin for REBCO
105
+
106
+ # Default operating parameters
107
+ Eps = -0.6/100 # Effective strain for Nb3Sn [-] (EU-DEMO TF: -0.35%)
108
+ Tet = 0.0 # REBCO tape angle [rad] (0 = B⊥, π/2 = B//ab)
109
+
110
+ #%% Power Conversion Efficiencies
111
+
112
+ eta_T = 0.4 # Thermal-to-electric conversion efficiency
113
+ eta_RF = 0.8 * 0.5 # RF heating efficiency (klystron efficiency × plasma absorption)
114
+
115
+ #%% Plasma-Facing Components (PFU)
116
+
117
+ theta_deg = 2.7 # Grazing angle at divertor strike point [deg]
118
+ # References:
119
+ # - T. R. Reiter, "Basic Fusion Boundary Plasma Physics," ITER School Lecture Notes (2019)
120
+ # - "SOLPS-ITER simulations of the ITER divertor with improved plasma conditions,"
121
+ # Journal of Nuclear Materials (2024)
122
+
123
+ #%% Numerical Configuration
124
+
125
+ # Suppress runtime warnings for cleaner output
126
+ warnings.filterwarnings("ignore", category=RuntimeWarning)
127
+
128
+ #%%
129
+
130
+ # print("D0FUS_parameterization loaded")