From 0b4f679f2fa7d64f027982918533c41cf48e5aca Mon Sep 17 00:00:00 2001 From: Clair Mould <86794332+clmould@users.noreply.github.com> Date: Wed, 12 Aug 2026 18:22:02 +0100 Subject: [PATCH 1/8] WIP but copied validate_input() to InDat, renamed to update_obsolete(), and got it working to update the obsolete vars when running process, includes pdbs --- process/core/init.py | 13 +++- process/core/io/in_dat/base.py | 134 ++++++++++++++++++++++++++++++++- process/main.py | 127 ++----------------------------- 3 files changed, 149 insertions(+), 125 deletions(-) diff --git a/process/core/init.py b/process/core/init.py index 7704fd05e8..46f9c076c2 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -14,6 +14,7 @@ from process.core import constants, process_output from process.core.exceptions import ProcessValidationError from process.core.input import parse_input_file +from process.core.io.in_dat.base import InDat from process.core.solver import iteration_variables from process.core.solver.constraints import ConstraintManager from process.data_structure.blanket_variables import BlktModelTypes @@ -50,7 +51,7 @@ from process.core.model import DataStructure -def init_process(data: DataStructure): +def init_process(data: DataStructure, update_obsolete: bool = False): """Routine that calls the initialisation routines This routine calls the main initialisation routines that set @@ -59,9 +60,17 @@ def init_process(data: DataStructure): """ # Initialise the program variables iteration_variables.initialise_iteration_variables(data) - # Creating and open the files MFile and OUTFile process_output.OutputFileManager.open_files(data.globals.output_prefix) + import ipdb + + ipdb.set_trace() + # TODO use InDat(filename) instead here? + # Use InDat class to read in IN.DAT, update obsolete and + # parse input file + filename = data.globals.output_prefix + "IN.DAT" + # Check for and, if requested, update obsolete variables + InDat(filename=filename, update_obsolete=update_obsolete) # Input any desired new initial values inputs = parse_input_file(data) diff --git a/process/core/io/in_dat/base.py b/process/core/io/in_dat/base.py index 21be3d153c..bc9b7951bf 100644 --- a/process/core/io/in_dat/base.py +++ b/process/core/io/in_dat/base.py @@ -14,6 +14,7 @@ from re import sub from process.core.exceptions import ProcessValidationError +from process.core.io import obsolete_vars as ov from process.core.io.data_structure_dicts import get_dicts from process.core.solver.constraints import ConstraintManager from process.core.solver.iteration_variables import ITERATION_VARIABLES @@ -1028,9 +1029,10 @@ class InDat: - Writing IN.DAT files - Storing information in dictionary for use in other codes - Alterations to IN.DAT + - Updating obsolete variables """ - def __init__(self, filename="IN.DAT", start_line=0): + def __init__(self, filename="IN.DAT", start_line=0, update_obsolete: bool = False): """Initialise class Parameters @@ -1039,9 +1041,18 @@ def __init__(self, filename="IN.DAT", start_line=0): Name of input IN.DAT start_line: Line to start reading from + update_obsolete: + Whether to update obsolete variables in the IN.DAT or not """ self.filename = filename self.start_line = start_line + self.update_obsolete = update_obsolete + import ipdb + + ipdb.set_trace() + # Update obsolete variables if requested + if self.update_obsolete: + self.update_obsolete_variables() # Initialise parameters self.in_dat_lines = [] @@ -1633,6 +1644,127 @@ def write_in_dat(self, output_filename="new_IN.DAT"): # Write parameters write_parameters(self.data, output) + def update_obsolete_variables(self): + """Checks the input IN.DAT file for any obsolete variables in the OBS_VARS dict + contained within obsolete_variables.py. + If obsolete variables are found, and if `update_obsolete` is set to True, + they are either removed or replaced by their updated names as specified + in the OBS_VARS dictionary. + + Raises + ------ + ValueError + If obsolete variables are present in the input file and update_obsolete + is False. + """ + obsolete_variables = ov.OBS_VARS + obsolete_vars_help_message = ov.OBS_VARS_HELP + + filename = self.filename + variables_in_in_dat = [] + modified_lines = [] + changes_made = [] # To store details of the changes + + with open(filename) as file: + for line in file: + # Skip comment lines or lines without an assignment + if line.startswith("*") or "=" not in line: + modified_lines.append(line) + continue + + # Extract the variable name before the separator + raw_variable_name = line.split("=", 1)[0].strip() + # handle cases where the variable name might have parentheses + variable_name = ( + raw_variable_name.split("(", 1)[0] + if "(" in raw_variable_name + else raw_variable_name + ) + + # Check if the variable is obsolete and needs replacing + if variable_name in obsolete_variables: + replacement = obsolete_variables.get(variable_name) + if self.update_obsolete: + # Prepare replacement or removal + if replacement is None: + # If no replacement is defined, comment out the line + modified_lines.append(f"* Obsolete: {line}") + changes_made.append( + f"Commented out obsolete variable: {variable_name}" + ) + else: + if isinstance(replacement, list): + # Raise an error if replacement is a list + replacement_str = ", ".join(replacement) + raise ValueError( + f"The variable '{variable_name}' is obsolete and " + "should be replaced by the following variables: " + f"{replacement_str}. " + "Please set their values accordingly." + ) + # Replace obsolete variable + modified_line = line.replace(variable_name, replacement, 1) + modified_lines.append( + f"* Replaced '{variable_name}' with " + f"'{replacement}'\n{modified_line}" + ) + changes_made.append( + f"Replaced '{variable_name}' with '{replacement}'" + ) + variables_in_in_dat.append(variable_name) + else: + # If replacement is False, add the line as-is + modified_lines.append(line) + variables_in_in_dat.append(variable_name) + else: + modified_lines.append(line) + + obs_vars_in_in_dat = [ + var for var in variables_in_in_dat if var in obsolete_variables + ] + + if obs_vars_in_in_dat: + if self.update_obsolete: + # If update_obsolete is True, write the modified content to the file + with open(filename, "w") as file: + file.writelines(modified_lines) + print( + "The IN.DAT file has been updated to replace or " + "comment out obsolete variables." + ) + print("Summary of changes made:") + for change in changes_made: + print(f" - {change}") + else: + # Only print the report if update_obsolete is False + message = ( + "The IN.DAT file contains obsolete variables " + "from the OBS_VARS dictionary. " + "The obsolete variables in your IN.DAT file are: " + f"{obs_vars_in_in_dat}. " + "Either remove these or replace them with " + "their updated variable names. " + "Use the --update-obsolete flag for this " + "to be done automatically." + ) + for obs_var in obs_vars_in_in_dat: + replacement = obsolete_variables.get(obs_var) + if replacement is None: + message += ( + f"\n\n{obs_var} is an obsolete variable " + "and needs to be removed." + ) + else: + message += ( + f"\n\n{obs_var} is an obsolete variable " + f"and needs to be replaced by {replacement}." + ) + message += f" {obsolete_vars_help_message.get(obs_var, '')}" + raise ValueError(message) + + else: + print("The IN.DAT file does not contain any obsolete variables.") + @property def number_of_constraints(self): """ diff --git a/process/main.py b/process/main.py index 4f2c7ccfa8..d5066a561c 100644 --- a/process/main.py +++ b/process/main.py @@ -39,7 +39,6 @@ import process # noqa: F401 from process.core import constants, init -from process.core.io import obsolete_vars as ov from process.core.io.cli_tools import LazyGroup, help_opt, indat_opt from process.core.io.mfile import MFile from process.core.io.plot import plot_sankey_plotly, plot_summary @@ -332,11 +331,13 @@ def __init__( """ self.input_file = Path(input_file) self.data = data_structure or DataStructure() + import ipdb - self.validate_input(update_obsolete) + ipdb.set_trace() + self.update_obsolete = update_obsolete self.init_module_vars() self.set_filenames(filepath_out) - self.initialise() + self.initialise() # in here does init_process self.models = Models(self.data) self.solver = solver @@ -429,7 +430,7 @@ def initialise(self): initialise_imprad(self.data) # Reads in input file - init.init_process(self.data) + init.init_process(self.data, self.update_obsolete) # Order optimisation parameters (arbitrary order in input file) # Ensures consistency and makes output comparisons more straightforward @@ -494,124 +495,6 @@ def append_input(self): mfile_file.write("***********************************************") mfile_file.writelines(input_lines) - def validate_input(self, replace_obsolete: bool = False): - """Checks the input IN.DAT file for any obsolete variables in the OBS_VARS dict - contained within obsolete_variables.py. - If obsolete variables are found, and if `replace_obsolete` is set to True, - they are either removed or replaced by their updated names as specified - in the OBS_VARS dictionary. - - Raises - ------ - ValueError - If obsolete variables are present in the input file. - """ - obsolete_variables = ov.OBS_VARS - obsolete_vars_help_message = ov.OBS_VARS_HELP - - filename = self.input_file - variables_in_in_dat = [] - modified_lines = [] - changes_made = [] # To store details of the changes - - with open(filename) as file: - for line in file: - # Skip comment lines or lines without an assignment - if line.startswith("*") or "=" not in line: - modified_lines.append(line) - continue - - # Extract the variable name before the separator - raw_variable_name = line.split("=", 1)[0].strip() - # handle cases where the variable name might have parentheses - variable_name = ( - raw_variable_name.split("(", 1)[0] - if "(" in raw_variable_name - else raw_variable_name - ) - - # Check if the variable is obsolete and needs replacing - if variable_name in obsolete_variables: - replacement = obsolete_variables.get(variable_name) - if replace_obsolete: - # Prepare replacement or removal - if replacement is None: - # If no replacement is defined, comment out the line - modified_lines.append(f"* Obsolete: {line}") - changes_made.append( - f"Commented out obsolete variable: {variable_name}" - ) - else: - if isinstance(replacement, list): - # Raise an error if replacement is a list - replacement_str = ", ".join(replacement) - raise ValueError( - f"The variable '{variable_name}' is obsolete and " - "should be replaced by the following variables: " - f"{replacement_str}. " - "Please set their values accordingly." - ) - # Replace obsolete variable - modified_line = line.replace(variable_name, replacement, 1) - modified_lines.append( - f"* Replaced '{variable_name}' with " - f"'{replacement}'\n{modified_line}" - ) - changes_made.append( - f"Replaced '{variable_name}' with '{replacement}'" - ) - variables_in_in_dat.append(variable_name) - else: - # If replacement is False, add the line as-is - modified_lines.append(line) - variables_in_in_dat.append(variable_name) - else: - modified_lines.append(line) - - obs_vars_in_in_dat = [ - var for var in variables_in_in_dat if var in obsolete_variables - ] - - if obs_vars_in_in_dat: - if replace_obsolete: - # If replace_obsolete is True, write the modified content to the file - with open(filename, "w") as file: - file.writelines(modified_lines) - print( - "The IN.DAT file has been updated to replace or " - "comment out obsolete variables." - ) - print("Summary of changes made:") - for change in changes_made: - print(f" - {change}") - else: - # Only print the report if replace_obsolete is False - message = ( - "The IN.DAT file contains obsolete variables " - "from the OBS_VARS dictionary. " - "The obsolete variables in your IN.DAT file are: " - f"{obs_vars_in_in_dat}. " - "Either remove these or replace them with " - "their updated variable names. " - ) - for obs_var in obs_vars_in_in_dat: - replacement = obsolete_variables.get(obs_var) - if replacement is None: - message += ( - f"\n\n{obs_var} is an obsolete variable " - "and needs to be removed." - ) - else: - message += ( - f"\n\n{obs_var} is an obsolete variable " - f"and needs to be replaced by {replacement}." - ) - message += f" {obsolete_vars_help_message.get(obs_var, '')}" - raise ValueError(message) - - else: - print("The IN.DAT file does not contain any obsolete variables.") - def validate_user_model(self): """Checks that a user-created model has been injected correctly From 46bedb1b232d89b9e44ac6bcaecb3770602efc63 Mon Sep 17 00:00:00 2001 From: Clair Mould <86794332+clmould@users.noreply.github.com> Date: Wed, 12 Aug 2026 18:26:26 +0100 Subject: [PATCH 2/8] Remove unnecessary init_module_vars() from main.py --- process/main.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/process/main.py b/process/main.py index d5066a561c..fa5fcbf820 100644 --- a/process/main.py +++ b/process/main.py @@ -335,7 +335,7 @@ def __init__( ipdb.set_trace() self.update_obsolete = update_obsolete - self.init_module_vars() + logging_model_handler.clear_logs() self.set_filenames(filepath_out) self.initialise() # in here does init_process self.models = Models(self.data) @@ -351,15 +351,6 @@ def run(self): self.finish() self.append_input() - @staticmethod - def init_module_vars(): - """Initialise all module variables in the Fortran. - - This "resets" all module variables to their initialised values, so each - new run doesn't have any side-effects from previous runs. - """ - logging_model_handler.clear_logs() - def set_filenames(self, filepath_out): """Validate the input filename and create other filenames from it.""" filepath = Path(filepath_out or self.input_file) From 6536f6e586a277d8eb8054ebba5ee48a853517a7 Mon Sep 17 00:00:00 2001 From: Clair Mould <86794332+clmould@users.noreply.github.com> Date: Thu, 13 Aug 2026 16:30:34 +0100 Subject: [PATCH 3/8] comment out ipdb --- process/core/init.py | 12 ++++++++---- process/core/io/in_dat/base.py | 4 ++-- process/main.py | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/process/core/init.py b/process/core/init.py index 46f9c076c2..bb0336c76c 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -62,19 +62,23 @@ def init_process(data: DataStructure, update_obsolete: bool = False): iteration_variables.initialise_iteration_variables(data) # Creating and open the files MFile and OUTFile process_output.OutputFileManager.open_files(data.globals.output_prefix) - import ipdb + # import ipdb - ipdb.set_trace() + # ipdb.set_trace() # TODO use InDat(filename) instead here? # Use InDat class to read in IN.DAT, update obsolete and # parse input file filename = data.globals.output_prefix + "IN.DAT" # Check for and, if requested, update obsolete variables - InDat(filename=filename, update_obsolete=update_obsolete) + in_dat = InDat(filename=filename, update_obsolete=update_obsolete) # Input any desired new initial values - inputs = parse_input_file(data) + # if comment this out, everything has its default value from data_structure files + # so need InDat to + inputs = parse_input_file(data) # want to absorb into InDat() + import ipdb + ipdb.set_trace() # Set active constraints set_active_constraints(data) diff --git a/process/core/io/in_dat/base.py b/process/core/io/in_dat/base.py index bc9b7951bf..775bdebced 100644 --- a/process/core/io/in_dat/base.py +++ b/process/core/io/in_dat/base.py @@ -1047,9 +1047,9 @@ def __init__(self, filename="IN.DAT", start_line=0, update_obsolete: bool = Fals self.filename = filename self.start_line = start_line self.update_obsolete = update_obsolete - import ipdb + # import ipdb - ipdb.set_trace() + # ipdb.set_trace() # Update obsolete variables if requested if self.update_obsolete: self.update_obsolete_variables() diff --git a/process/main.py b/process/main.py index fa5fcbf820..24d027ec2d 100644 --- a/process/main.py +++ b/process/main.py @@ -331,9 +331,9 @@ def __init__( """ self.input_file = Path(input_file) self.data = data_structure or DataStructure() - import ipdb + # import ipdb - ipdb.set_trace() + # ipdb.set_trace() self.update_obsolete = update_obsolete logging_model_handler.clear_logs() self.set_filenames(filepath_out) From efc37d45826197969c292d73411260d4139a409e Mon Sep 17 00:00:00 2001 From: Clair Mould <86794332+clmould@users.noreply.github.com> Date: Thu, 13 Aug 2026 16:31:04 +0100 Subject: [PATCH 4/8] rename to check_obsolete_variables, and make sure it runs at correct time --- process/core/io/in_dat/base.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/process/core/io/in_dat/base.py b/process/core/io/in_dat/base.py index 775bdebced..3796ccbb22 100644 --- a/process/core/io/in_dat/base.py +++ b/process/core/io/in_dat/base.py @@ -1051,8 +1051,7 @@ def __init__(self, filename="IN.DAT", start_line=0, update_obsolete: bool = Fals # ipdb.set_trace() # Update obsolete variables if requested - if self.update_obsolete: - self.update_obsolete_variables() + self.check_obsolete_variables() # Initialise parameters self.in_dat_lines = [] @@ -1644,7 +1643,7 @@ def write_in_dat(self, output_filename="new_IN.DAT"): # Write parameters write_parameters(self.data, output) - def update_obsolete_variables(self): + def check_obsolete_variables(self): """Checks the input IN.DAT file for any obsolete variables in the OBS_VARS dict contained within obsolete_variables.py. If obsolete variables are found, and if `update_obsolete` is set to True, From 1440963b7fbd0c73134cb64eac76366ce241004a Mon Sep 17 00:00:00 2001 From: Clair Mould <86794332+clmould@users.noreply.github.com> Date: Thu, 13 Aug 2026 17:19:47 +0100 Subject: [PATCH 5/8] comment --- process/core/init.py | 4 ++-- process/core/io/in_dat/base.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/process/core/init.py b/process/core/init.py index bb0336c76c..6fb192a3ec 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -76,9 +76,9 @@ def init_process(data: DataStructure, update_obsolete: bool = False): # if comment this out, everything has its default value from data_structure files # so need InDat to inputs = parse_input_file(data) # want to absorb into InDat() - import ipdb + # import ipdb - ipdb.set_trace() + # ipdb.set_trace() # Set active constraints set_active_constraints(data) diff --git a/process/core/io/in_dat/base.py b/process/core/io/in_dat/base.py index 3796ccbb22..b10fff7888 100644 --- a/process/core/io/in_dat/base.py +++ b/process/core/io/in_dat/base.py @@ -1050,7 +1050,7 @@ def __init__(self, filename="IN.DAT", start_line=0, update_obsolete: bool = Fals # import ipdb # ipdb.set_trace() - # Update obsolete variables if requested + # Check for obsolete variables and update if requested self.check_obsolete_variables() # Initialise parameters From 38d99af24886832262f613d99883d9b55d73d04e Mon Sep 17 00:00:00 2001 From: Clair Mould <86794332+clmould@users.noreply.github.com> Date: Tue, 18 Aug 2026 13:05:43 +0100 Subject: [PATCH 6/8] remove unused inputs arg from check_process --- process/core/init.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/process/core/init.py b/process/core/init.py index 6fb192a3ec..619a0c9a03 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -14,7 +14,6 @@ from process.core import constants, process_output from process.core.exceptions import ProcessValidationError from process.core.input import parse_input_file -from process.core.io.in_dat.base import InDat from process.core.solver import iteration_variables from process.core.solver.constraints import ConstraintManager from process.data_structure.blanket_variables import BlktModelTypes @@ -68,14 +67,14 @@ def init_process(data: DataStructure, update_obsolete: bool = False): # TODO use InDat(filename) instead here? # Use InDat class to read in IN.DAT, update obsolete and # parse input file - filename = data.globals.output_prefix + "IN.DAT" + # filename = data.globals.output_prefix + "IN.DAT" # Check for and, if requested, update obsolete variables - in_dat = InDat(filename=filename, update_obsolete=update_obsolete) + # in_dat = InDat(filename=filename, update_obsolete=update_obsolete) # Input any desired new initial values # if comment this out, everything has its default value from data_structure files # so need InDat to - inputs = parse_input_file(data) # want to absorb into InDat() + parse_input_file(data) # want to absorb into InDat() # import ipdb # ipdb.set_trace() @@ -89,7 +88,7 @@ def init_process(data: DataStructure, update_obsolete: bool = False): st_init(data) # Check input data for errors/ambiguities - check_process(inputs, data) + check_process(data) run_summary(data) @@ -261,7 +260,7 @@ def run_summary(data: DataStructure): ) -def check_process(inputs, data): # noqa: ARG001 +def check_process(data): """Routine to reset specific variables if certain options are being used From 3ce23d6594f1b48c72bfb7eb88344c2cdea051b9 Mon Sep 17 00:00:00 2001 From: Clair Mould <86794332+clmould@users.noreply.github.com> Date: Wed, 19 Aug 2026 17:58:16 +0100 Subject: [PATCH 7/8] update obsolete for ref_IN.DAT --- tests/integration/data/ref_IN.DAT | 74 ++++++++++++++++--------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/tests/integration/data/ref_IN.DAT b/tests/integration/data/ref_IN.DAT index 0255d192ed..7379e383d9 100644 --- a/tests/integration/data/ref_IN.DAT +++ b/tests/integration/data/ref_IN.DAT @@ -97,23 +97,24 @@ dr_shld_outboard = 0.80 * Outboard shield thickness (m) dz_shld_upper = 0.30 * Upper/lower shield thickness (m); dr_tf_inboard = 1.05 * Inboard tf coil thickness; (centrepost for st) (m) dr_tf_shld_gap = 0.05 * manufacturing/thermal expansion gap between TF and thermal shield (m) -vgap2 = 0.05 * Vertical gap between vacuum vessel and tf coil (m) +* Replaced 'vgap2' with 'dz_shld_vv_gap' +dz_shld_vv_gap = 0.05 * Vertical gap between vacuum vessel and tf coil (m) dr_shld_blkt_gap = 0.02 * gap between vacuum vessel and blanket (m) *---------------Constraint Variables---------------* -fbeta_max = 0.4815 * F-value for beta limit +* Obsolete: fbeta_max = 0.4815 * F-value for beta limit f_nd_plasma_electron_limit_max = 1.2 * F-value for density limit -fp_fusion_total_max_mw = 1 * F-value for maximum fusion power +* Obsolete: fp_fusion_total_max_mw = 1 * F-value for maximum fusion power fjohc = 0.25 * F-value for central solenoid current at end-of-flattop fjohc0 = 0.25 * F-value for central solenoid current at beginning of pulse -fjprot = 1.0 * F-value for tf coil winding pack current density -fl_h_threshold = 1.271 * F-value for l-h power threshold -fp_hcd_injected_max = 1.0 * F-value for injection power -fp_plant_electric_net_required_mw = 1.0 * F-value for net electric power -ft_burn_min = 1.00e+00 * F-value for minimum burn time -fvdump = 0.6116 * F-value for dump voltage -fpflux_fw_neutron_max_mw = 0.1312 * F-value for maximum wall load +* Obsolete: fjprot = 1.0 * F-value for tf coil winding pack current density +* Obsolete: fl_h_threshold = 1.271 * F-value for l-h power threshold +* Obsolete: fp_hcd_injected_max = 1.0 * F-value for injection power +* Obsolete: fp_plant_electric_net_required_mw = 1.0 * F-value for net electric power +* Obsolete: ft_burn_min = 1.00e+00 * F-value for minimum burn time +* Obsolete: fvdump = 0.6116 * F-value for dump voltage +* Obsolete: fpflux_fw_neutron_max_mw = 0.1312 * F-value for maximum wall load p_plant_electric_net_required_mw = 500.0 * Required net electric power (mw) t_burn_min = 7.2e3 * Minimum burn time (s) pflux_fw_neutron_max_mw = 8.0 * Allowable wall-load (mw/m2) @@ -152,12 +153,12 @@ p_hcd_primary_extra_heat_mw = 50.0 *----------------Divertor Variables----------------* -divdum = 1 * Switch for divertor n_charge_plasma_effective_vol_avg model; 0=calc; 1=input +* Obsolete: divdum = 1 * Switch for divertor n_charge_plasma_effective_vol_avg model; 0=calc; 1=input dz_divertor = 0.621 * Divertor structure vertical thickness (m) pflux_div_heat_load_max_mw = 10 * Heat load limit (mw/m2) -ksic = 1.4 * Power fraction for outboard double-null scrape-off plasma +* Obsolete: ksic = 1.4 * Power fraction for outboard double-null scrape-off plasma prn1 = 0.4 * N-scrape-off / n-average plasma; -zeffdiv = 3.5 * Zeff in the divertor region (if divdum /= 0) +* Obsolete: zeffdiv = 3.5 * Zeff in the divertor region (if divdum /= 0) *------------------Fwbs Variables------------------* @@ -202,14 +203,14 @@ epsvmc = 1.0e-8 * Error tolerance for vmcon *-----------------Pfcoil Variables-----------------* j_cs_flat_top_end = 13540000.0 * Central solenoid overall current density at end of flat-top (a/m2) -c_pf_coil_turn_peak_input = 4.22d4, 4.22d4, 4.22d4, 4.22d4, 4.3d4, 4.3d4, 4.3d4, 4.3d4, * Peak current per turn input for pf coil i (a) +c_pf_coil_turn_peak_input = 4.22d4, 4.22d4, 4.22d4, 4.22d4, 4.3d4, 4.3d4, 4.3d4, 4.3d4 * Peak current per turn input for pf coil i (a) f_j_cs_start_pulse_end_flat_top = 0.9362 * Ratio of central solenoid overall current density at i_pf_location = 2,2,3,3 * Switch for locating scheme of pf coil group i; i_pf_superconductor = 3 * Switch for superconductor material in pf coils; -n_pf_coils_in_group = 1,1,2,2, * Number of pf coils in group j +n_pf_coils_in_group = 1,1,2,2 * Number of pf coils in group j n_pf_coil_groups = 4 * Number of groups of pf coils; f_z_cs_tf_internal = 0.9 * Central solenoid height / tf coil internal height -j_pf_coil_wp_peak = 1.1d7, 1.1d7, 6.d6, 6.d6, 8.d6, 8.0d6, 8.0d6, 8.0d6, * Average winding pack current density of pf coil i (a/m2) +j_pf_coil_wp_peak = 1.1d7, 1.1d7, 6.d6, 6.d6, 8.d6, 8.0d6, 8.0d6, 8.0d6 * Average winding pack current density of pf coil i (a/m2) rpf2 = -1.825 * Offset (m) of radial position of i_pf_location=2 pf coils zref(1) = 3.6 @@ -242,7 +243,7 @@ i_beta_component = 1 * Switch for beta limit scaling (constraint equation 24); i_plasma_current = 4 * Switch for plasma current scaling to use; i_density_limit = 7 * Switch for density limit to enforce (constraint equation 5); i_beta_fast_alpha = 1 * Switch for fast alpha pressure calculation; -ifispact = 0 * Switch for neutronics calculations; +* Obsolete: ifispact = 0 * Switch for neutronics calculations; i_plasma_pedestal = 1 * Switch for pedestal profiles; f_nd_plasma_pedestal_greenwald = 0.85 * fraction of Greenwald density to set as pedestal-top density nd_plasma_pedestal_electron = 0.678e20 * Electron density of pedestal (/m3) (i_plasma_pedestal=1) INITIAL VALUE @@ -275,7 +276,7 @@ t_plant_pulse_coil_precharge = 500.0 *-----------------Tfcoil Variables-----------------* -fb_tf_inboard_max = 1.0 +* Obsolete: fb_tf_inboard_max = 1.0 b_tf_inboard_max = 11.2 dr_tf_plasma_case = 0.06 * Inboard tf coil case inner \(plasma side) thickness (m) dx_tf_side_case_min = 0.05 * Inboard tf coil sidewall case thickness (m) @@ -283,7 +284,8 @@ c_tf_turn = 6.5e+04 * Tf coil current per turn (a); ripple_b_tf_plasma_edge_max = 0.6 * Maximum allowable toroidal field ripple amplitude t_tf_superconductor_quench = 30.0 * Dump time for tf coil (s) n_tf_coils = 16 * Number of tf coils (default = 50 for stellarators) -alstrtf = 5.8E8 * allowable stress in TF coil (Pa) +sig_tf_case_max = 5.8E8 * allowable stress in TF coil (Pa) +sig_tf_wp_max = 5.8E8 dia_tf_turn_coolant_channel = 0.010 * diameter of He coil in TF winding (m) tftmp = 4.750 * Peak helium coolant temperature in tf coils and pf coils (k) dx_tf_turn_insulation = 2.0d-3 * Conduit insulation thickness (m) @@ -312,40 +314,42 @@ t_plant_pulse_burn = 1.0d4 * Burn time (s) (calculated if i_pulsed_plant=1) b_plasma_toroidal_on_axis = 5.3292E+00 rmajor = 8.8901E+00 temp_plasma_electron_vol_avg_keV = 1.2330E+01 - beta = 3.1421E-02 +* Replaced 'beta' with 'beta_total_vol_avg' + beta_total_vol_avg = 3.1421E-02 nd_plasma_electrons_vol_avg = 7.4321E+19 f_nd_plasma_electron_limit_max = 1.2000E+00 - oacdcp = 8.6739E+06 +* Replaced 'oacdcp' with 'j_tf_coil_full_area' + j_tf_coil_full_area = 8.6739E+06 dr_tf_inboard = 1.2080E+00 - fpflux_fw_neutron_max_mw = 1.3100E-01 +* Obsolete: fpflux_fw_neutron_max_mw = 1.3100E-01 dr_cs = 5.5242E-01 q95 = 3.5000E+00 dr_bore = 2.3322E+00 - fbeta_max = 4.8251E-01 +* Obsolete: fbeta_max = 4.8251E-01 j_cs_flat_top_end = 2.0726E+07 fjohc = 5.7941E-01 fjohc0 = 5.3923E-01 f_j_cs_start_pulse_end_flat_top = 9.3176E-01 dr_cs_tf_gap = 5.0000E-02 f_c_plasma_non_inductive = 3.9566E-01 - fstrcase = 1.0000E+00 - fstrcond = 9.2007E-01 +* Obsolete: fstrcase = 1.0000E+00 +* Obsolete: fstrcond = 9.2007E-01 f_j_tf_wp_critical_max = 6.3437E-01 - fvdump = 1.0000E+00 +* Obsolete: fvdump = 1.0000E+00 v_tf_coil_dump_quench_max_kv = 1.0000E+01 - fjprot = 1.0000E+00 +* Obsolete: fjprot = 1.0000E+00 t_tf_superconductor_quench = 2.5829E+01 dr_tf_nose_case = 5.2465E-01 dx_tf_turn_steel = 8.0000E-03 dr_shld_vv_gap_inboard = 2.0000E-02 - fl_h_threshold = 1.4972E+00 - fpsepbqar = 1.0000E+00 - ftaucq = 9.1874E-01 +* Obsolete: fl_h_threshold = 1.4972E+00 +* Obsolete: fpsepbqar = 1.0000E+00 c_tf_turn = 6.5000E+04 f_a_tf_turn_cable_copper = 8.0884E-01 - ftmargtf = 1.0000E+00 - ftmargoh = 1.0000E+00 +* Obsolete: ftmargtf = 1.0000E+00 +* Obsolete: ftmargoh = 1.0000E+00 f_a_cs_turn_steel = 5.7875E-01 - foh_stress = 1.0000E+00 - f_nd_alpha_electron = 6.8940E-02 - falpha_energy_confinement = 1.0000E+00 \ No newline at end of file +* Obsolete: foh_stress = 1.0000E+00 +* Replaced 'f_nd_alpha_electron' with 'f_nd_alpha_thermal_electron' + f_nd_alpha_thermal_electron = 6.8940E-02 +* Obsolete: falpha_energy_confinement = 1.0000E+00 \ No newline at end of file From 0b82c25f4e717c707dd478bb1edba5af37e74e10 Mon Sep 17 00:00:00 2001 From: Clair Mould <86794332+clmould@users.noreply.github.com> Date: Thu, 20 Aug 2026 14:13:06 +0100 Subject: [PATCH 8/8] remove ref_IN.DAT as it is too outdated and use large tokamak instead in test need to call InDat in init_process in order to update obs vars --- process/core/init.py | 10 +- tests/integration/data/ref_IN.DAT | 355 --------------------- tests/integration/test_write_new_in_dat.py | 2 +- 3 files changed, 8 insertions(+), 359 deletions(-) delete mode 100644 tests/integration/data/ref_IN.DAT diff --git a/process/core/init.py b/process/core/init.py index 619a0c9a03..36a9fcf877 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -14,6 +14,7 @@ from process.core import constants, process_output from process.core.exceptions import ProcessValidationError from process.core.input import parse_input_file +from process.core.io.in_dat.base import InDat from process.core.solver import iteration_variables from process.core.solver.constraints import ConstraintManager from process.data_structure.blanket_variables import BlktModelTypes @@ -67,9 +68,12 @@ def init_process(data: DataStructure, update_obsolete: bool = False): # TODO use InDat(filename) instead here? # Use InDat class to read in IN.DAT, update obsolete and # parse input file - # filename = data.globals.output_prefix + "IN.DAT" - # Check for and, if requested, update obsolete variables - # in_dat = InDat(filename=filename, update_obsolete=update_obsolete) + filename = data.globals.output_prefix + "IN.DAT" + # filename = Path.cwd() / str(data.globals.output_prefix + "IN.DAT") + # ^ trying this to help tests pass... no luck tho so far + + # Read in the file using the InDat class + InDat(filename=filename, update_obsolete=update_obsolete) # Input any desired new initial values # if comment this out, everything has its default value from data_structure files diff --git a/tests/integration/data/ref_IN.DAT b/tests/integration/data/ref_IN.DAT deleted file mode 100644 index 7379e383d9..0000000000 --- a/tests/integration/data/ref_IN.DAT +++ /dev/null @@ -1,355 +0,0 @@ -*---------------Constraint Equations---------------* - -icc = 1 * Beta -icc = 2 * Global power balance -icc = 5 * Density upper limit -icc = 8 * Neutron wall load upper limit -icc = 11 * Radial build -icc = 13 * Burn time lower limit -icc = 15 * L -icc = 16 * Net electric power lower limit -icc = 24 * Beta upper limit -icc = 26 * Central solenoid EOF current density upper limit -icc = 27 * Central solenoid BOP current density upper limit -icc = 30 * Injection power upper limit -icc = 31 * TF coil case stress upper limit -icc = 32 * TF coil conduit stress upper limit -icc = 33 * I_op/I_Crit -icc = 34 * Dump voltage upper limit -icc = 35 * J_winding pack -icc = 36 * TF temp marg -icc = 68 * Pseparatrix Bt / q A R -icc = 65 * dumpt time by VV stresses -icc = 60 * OH coil temp margin -icc = 72 * OH stress limit -icc = 25 * Max TF field -icc = 62 * f_alpha_energy_confinement_min - -*---------------Iteration Variables----------------* - -ixc= 2 * b_plasma_toroidal_on_axis -boundu(2) = 20.0 -ixc = 3 * rmajor -boundu(3) = 13 -ixc = 4 * temp_plasma_electron_vol_avg_keV -boundu(4) = 150.0 -ixc = 5 * beta -ixc = 6 * nd_plasma_electrons_vol_avg -ixc = 13 * dr_tf_inboard -boundl(13) = 1.4 -ixc = 16 * dr_cs -boundl(16) = 0.5 -ixc = 18 * q -boundl(18) = 3.5 -ixc = 29 * dr_bore -boundl(29) = 0.1 -ixc = 37 * j_cs_flat_top_end -ixc = 41 * f_j_cs_start_pulse_end_flat_top -ixc = 42 * dr_cs_tf_gap -boundl(42) = 0.05 -boundu(42) = 0.1 -ixc = 44 * f_c_plasma_non_inductive -ixc = 56 * t_tf_superconductor_quench -ixc = 57 * dr_tf_nose_case -ixc = 58 * dx_tf_turn_steel -boundl(58) = 8.0d-3 -ixc = 61 * dr_shld_vv_gap_inboard -boundl(61) = 0.02 - -ixc = 60 * c_tf_turn -boundl(60) = 6.0e4 -boundu(60) = 9.0e4 - -*icc = 77 * Max c_tf_turn -*ixc = 145 * fc_tf_turn_max -*c_tf_turn_max = 9.0e4 - -ixc = 59 * copper fraction of cable conductor (TF coils) -boundl(59) = 0.50 -boundu(59) = 0.94 -ixc = 122 * f_a_cs_turn_steel -ixc = 109 * f_nd_alpha_electron - -*isweep = 3 -*nsweep = 17 -*sweep = 11.8, 12.5, 13.36 - - -*-----------------Build Variables------------------* - -dr_blkt_inboard = 0.755 * Inboard blanket thickness (m); -dr_blkt_outboard = 0.982 * Outboard blanket thickness (m) -dr_bore = 2.483 * Central solenoid inboard radius (m) -dr_cryostat = 0.15 * Cryostat thickness (m) -dr_vv_inboard = 0.30 * Inboard vacuum vessel thickness (tf coil / shield) (m) -dr_vv_outboard = 0.30 * Outboard vacuum vessel thickness (tf coil / shield) (m) -dz_vv_upper = 0.30 * Topside vacuum vessel thickness (tf coil / shield) (m) -dz_vv_lower = 0.30 * Underside vacuum vessel thickness (tf coil / shield) (m) -dr_shld_vv_gap_inboard = 0.12 * Gap between inboard vacuum vessel and tf coil (m) -dr_cs_tf_gap = 0.05 * Gap between central solenoid and tf coil (m) -gapomin = 0.20 * Minimum gap between outboard vacuum vessel and tf coil (m) -iohcl = 1 * Switch for existence of central solenoid; -dr_cs = 0.8181 * Central solenoid thickness (m) -dr_fw_plasma_gap_inboard = 0.225 * Gap between plasma and first wall; inboard side (m) -dr_fw_plasma_gap_outboard = 0.225 * Gap between plasma and first wall; outboard side (m) -dr_shld_inboard = 0.30 * Inboard shield thickness (m) -dr_shld_outboard = 0.80 * Outboard shield thickness (m) -dz_shld_upper = 0.30 * Upper/lower shield thickness (m); -dr_tf_inboard = 1.05 * Inboard tf coil thickness; (centrepost for st) (m) -dr_tf_shld_gap = 0.05 * manufacturing/thermal expansion gap between TF and thermal shield (m) -* Replaced 'vgap2' with 'dz_shld_vv_gap' -dz_shld_vv_gap = 0.05 * Vertical gap between vacuum vessel and tf coil (m) -dr_shld_blkt_gap = 0.02 * gap between vacuum vessel and blanket (m) - -*---------------Constraint Variables---------------* - -* Obsolete: fbeta_max = 0.4815 * F-value for beta limit -f_nd_plasma_electron_limit_max = 1.2 * F-value for density limit -* Obsolete: fp_fusion_total_max_mw = 1 * F-value for maximum fusion power -fjohc = 0.25 * F-value for central solenoid current at end-of-flattop -fjohc0 = 0.25 * F-value for central solenoid current at beginning of pulse -* Obsolete: fjprot = 1.0 * F-value for tf coil winding pack current density -* Obsolete: fl_h_threshold = 1.271 * F-value for l-h power threshold -* Obsolete: fp_hcd_injected_max = 1.0 * F-value for injection power -* Obsolete: fp_plant_electric_net_required_mw = 1.0 * F-value for net electric power -* Obsolete: ft_burn_min = 1.00e+00 * F-value for minimum burn time -* Obsolete: fvdump = 0.6116 * F-value for dump voltage -* Obsolete: fpflux_fw_neutron_max_mw = 0.1312 * F-value for maximum wall load -p_plant_electric_net_required_mw = 500.0 * Required net electric power (mw) -t_burn_min = 7.2e3 * Minimum burn time (s) -pflux_fw_neutron_max_mw = 8.0 * Allowable wall-load (mw/m2) -p_div_bt_q_aspect_rmajor_max_mw = 9.2 * maximum ratio of Psep*Bt/qAR (MWT/m) - -*------------------Cost Variables------------------* - -output_costs = 0 -i_cost_model = 0 -abktflnc = 15 * Allowable first wall/blanket neutron -adivflnc = 20.0 * Allowable divertor heat fluence (mw-yr/m2) -f_t_plant_available = 0.75 * Total plant availability fraction; -dintrt = 0.00 * Diff between borrowing and saving interest rates -fcap0 = 1.15 * Average cost of money for construction of plant -fcap0cp = 1.06 * Average cost of money for replaceable components -fcontng = 0.15 * Project contingency factor -fcr0 = 0.065 * Fixed charge rate during construction -fkind = 1.0 * Multiplier for nth of a kind costs -i_plant_availability = 0 * Switch for plant availability model; -ifueltyp = 1 * Switch; -lsa = 2 * Level of safety assurance switch (generally; use 3 or 4); -discount_rate = 0.06 * Effective cost of money in constant dollars -life_plant = 40 * Plant life (years) -ucblvd = 280.0 * Unit cost for blanket vanadium ($/kg) -ucdiv = 5.0d5 * Cost of divertor blade ($) -ucme = 3.0d8 * Unit cost of maintenance equipment ($/w**0;3) - -*-------------Current Drive Variables--------------* - -f_c_plasma_bootstrap_max = 0.99 * Maximum fraction of plasma current from bootstrap; -i_hcd_primary = 10 * Switch for current drive efficiency model; -eta_cd_norm_ecrh = 0.30 * ECRH gamma_CD (user input) -eta_ecrh_injector_wall_plug = 0.4 * ECRH wall-plug efficiency -p_hcd_injected_max = 51.0 * Maximum allowable value for injected power (mw) -p_hcd_primary_extra_heat_mw = 50.0 - -*----------------Divertor Variables----------------* - -* Obsolete: divdum = 1 * Switch for divertor n_charge_plasma_effective_vol_avg model; 0=calc; 1=input -dz_divertor = 0.621 * Divertor structure vertical thickness (m) -pflux_div_heat_load_max_mw = 10 * Heat load limit (mw/m2) -* Obsolete: ksic = 1.4 * Power fraction for outboard double-null scrape-off plasma -prn1 = 0.4 * N-scrape-off / n-average plasma; -* Obsolete: zeffdiv = 3.5 * Zeff in the divertor region (if divdum /= 0) - -*------------------Fwbs Variables------------------* - -vfshld = 0.60 * Coolant void fraction in shield - -*-------------Heat Transport Variables-------------* - -ipowerflow = 0 * Switch for power flow model; HAS NO EFFECT? -i_p_coolant_pumping = 3 * Switch for pumping power for primary coolant -eta_coolant_pump_electric = 0.87 * electrical efficiency of FW and blanket coolant pumps -etaiso = 0.9 * isentropic efficiency of FW and blanket coolant pumps -i_thermal_electric_conversion = 2 * user input thermal-electric efficiency (eta_turbine) -i_shld_primary_heat = 1 * switch for shield thermal power destiny: = 1 contributes to energy generation cycle -eta_turbine = 0.375D0 * thermal to electric conversion efficiency - -*------------Impurity Radiation Module-------------* - -*imprad_model = 1 * Switch for impurity radiation model; -radius_plasma_core_norm = 0.75 * Normalised radius defining the 'core' region -f_p_plasma_core_rad_reduction = 0.6 * fraction of radiation from 'core' region that is subtracted from the loss pow -f_nd_impurity_electrons(1) = 1.0 -f_nd_impurity_electrons(2) = 0.1 -f_nd_impurity_electrons(3) = 0.0 -f_nd_impurity_electrons(4) = 0.0 -f_nd_impurity_electrons(5) = 0.0 -f_nd_impurity_electrons(6) = 0.0 -f_nd_impurity_electrons(7) = 0.0 -f_nd_impurity_electrons(8) = 0.0 -f_nd_impurity_electrons(9) = 0.0 -f_nd_impurity_electrons(10) = 0.0 -f_nd_impurity_electrons(11) = 0.0 -f_nd_impurity_electrons(12) = 0.0 -f_nd_impurity_electrons(13) = 0.00044 -f_nd_impurity_electrons(14) = 5e-05 - -*---------------------Numerics---------------------* - -i_process_run_mode = 1 * for optimisation VMCON only -i_figure_merit = 1 * Switch for figure-of-merit (see lablmm for descriptions) -epsvmc = 1.0e-8 * Error tolerance for vmcon - -*-----------------Pfcoil Variables-----------------* - -j_cs_flat_top_end = 13540000.0 * Central solenoid overall current density at end of flat-top (a/m2) -c_pf_coil_turn_peak_input = 4.22d4, 4.22d4, 4.22d4, 4.22d4, 4.3d4, 4.3d4, 4.3d4, 4.3d4 * Peak current per turn input for pf coil i (a) -f_j_cs_start_pulse_end_flat_top = 0.9362 * Ratio of central solenoid overall current density at -i_pf_location = 2,2,3,3 * Switch for locating scheme of pf coil group i; -i_pf_superconductor = 3 * Switch for superconductor material in pf coils; -n_pf_coils_in_group = 1,1,2,2 * Number of pf coils in group j -n_pf_coil_groups = 4 * Number of groups of pf coils; -f_z_cs_tf_internal = 0.9 * Central solenoid height / tf coil internal height -j_pf_coil_wp_peak = 1.1d7, 1.1d7, 6.d6, 6.d6, 8.d6, 8.0d6, 8.0d6, 8.0d6 * Average winding pack current density of pf coil i (a/m2) -rpf2 = -1.825 * Offset (m) of radial position of i_pf_location=2 pf coils - -zref(1) = 3.6 -zref(2) = 1.2 -zref(3) = 1.0 -zref(4) = 2.8 -zref(5) = 1.0 -zref(6) = 1.0 -zref(7) = 1.0 -zref(8) = 1.0 - -stress_cs_steel_max = 6.6D8 * allowable hoop stress in Central Solenoid structural material (Pa) -fcuohsu = 0.70 * copper fraction of strand in central solenoid cable -i_cs_superconductor = 5 * WST Nb3Sn parameterisation -f_a_cs_turn_steel = 0.8 - -*----------------Physics Variables-----------------* - -alphan = 1.00 * Density profile index -alphat = 1.45 * Temperature profile index -aspect = 3.1 * Aspect ratio (iteration variable 1) -nd_plasma_electrons_vol_avg = 7.983e+19 * Electron density (/m3) (iteration variable 6) -beta_norm_max = 3.0 * (troyon-like) coefficient for beta scaling; -fkzohm = 1.0245 * Zohm elongation scaling adjustment factor (i_plasma_geometry=2; 3) -f_c_plasma_non_inductive = 0.4434 * Fraction of the plasma current produced by -ejima_coeff = 0.3 * Ejima coefficient for resistive startup v-s formula -hfact = 1.1 * H factor on energy confinement times (iteration variable 10) -i_bootstrap_current = 4 * Switch for bootstrap current scaling; -i_beta_component = 1 * Switch for beta limit scaling (constraint equation 24); -i_plasma_current = 4 * Switch for plasma current scaling to use; -i_density_limit = 7 * Switch for density limit to enforce (constraint equation 5); -i_beta_fast_alpha = 1 * Switch for fast alpha pressure calculation; -* Obsolete: ifispact = 0 * Switch for neutronics calculations; -i_plasma_pedestal = 1 * Switch for pedestal profiles; -f_nd_plasma_pedestal_greenwald = 0.85 * fraction of Greenwald density to set as pedestal-top density -nd_plasma_pedestal_electron = 0.678e20 * Electron density of pedestal (/m3) (i_plasma_pedestal=1) INITIAL VALUE -nd_plasma_separatrix_electron = 0.2e20 * Electron density at separatrix (/m3) (i_plasma_pedestal=1) -radius_plasma_pedestal_density_norm = 0.94 * R/a of density pedestal (i_plasma_pedestal=1) -radius_plasma_pedestal_temp_norm = 0.94 * R/a of temperature pedestal (i_plasma_pedestal=1) -tbeta = 2.0 * Temperature profile index beta (i_plasma_pedestal=1) -temp_plasma_pedestal_kev = 5.5 * Electron temperature of pedestal (kev) (i_plasma_pedestal=1) -temp_plasma_separatrix_kev = 0.1 * Electron temperature at separatrix (kev) (i_plasma_pedestal=1) -i_confinement_time = 34 * Switch for energy confinement time scaling law -i_plasma_geometry = 0 * Switch for plasma cross-sectional shape calculation: use input kappa & triang -*kappa = 1.7808 -kappa = 1.848 -triang = 0.5 * Plasma separatrix triangularity (calculated if i_plasma_geometry=1; 3 or 4) -q95 = 3.247 * Safety factor 'near' plasma edge (iteration variable 18); -q0 = 1.0 * Safety factor on axis -rmajor = 9.072 * Plasma major radius (m) (iteration variable 3) -i_single_null = 1 * Switch for single null / double null plasma; -f_sync_reflect = 0.6 * Synchrotron wall reflectivity factor -temp_plasma_electron_vol_avg_keV = 13.07 * Volume averaged electron temperature (kev) -*zfear = 1 * High-z impurity switch; 0=iron; 1=argon -plasma_res_factor = 0.66 * plasma resistivity pre-factor - -*-----------------Pulse Variables------------------* - -i_pulsed_plant = 1 * Switch for reactor model; -t_plant_pulse_dwell = 0 * dwell time (s) -pulsetimings = 0 -t_plant_pulse_coil_precharge = 500.0 - -*-----------------Tfcoil Variables-----------------* - -* Obsolete: fb_tf_inboard_max = 1.0 -b_tf_inboard_max = 11.2 -dr_tf_plasma_case = 0.06 * Inboard tf coil case inner \(plasma side) thickness (m) -dx_tf_side_case_min = 0.05 * Inboard tf coil sidewall case thickness (m) -c_tf_turn = 6.5e+04 * Tf coil current per turn (a); -ripple_b_tf_plasma_edge_max = 0.6 * Maximum allowable toroidal field ripple amplitude -t_tf_superconductor_quench = 30.0 * Dump time for tf coil (s) -n_tf_coils = 16 * Number of tf coils (default = 50 for stellarators) -sig_tf_case_max = 5.8E8 * allowable stress in TF coil (Pa) -sig_tf_wp_max = 5.8E8 -dia_tf_turn_coolant_channel = 0.010 * diameter of He coil in TF winding (m) -tftmp = 4.750 * Peak helium coolant temperature in tf coils and pf coils (k) -dx_tf_turn_insulation = 2.0d-3 * Conduit insulation thickness (m) -dr_tf_nose_case = 0.495 * Inboard tf coil case outer (non-plasma side) thickness (m) -dx_tf_turn_steel = 0.008 * Tf coil conduit case thickness (m) -dx_tf_wp_insulation = 0.008 * Ground insulation thickness surrounding winding pack (m) -tmargmin = 1.500 * Minimum allowable temperature margin (cs and tf coils) (k) -v_tf_coil_dump_quench_max_kv = 10.00 * Max voltage across tf coil during quench (kv) -f_a_tf_turn_cable_space_extra_void = 0.300 * Coolant fraction of tfc 'cable' (i_tf_sup=1); or of tfc leg (i_tf_sup=0) -i_tf_sc_mat = 5 -*strncon = -0.0066 - -n_tf_wp_pancakes = 20 -n_tf_wp_layers = 10 -i_tf_turns_integer = 1 - -inuclear = 1 -* Nuclear heating of cryogenic components (MW) (qnuc/1.0D6) 1.292E-02 OP -qnuc = 1.292E4 - -*-----------------Times Variables------------------* - -t_plant_pulse_burn = 1.0d4 * Burn time (s) (calculated if i_pulsed_plant=1) - - - b_plasma_toroidal_on_axis = 5.3292E+00 - rmajor = 8.8901E+00 - temp_plasma_electron_vol_avg_keV = 1.2330E+01 -* Replaced 'beta' with 'beta_total_vol_avg' - beta_total_vol_avg = 3.1421E-02 - nd_plasma_electrons_vol_avg = 7.4321E+19 - f_nd_plasma_electron_limit_max = 1.2000E+00 -* Replaced 'oacdcp' with 'j_tf_coil_full_area' - j_tf_coil_full_area = 8.6739E+06 - dr_tf_inboard = 1.2080E+00 -* Obsolete: fpflux_fw_neutron_max_mw = 1.3100E-01 - dr_cs = 5.5242E-01 - q95 = 3.5000E+00 - dr_bore = 2.3322E+00 -* Obsolete: fbeta_max = 4.8251E-01 - j_cs_flat_top_end = 2.0726E+07 - fjohc = 5.7941E-01 - fjohc0 = 5.3923E-01 - f_j_cs_start_pulse_end_flat_top = 9.3176E-01 - dr_cs_tf_gap = 5.0000E-02 - f_c_plasma_non_inductive = 3.9566E-01 -* Obsolete: fstrcase = 1.0000E+00 -* Obsolete: fstrcond = 9.2007E-01 - f_j_tf_wp_critical_max = 6.3437E-01 -* Obsolete: fvdump = 1.0000E+00 - v_tf_coil_dump_quench_max_kv = 1.0000E+01 -* Obsolete: fjprot = 1.0000E+00 - t_tf_superconductor_quench = 2.5829E+01 - dr_tf_nose_case = 5.2465E-01 - dx_tf_turn_steel = 8.0000E-03 - dr_shld_vv_gap_inboard = 2.0000E-02 -* Obsolete: fl_h_threshold = 1.4972E+00 -* Obsolete: fpsepbqar = 1.0000E+00 - c_tf_turn = 6.5000E+04 - f_a_tf_turn_cable_copper = 8.0884E-01 -* Obsolete: ftmargtf = 1.0000E+00 -* Obsolete: ftmargoh = 1.0000E+00 - f_a_cs_turn_steel = 5.7875E-01 -* Obsolete: foh_stress = 1.0000E+00 -* Replaced 'f_nd_alpha_electron' with 'f_nd_alpha_thermal_electron' - f_nd_alpha_thermal_electron = 6.8940E-02 -* Obsolete: falpha_energy_confinement = 1.0000E+00 \ No newline at end of file diff --git a/tests/integration/test_write_new_in_dat.py b/tests/integration/test_write_new_in_dat.py index efd8992a62..7680a4ca67 100644 --- a/tests/integration/test_write_new_in_dat.py +++ b/tests/integration/test_write_new_in_dat.py @@ -16,7 +16,7 @@ def test_write_new_in_dat(temp_data, mfile_name, cli_runner): :type mfile_name: str """ mfile_path = temp_data / mfile_name - in_dat_path = temp_data / "ref_IN.DAT" + in_dat_path = temp_data / "large_tokamak_IN.DAT" new_in_dat_path = temp_data / "new_IN.DAT" # Get final value of te and f_nd_impurity_electrons(13) optimisation parameters mfile = MFile(mfile_path)