From d0a9fa97ee5754d979656d724ffed1dae6da9138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Delaporte-Mathurin?= <40028739+RemDelaporteMathurin@users.noreply.github.com> Date: Fri, 1 Nov 2024 08:03:24 -0400 Subject: [PATCH 01/62] updated install instructions --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d19ea5..40bd530 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,14 @@ Hydrogen Inventory Simulations for PFCs (HISP) is a series of code that uses FES ## How to Run: -First, run this in the terminal to create a new environment with the right dependencies: +Clone the repository: + +``` +git clone https://github.com/kaelyndunnell/hisp +cd hisp +``` + +Run this command to create a new environment with the right dependencies (eg. dolfinx): ``` conda env create -f environment.yml ``` @@ -13,3 +20,14 @@ Then, activate the environment: conda activate hisp-env ``` + +Install the `hisp` package with: + +``` +python -m pip install -e . +``` + +This will also install the pip dependencies like `h-transport-materials` and `FESTIM`. + +> **_NOTE:_** Using `-e` with pip will install the package in editable mode, meaning the source code can be modified without having to reinstall the package. + From 22d315c371c113f8d008762ba96ba13e5e7811e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Delaporte-Mathurin?= <40028739+RemDelaporteMathurin@users.noreply.github.com> Date: Fri, 1 Nov 2024 08:06:06 -0400 Subject: [PATCH 02/62] badge + how to run tests --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 40bd530..b1cd92b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ +[![CI](https://github.com/kaelyndunnell/hisp/actions/workflows/ci.yml/badge.svg)](https://github.com/kaelyndunnell/hisp/actions/workflows/ci.yml) # HISP + Hydrogen Inventory Simulations for PFCs (HISP) is a series of code that uses FESTIM to simulate deuterium and tritium inventories in a fusion tokamak first wall and divertor PFCs. ## How to Run: @@ -31,3 +33,12 @@ This will also install the pip dependencies like `h-transport-materials` and `FE > **_NOTE:_** Using `-e` with pip will install the package in editable mode, meaning the source code can be modified without having to reinstall the package. +## Run the tests + +After cloning the repo and installing hisp, run: + +``` +python -m pytest test +``` + +> **_NOTE:_** Make sure to install the test dependencies with `python -m pip install -e .[test]` From d5c2a106a5b108d7d9f0dafc1a74556b765668a0 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 15:33:56 -0400 Subject: [PATCH 03/62] refactor if statements --- mb_scenario.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 700195a..16bf5b7 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -222,12 +222,17 @@ def RISP_data(monob, time): t = int(time) if div: - if t in list(range(1,10)): data = np.loadtxt(label+"_data/time0.dat", skiprows=1) - elif t in list(range(11,99)): data = np.loadtxt(label+"_data/time10.dat", skiprows=1) - elif t in list(range(100,261)): data = np.loadtxt(label+"_data/time"+str(t)+".dat", skiprows=1) - elif t in list(range(261,270)): data = np.loadtxt(label+"_data/time270.dat", skiprows=1) - else: data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) - else: + if 1 <= t <= 9: + data = np.loadtxt(f"{label}_data/time0.dat", skiprows=1) + elif 10 <= t <= 98: + data = np.loadtxt(f"{label}_data/time10.dat", skiprows=1) + elif 100 <= t <= 260: + data = np.loadtxt(f"{label}_data/time{t}.dat", skiprows=1) + elif 261 <= t <= 269: + data = np.loadtxt(f"{label}_data/time270.dat", skiprows=1) + else: + data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) + else: data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) return data[monob-offset_mb,:] From f9fee540de8a496547281b6ef0569c9a44eb45f6 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 15:39:58 -0400 Subject: [PATCH 04/62] use as_fenics_constant --- src/hisp/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hisp/helpers.py b/src/hisp/helpers.py index 43b18b2..f4923ed 100644 --- a/src/hisp/helpers.py +++ b/src/hisp/helpers.py @@ -26,7 +26,7 @@ def time_dependent(self): return True def create_value_fenics(self, mesh, temperature, t: Constant): - self.flux_fenics = Constant(mesh, float(self.flux(t))) + self.flux_fenics = F.as_fenics_constant(float(self.flux(t)), mesh) x = ufl.SpatialCoordinate(mesh) self.distribution_fenics = self.distribution(x) From 7c9a8c6f39ea5b5248eb47634c6ce4259fdb1c67 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 15:46:17 -0400 Subject: [PATCH 05/62] t is always float in fluxes --- mb_scenario.py | 14 +++++++------- src/hisp/helpers.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 16bf5b7..9ec5134 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -351,7 +351,7 @@ def get_flux(pulse_type, monob, t: float, ion=True): return flux - def deuterium_ion_flux(t: float): + def deuterium_ion_flux(t: float) -> float: pulse_type = my_scenario.get_pulse_type(float(t)) pulse_row = my_scenario.get_row(float(t)) @@ -374,7 +374,7 @@ def deuterium_ion_flux(t: float): # plt.show() # exit() - def tritium_ion_flux(t: float): + def tritium_ion_flux(t: float) -> float: pulse_type = my_scenario.get_pulse_type(float(t)) pulse_row = my_scenario.get_row(float(t)) @@ -386,14 +386,14 @@ def tritium_ion_flux(t: float): tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * tritium_fraction - resting_value = 0 + resting_value = 0.0 return ( flat_top_value if (float(t)-time_elapsed) % total_time_pulse < total_time_on and (float(t)-time_elapsed) % total_time_pulse != 0.0 else resting_value ) - def deuterium_atom_flux(t: float): + def deuterium_atom_flux(t: float) -> float: pulse_type = my_scenario.get_pulse_type(float(t)) pulse_row = my_scenario.get_row(float(t)) @@ -405,14 +405,14 @@ def deuterium_atom_flux(t: float): tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * (1 - tritium_fraction) - resting_value = 0 + resting_value = 0.0 return ( flat_top_value if (float(t)-time_elapsed) % total_time_pulse < total_time_on and (float(t)-time_elapsed) % total_time_pulse != 0.0 else resting_value ) - def tritium_atom_flux(t: float): + def tritium_atom_flux(t: float) -> float: pulse_type = my_scenario.get_pulse_type(float(t)) pulse_row = my_scenario.get_row(float(t)) @@ -423,7 +423,7 @@ def tritium_atom_flux(t: float): atom_flux = get_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=False) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * tritium_fraction - resting_value = 0 + resting_value = 0.0 return ( flat_top_value if (float(t)-time_elapsed) % total_time_pulse < total_time_on and (float(t)-time_elapsed) % total_time_pulse != 0.0 diff --git a/src/hisp/helpers.py b/src/hisp/helpers.py index f4923ed..0d9705c 100644 --- a/src/hisp/helpers.py +++ b/src/hisp/helpers.py @@ -26,7 +26,7 @@ def time_dependent(self): return True def create_value_fenics(self, mesh, temperature, t: Constant): - self.flux_fenics = F.as_fenics_constant(float(self.flux(t)), mesh) + self.flux_fenics = F.as_fenics_constant(self.flux(float(t)), mesh) x = ufl.SpatialCoordinate(mesh) self.distribution_fenics = self.distribution(x) From 54f901bd9860396dcb7f26b00ebbdb868b306144 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 15:50:11 -0400 Subject: [PATCH 06/62] gaussian distr in helpers --- mb_scenario.py | 18 +++++++++--------- src/hisp/helpers.py | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 9ec5134..8bf5fbd 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -10,7 +10,7 @@ import dolfinx.fem as fem import dolfinx -from hisp.helpers import PulsedSource, Scenario +from hisp.helpers import PulsedSource, Scenario, gaussian_distribution from hisp import CustomProblem # dolfinx.log.set_log_level(dolfinx.log.LogLevel.INFO) @@ -33,10 +33,7 @@ } -def gaussian_distribution(x, mod=ufl): - depth = 3e-9 - width = 1e-9 - return mod.exp(-((x[0] - depth) ** 2) / (2 * width**2)) + def make_mb_model(nb_mb, scenario_file): @@ -430,28 +427,31 @@ def tritium_atom_flux(t: float) -> float: else resting_value ) + # TODO this is hard coded and show depend on incident energy? + implantation_range = 3e-9 # m + width = 1e-9 # m my_model.sources = [ PulsedSource( flux=deuterium_ion_flux, - distribution=gaussian_distribution, + distribution=lambda x: gaussian_distribution(x, implantation_range, width), species=mobile_D, volume=w_subdomain, ), PulsedSource( flux=tritium_ion_flux, - distribution=gaussian_distribution, + distribution=lambda x: gaussian_distribution(x, implantation_range, width), species=mobile_T, volume=w_subdomain, ), PulsedSource( flux=deuterium_atom_flux, - distribution=gaussian_distribution, + distribution=lambda x: gaussian_distribution(x, implantation_range, width), species=mobile_D, volume=w_subdomain, ), PulsedSource( flux=tritium_atom_flux, - distribution=gaussian_distribution, + distribution=lambda x: gaussian_distribution(x, implantation_range, width), species=mobile_T, volume=w_subdomain, ), diff --git a/src/hisp/helpers.py b/src/hisp/helpers.py index 0d9705c..716c25b 100644 --- a/src/hisp/helpers.py +++ b/src/hisp/helpers.py @@ -151,3 +151,6 @@ def get_maximum_time(self) -> float: nb_pulses = int(row[1]) max_time += nb_pulses * self.get_pulse_duration(i) return max_time + +def gaussian_distribution(x, mean, width, mod=ufl): + return mod.exp(-((x[0] - mean) ** 2) / (2 * width**2)) From 2856cc1eb92f2728e7d87152057c012aa9838762 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 15:53:20 -0400 Subject: [PATCH 07/62] type hinting for gaussian --- src/hisp/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hisp/helpers.py b/src/hisp/helpers.py index 716c25b..6534b0b 100644 --- a/src/hisp/helpers.py +++ b/src/hisp/helpers.py @@ -2,6 +2,7 @@ from dolfinx.fem.function import Constant import ufl import numpy as np +import numpy.typing as npt class PulsedSource(F.ParticleSource): @@ -152,5 +153,5 @@ def get_maximum_time(self) -> float: max_time += nb_pulses * self.get_pulse_duration(i) return max_time -def gaussian_distribution(x, mean, width, mod=ufl): +def gaussian_distribution(x: npt.NDArray, mean:float, width:float, mod=ufl) -> ufl.core.expr.Expr: return mod.exp(-((x[0] - mean) ** 2) / (2 * width**2)) From 4aa00fc3cc914419c561f1a0c86251e9d74f0270 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 15:54:47 -0400 Subject: [PATCH 08/62] todo --- mb_scenario.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mb_scenario.py b/mb_scenario.py index 8bf5fbd..bb1ee52 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -196,7 +196,7 @@ def RISP_data(monob, time): Args: monob (int): mb number - t (int): time as an integer + t (int): time as an integer # TODO: what does that mean? what units? will it be a float? I don't get it Returns: data (np.array): data from correct file as a numpy array From 89b72272db6c1e35199d7816c2ef7454f6da7b69 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:06:17 -0400 Subject: [PATCH 09/62] moved RISP_data out --- mb_scenario.py | 84 ++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index bb1ee52..5c467ec 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -32,7 +32,48 @@ "BAKE": 0, } +def RISP_data(monob, time): + """Returns the correct RISP data file for indicated monoblock + + Args: + monob (int): mb number + t (int): time as an integer # TODO: what does that mean? what units? will it be a float? I don't get it + + Returns: + data (np.array): data from correct file as a numpy array + """ + inner_swept_bins = list(range(46,65)) + outer_swept_bins = list(range(19,34)) + + if monob in inner_swept_bins: + label = "RISP" + div = True + offset_mb = 46 + elif monob in outer_swept_bins: + label = "ROSP" + div = True + offset_mb = 19 + else: + div = False + offset_mb = 0 + + t = int(time) + + if div: + if 1 <= t <= 9: + data = np.loadtxt(f"{label}_data/time0.dat", skiprows=1) + elif 10 <= t <= 98: + data = np.loadtxt(f"{label}_data/time10.dat", skiprows=1) + elif 100 <= t <= 260: + data = np.loadtxt(f"{label}_data/time{t}.dat", skiprows=1) + elif 261 <= t <= 269: + data = np.loadtxt(f"{label}_data/time270.dat", skiprows=1) + else: + data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) + else: + data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) + return data[monob-offset_mb,:] @@ -191,49 +232,6 @@ def make_mb_model(nb_mb, scenario_file): "GDC": np.loadtxt("GDC_data.dat", skiprows=1), } - def RISP_data(monob, time): - """Returns the correct RISP data file for indicated monoblock - - Args: - monob (int): mb number - t (int): time as an integer # TODO: what does that mean? what units? will it be a float? I don't get it - - Returns: - data (np.array): data from correct file as a numpy array - """ - inner_swept_bins = list(range(46,65)) - outer_swept_bins = list(range(19,34)) - - if monob in inner_swept_bins: - label = "RISP" - div = True - offset_mb = 46 - elif monob in outer_swept_bins: - label = "ROSP" - div = True - offset_mb = 19 - else: - div = False - offset_mb = 0 - - t = int(time) - - if div: - if 1 <= t <= 9: - data = np.loadtxt(f"{label}_data/time0.dat", skiprows=1) - elif 10 <= t <= 98: - data = np.loadtxt(f"{label}_data/time10.dat", skiprows=1) - elif 100 <= t <= 260: - data = np.loadtxt(f"{label}_data/time{t}.dat", skiprows=1) - elif 261 <= t <= 269: - data = np.loadtxt(f"{label}_data/time270.dat", skiprows=1) - else: - data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) - else: - data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) - - return data[monob-offset_mb,:] - ############# Temperature Parameters (K) ############# def heat(pulse_type: str, t:float) -> float: From 4b97425551143d190e1b7e59c440d46305e8371b Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:06:40 -0400 Subject: [PATCH 10/62] refac heat() --- mb_scenario.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 5c467ec..1b8102f 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -246,17 +246,19 @@ def heat(pulse_type: str, t:float) -> float: Returns: the surface heat flux in W/m2 """ - if pulse_type not in ["FP", "ICWC", "RISP", "GDC", "BAKE"]: - raise ValueError(f"Invalid pulse type {pulse_type}") - if pulse_type == "RISP": data = RISP_data(nb_mb, time=t) - else: + elif pulse_type in pulse_type_to_DINA_data.keys(): data = pulse_type_to_DINA_data[pulse_type] + else: + raise ValueError(f"Invalid pulse type {pulse_type}") - if pulse_type == "FP": heat_val = data[:, -2][nb_mb - 1] - elif pulse_type == "RISP": heat_val = data[-1] - else: heat_val = data[:, -1][nb_mb - 1] + if pulse_type == "FP": + heat_val = data[:, -2][nb_mb - 1] + elif pulse_type == "RISP": + heat_val = data[-1] + else: + heat_val = data[:, -1][nb_mb - 1] return heat_val From 81b44553d9b79cb82f660a634634b084eeec1717 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:07:32 -0400 Subject: [PATCH 11/62] moved dict out --- mb_scenario.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 1b8102f..34d51e5 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -32,6 +32,13 @@ "BAKE": 0, } +# TODO change the dat file for other pulse types +pulse_type_to_DINA_data = { + "FP": np.loadtxt("Binned_Flux_Data.dat", skiprows=1), + "ICWC": np.loadtxt("ICWC_data.dat", skiprows=1), + "GDC": np.loadtxt("GDC_data.dat", skiprows=1), +} + def RISP_data(monob, time): """Returns the correct RISP data file for indicated monoblock @@ -223,15 +230,6 @@ def make_mb_model(nb_mb, scenario_file): ), ] - ############# Pulse Parameters (s) ############# - - # TODO change the dat file for other pulse types - pulse_type_to_DINA_data = { - "FP": np.loadtxt("Binned_Flux_Data.dat", skiprows=1), - "ICWC": np.loadtxt("ICWC_data.dat", skiprows=1), - "GDC": np.loadtxt("GDC_data.dat", skiprows=1), - } - ############# Temperature Parameters (K) ############# def heat(pulse_type: str, t:float) -> float: From dcf1ef39b244f6ec0cdf1f2df0f0487dcb5ad27f Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:11:35 -0400 Subject: [PATCH 12/62] simplify indexing with ion --- mb_scenario.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 34d51e5..11b664e 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -328,11 +328,12 @@ def T_function(x, t: Constant): ############# Flux Parameters ############# def get_flux(pulse_type, monob, t: float, ion=True): - FP_index = 2 - other_index = 0 + if ion: + FP_index = 2 + other_index = 0 if not ion: - FP_index += FP_index+1 - other_index += other_index+1 + FP_index = 3 + other_index = 1 if pulse_type == "FP": flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][monob - 1] From ec2ee731f1d748a1d73d89e7605e30de4572b0ab Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:12:26 -0400 Subject: [PATCH 13/62] relative time instead of t --- mb_scenario.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 11b664e..146bc71 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -39,15 +39,16 @@ "GDC": np.loadtxt("GDC_data.dat", skiprows=1), } -def RISP_data(monob, time): +def RISP_data(monob: int, t_rel: float | int) -> NDArray: """Returns the correct RISP data file for indicated monoblock Args: - monob (int): mb number - t (int): time as an integer # TODO: what does that mean? what units? will it be a float? I don't get it + monob: mb number + t_rel: t_rel as an integer(in seconds). + t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds Returns: - data (np.array): data from correct file as a numpy array + data: data from correct file as a numpy array """ inner_swept_bins = list(range(46,65)) outer_swept_bins = list(range(19,34)) @@ -64,16 +65,16 @@ def RISP_data(monob, time): div = False offset_mb = 0 - t = int(time) + t_rel = int(t_rel) if div: - if 1 <= t <= 9: + if 1 <= t_rel <= 9: data = np.loadtxt(f"{label}_data/time0.dat", skiprows=1) - elif 10 <= t <= 98: + elif 10 <= t_rel <= 98: data = np.loadtxt(f"{label}_data/time10.dat", skiprows=1) - elif 100 <= t <= 260: - data = np.loadtxt(f"{label}_data/time{t}.dat", skiprows=1) - elif 261 <= t <= 269: + elif 100 <= t_rel <= 260: + data = np.loadtxt(f"{label}_data/time{t_rel}.dat", skiprows=1) + elif 261 <= t_rel <= 269: data = np.loadtxt(f"{label}_data/time270.dat", skiprows=1) else: data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) From 3ef7d801056a061d61028a31d93afcac4d819607 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:13:30 -0400 Subject: [PATCH 14/62] moved get_flux out --- mb_scenario.py | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 146bc71..26691ee 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -9,6 +9,7 @@ from scipy import constants import dolfinx.fem as fem import dolfinx +from numpy.typing import NDArray from hisp.helpers import PulsedSource, Scenario, gaussian_distribution from hisp import CustomProblem @@ -83,7 +84,25 @@ def RISP_data(monob: int, t_rel: float | int) -> NDArray: return data[monob-offset_mb,:] - +def get_flux(pulse_type: str, monob: int, t: float, ion=True): + if ion: + FP_index = 2 + other_index = 0 + if not ion: + FP_index = 3 + other_index = 1 + + if pulse_type == "FP": + flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][monob - 1] + elif pulse_type == "RISP": + t_value = int(t.value) if isinstance(t, Constant) else int(t) + flux = RISP_data(monob=monob, time=t_value)[other_index] + elif pulse_type == "BAKE": + flux = 0.0 + else: + flux = pulse_type_to_DINA_data[pulse_type][:, other_index][monob - 1] + + return flux def make_mb_model(nb_mb, scenario_file): ############# Input Flux, Heat Data ############# @@ -328,26 +347,6 @@ def T_function(x, t: Constant): ############# Flux Parameters ############# - def get_flux(pulse_type, monob, t: float, ion=True): - if ion: - FP_index = 2 - other_index = 0 - if not ion: - FP_index = 3 - other_index = 1 - - if pulse_type == "FP": - flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][monob - 1] - elif pulse_type == "RISP": - t_value = int(t.value) if isinstance(t, Constant) else int(t) - flux = RISP_data(monob=nb_mb, time=t_value)[other_index] - elif pulse_type == "BAKE": - flux = 0.0 - else: - flux = pulse_type_to_DINA_data[pulse_type][:, other_index][monob - 1] - - return flux - def deuterium_ion_flux(t: float) -> float: pulse_type = my_scenario.get_pulse_type(float(t)) From c0bfbf4835bca66343ed2cee0f2a41cf7677a448 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:14:23 -0400 Subject: [PATCH 15/62] type hint --- mb_scenario.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mb_scenario.py b/mb_scenario.py index 26691ee..05c726d 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -84,7 +84,7 @@ def RISP_data(monob: int, t_rel: float | int) -> NDArray: return data[monob-offset_mb,:] -def get_flux(pulse_type: str, monob: int, t: float, ion=True): +def get_flux(pulse_type: str, monob: int, t: float, ion=True) -> float: if ion: FP_index = 2 other_index = 0 From 0e14e8fc5c01d8dd6ca1664fc9bed614624a8f71 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:26:58 -0400 Subject: [PATCH 16/62] moved heat out --- mb_scenario.py | 66 +++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 05c726d..2078baa 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -104,7 +104,35 @@ def get_flux(pulse_type: str, monob: int, t: float, ion=True) -> float: return flux -def make_mb_model(nb_mb, scenario_file): +def heat(nb_mb:int, pulse_type: str, t:float) -> float: + """Returns the surface heat flux for a given pulse type + + Args: + pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) + + Raises: + ValueError: if the pulse type is unknown + + Returns: + the surface heat flux in W/m2 + """ + if pulse_type == "RISP": + data = RISP_data(nb_mb, time=t) + elif pulse_type in pulse_type_to_DINA_data.keys(): + data = pulse_type_to_DINA_data[pulse_type] + else: + raise ValueError(f"Invalid pulse type {pulse_type}") + + if pulse_type == "FP": + heat_val = data[:, -2][nb_mb - 1] + elif pulse_type == "RISP": + heat_val = data[-1] + else: + heat_val = data[:, -1][nb_mb - 1] + + return heat_val + +def make_mb_model(nb_mb: int, scenario_file: str): ############# Input Flux, Heat Data ############# my_scenario = Scenario(scenario_file) @@ -252,34 +280,6 @@ def make_mb_model(nb_mb, scenario_file): ############# Temperature Parameters (K) ############# - def heat(pulse_type: str, t:float) -> float: - """Returns the surface heat flux for a given pulse type - - Args: - pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) - - Raises: - ValueError: if the pulse type is unknown - - Returns: - the surface heat flux in W/m2 - """ - if pulse_type == "RISP": - data = RISP_data(nb_mb, time=t) - elif pulse_type in pulse_type_to_DINA_data.keys(): - data = pulse_type_to_DINA_data[pulse_type] - else: - raise ValueError(f"Invalid pulse type {pulse_type}") - - if pulse_type == "FP": - heat_val = data[:, -2][nb_mb - 1] - elif pulse_type == "RISP": - heat_val = data[-1] - else: - heat_val = data[:, -1][nb_mb - 1] - - return heat_val - def T_surface(t: dolfinx.fem.Constant) -> float: """Monoblock surface temperature @@ -290,9 +290,9 @@ def T_surface(t: dolfinx.fem.Constant) -> float: monoblock surface temperature in K """ pulse_type = my_scenario.get_pulse_type(float(t)) - return 1.1e-4 * heat(pulse_type, t=t) + COOLANT_TEMP + return 1.1e-4 * heat(nb_mb=nb_mb, pulse_type=pulse_type, t=t) + COOLANT_TEMP - def T_rear(t: dolfinx.fem.Constant): + def T_rear(t: dolfinx.fem.Constant) -> float: """Monoblock surface temperature Args: @@ -302,9 +302,9 @@ def T_rear(t: dolfinx.fem.Constant): monoblock surface temperature in K """ pulse_type = my_scenario.get_pulse_type(float(t)) - return 2.2e-5 * heat(pulse_type, t=t) + COOLANT_TEMP + return 2.2e-5 * heat(nb_mb=nb_mb, pulse_type=pulse_type, t=t) + COOLANT_TEMP - def T_function(x, t: Constant): + def T_function(x, t: Constant) -> float: """Monoblock temperature function Args: From 2293328cc41515fc664af3813c17ec6850c08415 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:47:43 -0400 Subject: [PATCH 17/62] new make_mb_model function --- mb_scenario.py | 293 +++--------------------------------- src/hisp/__init__.py | 2 + src/hisp/festim_mb_model.py | 261 ++++++++++++++++++++++++++++++++ 3 files changed, 281 insertions(+), 275 deletions(-) create mode 100644 src/hisp/festim_mb_model.py diff --git a/mb_scenario.py b/mb_scenario.py index 2078baa..c064be3 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -1,29 +1,19 @@ # simple monoblock simulation in festim -import festim as F import numpy as np import matplotlib.pyplot as plt -import h_transport_materials as htm -import ufl from dolfinx.fem.function import Constant -from scipy import constants -import dolfinx.fem as fem import dolfinx from numpy.typing import NDArray -from hisp.helpers import PulsedSource, Scenario, gaussian_distribution -from hisp import CustomProblem +from hisp.helpers import Scenario +from hisp import make_mb_model # dolfinx.log.set_log_level(dolfinx.log.LogLevel.INFO) NB_FP_PULSES_PER_DAY = 13 COOLANT_TEMP = 343 # 70 degree C cooling water -############# CUSTOM CLASSES FOR PULSED FLUXES & RECOMBO BC ############# - -# TODO: ADJUST TO HANDLE ANY STRAIGHT W 6MM SIMU -mb = 64 - # tritium fraction = T/D PULSE_TYPE_TO_TRITIUM_FRACTION = { "FP": 0.5, @@ -96,7 +86,7 @@ def get_flux(pulse_type: str, monob: int, t: float, ion=True) -> float: flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][monob - 1] elif pulse_type == "RISP": t_value = int(t.value) if isinstance(t, Constant) else int(t) - flux = RISP_data(monob=monob, time=t_value)[other_index] + flux = RISP_data(monob=monob, t_rel=t_value)[other_index] elif pulse_type == "BAKE": flux = 0.0 else: @@ -117,7 +107,7 @@ def heat(nb_mb:int, pulse_type: str, t:float) -> float: the surface heat flux in W/m2 """ if pulse_type == "RISP": - data = RISP_data(nb_mb, time=t) + data = RISP_data(nb_mb, t_rel=t) elif pulse_type in pulse_type_to_DINA_data.keys(): data = pulse_type_to_DINA_data[pulse_type] else: @@ -132,153 +122,12 @@ def heat(nb_mb:int, pulse_type: str, t:float) -> float: return heat_val -def make_mb_model(nb_mb: int, scenario_file: str): - ############# Input Flux, Heat Data ############# - my_scenario = Scenario(scenario_file) - - my_model = CustomProblem() - ############# Material Parameters ############# - - L = 6e-3 # m - vertices = np.concatenate( # 1D mesh with extra refinement - [ - np.linspace(0, 30e-9, num=200), - np.linspace(30e-9, 3e-6, num=300), - np.linspace(3e-6, 30e-6, num=200), - np.linspace(30e-6, L, num=200), - ] - ) - my_model.mesh = F.Mesh1D(vertices) - - # W material parameters - w_density = 6.3382e28 # atoms/m3 - w_diffusivity = ( - htm.diffusivities.filter(material="tungsten") - .filter(isotope="h") - .filter(author="frauenfelder") - ) - w_diffusivity = w_diffusivity[0] - D_0 = w_diffusivity.pre_exp.magnitude - E_D = w_diffusivity.act_energy.magnitude - tungsten = F.Material( - D_0=D_0, - E_D=E_D, - name="tungsten", - ) - - # mb subdomains - w_subdomain = F.VolumeSubdomain1D(id=1, borders=[0, L], material=tungsten) - inlet = F.SurfaceSubdomain1D(id=1, x=0) - outlet = F.SurfaceSubdomain1D(id=2, x=L) - - my_model.subdomains = [ - w_subdomain, - inlet, - outlet, - ] - - # hydrogen species - mobile_D = F.Species("D") - mobile_T = F.Species("T") - - trap1_D = F.Species("trap1_D", mobile=False) - trap1_T = F.Species("trap1_T", mobile=False) - trap2_D = F.Species("trap2_D", mobile=False) - trap2_T = F.Species("trap2_T", mobile=False) - trap3_D = F.Species("trap3_D", mobile=False) - trap3_T = F.Species("trap3_T", mobile=False) - - # traps - empty_trap1 = F.ImplicitSpecies( # implicit trap 1 - n=6.338e24, # 1e-4 at.fr. - others=[trap1_T, trap1_D], - name="empty_trap1", - ) - - empty_trap2 = F.ImplicitSpecies( # implicit trap 2 - n=6.338e24, - others=[trap2_T, trap2_D], - name="empty_trap2", - ) - - # density_func = - empty_trap3 = F.ImplicitSpecies( # not implicit, but can simplify trap creation model to small damanged zone in first 10nm - n=6.338e27, # 1e-1 at.fr. - others=[trap3_T, trap3_D], - name="empty_trap3", - ) +if __name__ == "__main__": + my_scenario = Scenario("scenario_test.txt") - my_model.species = [ - mobile_D, - mobile_T, - trap1_D, - trap1_T, - trap2_D, - trap2_T, - trap3_D, - trap3_T, - ] - - # hydrogen reactions - 1 per trap per species - my_model.reactions = [ - F.Reaction( - k_0=D_0 / (1.1e-10**2 * 6 * w_density), - E_k=E_D, - p_0=1e13, - E_p=0.85, - volume=w_subdomain, - reactant=[mobile_D, empty_trap1], - product=trap1_D, - ), - F.Reaction( - k_0=D_0 / (1.1e-10**2 * 6 * w_density), - E_k=E_D, - p_0=1e13, - E_p=0.85, - volume=w_subdomain, - reactant=[mobile_T, empty_trap1], - product=trap1_T, - ), - F.Reaction( - k_0=D_0 / (1.1e-10**2 * 6 * w_density), - E_k=E_D, - p_0=1e13, - E_p=1, - volume=w_subdomain, - reactant=[mobile_D, empty_trap2], - product=trap2_D, - ), - F.Reaction( - k_0=D_0 / (1.1e-10**2 * 6 * w_density), - E_k=E_D, - p_0=1e13, - E_p=1, - volume=w_subdomain, - reactant=[mobile_T, empty_trap2], - product=trap2_T, - ), - F.Reaction( - k_0=D_0 / (1.1e-10**2 * 6 * w_density), - E_k=E_D, - p_0=1e13, - E_p=1.5, - volume=w_subdomain, - reactant=[mobile_D, empty_trap3], - product=trap3_D, - ), - F.Reaction( - k_0=D_0 / (1.1e-10**2 * 6 * w_density), - E_k=E_D, - p_0=1e13, - E_p=1.5, - volume=w_subdomain, - reactant=[mobile_T, empty_trap3], - product=trap3_T, - ), - ] - - ############# Temperature Parameters (K) ############# + nb_mb = 64 + L = 6e-3 def T_surface(t: dolfinx.fem.Constant) -> float: """Monoblock surface temperature @@ -335,18 +184,6 @@ def T_function(x, t: Constant) -> float: else resting_value ) - # times = np.linspace(0, my_scenario.get_maximum_time(), num=100) - - # x = [0] - # Ts = [T_function(x, t) for t in times] - - # plt.plot(times, Ts, marker="o") - # plt.show() - - my_model.temperature = T_function - - ############# Flux Parameters ############# - def deuterium_ion_flux(t: float) -> float: pulse_type = my_scenario.get_pulse_type(float(t)) @@ -365,7 +202,7 @@ def deuterium_ion_flux(t: float) -> float: if (float(t)-time_elapsed) % total_time_pulse < total_time_on and (float(t)-time_elapsed) % total_time_pulse != 0.0 else resting_value ) - + # plt.plot(times, [deuterium_ion_flux(t) for t in times], marker="o") # plt.show() # exit() @@ -426,110 +263,16 @@ def tritium_atom_flux(t: float) -> float: else resting_value ) - # TODO this is hard coded and show depend on incident energy? - implantation_range = 3e-9 # m - width = 1e-9 # m - my_model.sources = [ - PulsedSource( - flux=deuterium_ion_flux, - distribution=lambda x: gaussian_distribution(x, implantation_range, width), - species=mobile_D, - volume=w_subdomain, - ), - PulsedSource( - flux=tritium_ion_flux, - distribution=lambda x: gaussian_distribution(x, implantation_range, width), - species=mobile_T, - volume=w_subdomain, - ), - PulsedSource( - flux=deuterium_atom_flux, - distribution=lambda x: gaussian_distribution(x, implantation_range, width), - species=mobile_D, - volume=w_subdomain, - ), - PulsedSource( - flux=tritium_atom_flux, - distribution=lambda x: gaussian_distribution(x, implantation_range, width), - species=mobile_T, - volume=w_subdomain, - ), - ] - - ############# Boundary Conditions ############# - surface_reaction_dd = F.SurfaceReactionBC( - reactant=[mobile_D, mobile_D], - gas_pressure=0, - k_r0=7.94e-17, - E_kr=-2, - k_d0=0, - E_kd=0, - subdomain=inlet, - ) - - surface_reaction_tt = F.SurfaceReactionBC( - reactant=[mobile_T, mobile_T], - gas_pressure=0, - k_r0=7.94e-17, - E_kr=-2, - k_d0=0, - E_kd=0, - subdomain=inlet, - ) - - surface_reaction_dt = F.SurfaceReactionBC( - reactant=[mobile_D, mobile_T], - gas_pressure=0, - k_r0=7.94e-17, - E_kr=-2, - k_d0=0, - E_kd=0, - subdomain=inlet, + my_model, quantities = make_mb_model( + T_function=T_function, + deuterium_ion_flux=deuterium_ion_flux, + tritium_ion_flux=tritium_ion_flux, + deuterium_atom_flux=deuterium_atom_flux, + tritium_atom_flux=tritium_atom_flux, + final_time=my_scenario.get_maximum_time(), + L=6e-3, + folder=f"mb{nb_mb}_results" ) - - my_model.boundary_conditions = [ - surface_reaction_dd, - surface_reaction_dt, - surface_reaction_tt, - ] - - ############# Exports ############# - - folder = f"mb{mb}_results" - - my_model.exports = [ - F.VTXExport(f"{folder}/mobile_concentration_t.bp", field=mobile_T), - F.VTXExport(f"{folder}/mobile_concentration_d.bp", field=mobile_D), - F.VTXExport(f"{folder}/trapped_concentration_d1.bp", field=trap1_D), - F.VTXExport(f"{folder}/trapped_concentration_t1.bp", field=trap1_T), - F.VTXExport(f"{folder}/trapped_concentration_d2.bp", field=trap2_D), - F.VTXExport(f"{folder}/trapped_concentration_t2.bp", field=trap2_T), - F.VTXExport(f"{folder}/trapped_concentration_d3.bp", field=trap3_D), - F.VTXExport(f"{folder}/trapped_concentration_t3.bp", field=trap3_T), - ] - - quantities = {} - for species in my_model.species: - quantity = F.TotalVolume(field=species, volume=w_subdomain) - my_model.exports.append(quantity) - quantities[species.name] = quantity - - ############# Settings ############# - my_model.settings = F.Settings( - atol=1e-15, - rtol=1e-15, - max_iterations=1000, - final_time=my_scenario.get_maximum_time() - ) - - my_model.settings.stepsize = F.Stepsize(initial_value=1) - - return my_model, quantities - - -if __name__ == "__main__": - my_model, quantities = make_mb_model(nb_mb=mb, scenario_file="scenario_test.txt") - ############# Run Simu ############# my_model.initialise() diff --git a/src/hisp/__init__.py b/src/hisp/__init__.py index 391c7d9..6aae89f 100644 --- a/src/hisp/__init__.py +++ b/src/hisp/__init__.py @@ -1,3 +1,5 @@ from .helpers import PulsedSource, Scenario from .h_transport_class import CustomProblem + +from .festim_mb_model import make_mb_model \ No newline at end of file diff --git a/src/hisp/festim_mb_model.py b/src/hisp/festim_mb_model.py new file mode 100644 index 0000000..527fe98 --- /dev/null +++ b/src/hisp/festim_mb_model.py @@ -0,0 +1,261 @@ +from hisp.h_transport_class import CustomProblem +from hisp.helpers import PulsedSource, gaussian_distribution + +import numpy as np +import festim as F +import h_transport_materials as htm + +from typing import Callable + +# TODO this is hard coded and show depend on incident energy? +implantation_range = 3e-9 # m +width = 1e-9 # m + +def make_mb_model( + T_function: Callable, + deuterium_ion_flux: Callable, + tritium_ion_flux: Callable, + deuterium_atom_flux: Callable, + tritium_atom_flux: Callable, + final_time: float, + folder: str, + L: float = 6e-3, +): + my_model = CustomProblem() + + ############# Material Parameters ############# + + L = 6e-3 # m + vertices = np.concatenate( # 1D mesh with extra refinement + [ + np.linspace(0, 30e-9, num=200), + np.linspace(30e-9, 3e-6, num=300), + np.linspace(3e-6, 30e-6, num=200), + np.linspace(30e-6, L, num=200), + ] + ) + my_model.mesh = F.Mesh1D(vertices) + + # W material parameters + w_density = 6.3382e28 # atoms/m3 + w_diffusivity = ( + htm.diffusivities.filter(material="tungsten") + .filter(isotope="h") + .filter(author="frauenfelder") + ) + w_diffusivity = w_diffusivity[0] + D_0 = w_diffusivity.pre_exp.magnitude + E_D = w_diffusivity.act_energy.magnitude + tungsten = F.Material( + D_0=D_0, + E_D=E_D, + name="tungsten", + ) + + # mb subdomains + w_subdomain = F.VolumeSubdomain1D(id=1, borders=[0, L], material=tungsten) + inlet = F.SurfaceSubdomain1D(id=1, x=0) + outlet = F.SurfaceSubdomain1D(id=2, x=L) + + my_model.subdomains = [w_subdomain, inlet, outlet] + + # hydrogen species + mobile_D = F.Species("D") + mobile_T = F.Species("T") + + trap1_D = F.Species("trap1_D", mobile=False) + trap1_T = F.Species("trap1_T", mobile=False) + trap2_D = F.Species("trap2_D", mobile=False) + trap2_T = F.Species("trap2_T", mobile=False) + trap3_D = F.Species("trap3_D", mobile=False) + trap3_T = F.Species("trap3_T", mobile=False) + + # traps + empty_trap1 = F.ImplicitSpecies( # implicit trap 1 + n=6.338e24, # 1e-4 at.fr. + others=[trap1_T, trap1_D], + name="empty_trap1", + ) + + empty_trap2 = F.ImplicitSpecies( # implicit trap 2 + n=6.338e24, + others=[trap2_T, trap2_D], + name="empty_trap2", + ) + + # density_func = + empty_trap3 = F.ImplicitSpecies( # not implicit, but can simplify trap creation model to small damanged zone in first 10nm + n=6.338e27, # 1e-1 at.fr. + others=[trap3_T, trap3_D], + name="empty_trap3", + ) + + my_model.species = [ + mobile_D, + mobile_T, + trap1_D, + trap1_T, + trap2_D, + trap2_T, + trap3_D, + trap3_T, + ] + + # hydrogen reactions - 1 per trap per species + my_model.reactions = [ + F.Reaction( + k_0=D_0 / (1.1e-10**2 * 6 * w_density), + E_k=E_D, + p_0=1e13, + E_p=0.85, + volume=w_subdomain, + reactant=[mobile_D, empty_trap1], + product=trap1_D, + ), + F.Reaction( + k_0=D_0 / (1.1e-10**2 * 6 * w_density), + E_k=E_D, + p_0=1e13, + E_p=0.85, + volume=w_subdomain, + reactant=[mobile_T, empty_trap1], + product=trap1_T, + ), + F.Reaction( + k_0=D_0 / (1.1e-10**2 * 6 * w_density), + E_k=E_D, + p_0=1e13, + E_p=1, + volume=w_subdomain, + reactant=[mobile_D, empty_trap2], + product=trap2_D, + ), + F.Reaction( + k_0=D_0 / (1.1e-10**2 * 6 * w_density), + E_k=E_D, + p_0=1e13, + E_p=1, + volume=w_subdomain, + reactant=[mobile_T, empty_trap2], + product=trap2_T, + ), + F.Reaction( + k_0=D_0 / (1.1e-10**2 * 6 * w_density), + E_k=E_D, + p_0=1e13, + E_p=1.5, + volume=w_subdomain, + reactant=[mobile_D, empty_trap3], + product=trap3_D, + ), + F.Reaction( + k_0=D_0 / (1.1e-10**2 * 6 * w_density), + E_k=E_D, + p_0=1e13, + E_p=1.5, + volume=w_subdomain, + reactant=[mobile_T, empty_trap3], + product=trap3_T, + ), + ] + + ############# Temperature Parameters (K) ############# + + my_model.temperature = T_function + + ############# Flux Parameters ############# + + my_model.sources = [ + PulsedSource( + flux=deuterium_ion_flux, + distribution=lambda x: gaussian_distribution(x, implantation_range, width), + species=mobile_D, + volume=w_subdomain, + ), + PulsedSource( + flux=tritium_ion_flux, + distribution=lambda x: gaussian_distribution(x, implantation_range, width), + species=mobile_T, + volume=w_subdomain, + ), + PulsedSource( + flux=deuterium_atom_flux, + distribution=lambda x: gaussian_distribution(x, implantation_range, width), + species=mobile_D, + volume=w_subdomain, + ), + PulsedSource( + flux=tritium_atom_flux, + distribution=lambda x: gaussian_distribution(x, implantation_range, width), + species=mobile_T, + volume=w_subdomain, + ), + ] + + ############# Boundary Conditions ############# + surface_reaction_dd = F.SurfaceReactionBC( + reactant=[mobile_D, mobile_D], + gas_pressure=0, + k_r0=7.94e-17, + E_kr=-2, + k_d0=0, + E_kd=0, + subdomain=inlet, + ) + + surface_reaction_tt = F.SurfaceReactionBC( + reactant=[mobile_T, mobile_T], + gas_pressure=0, + k_r0=7.94e-17, + E_kr=-2, + k_d0=0, + E_kd=0, + subdomain=inlet, + ) + + surface_reaction_dt = F.SurfaceReactionBC( + reactant=[mobile_D, mobile_T], + gas_pressure=0, + k_r0=7.94e-17, + E_kr=-2, + k_d0=0, + E_kd=0, + subdomain=inlet, + ) + + my_model.boundary_conditions = [ + surface_reaction_dd, + surface_reaction_dt, + surface_reaction_tt, + ] + + ############# Exports ############# + + my_model.exports = [ + F.VTXExport(f"{folder}/mobile_concentration_t.bp", field=mobile_T), + F.VTXExport(f"{folder}/mobile_concentration_d.bp", field=mobile_D), + F.VTXExport(f"{folder}/trapped_concentration_d1.bp", field=trap1_D), + F.VTXExport(f"{folder}/trapped_concentration_t1.bp", field=trap1_T), + F.VTXExport(f"{folder}/trapped_concentration_d2.bp", field=trap2_D), + F.VTXExport(f"{folder}/trapped_concentration_t2.bp", field=trap2_T), + F.VTXExport(f"{folder}/trapped_concentration_d3.bp", field=trap3_D), + F.VTXExport(f"{folder}/trapped_concentration_t3.bp", field=trap3_T), + ] + + quantities = {} + for species in my_model.species: + quantity = F.TotalVolume(field=species, volume=w_subdomain) + my_model.exports.append(quantity) + quantities[species.name] = quantity + + ############# Settings ############# + my_model.settings = F.Settings( + atol=1e-15, + rtol=1e-15, + max_iterations=1000, + final_time=final_time, + ) + + my_model.settings.stepsize = F.Stepsize(initial_value=1) + + return my_model, quantities From 991e5ee37434f23f419c9db3e8d087b2ec39f8e4 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:56:04 -0400 Subject: [PATCH 18/62] added TODO --- mb_scenario.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index c064be3..38a2895 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -74,7 +74,7 @@ def RISP_data(monob: int, t_rel: float | int) -> NDArray: return data[monob-offset_mb,:] -def get_flux(pulse_type: str, monob: int, t: float, ion=True) -> float: +def get_particle_flux(pulse_type: str, monob: int, t: float, ion=True) -> float: if ion: FP_index = 2 other_index = 0 @@ -95,7 +95,7 @@ def get_flux(pulse_type: str, monob: int, t: float, ion=True) -> float: return flux def heat(nb_mb:int, pulse_type: str, t:float) -> float: - """Returns the surface heat flux for a given pulse type + """Returns the surface heat flux (W/m2) for a given pulse type Args: pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) @@ -168,7 +168,7 @@ def T_function(x, t: Constant) -> float: pulse_type = my_scenario.get_pulse_type(float(t)) if pulse_type == "BAKE": - flat_top_value = 483.15 + flat_top_value = 483.15 # TODO, we probably have to return np.full_like(x[0], 483.15) else: a = (T_rear(t) - T_surface(t)) / L b = T_surface(t) @@ -192,7 +192,7 @@ def deuterium_ion_flux(t: float) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_elapsed = my_scenario.get_time_till_row(pulse_row) - ion_flux = get_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed) + ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=True) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * (1 - tritium_fraction) resting_value = 0 @@ -215,7 +215,7 @@ def tritium_ion_flux(t: float) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_elapsed = my_scenario.get_time_till_row(pulse_row) - ion_flux = get_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed) + ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=True) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * tritium_fraction @@ -234,7 +234,7 @@ def deuterium_atom_flux(t: float) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_elapsed = my_scenario.get_time_till_row(pulse_row) - atom_flux = get_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=False) + atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=False) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * (1 - tritium_fraction) @@ -253,7 +253,7 @@ def tritium_atom_flux(t: float) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_elapsed = my_scenario.get_time_till_row(pulse_row) - atom_flux = get_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=False) + atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=False) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * tritium_fraction resting_value = 0.0 From 1e9c51cab359f9908f1da2a7149d4bd36a6dc60c Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 16:56:56 -0400 Subject: [PATCH 19/62] added TODO --- src/hisp/helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hisp/helpers.py b/src/hisp/helpers.py index 6534b0b..751a2bf 100644 --- a/src/hisp/helpers.py +++ b/src/hisp/helpers.py @@ -126,6 +126,7 @@ def get_pulse_duration_no_waiting(self, row: int) -> float: duration = self.get_pulse_duration(row) - waiting_time return duration + # TODO rename this get_start_time_current_pulse() def get_time_till_row(self, row:int) -> float: """Returns the time that has elapsed in scenario up until start of current row. From 0e49ae1f73d766fd50afafaf34b70c16babf8255 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 17:02:39 -0400 Subject: [PATCH 20/62] explicit relative time for get_particle_flux --- mb_scenario.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 38a2895..e8dfc17 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -74,7 +74,19 @@ def RISP_data(monob: int, t_rel: float | int) -> NDArray: return data[monob-offset_mb,:] -def get_particle_flux(pulse_type: str, monob: int, t: float, ion=True) -> float: +def get_particle_flux(pulse_type: str, monob: int, t_rel: float, ion=True) -> float: + """_summary_ + + Args: + pulse_type (str): _description_ + monob (int): _description_ + t_rel: t_rel as an integer (in seconds). + t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds + ion (bool, optional): _description_. Defaults to True. + + Returns: + float: _description_ + """ if ion: FP_index = 2 other_index = 0 @@ -85,8 +97,8 @@ def get_particle_flux(pulse_type: str, monob: int, t: float, ion=True) -> float: if pulse_type == "FP": flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][monob - 1] elif pulse_type == "RISP": - t_value = int(t.value) if isinstance(t, Constant) else int(t) - flux = RISP_data(monob=monob, t_rel=t_value)[other_index] + assert isinstance(t_rel, float), f"t_rel should be a float, not {type(t_rel)}" + flux = RISP_data(monob=monob, t_rel=t_rel)[other_index] elif pulse_type == "BAKE": flux = 0.0 else: @@ -176,11 +188,11 @@ def T_function(x, t: Constant) -> float: total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_elapsed = my_scenario.get_time_till_row(pulse_row) + time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) return ( flat_top_value - if (float(t)-time_elapsed) % total_time_pulse < total_time_on and (float(t)-time_elapsed) % total_time_pulse != 0.0 + if (float(t)-time_start_current_pulse) % total_time_pulse < total_time_on and (float(t)-time_start_current_pulse) % total_time_pulse != 0.0 else resting_value ) @@ -190,16 +202,16 @@ def deuterium_ion_flux(t: float) -> float: pulse_row = my_scenario.get_row(float(t)) total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_elapsed = my_scenario.get_time_till_row(pulse_row) + time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) - ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=True) + ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=t-time_start_current_pulse, ion=True) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * (1 - tritium_fraction) resting_value = 0 return ( flat_top_value - if (float(t)-time_elapsed) % total_time_pulse < total_time_on and (float(t)-time_elapsed) % total_time_pulse != 0.0 + if (float(t)-time_start_current_pulse) % total_time_pulse < total_time_on and (float(t)-time_start_current_pulse) % total_time_pulse != 0.0 else resting_value ) @@ -215,7 +227,7 @@ def tritium_ion_flux(t: float) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_elapsed = my_scenario.get_time_till_row(pulse_row) - ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=True) + ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=t-time_elapsed, ion=True) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * tritium_fraction @@ -234,7 +246,7 @@ def deuterium_atom_flux(t: float) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_elapsed = my_scenario.get_time_till_row(pulse_row) - atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=False) + atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=t-time_elapsed, ion=False) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * (1 - tritium_fraction) @@ -253,7 +265,7 @@ def tritium_atom_flux(t: float) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_elapsed = my_scenario.get_time_till_row(pulse_row) - atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t=t-time_elapsed, ion=False) + atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=t-time_elapsed, ion=False) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * tritium_fraction resting_value = 0.0 From a8a22b6e1795da1776bdbfb4037d51218b64fe2e Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 17:18:00 -0400 Subject: [PATCH 21/62] refactored temp --- mb_scenario.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index e8dfc17..11e33e6 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -106,11 +106,14 @@ def get_particle_flux(pulse_type: str, monob: int, t_rel: float, ion=True) -> fl return flux -def heat(nb_mb:int, pulse_type: str, t:float) -> float: +def heat(nb_mb:int, pulse_type: str, t_rel:float) -> float: """Returns the surface heat flux (W/m2) for a given pulse type Args: + nb_mb: monoblock number pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) + t_rel: t_rel as an integer (in seconds). + t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds Raises: ValueError: if the pulse type is unknown @@ -119,7 +122,7 @@ def heat(nb_mb:int, pulse_type: str, t:float) -> float: the surface heat flux in W/m2 """ if pulse_type == "RISP": - data = RISP_data(nb_mb, t_rel=t) + data = RISP_data(nb_mb, t_rel=t_rel) elif pulse_type in pulse_type_to_DINA_data.keys(): data = pulse_type_to_DINA_data[pulse_type] else: @@ -141,29 +144,27 @@ def heat(nb_mb:int, pulse_type: str, t:float) -> float: nb_mb = 64 L = 6e-3 - def T_surface(t: dolfinx.fem.Constant) -> float: + def T_surface(heat_flux: float) -> float: """Monoblock surface temperature Args: - t: time in seconds + heat_flux: surface heat flux in W/m2 Returns: monoblock surface temperature in K """ - pulse_type = my_scenario.get_pulse_type(float(t)) - return 1.1e-4 * heat(nb_mb=nb_mb, pulse_type=pulse_type, t=t) + COOLANT_TEMP + return 1.1e-4 * heat_flux + COOLANT_TEMP - def T_rear(t: dolfinx.fem.Constant) -> float: + def T_rear(heat_flux: float) -> float: """Monoblock surface temperature Args: - t: time in seconds + heat_flux: surface heat flux in W/m2 Returns: - monoblock surface temperature in K + monoblock rear temperature in K """ - pulse_type = my_scenario.get_pulse_type(float(t)) - return 2.2e-5 * heat(nb_mb=nb_mb, pulse_type=pulse_type, t=t) + COOLANT_TEMP + return 2.2e-5 * heat_flux + COOLANT_TEMP def T_function(x, t: Constant) -> float: """Monoblock temperature function @@ -178,12 +179,14 @@ def T_function(x, t: Constant) -> float: resting_value = np.full_like(x[0], COOLANT_TEMP) pulse_row = my_scenario.get_row(float(t)) pulse_type = my_scenario.get_pulse_type(float(t)) + t_rel = t - my_scenario.get_time_till_row(pulse_row) if pulse_type == "BAKE": flat_top_value = 483.15 # TODO, we probably have to return np.full_like(x[0], 483.15) - else: - a = (T_rear(t) - T_surface(t)) / L - b = T_surface(t) + else: + heat_flux = heat(nb_mb, pulse_type, t_rel) + a = (T_rear(heat_flux) - T_surface(heat_flux)) / L + b = T_surface(heat_flux) flat_top_value = a * x[0] + b total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) From 12e43ab9b5cd88d7202481750e5e620905024969 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 19:33:30 -0400 Subject: [PATCH 22/62] removed T_rear and T_surf --- mb_scenario.py | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 11e33e6..23b4bcb 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -144,28 +144,6 @@ def heat(nb_mb:int, pulse_type: str, t_rel:float) -> float: nb_mb = 64 L = 6e-3 - def T_surface(heat_flux: float) -> float: - """Monoblock surface temperature - - Args: - heat_flux: surface heat flux in W/m2 - - Returns: - monoblock surface temperature in K - """ - return 1.1e-4 * heat_flux + COOLANT_TEMP - - def T_rear(heat_flux: float) -> float: - """Monoblock surface temperature - - Args: - heat_flux: surface heat flux in W/m2 - - Returns: - monoblock rear temperature in K - """ - return 2.2e-5 * heat_flux + COOLANT_TEMP - def T_function(x, t: Constant) -> float: """Monoblock temperature function @@ -185,8 +163,10 @@ def T_function(x, t: Constant) -> float: flat_top_value = 483.15 # TODO, we probably have to return np.full_like(x[0], 483.15) else: heat_flux = heat(nb_mb, pulse_type, t_rel) - a = (T_rear(heat_flux) - T_surface(heat_flux)) / L - b = T_surface(heat_flux) + T_surface = 1.1e-4 * heat_flux + COOLANT_TEMP + T_rear = 2.2e-5 * heat_flux + COOLANT_TEMP + a = (T_rear - T_surface) / L + b = T_surface flat_top_value = a * x[0] + b total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) From 3c18593e2a88d1eb5b46ea0478c6f51c2b7375e8 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 19:35:38 -0400 Subject: [PATCH 23/62] type hinting --- mb_scenario.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 23b4bcb..ea0a29c 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -144,8 +144,8 @@ def heat(nb_mb:int, pulse_type: str, t_rel:float) -> float: nb_mb = 64 L = 6e-3 - def T_function(x, t: Constant) -> float: - """Monoblock temperature function + def T_function(x: NDArray, t: Constant) -> float: + """Monoblock temperature function. Args: x: position along monoblock @@ -160,7 +160,8 @@ def T_function(x, t: Constant) -> float: t_rel = t - my_scenario.get_time_till_row(pulse_row) if pulse_type == "BAKE": - flat_top_value = 483.15 # TODO, we probably have to return np.full_like(x[0], 483.15) + T_bake = 483.15 # K + flat_top_value = np.full_like(x[0], T_bake) else: heat_flux = heat(nb_mb, pulse_type, t_rel) T_surface = 1.1e-4 * heat_flux + COOLANT_TEMP From e9e428b5a12baf0c6fa16c7a36dbc36e268e3c11 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 19:42:49 -0400 Subject: [PATCH 24/62] assert and refactoring of particle fluxes --- mb_scenario.py | 51 +++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index ea0a29c..17e438f 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -174,28 +174,31 @@ def T_function(x: NDArray, t: Constant) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + relative_time = t-time_start_current_pulse return ( flat_top_value - if (float(t)-time_start_current_pulse) % total_time_pulse < total_time_on and (float(t)-time_start_current_pulse) % total_time_pulse != 0.0 + if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 else resting_value ) def deuterium_ion_flux(t: float) -> float: - pulse_type = my_scenario.get_pulse_type(float(t)) + assert isinstance(t, float), f"t should be a float, not {type(t)}" + pulse_type = my_scenario.get_pulse_type(t) - pulse_row = my_scenario.get_row(float(t)) + pulse_row = my_scenario.get_row(t) total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + relative_time = t-time_start_current_pulse - ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=t-time_start_current_pulse, ion=True) + ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=True) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * (1 - tritium_fraction) resting_value = 0 return ( flat_top_value - if (float(t)-time_start_current_pulse) % total_time_pulse < total_time_on and (float(t)-time_start_current_pulse) % total_time_pulse != 0.0 + if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 else resting_value ) @@ -204,58 +207,64 @@ def deuterium_ion_flux(t: float) -> float: # exit() def tritium_ion_flux(t: float) -> float: - pulse_type = my_scenario.get_pulse_type(float(t)) + assert isinstance(t, float), f"t should be a float, not {type(t)}" + pulse_type = my_scenario.get_pulse_type(t) - pulse_row = my_scenario.get_row(float(t)) + pulse_row = my_scenario.get_row(t) total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_elapsed = my_scenario.get_time_till_row(pulse_row) + time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + relative_time = t-time_start_current_pulse - ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=t-time_elapsed, ion=True) + ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=True) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * tritium_fraction resting_value = 0.0 + return ( flat_top_value - if (float(t)-time_elapsed) % total_time_pulse < total_time_on and (float(t)-time_elapsed) % total_time_pulse != 0.0 + if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 else resting_value ) def deuterium_atom_flux(t: float) -> float: - pulse_type = my_scenario.get_pulse_type(float(t)) + assert isinstance(t, float), f"t should be a float, not {type(t)}" + pulse_type = my_scenario.get_pulse_type(t) - pulse_row = my_scenario.get_row(float(t)) + pulse_row = my_scenario.get_row(t) total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_elapsed = my_scenario.get_time_till_row(pulse_row) - - atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=t-time_elapsed, ion=False) + time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + relative_time = t-time_start_current_pulse + atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=False) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * (1 - tritium_fraction) resting_value = 0.0 return ( flat_top_value - if (float(t)-time_elapsed) % total_time_pulse < total_time_on and (float(t)-time_elapsed) % total_time_pulse != 0.0 + if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 else resting_value ) def tritium_atom_flux(t: float) -> float: - pulse_type = my_scenario.get_pulse_type(float(t)) + assert isinstance(t, float), f"t should be a float, not {type(t)}" + pulse_type = my_scenario.get_pulse_type(t) - pulse_row = my_scenario.get_row(float(t)) + pulse_row = my_scenario.get_row(t) total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_elapsed = my_scenario.get_time_till_row(pulse_row) + time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + relative_time = t-time_start_current_pulse - atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=t-time_elapsed, ion=False) + atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=False) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * tritium_fraction resting_value = 0.0 return ( flat_top_value - if (float(t)-time_elapsed) % total_time_pulse < total_time_on and (float(t)-time_elapsed) % total_time_pulse != 0.0 + if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 else resting_value ) From 4c8a3d45548cea1e8151ea26e85a067e46a395a8 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 19:46:37 -0400 Subject: [PATCH 25/62] simplify return --- mb_scenario.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 17e438f..c9dfe7a 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -196,11 +196,11 @@ def deuterium_ion_flux(t: float) -> float: flat_top_value = ion_flux * (1 - tritium_fraction) resting_value = 0 - return ( - flat_top_value - if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 - else resting_value - ) + is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on + if is_pulse_active: + return flat_top_value + else: + return resting_value # plt.plot(times, [deuterium_ion_flux(t) for t in times], marker="o") # plt.show() @@ -222,11 +222,11 @@ def tritium_ion_flux(t: float) -> float: flat_top_value = ion_flux * tritium_fraction resting_value = 0.0 - return ( - flat_top_value - if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 - else resting_value - ) + is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on + if is_pulse_active: + return flat_top_value + else: + return resting_value def deuterium_atom_flux(t: float) -> float: assert isinstance(t, float), f"t should be a float, not {type(t)}" @@ -242,11 +242,11 @@ def deuterium_atom_flux(t: float) -> float: tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * (1 - tritium_fraction) resting_value = 0.0 - return ( - flat_top_value - if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 - else resting_value - ) + is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on + if is_pulse_active: + return flat_top_value + else: + return resting_value def tritium_atom_flux(t: float) -> float: assert isinstance(t, float), f"t should be a float, not {type(t)}" @@ -262,11 +262,11 @@ def tritium_atom_flux(t: float) -> float: tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * tritium_fraction resting_value = 0.0 - return ( - flat_top_value - if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 - else resting_value - ) + is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on + if is_pulse_active: + return flat_top_value + else: + return resting_value my_model, quantities = make_mb_model( T_function=T_function, From b372b2ca390c0d46830d9da84ecc13bb7bfa85e6 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 19:47:28 -0400 Subject: [PATCH 26/62] black formatting --- mb_scenario.py | 86 ++++++++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 37 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index c9dfe7a..d6b948a 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -30,7 +30,8 @@ "GDC": np.loadtxt("GDC_data.dat", skiprows=1), } -def RISP_data(monob: int, t_rel: float | int) -> NDArray: + +def RISP_data(monob: int, t_rel: float | int) -> NDArray: """Returns the correct RISP data file for indicated monoblock Args: @@ -39,11 +40,11 @@ def RISP_data(monob: int, t_rel: float | int) -> NDArray: t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds Returns: - data: data from correct file as a numpy array + data: data from correct file as a numpy array """ - inner_swept_bins = list(range(46,65)) - outer_swept_bins = list(range(19,34)) - + inner_swept_bins = list(range(46, 65)) + outer_swept_bins = list(range(19, 34)) + if monob in inner_swept_bins: label = "RISP" div = True @@ -72,7 +73,8 @@ def RISP_data(monob: int, t_rel: float | int) -> NDArray: else: data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) - return data[monob-offset_mb,:] + return data[monob - offset_mb, :] + def get_particle_flux(pulse_type: str, monob: int, t_rel: float, ion=True) -> float: """_summary_ @@ -90,23 +92,24 @@ def get_particle_flux(pulse_type: str, monob: int, t_rel: float, ion=True) -> fl if ion: FP_index = 2 other_index = 0 - if not ion: + if not ion: FP_index = 3 other_index = 1 if pulse_type == "FP": flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][monob - 1] - elif pulse_type == "RISP": + elif pulse_type == "RISP": assert isinstance(t_rel, float), f"t_rel should be a float, not {type(t_rel)}" flux = RISP_data(monob=monob, t_rel=t_rel)[other_index] - elif pulse_type == "BAKE": + elif pulse_type == "BAKE": flux = 0.0 - else: + else: flux = pulse_type_to_DINA_data[pulse_type][:, other_index][monob - 1] - + return flux -def heat(nb_mb:int, pulse_type: str, t_rel:float) -> float: + +def heat(nb_mb: int, pulse_type: str, t_rel: float) -> float: """Returns the surface heat flux (W/m2) for a given pulse type Args: @@ -123,7 +126,7 @@ def heat(nb_mb:int, pulse_type: str, t_rel:float) -> float: """ if pulse_type == "RISP": data = RISP_data(nb_mb, t_rel=t_rel) - elif pulse_type in pulse_type_to_DINA_data.keys(): + elif pulse_type in pulse_type_to_DINA_data.keys(): data = pulse_type_to_DINA_data[pulse_type] else: raise ValueError(f"Invalid pulse type {pulse_type}") @@ -159,11 +162,11 @@ def T_function(x: NDArray, t: Constant) -> float: pulse_type = my_scenario.get_pulse_type(float(t)) t_rel = t - my_scenario.get_time_till_row(pulse_row) - if pulse_type == "BAKE": + if pulse_type == "BAKE": T_bake = 483.15 # K flat_top_value = np.full_like(x[0], T_bake) else: - heat_flux = heat(nb_mb, pulse_type, t_rel) + heat_flux = heat(nb_mb, pulse_type, t_rel) T_surface = 1.1e-4 * heat_flux + COOLANT_TEMP T_rear = 2.2e-5 * heat_flux + COOLANT_TEMP a = (T_rear - T_surface) / L @@ -174,10 +177,11 @@ def T_function(x: NDArray, t: Constant) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) - relative_time = t-time_start_current_pulse + relative_time = t - time_start_current_pulse return ( flat_top_value - if relative_time % total_time_pulse < total_time_on and relative_time % total_time_pulse != 0.0 + if relative_time % total_time_pulse < total_time_on + and relative_time % total_time_pulse != 0.0 else resting_value ) @@ -189,14 +193,16 @@ def deuterium_ion_flux(t: float) -> float: total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) - relative_time = t-time_start_current_pulse - - ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=True) + relative_time = t - time_start_current_pulse + + ion_flux = get_particle_flux( + pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=True + ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * (1 - tritium_fraction) resting_value = 0 - - is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on + + is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on if is_pulse_active: return flat_top_value else: @@ -214,15 +220,17 @@ def tritium_ion_flux(t: float) -> float: total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) - relative_time = t-time_start_current_pulse - - ion_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=True) - + relative_time = t - time_start_current_pulse + + ion_flux = get_particle_flux( + pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=True + ) + tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * tritium_fraction resting_value = 0.0 - is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on + is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on if is_pulse_active: return flat_top_value else: @@ -236,13 +244,15 @@ def deuterium_atom_flux(t: float) -> float: total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) - relative_time = t-time_start_current_pulse - atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=False) - + relative_time = t - time_start_current_pulse + atom_flux = get_particle_flux( + pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=False + ) + tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * (1 - tritium_fraction) resting_value = 0.0 - is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on + is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on if is_pulse_active: return flat_top_value else: @@ -251,18 +261,20 @@ def deuterium_atom_flux(t: float) -> float: def tritium_atom_flux(t: float) -> float: assert isinstance(t, float), f"t should be a float, not {type(t)}" pulse_type = my_scenario.get_pulse_type(t) - + pulse_row = my_scenario.get_row(t) total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) - relative_time = t-time_start_current_pulse - - atom_flux = get_particle_flux(pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=False) + relative_time = t - time_start_current_pulse + + atom_flux = get_particle_flux( + pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=False + ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * tritium_fraction resting_value = 0.0 - is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on + is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on if is_pulse_active: return flat_top_value else: @@ -276,7 +288,7 @@ def tritium_atom_flux(t: float) -> float: tritium_atom_flux=tritium_atom_flux, final_time=my_scenario.get_maximum_time(), L=6e-3, - folder=f"mb{nb_mb}_results" + folder=f"mb{nb_mb}_results", ) ############# Run Simu ############# From 31cbd918f3ec9fdf08d76bfbb3b50c9e9045b2dc Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 19:51:11 -0400 Subject: [PATCH 27/62] monob argument is now nb_mb --- mb_scenario.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index d6b948a..4741dda 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -31,11 +31,11 @@ } -def RISP_data(monob: int, t_rel: float | int) -> NDArray: +def RISP_data(nb_mb: int, t_rel: float | int) -> NDArray: """Returns the correct RISP data file for indicated monoblock Args: - monob: mb number + nb_mb: mb number t_rel: t_rel as an integer(in seconds). t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds @@ -45,11 +45,11 @@ def RISP_data(monob: int, t_rel: float | int) -> NDArray: inner_swept_bins = list(range(46, 65)) outer_swept_bins = list(range(19, 34)) - if monob in inner_swept_bins: + if nb_mb in inner_swept_bins: label = "RISP" div = True offset_mb = 46 - elif monob in outer_swept_bins: + elif nb_mb in outer_swept_bins: label = "ROSP" div = True offset_mb = 19 @@ -73,15 +73,15 @@ def RISP_data(monob: int, t_rel: float | int) -> NDArray: else: data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) - return data[monob - offset_mb, :] + return data[nb_mb - offset_mb, :] -def get_particle_flux(pulse_type: str, monob: int, t_rel: float, ion=True) -> float: +def get_particle_flux(pulse_type: str, nb_mb: int, t_rel: float, ion=True) -> float: """_summary_ Args: pulse_type (str): _description_ - monob (int): _description_ + nb_mb (int): _description_ t_rel: t_rel as an integer (in seconds). t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds ion (bool, optional): _description_. Defaults to True. @@ -97,14 +97,14 @@ def get_particle_flux(pulse_type: str, monob: int, t_rel: float, ion=True) -> fl other_index = 1 if pulse_type == "FP": - flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][monob - 1] + flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][nb_mb - 1] elif pulse_type == "RISP": assert isinstance(t_rel, float), f"t_rel should be a float, not {type(t_rel)}" - flux = RISP_data(monob=monob, t_rel=t_rel)[other_index] + flux = RISP_data(nb_mb=nb_mb, t_rel=t_rel)[other_index] elif pulse_type == "BAKE": flux = 0.0 else: - flux = pulse_type_to_DINA_data[pulse_type][:, other_index][monob - 1] + flux = pulse_type_to_DINA_data[pulse_type][:, other_index][nb_mb - 1] return flux @@ -196,7 +196,7 @@ def deuterium_ion_flux(t: float) -> float: relative_time = t - time_start_current_pulse ion_flux = get_particle_flux( - pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=True + pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=True ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * (1 - tritium_fraction) @@ -223,7 +223,7 @@ def tritium_ion_flux(t: float) -> float: relative_time = t - time_start_current_pulse ion_flux = get_particle_flux( - pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=True + pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=True ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] @@ -246,7 +246,7 @@ def deuterium_atom_flux(t: float) -> float: time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) relative_time = t - time_start_current_pulse atom_flux = get_particle_flux( - pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=False + pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=False ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] @@ -269,7 +269,7 @@ def tritium_atom_flux(t: float) -> float: relative_time = t - time_start_current_pulse atom_flux = get_particle_flux( - pulse_type=pulse_type, monob=nb_mb, t_rel=relative_time, ion=False + pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=False ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * tritium_fraction From e56cba1f9fbbb0e13dcd2fe70b13e2bfca27102e Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 20:09:21 -0400 Subject: [PATCH 28/62] comments --- mb_scenario.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 4741dda..ed4febd 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -57,8 +57,9 @@ def RISP_data(nb_mb: int, t_rel: float | int) -> NDArray: div = False offset_mb = 0 - t_rel = int(t_rel) + t_rel = int(t_rel) # convert t_rel to an integer + # NOTE: what is the point of this test since it takes nb_mb as an argument? if div: if 1 <= t_rel <= 9: data = np.loadtxt(f"{label}_data/time0.dat", skiprows=1) @@ -68,7 +69,7 @@ def RISP_data(nb_mb: int, t_rel: float | int) -> NDArray: data = np.loadtxt(f"{label}_data/time{t_rel}.dat", skiprows=1) elif 261 <= t_rel <= 269: data = np.loadtxt(f"{label}_data/time270.dat", skiprows=1) - else: + else: # NOTE: so if time is too large a MB transforms into a FW element??? data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) else: data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) @@ -77,17 +78,17 @@ def RISP_data(nb_mb: int, t_rel: float | int) -> NDArray: def get_particle_flux(pulse_type: str, nb_mb: int, t_rel: float, ion=True) -> float: - """_summary_ + """Returns the particle flux for a given pulse type Args: - pulse_type (str): _description_ - nb_mb (int): _description_ + pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) + nb_mb: monoblock number t_rel: t_rel as an integer (in seconds). t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds ion (bool, optional): _description_. Defaults to True. Returns: - float: _description_ + float: particle flux in part/m2/s """ if ion: FP_index = 2 @@ -145,7 +146,7 @@ def heat(nb_mb: int, pulse_type: str, t_rel: float) -> float: my_scenario = Scenario("scenario_test.txt") nb_mb = 64 - L = 6e-3 + L = 6e-3 # m def T_function(x: NDArray, t: Constant) -> float: """Monoblock temperature function. @@ -208,10 +209,6 @@ def deuterium_ion_flux(t: float) -> float: else: return resting_value - # plt.plot(times, [deuterium_ion_flux(t) for t in times], marker="o") - # plt.show() - # exit() - def tritium_ion_flux(t: float) -> float: assert isinstance(t, float), f"t should be a float, not {type(t)}" pulse_type = my_scenario.get_pulse_type(t) @@ -308,8 +305,6 @@ def tritium_atom_flux(t: float) -> float: plt.show() - # make the same but with a stack plot - fig, ax = plt.subplots() ax.stackplot( @@ -321,4 +316,4 @@ def tritium_atom_flux(t: float) -> float: plt.xlabel("Time (s)") plt.ylabel("Total quantity (atoms/m2)") plt.legend() - # plt.show() + plt.show() From a02f6a2a0a5e9b32776801550852939b55ee4157 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 20:27:23 -0400 Subject: [PATCH 29/62] added docstrings --- src/hisp/festim_mb_model.py | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/hisp/festim_mb_model.py b/src/hisp/festim_mb_model.py index 527fe98..3bde65a 100644 --- a/src/hisp/festim_mb_model.py +++ b/src/hisp/festim_mb_model.py @@ -5,22 +5,37 @@ import festim as F import h_transport_materials as htm -from typing import Callable +from typing import Callable, Tuple, Dict # TODO this is hard coded and show depend on incident energy? implantation_range = 3e-9 # m width = 1e-9 # m def make_mb_model( - T_function: Callable, - deuterium_ion_flux: Callable, - tritium_ion_flux: Callable, - deuterium_atom_flux: Callable, - tritium_atom_flux: Callable, + temperature: Callable | float | int, + deuterium_ion_flux: Callable | float | int, + tritium_ion_flux: Callable | float | int, + deuterium_atom_flux: Callable | float | int, + tritium_atom_flux: Callable | float | int, final_time: float, folder: str, L: float = 6e-3, -): +) -> Tuple[CustomProblem, Dict[str, F.TotalVolume]]: + """Create a FESTIM model for the MB scenario. + + Args: + temperature: the temperature in K. + deuterium_ion_flux: the deuterium ion flux in m^-2 s^-1. + tritium_ion_flux: the tritium ion flux in m^-2 s^-1. + deuterium_atom_flux: the deuterium atom flux in m^-2 s^-1. + tritium_atom_flux: the tritium atom flux in m^-2 s^-1. + final_time: the final time in s. + folder: the folder to save the results. + L: the length of the domain in m. + + Returns: + the FESTIM model, the quantities to export. + """ my_model = CustomProblem() ############# Material Parameters ############# @@ -161,7 +176,7 @@ def make_mb_model( ############# Temperature Parameters (K) ############# - my_model.temperature = T_function + my_model.temperature = temperature ############# Flux Parameters ############# From 770b9e5706cbe40158dbadf9dcfa996e6aad2eb7 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 20:28:44 -0400 Subject: [PATCH 30/62] fixed arg --- mb_scenario.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mb_scenario.py b/mb_scenario.py index ed4febd..d9466f1 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -278,7 +278,7 @@ def tritium_atom_flux(t: float) -> float: return resting_value my_model, quantities = make_mb_model( - T_function=T_function, + temperature=T_function, deuterium_ion_flux=deuterium_ion_flux, tritium_ion_flux=tritium_ion_flux, deuterium_atom_flux=deuterium_atom_flux, From 00f9f8885a459eab3942b2f7f921206a3b2e95d9 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 20:29:18 -0400 Subject: [PATCH 31/62] moved to own submodule --- src/hisp/__init__.py | 2 +- src/hisp/festim_models/__init__.py | 1 + src/hisp/{festim_mb_model.py => festim_models/mb_model.py} | 0 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 src/hisp/festim_models/__init__.py rename src/hisp/{festim_mb_model.py => festim_models/mb_model.py} (100%) diff --git a/src/hisp/__init__.py b/src/hisp/__init__.py index 6aae89f..951266d 100644 --- a/src/hisp/__init__.py +++ b/src/hisp/__init__.py @@ -2,4 +2,4 @@ from .h_transport_class import CustomProblem -from .festim_mb_model import make_mb_model \ No newline at end of file +from .festim_models.mb_model import make_mb_model \ No newline at end of file diff --git a/src/hisp/festim_models/__init__.py b/src/hisp/festim_models/__init__.py new file mode 100644 index 0000000..c70dbda --- /dev/null +++ b/src/hisp/festim_models/__init__.py @@ -0,0 +1 @@ +from .mb_model import make_mb_model \ No newline at end of file diff --git a/src/hisp/festim_mb_model.py b/src/hisp/festim_models/mb_model.py similarity index 100% rename from src/hisp/festim_mb_model.py rename to src/hisp/festim_models/mb_model.py From b8a30c49c09f4f70337307e1fec82285ac6034f7 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 21:25:16 -0400 Subject: [PATCH 32/62] added DINA submodule --- mb_scenario.py | 121 +------------------------------------- src/hisp/__init__.py | 2 +- src/hisp/dina/__init__.py | 1 + src/hisp/dina/dina.py | 119 +++++++++++++++++++++++++++++++++++++ 4 files changed, 122 insertions(+), 121 deletions(-) create mode 100644 src/hisp/dina/__init__.py create mode 100644 src/hisp/dina/dina.py diff --git a/mb_scenario.py b/mb_scenario.py index d9466f1..da0a487 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -3,11 +3,11 @@ import matplotlib.pyplot as plt from dolfinx.fem.function import Constant -import dolfinx from numpy.typing import NDArray from hisp.helpers import Scenario from hisp import make_mb_model +from hisp.dina import get_particle_flux, heat # dolfinx.log.set_log_level(dolfinx.log.LogLevel.INFO) @@ -23,125 +23,6 @@ "BAKE": 0, } -# TODO change the dat file for other pulse types -pulse_type_to_DINA_data = { - "FP": np.loadtxt("Binned_Flux_Data.dat", skiprows=1), - "ICWC": np.loadtxt("ICWC_data.dat", skiprows=1), - "GDC": np.loadtxt("GDC_data.dat", skiprows=1), -} - - -def RISP_data(nb_mb: int, t_rel: float | int) -> NDArray: - """Returns the correct RISP data file for indicated monoblock - - Args: - nb_mb: mb number - t_rel: t_rel as an integer(in seconds). - t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds - - Returns: - data: data from correct file as a numpy array - """ - inner_swept_bins = list(range(46, 65)) - outer_swept_bins = list(range(19, 34)) - - if nb_mb in inner_swept_bins: - label = "RISP" - div = True - offset_mb = 46 - elif nb_mb in outer_swept_bins: - label = "ROSP" - div = True - offset_mb = 19 - else: - div = False - offset_mb = 0 - - t_rel = int(t_rel) # convert t_rel to an integer - - # NOTE: what is the point of this test since it takes nb_mb as an argument? - if div: - if 1 <= t_rel <= 9: - data = np.loadtxt(f"{label}_data/time0.dat", skiprows=1) - elif 10 <= t_rel <= 98: - data = np.loadtxt(f"{label}_data/time10.dat", skiprows=1) - elif 100 <= t_rel <= 260: - data = np.loadtxt(f"{label}_data/time{t_rel}.dat", skiprows=1) - elif 261 <= t_rel <= 269: - data = np.loadtxt(f"{label}_data/time270.dat", skiprows=1) - else: # NOTE: so if time is too large a MB transforms into a FW element??? - data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) - else: - data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) - - return data[nb_mb - offset_mb, :] - - -def get_particle_flux(pulse_type: str, nb_mb: int, t_rel: float, ion=True) -> float: - """Returns the particle flux for a given pulse type - - Args: - pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) - nb_mb: monoblock number - t_rel: t_rel as an integer (in seconds). - t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds - ion (bool, optional): _description_. Defaults to True. - - Returns: - float: particle flux in part/m2/s - """ - if ion: - FP_index = 2 - other_index = 0 - if not ion: - FP_index = 3 - other_index = 1 - - if pulse_type == "FP": - flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][nb_mb - 1] - elif pulse_type == "RISP": - assert isinstance(t_rel, float), f"t_rel should be a float, not {type(t_rel)}" - flux = RISP_data(nb_mb=nb_mb, t_rel=t_rel)[other_index] - elif pulse_type == "BAKE": - flux = 0.0 - else: - flux = pulse_type_to_DINA_data[pulse_type][:, other_index][nb_mb - 1] - - return flux - - -def heat(nb_mb: int, pulse_type: str, t_rel: float) -> float: - """Returns the surface heat flux (W/m2) for a given pulse type - - Args: - nb_mb: monoblock number - pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) - t_rel: t_rel as an integer (in seconds). - t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds - - Raises: - ValueError: if the pulse type is unknown - - Returns: - the surface heat flux in W/m2 - """ - if pulse_type == "RISP": - data = RISP_data(nb_mb, t_rel=t_rel) - elif pulse_type in pulse_type_to_DINA_data.keys(): - data = pulse_type_to_DINA_data[pulse_type] - else: - raise ValueError(f"Invalid pulse type {pulse_type}") - - if pulse_type == "FP": - heat_val = data[:, -2][nb_mb - 1] - elif pulse_type == "RISP": - heat_val = data[-1] - else: - heat_val = data[:, -1][nb_mb - 1] - - return heat_val - - if __name__ == "__main__": my_scenario = Scenario("scenario_test.txt") diff --git a/src/hisp/__init__.py b/src/hisp/__init__.py index 951266d..18f5894 100644 --- a/src/hisp/__init__.py +++ b/src/hisp/__init__.py @@ -2,4 +2,4 @@ from .h_transport_class import CustomProblem -from .festim_models.mb_model import make_mb_model \ No newline at end of file +from .festim_models.mb_model import make_mb_model diff --git a/src/hisp/dina/__init__.py b/src/hisp/dina/__init__.py new file mode 100644 index 0000000..c3da152 --- /dev/null +++ b/src/hisp/dina/__init__.py @@ -0,0 +1 @@ +from .dina import RISP_data, heat, get_particle_flux \ No newline at end of file diff --git a/src/hisp/dina/dina.py b/src/hisp/dina/dina.py new file mode 100644 index 0000000..3a75922 --- /dev/null +++ b/src/hisp/dina/dina.py @@ -0,0 +1,119 @@ +import numpy as np +from numpy.typing import NDArray + + +# TODO change the dat file for other pulse types +pulse_type_to_DINA_data = { + "FP": np.loadtxt("Binned_Flux_Data.dat", skiprows=1), + "ICWC": np.loadtxt("ICWC_data.dat", skiprows=1), + "GDC": np.loadtxt("GDC_data.dat", skiprows=1), +} + +def get_particle_flux(pulse_type: str, nb_mb: int, t_rel: float, ion=True) -> float: + """Returns the particle flux for a given pulse type + + Args: + pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) + nb_mb: monoblock number + t_rel: t_rel as an integer (in seconds). + t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds + ion (bool, optional): _description_. Defaults to True. + + Returns: + float: particle flux in part/m2/s + """ + if ion: + FP_index = 2 + other_index = 0 + if not ion: + FP_index = 3 + other_index = 1 + + if pulse_type == "FP": + flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][nb_mb - 1] + elif pulse_type == "RISP": + assert isinstance(t_rel, float), f"t_rel should be a float, not {type(t_rel)}" + flux = RISP_data(nb_mb=nb_mb, t_rel=t_rel)[other_index] + elif pulse_type == "BAKE": + flux = 0.0 + else: + flux = pulse_type_to_DINA_data[pulse_type][:, other_index][nb_mb - 1] + + return flux + +def RISP_data(nb_mb: int, t_rel: float | int) -> NDArray: + """Returns the correct RISP data file for indicated monoblock + + Args: + nb_mb: mb number + t_rel: t_rel as an integer(in seconds). + t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds + + Returns: + data: data from correct file as a numpy array + """ + inner_swept_bins = list(range(46, 65)) + outer_swept_bins = list(range(19, 34)) + + if nb_mb in inner_swept_bins: + label = "RISP" + div = True + offset_mb = 46 + elif nb_mb in outer_swept_bins: + label = "ROSP" + div = True + offset_mb = 19 + else: + div = False + offset_mb = 0 + + t_rel = int(t_rel) # convert t_rel to an integer + + # NOTE: what is the point of this test since it takes nb_mb as an argument? + if div: + if 1 <= t_rel <= 9: + data = np.loadtxt(f"{label}_data/time0.dat", skiprows=1) + elif 10 <= t_rel <= 98: + data = np.loadtxt(f"{label}_data/time10.dat", skiprows=1) + elif 100 <= t_rel <= 260: + data = np.loadtxt(f"{label}_data/time{t_rel}.dat", skiprows=1) + elif 261 <= t_rel <= 269: + data = np.loadtxt(f"{label}_data/time270.dat", skiprows=1) + else: # NOTE: so if time is too large a MB transforms into a FW element??? + data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) + else: + data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) + + return data[nb_mb - offset_mb, :] + + +def heat(nb_mb: int, pulse_type: str, t_rel: float) -> float: + """Returns the surface heat flux (W/m2) for a given pulse type + + Args: + nb_mb: monoblock number + pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) + t_rel: t_rel as an integer (in seconds). + t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds + + Raises: + ValueError: if the pulse type is unknown + + Returns: + the surface heat flux in W/m2 + """ + if pulse_type == "RISP": + data = RISP_data(nb_mb, t_rel=t_rel) + elif pulse_type in pulse_type_to_DINA_data.keys(): + data = pulse_type_to_DINA_data[pulse_type] + else: + raise ValueError(f"Invalid pulse type {pulse_type}") + + if pulse_type == "FP": + heat_val = data[:, -2][nb_mb - 1] + elif pulse_type == "RISP": + heat_val = data[-1] + else: + heat_val = data[:, -1][nb_mb - 1] + + return heat_val \ No newline at end of file From 4302bf3d0970e09da97a5e3040e480efd1a0ecca Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Fri, 1 Nov 2024 21:27:54 -0400 Subject: [PATCH 33/62] same order for args --- mb_scenario.py | 2 +- src/hisp/dina/dina.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index da0a487..e6a672f 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -48,7 +48,7 @@ def T_function(x: NDArray, t: Constant) -> float: T_bake = 483.15 # K flat_top_value = np.full_like(x[0], T_bake) else: - heat_flux = heat(nb_mb, pulse_type, t_rel) + heat_flux = heat(pulse_type, nb_mb, t_rel) T_surface = 1.1e-4 * heat_flux + COOLANT_TEMP T_rear = 2.2e-5 * heat_flux + COOLANT_TEMP a = (T_rear - T_surface) / L diff --git a/src/hisp/dina/dina.py b/src/hisp/dina/dina.py index 3a75922..c2989c6 100644 --- a/src/hisp/dina/dina.py +++ b/src/hisp/dina/dina.py @@ -87,12 +87,12 @@ def RISP_data(nb_mb: int, t_rel: float | int) -> NDArray: return data[nb_mb - offset_mb, :] -def heat(nb_mb: int, pulse_type: str, t_rel: float) -> float: +def heat(pulse_type: str, nb_mb: int, t_rel: float) -> float: """Returns the surface heat flux (W/m2) for a given pulse type Args: - nb_mb: monoblock number pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) + nb_mb: monoblock number t_rel: t_rel as an integer (in seconds). t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds From b11a351845ddb84679c501a460909ddaae381522 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 13:12:43 -0400 Subject: [PATCH 34/62] initial class and tests --- environment.yml | 1 + src/hisp/scenario.py | 57 +++++++++++++++++++++ test/test_scenario_python.py | 96 ++++++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 src/hisp/scenario.py create mode 100644 test/test_scenario_python.py diff --git a/environment.yml b/environment.yml index 741eaa1..892b004 100644 --- a/environment.yml +++ b/environment.yml @@ -6,6 +6,7 @@ dependencies: - fenics-dolfinx=0.9.0 - matplotlib - scipy + - pandas - pint # need to install pint with conda to avoid conflicts (HTM) - pip - pip: diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py new file mode 100644 index 0000000..d514ef3 --- /dev/null +++ b/src/hisp/scenario.py @@ -0,0 +1,57 @@ +import pandas as pd +from typing import List + +class Pulse: + pulse_type: str + nb_pulses: int + ramp_up: float + steady_state: float + ramp_down: float + waiting: float + + def __init__(self, pulse_type: str, nb_pulses: int, ramp_up: float, steady_state: float, ramp_down: float, waiting: float): + self.pulse_type = pulse_type + self.nb_pulses = nb_pulses + self.ramp_up = ramp_up + self.steady_state = steady_state + self.ramp_down = ramp_down + self.waiting = waiting + + @property + def total_duration(self) -> float: + return self.ramp_up + self.steady_state + self.ramp_down + self.waiting + +class Scenario: + def __init__(self, pulses = None): + self._pulses = pulses if pulses is not None else [] + + @property + def pulses(self) -> List[Pulse]: + return self._pulses + + def to_txt_file(self, filename: str): + df = pd.DataFrame([{ + "pulse_type": pulse.pulse_type, + "nb_pulses": pulse.nb_pulses, + "ramp_up": pulse.ramp_up, + "steady_state": pulse.steady_state, + "ramp_down": pulse.ramp_down, + "waiting": pulse.waiting + } for pulse in self.pulses]) + df.to_csv(filename, index=False) + + @staticmethod + def from_txt_file(filename: str): + df = pd.read_csv(filename) + pulses = [ + Pulse( + pulse_type=row["pulse_type"], + nb_pulses=int(row["nb_pulses"]), + ramp_up=float(row["ramp_up"]), + steady_state=float(row["steady_state"]), + ramp_down=float(row["ramp_down"]), + waiting=float(row["waiting"]), + ) + for _, row in df.iterrows() + ] + return Scenario(pulses) diff --git a/test/test_scenario_python.py b/test/test_scenario_python.py new file mode 100644 index 0000000..70fd826 --- /dev/null +++ b/test/test_scenario_python.py @@ -0,0 +1,96 @@ +from hisp.scenario import Scenario, Pulse + + +def test_scenario(): + scenario = Scenario() + assert len(scenario.pulses) == 0 + + scenario.pulses.append( + Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=0.1, + steady_state=0.2, + ramp_down=0.3, + waiting=0.4, + ) + ) + + assert len(scenario.pulses) == 1 + assert scenario.pulses[0].pulse_type == "FP" + assert scenario.pulses[0].nb_pulses == 2 + assert scenario.pulses[0].ramp_up == 0.1 + assert scenario.pulses[0].steady_state == 0.2 + assert scenario.pulses[0].ramp_down == 0.3 + assert scenario.pulses[0].waiting == 0.4 + + scenario.to_txt_file("test_scenario.txt") + scenario2 = Scenario.from_txt_file("test_scenario.txt") + + assert len(scenario2.pulses) == 1 + assert scenario2.pulses[0].pulse_type == "FP" + assert scenario2.pulses[0].nb_pulses == 2 + assert scenario2.pulses[0].ramp_up == 0.1 + assert scenario2.pulses[0].steady_state == 0.2 + assert scenario2.pulses[0].ramp_down == 0.3 + assert scenario2.pulses[0].waiting == 0.4 + +def test_scenario_several_pulses(): + scenario = Scenario() + assert len(scenario.pulses) == 0 + + scenario.pulses.append( + Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=0.1, + steady_state=0.2, + ramp_down=0.3, + waiting=0.4, + ) + ) + + scenario.pulses.append( + Pulse( + pulse_type="ICWC", + nb_pulses=3, + ramp_up=0.5, + steady_state=0.6, + ramp_down=0.7, + waiting=0.8, + ) + ) + + assert len(scenario.pulses) == 2 + assert scenario.pulses[0].pulse_type == "FP" + assert scenario.pulses[0].nb_pulses == 2 + assert scenario.pulses[0].ramp_up == 0.1 + assert scenario.pulses[0].steady_state == 0.2 + assert scenario.pulses[0].ramp_down == 0.3 + assert scenario.pulses[0].waiting == 0.4 + + assert scenario.pulses[1].pulse_type == "ICWC" + assert scenario.pulses[1].nb_pulses == 3 + assert scenario.pulses[1].ramp_up == 0.5 + assert scenario.pulses[1].steady_state == 0.6 + assert scenario.pulses[1].ramp_down == 0.7 + assert scenario.pulses[1].waiting == 0.8 + + scenario.to_txt_file("test_scenario.txt") + scenario2 = Scenario.from_txt_file("test_scenario.txt") + + assert len(scenario2.pulses) == 2 + assert scenario2.pulses[0].pulse_type == "FP" + assert scenario2.pulses[0].nb_pulses == 2 + assert scenario2.pulses[0].ramp_up == 0.1 + assert scenario2.pulses[0].steady_state == 0.2 + assert scenario2.pulses[0].ramp_down == 0.3 + assert scenario2.pulses[0].waiting == 0.4 + + assert scenario2.pulses[1].pulse_type == "ICWC" + assert scenario2.pulses[1].nb_pulses == 3 + assert scenario2.pulses[1].ramp_up == 0.5 + assert scenario2.pulses[1].steady_state == 0.6 + assert scenario2.pulses[1].ramp_down == 0.7 + assert scenario2.pulses[1].waiting == 0.8 + \ No newline at end of file From 3575686a50f9ca8cbea9d4817db117035cd9ac63 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 13:39:30 -0400 Subject: [PATCH 35/62] ported existing tests --- src/hisp/scenario.py | 105 +++++++++++++++++++++++++++++++++++ test/test_scenario_python.py | 95 ++++++++++++++++++++++++++++++- 2 files changed, 198 insertions(+), 2 deletions(-) diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py index d514ef3..9814688 100644 --- a/src/hisp/scenario.py +++ b/src/hisp/scenario.py @@ -21,6 +21,10 @@ def __init__(self, pulse_type: str, nb_pulses: int, ramp_up: float, steady_state def total_duration(self) -> float: return self.ramp_up + self.steady_state + self.ramp_down + self.waiting + @property + def duration_no_waiting(self) -> float: + return self.total_duration - self.waiting + class Scenario: def __init__(self, pulses = None): self._pulses = pulses if pulses is not None else [] @@ -55,3 +59,104 @@ def from_txt_file(filename: str): for _, row in df.iterrows() ] return Scenario(pulses) + + def get_row(self, t:float) -> int: + """Returns the row of the scenario file that corresponds to the time t. + + Args: + t: the time in seconds + + Returns: + int: the row index of the scenario file corresponding to the time t + """ + current_time = 0 + for i, pulse in enumerate(self.pulses): + phase_duration = pulse.nb_pulses * pulse.total_duration + if t <= current_time + phase_duration: + return i + else: + current_time += phase_duration + + raise ValueError( + f"Time t {t} is out of bounds of the scenario file. Maximum time is {self.get_maximum_time()}" + ) + + def get_pulse(self, t: float) -> Pulse: + """Returns the pulse at time t. + + Args: + t: the time in seconds + + Returns: + Pulse: the pulse at time t + """ + row_idx = self.get_row(t) + return self.pulses[row_idx] + + def get_pulse_type(self, t: float) -> str: + """Returns the pulse type as a string at time t. + + Args: + t: time in seconds + + Returns: + pulse type (eg. FP, ICWC, RISP, GDC, BAKE) + """ + return self.get_pulse(t).pulse_type + + def get_maximum_time(self) -> float: + """Returns the maximum time of the scenario in seconds. + + Returns: + the maximum time of the scenario in seconds + """ + return sum([pulse.nb_pulses * pulse.total_duration for pulse in self.pulses]) + + def get_time_start_current_pulse(self, t: float): + """Returns the time (s) at which the current pulse started. + + Args: + t: the time in seconds + + Returns: + the time at which the current pulse started + """ + current_pulse = self.get_pulse(t) + pulse_index = self.pulses.index(current_pulse) + return sum([pulse.nb_pulses * pulse.total_duration for pulse in self.pulses[:pulse_index]]) + + # TODO this is the same as get_time_start_current_pulse, remove + def get_time_till_row(self, row:int) -> float: + """Returns the time (s) until the row in the scenario file. + + Args: + row: the row index in the scenario file + + Returns: + the time until the row in the scenario file + """ + return sum([pulse.nb_pulses * pulse.total_duration for pulse in self.pulses[:row]]) + + # TODO remove + def get_pulse_duration_no_waiting(self, row:int) -> float: + """Returns the total duration (without the waiting time) of a pulse in seconds for a given row in the file. + + Args: + row: the row index in the scenario file + + Returns: + the total duration of the pulse in seconds + """ + return self.pulses[row].duration_no_waiting + + # TODO remove + def get_pulse_duration(self, row:int) -> float: + """Returns the total duration of a pulse in seconds for a given row in the file. + + Args: + row: the row index in the scenario file + + Returns: + the total duration of the pulse in seconds + """ + return self.pulses[row].total_duration \ No newline at end of file diff --git a/test/test_scenario_python.py b/test/test_scenario_python.py index 70fd826..9daa018 100644 --- a/test/test_scenario_python.py +++ b/test/test_scenario_python.py @@ -1,5 +1,5 @@ from hisp.scenario import Scenario, Pulse - +import pytest def test_scenario(): scenario = Scenario() @@ -93,4 +93,95 @@ def test_scenario_several_pulses(): assert scenario2.pulses[1].steady_state == 0.6 assert scenario2.pulses[1].ramp_down == 0.7 assert scenario2.pulses[1].waiting == 0.8 - \ No newline at end of file + + +def test_maximum_time(): + # BUILD + + pulse1 = Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=455, + steady_state=455, + ramp_down=650, + waiting=1000, + ) + pulse2 = Pulse( + pulse_type="ICWC", + nb_pulses=2, + ramp_up=36, + steady_state=36, + ramp_down=180, + waiting=1000, + ) + my_scenario = Scenario([pulse1, pulse2]) + + + expected_maximum_time = 2 * (455 + 455 + 650 + 1000) + 2 * (36 + 36 + 180 + 1000) + + # RUN + computed_maximum_time = my_scenario.get_maximum_time() + + # TEST + assert computed_maximum_time == expected_maximum_time + + +pulse1 = Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=455, + steady_state=455, + ramp_down=650, + waiting=1000, + ) +pulse2 = Pulse( + pulse_type="ICWC", + nb_pulses=2, + ramp_up=36, + steady_state=36, + ramp_down=180, + waiting=1000, +) +@pytest.mark.parametrize("t, expected_pulse", [(0, pulse1), (6000, pulse2), (1e5, None)]) +def test_get_pulse(t, expected_pulse): + + my_scenario = Scenario([pulse1, pulse2]) + + if expected_pulse is None: + with pytest.raises(ValueError): + my_scenario.get_pulse(t=t) + else: + pulse = my_scenario.get_pulse(t=t) + assert pulse == expected_pulse + +@pytest.mark.parametrize("t, expected_pulse", [(100, pulse1)]) +def test_one_pulse_scenario(t, expected_pulse): + my_scenario = Scenario([expected_pulse]) + + pulse = my_scenario.get_pulse(t=t) + + assert pulse == expected_pulse + +@pytest.mark.parametrize("row, expected_duration", [(0, 2560), (1, 1252)]) +def test_get_pulse_duration(row, expected_duration): + my_scenario = Scenario([pulse1, pulse2]) + + duration = my_scenario.get_pulse_duration(row=row) + + assert duration == expected_duration + +@pytest.mark.parametrize("row, expected_duration", [(0, 1560), (1, 252)]) +def test_get_pulse_duration_no_waiting(row, expected_duration): + my_scenario = Scenario([pulse1, pulse2]) + + duration = my_scenario.get_pulse_duration_no_waiting(row=row) + + assert duration == expected_duration + +@pytest.mark.parametrize("row, expected_time", [(0, 0.0), (1, 5120.0)]) +def test_get_time_till_row(row, expected_time): + my_scenario = Scenario([pulse1, pulse2]) + + elapsed_time = my_scenario.get_time_till_row(row=row) + + assert elapsed_time == expected_time \ No newline at end of file From d4174243359c57bf5bb5986e11f8cd484bb1875f Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 13:40:55 -0400 Subject: [PATCH 36/62] one final test --- test/test_scenario_python.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/test/test_scenario_python.py b/test/test_scenario_python.py index 9daa018..31c0035 100644 --- a/test/test_scenario_python.py +++ b/test/test_scenario_python.py @@ -1,5 +1,7 @@ from hisp.scenario import Scenario, Pulse import pytest +import matplotlib.pyplot as plt +import numpy as np def test_scenario(): scenario = Scenario() @@ -184,4 +186,29 @@ def test_get_time_till_row(row, expected_time): elapsed_time = my_scenario.get_time_till_row(row=row) - assert elapsed_time == expected_time \ No newline at end of file + assert elapsed_time == expected_time + +def test_reading_a_file(): + my_scenario = Scenario([pulse1, pulse2]) + + times = np.linspace(0, my_scenario.get_maximum_time(), 1000) + pulse_types = [] + for t in times: + pulse_type = my_scenario.get_pulse_type(t) + pulse_types.append(pulse_type) + + # color the line based on the pulse type + color = { + "FP": "red", + "ICWC": "blue", + "RISP": "green", + "GDC": "orange", + "BAKE": "purple", + } + + colors = [color[pulse_type] for pulse_type in pulse_types] + + for i in range(len(times) - 1): + plt.plot(times[i : i + 2], np.ones_like(times[i : i + 2]), c=colors[i]) + # plt.xscale("log") + # plt.show() \ No newline at end of file From 9e7d754376269a35176d1db578467f32519c8fa2 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 13:43:47 -0400 Subject: [PATCH 37/62] added temporary warning for RISP --- src/hisp/scenario.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py index 9814688..b72ffe8 100644 --- a/src/hisp/scenario.py +++ b/src/hisp/scenario.py @@ -1,5 +1,6 @@ import pandas as pd from typing import List +import warnings class Pulse: pulse_type: str @@ -19,6 +20,10 @@ def __init__(self, pulse_type: str, nb_pulses: int, ramp_up: float, steady_state @property def total_duration(self) -> float: + all_zeros = self.ramp_up == 0 and self.steady_state == 0 and self.ramp_down == 0 and self.waiting == 0 + if self.pulse_type == "RISP" and all_zeros: + warnings.warn("RISP pulse has all zeros for ramp_up, steady_state, ramp_down, waiting. Using hardcoded values. Please check the values in the scenario file.") + return 10 + 250 + 10 + 1530 return self.ramp_up + self.steady_state + self.ramp_down + self.waiting @property From aab1449f9ff8270612d725798fd9f84c9a4e81a0 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 13:49:49 -0400 Subject: [PATCH 38/62] Use the new scenario class --- mb_scenario.py | 5 +- src/hisp/__init__.py | 3 +- src/hisp/helpers.py | 2 +- src/hisp/scenario.py | 23 +++- test/test_scenario.py | 227 ++++++++++++++++++++++++++--------- test/test_scenario_python.py | 214 --------------------------------- 6 files changed, 201 insertions(+), 273 deletions(-) delete mode 100644 test/test_scenario_python.py diff --git a/mb_scenario.py b/mb_scenario.py index 57ddeeb..d44362a 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -10,7 +10,8 @@ import dolfinx.fem as fem import dolfinx -from hisp.helpers import PulsedSource, Scenario +from hisp.helpers import PulsedSource +from hisp.scenario import Scenario from hisp import CustomProblem # dolfinx.log.set_log_level(dolfinx.log.LogLevel.INFO) @@ -42,7 +43,7 @@ def gaussian_distribution(x, mod=ufl): def make_mb_model(nb_mb, scenario_file): ############# Input Flux, Heat Data ############# - my_scenario = Scenario(scenario_file) + my_scenario = Scenario.from_txt_file(scenario_file, old_format=True) my_model = CustomProblem() diff --git a/src/hisp/__init__.py b/src/hisp/__init__.py index 391c7d9..7666f43 100644 --- a/src/hisp/__init__.py +++ b/src/hisp/__init__.py @@ -1,3 +1,4 @@ -from .helpers import PulsedSource, Scenario +from .helpers import PulsedSource from .h_transport_class import CustomProblem +from .scenario import Scenario, Pulse diff --git a/src/hisp/helpers.py b/src/hisp/helpers.py index 43b18b2..083d2ac 100644 --- a/src/hisp/helpers.py +++ b/src/hisp/helpers.py @@ -36,7 +36,7 @@ def update(self, t: float): self.flux_fenics.value = self.flux(t) -class Scenario: +class ScenarioOld: def __init__(self, filename: str): self.filename = filename data = np.genfromtxt(filename, dtype=str, comments="#") diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py index b72ffe8..14680ff 100644 --- a/src/hisp/scenario.py +++ b/src/hisp/scenario.py @@ -50,7 +50,28 @@ def to_txt_file(self, filename: str): df.to_csv(filename, index=False) @staticmethod - def from_txt_file(filename: str): + def from_txt_file(filename: str, old_format=False): + if old_format: + pulses = [] + with open(filename, "r") as f: + for line in f: + # skip first line + if line.startswith("#"): + continue + + # assume this is the format + pulse_type, nb_pulses, ramp_up, steady_state, ramp_down, waiting = line.split() + pulses.append( + Pulse( + pulse_type=pulse_type, + nb_pulses=int(nb_pulses), + ramp_up=float(ramp_up), + steady_state=float(steady_state), + ramp_down=float(ramp_down), + waiting=float(waiting), + ) + ) + return Scenario(pulses) df = pd.read_csv(filename) pulses = [ Pulse( diff --git a/test/test_scenario.py b/test/test_scenario.py index 2ad8fe0..31c0035 100644 --- a/test/test_scenario.py +++ b/test/test_scenario.py @@ -1,17 +1,124 @@ -from hisp import Scenario -import os +from hisp.scenario import Scenario, Pulse import pytest -import numpy as np import matplotlib.pyplot as plt +import numpy as np -current_dir = os.path.dirname(__file__) -scenario_path = os.path.join(current_dir, "scenario_test.txt") -one_line_scenario_path = os.path.join(current_dir, "one_line_scenario.txt") +def test_scenario(): + scenario = Scenario() + assert len(scenario.pulses) == 0 + + scenario.pulses.append( + Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=0.1, + steady_state=0.2, + ramp_down=0.3, + waiting=0.4, + ) + ) + + assert len(scenario.pulses) == 1 + assert scenario.pulses[0].pulse_type == "FP" + assert scenario.pulses[0].nb_pulses == 2 + assert scenario.pulses[0].ramp_up == 0.1 + assert scenario.pulses[0].steady_state == 0.2 + assert scenario.pulses[0].ramp_down == 0.3 + assert scenario.pulses[0].waiting == 0.4 + + scenario.to_txt_file("test_scenario.txt") + scenario2 = Scenario.from_txt_file("test_scenario.txt") + + assert len(scenario2.pulses) == 1 + assert scenario2.pulses[0].pulse_type == "FP" + assert scenario2.pulses[0].nb_pulses == 2 + assert scenario2.pulses[0].ramp_up == 0.1 + assert scenario2.pulses[0].steady_state == 0.2 + assert scenario2.pulses[0].ramp_down == 0.3 + assert scenario2.pulses[0].waiting == 0.4 + +def test_scenario_several_pulses(): + scenario = Scenario() + assert len(scenario.pulses) == 0 + + scenario.pulses.append( + Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=0.1, + steady_state=0.2, + ramp_down=0.3, + waiting=0.4, + ) + ) + + scenario.pulses.append( + Pulse( + pulse_type="ICWC", + nb_pulses=3, + ramp_up=0.5, + steady_state=0.6, + ramp_down=0.7, + waiting=0.8, + ) + ) + + assert len(scenario.pulses) == 2 + assert scenario.pulses[0].pulse_type == "FP" + assert scenario.pulses[0].nb_pulses == 2 + assert scenario.pulses[0].ramp_up == 0.1 + assert scenario.pulses[0].steady_state == 0.2 + assert scenario.pulses[0].ramp_down == 0.3 + assert scenario.pulses[0].waiting == 0.4 + + assert scenario.pulses[1].pulse_type == "ICWC" + assert scenario.pulses[1].nb_pulses == 3 + assert scenario.pulses[1].ramp_up == 0.5 + assert scenario.pulses[1].steady_state == 0.6 + assert scenario.pulses[1].ramp_down == 0.7 + assert scenario.pulses[1].waiting == 0.8 + + scenario.to_txt_file("test_scenario.txt") + scenario2 = Scenario.from_txt_file("test_scenario.txt") + + assert len(scenario2.pulses) == 2 + assert scenario2.pulses[0].pulse_type == "FP" + assert scenario2.pulses[0].nb_pulses == 2 + assert scenario2.pulses[0].ramp_up == 0.1 + assert scenario2.pulses[0].steady_state == 0.2 + assert scenario2.pulses[0].ramp_down == 0.3 + assert scenario2.pulses[0].waiting == 0.4 + + assert scenario2.pulses[1].pulse_type == "ICWC" + assert scenario2.pulses[1].nb_pulses == 3 + assert scenario2.pulses[1].ramp_up == 0.5 + assert scenario2.pulses[1].steady_state == 0.6 + assert scenario2.pulses[1].ramp_down == 0.7 + assert scenario2.pulses[1].waiting == 0.8 def test_maximum_time(): # BUILD - my_scenario = Scenario(scenario_path) + + pulse1 = Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=455, + steady_state=455, + ramp_down=650, + waiting=1000, + ) + pulse2 = Pulse( + pulse_type="ICWC", + nb_pulses=2, + ramp_up=36, + steady_state=36, + ramp_down=180, + waiting=1000, + ) + my_scenario = Scenario([pulse1, pulse2]) + + expected_maximum_time = 2 * (455 + 455 + 650 + 1000) + 2 * (36 + 36 + 180 + 1000) # RUN @@ -21,75 +128,87 @@ def test_maximum_time(): assert computed_maximum_time == expected_maximum_time -@pytest.mark.parametrize("t, expected_row", [(0, 0), (6000, 1), (1e5, ValueError)]) -def test_get_pulse_row(t, expected_row): - my_scenario = Scenario(scenario_path) - - if isinstance(expected_row, type) and issubclass(expected_row, Exception): - with pytest.raises(expected_row): - my_scenario.get_row(t=t) +pulse1 = Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=455, + steady_state=455, + ramp_down=650, + waiting=1000, + ) +pulse2 = Pulse( + pulse_type="ICWC", + nb_pulses=2, + ramp_up=36, + steady_state=36, + ramp_down=180, + waiting=1000, +) +@pytest.mark.parametrize("t, expected_pulse", [(0, pulse1), (6000, pulse2), (1e5, None)]) +def test_get_pulse(t, expected_pulse): + + my_scenario = Scenario([pulse1, pulse2]) + + if expected_pulse is None: + with pytest.raises(ValueError): + my_scenario.get_pulse(t=t) else: - pulse_row = my_scenario.get_row(t=t) - assert pulse_row == expected_row - - -def test_reading_a_file(): - my_scenario = Scenario(scenario_path) - - times = np.linspace(0, my_scenario.get_maximum_time(), 1000) - pulse_types = [] - for t in times: - pulse_type = my_scenario.get_pulse_type(t) - pulse_types.append(pulse_type) + pulse = my_scenario.get_pulse(t=t) + assert pulse == expected_pulse - # color the line based on the pulse type - color = { - "FP": "red", - "ICWC": "blue", - "RISP": "green", - "GDC": "orange", - "BAKE": "purple", - } - - colors = [color[pulse_type] for pulse_type in pulse_types] - - for i in range(len(times) - 1): - plt.plot(times[i : i + 2], np.ones_like(times[i : i + 2]), c=colors[i]) - # plt.xscale("log") - # plt.show() +@pytest.mark.parametrize("t, expected_pulse", [(100, pulse1)]) +def test_one_pulse_scenario(t, expected_pulse): + my_scenario = Scenario([expected_pulse]) + pulse = my_scenario.get_pulse(t=t) -@pytest.mark.parametrize("t, expected_row", [(100, 0)]) -def test_one_line_scenario(t, expected_row): - my_scenario = Scenario(one_line_scenario_path) - - pulse_row = my_scenario.get_row(t=t) - - assert pulse_row == expected_row - + assert pulse == expected_pulse @pytest.mark.parametrize("row, expected_duration", [(0, 2560), (1, 1252)]) def test_get_pulse_duration(row, expected_duration): - my_scenario = Scenario(scenario_path) + my_scenario = Scenario([pulse1, pulse2]) duration = my_scenario.get_pulse_duration(row=row) assert duration == expected_duration - @pytest.mark.parametrize("row, expected_duration", [(0, 1560), (1, 252)]) def test_get_pulse_duration_no_waiting(row, expected_duration): - my_scenario = Scenario(scenario_path) + my_scenario = Scenario([pulse1, pulse2]) duration = my_scenario.get_pulse_duration_no_waiting(row=row) assert duration == expected_duration - @pytest.mark.parametrize("row, expected_time", [(0, 0.0), (1, 5120.0)]) def test_get_time_till_row(row, expected_time): - my_scenario = Scenario(scenario_path) + my_scenario = Scenario([pulse1, pulse2]) elapsed_time = my_scenario.get_time_till_row(row=row) assert elapsed_time == expected_time + +def test_reading_a_file(): + my_scenario = Scenario([pulse1, pulse2]) + + times = np.linspace(0, my_scenario.get_maximum_time(), 1000) + pulse_types = [] + for t in times: + pulse_type = my_scenario.get_pulse_type(t) + pulse_types.append(pulse_type) + + # color the line based on the pulse type + color = { + "FP": "red", + "ICWC": "blue", + "RISP": "green", + "GDC": "orange", + "BAKE": "purple", + } + + colors = [color[pulse_type] for pulse_type in pulse_types] + + for i in range(len(times) - 1): + plt.plot(times[i : i + 2], np.ones_like(times[i : i + 2]), c=colors[i]) + # plt.xscale("log") + # plt.show() \ No newline at end of file diff --git a/test/test_scenario_python.py b/test/test_scenario_python.py deleted file mode 100644 index 31c0035..0000000 --- a/test/test_scenario_python.py +++ /dev/null @@ -1,214 +0,0 @@ -from hisp.scenario import Scenario, Pulse -import pytest -import matplotlib.pyplot as plt -import numpy as np - -def test_scenario(): - scenario = Scenario() - assert len(scenario.pulses) == 0 - - scenario.pulses.append( - Pulse( - pulse_type="FP", - nb_pulses=2, - ramp_up=0.1, - steady_state=0.2, - ramp_down=0.3, - waiting=0.4, - ) - ) - - assert len(scenario.pulses) == 1 - assert scenario.pulses[0].pulse_type == "FP" - assert scenario.pulses[0].nb_pulses == 2 - assert scenario.pulses[0].ramp_up == 0.1 - assert scenario.pulses[0].steady_state == 0.2 - assert scenario.pulses[0].ramp_down == 0.3 - assert scenario.pulses[0].waiting == 0.4 - - scenario.to_txt_file("test_scenario.txt") - scenario2 = Scenario.from_txt_file("test_scenario.txt") - - assert len(scenario2.pulses) == 1 - assert scenario2.pulses[0].pulse_type == "FP" - assert scenario2.pulses[0].nb_pulses == 2 - assert scenario2.pulses[0].ramp_up == 0.1 - assert scenario2.pulses[0].steady_state == 0.2 - assert scenario2.pulses[0].ramp_down == 0.3 - assert scenario2.pulses[0].waiting == 0.4 - -def test_scenario_several_pulses(): - scenario = Scenario() - assert len(scenario.pulses) == 0 - - scenario.pulses.append( - Pulse( - pulse_type="FP", - nb_pulses=2, - ramp_up=0.1, - steady_state=0.2, - ramp_down=0.3, - waiting=0.4, - ) - ) - - scenario.pulses.append( - Pulse( - pulse_type="ICWC", - nb_pulses=3, - ramp_up=0.5, - steady_state=0.6, - ramp_down=0.7, - waiting=0.8, - ) - ) - - assert len(scenario.pulses) == 2 - assert scenario.pulses[0].pulse_type == "FP" - assert scenario.pulses[0].nb_pulses == 2 - assert scenario.pulses[0].ramp_up == 0.1 - assert scenario.pulses[0].steady_state == 0.2 - assert scenario.pulses[0].ramp_down == 0.3 - assert scenario.pulses[0].waiting == 0.4 - - assert scenario.pulses[1].pulse_type == "ICWC" - assert scenario.pulses[1].nb_pulses == 3 - assert scenario.pulses[1].ramp_up == 0.5 - assert scenario.pulses[1].steady_state == 0.6 - assert scenario.pulses[1].ramp_down == 0.7 - assert scenario.pulses[1].waiting == 0.8 - - scenario.to_txt_file("test_scenario.txt") - scenario2 = Scenario.from_txt_file("test_scenario.txt") - - assert len(scenario2.pulses) == 2 - assert scenario2.pulses[0].pulse_type == "FP" - assert scenario2.pulses[0].nb_pulses == 2 - assert scenario2.pulses[0].ramp_up == 0.1 - assert scenario2.pulses[0].steady_state == 0.2 - assert scenario2.pulses[0].ramp_down == 0.3 - assert scenario2.pulses[0].waiting == 0.4 - - assert scenario2.pulses[1].pulse_type == "ICWC" - assert scenario2.pulses[1].nb_pulses == 3 - assert scenario2.pulses[1].ramp_up == 0.5 - assert scenario2.pulses[1].steady_state == 0.6 - assert scenario2.pulses[1].ramp_down == 0.7 - assert scenario2.pulses[1].waiting == 0.8 - - -def test_maximum_time(): - # BUILD - - pulse1 = Pulse( - pulse_type="FP", - nb_pulses=2, - ramp_up=455, - steady_state=455, - ramp_down=650, - waiting=1000, - ) - pulse2 = Pulse( - pulse_type="ICWC", - nb_pulses=2, - ramp_up=36, - steady_state=36, - ramp_down=180, - waiting=1000, - ) - my_scenario = Scenario([pulse1, pulse2]) - - - expected_maximum_time = 2 * (455 + 455 + 650 + 1000) + 2 * (36 + 36 + 180 + 1000) - - # RUN - computed_maximum_time = my_scenario.get_maximum_time() - - # TEST - assert computed_maximum_time == expected_maximum_time - - -pulse1 = Pulse( - pulse_type="FP", - nb_pulses=2, - ramp_up=455, - steady_state=455, - ramp_down=650, - waiting=1000, - ) -pulse2 = Pulse( - pulse_type="ICWC", - nb_pulses=2, - ramp_up=36, - steady_state=36, - ramp_down=180, - waiting=1000, -) -@pytest.mark.parametrize("t, expected_pulse", [(0, pulse1), (6000, pulse2), (1e5, None)]) -def test_get_pulse(t, expected_pulse): - - my_scenario = Scenario([pulse1, pulse2]) - - if expected_pulse is None: - with pytest.raises(ValueError): - my_scenario.get_pulse(t=t) - else: - pulse = my_scenario.get_pulse(t=t) - assert pulse == expected_pulse - -@pytest.mark.parametrize("t, expected_pulse", [(100, pulse1)]) -def test_one_pulse_scenario(t, expected_pulse): - my_scenario = Scenario([expected_pulse]) - - pulse = my_scenario.get_pulse(t=t) - - assert pulse == expected_pulse - -@pytest.mark.parametrize("row, expected_duration", [(0, 2560), (1, 1252)]) -def test_get_pulse_duration(row, expected_duration): - my_scenario = Scenario([pulse1, pulse2]) - - duration = my_scenario.get_pulse_duration(row=row) - - assert duration == expected_duration - -@pytest.mark.parametrize("row, expected_duration", [(0, 1560), (1, 252)]) -def test_get_pulse_duration_no_waiting(row, expected_duration): - my_scenario = Scenario([pulse1, pulse2]) - - duration = my_scenario.get_pulse_duration_no_waiting(row=row) - - assert duration == expected_duration - -@pytest.mark.parametrize("row, expected_time", [(0, 0.0), (1, 5120.0)]) -def test_get_time_till_row(row, expected_time): - my_scenario = Scenario([pulse1, pulse2]) - - elapsed_time = my_scenario.get_time_till_row(row=row) - - assert elapsed_time == expected_time - -def test_reading_a_file(): - my_scenario = Scenario([pulse1, pulse2]) - - times = np.linspace(0, my_scenario.get_maximum_time(), 1000) - pulse_types = [] - for t in times: - pulse_type = my_scenario.get_pulse_type(t) - pulse_types.append(pulse_type) - - # color the line based on the pulse type - color = { - "FP": "red", - "ICWC": "blue", - "RISP": "green", - "GDC": "orange", - "BAKE": "purple", - } - - colors = [color[pulse_type] for pulse_type in pulse_types] - - for i in range(len(times) - 1): - plt.plot(times[i : i + 2], np.ones_like(times[i : i + 2]), c=colors[i]) - # plt.xscale("log") - # plt.show() \ No newline at end of file From c0050e8523381d8b8ef47852f41c3534baad81ef Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 13:50:30 -0400 Subject: [PATCH 39/62] removed class --- src/hisp/helpers.py | 118 -------------------------------------------- 1 file changed, 118 deletions(-) diff --git a/src/hisp/helpers.py b/src/hisp/helpers.py index 083d2ac..dfe0f7d 100644 --- a/src/hisp/helpers.py +++ b/src/hisp/helpers.py @@ -1,7 +1,6 @@ import festim as F from dolfinx.fem.function import Constant import ufl -import numpy as np class PulsedSource(F.ParticleSource): @@ -34,120 +33,3 @@ def create_value_fenics(self, mesh, temperature, t: Constant): def update(self, t: float): self.flux_fenics.value = self.flux(t) - - -class ScenarioOld: - def __init__(self, filename: str): - self.filename = filename - data = np.genfromtxt(filename, dtype=str, comments="#") - if isinstance(data[0], str): - self.data = [data] - else: - self.data = data - - def get_row(self, t: float): - """Returns the row of the scenario file that corresponds to the time t. - - Args: - t (float): the time in seconds - - Returns: - int: the row index of the scenario file corresponding to the time t - """ - current_time = 0 - for i, row in enumerate(self.data): - nb_pulses = int(row[1]) - phase_duration = nb_pulses * self.get_pulse_duration(i) - if t <= current_time + phase_duration: - return i - else: - current_time += phase_duration - - raise ValueError( - f"Time t {t} is out of bounds of the scenario file. Maximum time is {self.get_maximum_time()}" - ) - - def get_pulse_type(self, t: float) -> str: - """Returns the pulse type as a string at time t. - - Args: - t (float): time in seconds - - Returns: - str: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) - """ - row_idx = self.get_row(t) - return self.data[row_idx][0] - - def get_pulse_duration(self, row: int) -> float: - """Returns the total duration of a pulse in seconds for a given row in the file. - - Args: - row (int): the row index in the scenario file - - Returns: - float: the total duration of the pulse in seconds - """ - row_data = self.data[row] - pulse_type = row_data[0] - if pulse_type == "RISP": # hard coded because it's zero in the files - ramp_up = 10 - steady_state = 250 - ramp_down = 10 - waiting = 1530 - total_duration = ramp_up + steady_state + ramp_down + waiting - return total_duration - - ramp_up = float(row_data[2]) - steady_state = float(row_data[4]) - ramp_down = float(row_data[3]) - waiting = float(row_data[5]) - - total_duration = ramp_up + steady_state + ramp_down + waiting - return total_duration - - def get_pulse_duration_no_waiting(self, row: int) -> float: - """Returns the total duration (without the waiting time) of a pulse in seconds for a given row in the file. - - Args: - row (int): the row index in the scenario file - - Returns: - float: the total duration of the pulse in seconds - """ - row_data = self.data[row] - pulse_type = row_data[0] - if pulse_type == "RISP": # hard coded because it's zero in the files - waiting_time = 1530 - else: - waiting_time = float(row_data[5]) - - duration = self.get_pulse_duration(row) - waiting_time - return duration - - def get_time_till_row(self, row:int) -> float: - """Returns the time that has elapsed in scenario up until start of current row. - - Args: - row (int): the row index in the scenario file - - Returns: - float: the time that has elapsed in scenario until and not including input row. - """ - time_elapsed = 0 - for prev_row_id in range(0,row): - nb_pulses = int(self.data[prev_row_id][1]) - time_elapsed += nb_pulses * self.get_pulse_duration(prev_row_id) - return time_elapsed - - def get_maximum_time(self) -> float: - """Returns the maximum time in seconds for the scenario file. - - Returns: - float: the maximum time in seconds - """ - max_time = 0 - for i, row in enumerate(self.data): - nb_pulses = int(row[1]) - max_time += nb_pulses * self.get_pulse_duration(i) - return max_time From 7029ed67126fb176138c9ec36cf0f3a25a188e6e Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 13:51:40 -0400 Subject: [PATCH 40/62] black formatting --- src/hisp/scenario.py | 77 +++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 23 deletions(-) diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py index 14680ff..69e6233 100644 --- a/src/hisp/scenario.py +++ b/src/hisp/scenario.py @@ -2,6 +2,7 @@ from typing import List import warnings + class Pulse: pulse_type: str nb_pulses: int @@ -10,19 +11,34 @@ class Pulse: ramp_down: float waiting: float - def __init__(self, pulse_type: str, nb_pulses: int, ramp_up: float, steady_state: float, ramp_down: float, waiting: float): + def __init__( + self, + pulse_type: str, + nb_pulses: int, + ramp_up: float, + steady_state: float, + ramp_down: float, + waiting: float, + ): self.pulse_type = pulse_type self.nb_pulses = nb_pulses self.ramp_up = ramp_up self.steady_state = steady_state self.ramp_down = ramp_down self.waiting = waiting - + @property def total_duration(self) -> float: - all_zeros = self.ramp_up == 0 and self.steady_state == 0 and self.ramp_down == 0 and self.waiting == 0 + all_zeros = ( + self.ramp_up == 0 + and self.steady_state == 0 + and self.ramp_down == 0 + and self.waiting == 0 + ) if self.pulse_type == "RISP" and all_zeros: - warnings.warn("RISP pulse has all zeros for ramp_up, steady_state, ramp_down, waiting. Using hardcoded values. Please check the values in the scenario file.") + warnings.warn( + "RISP pulse has all zeros for ramp_up, steady_state, ramp_down, waiting. Using hardcoded values. Please check the values in the scenario file." + ) return 10 + 250 + 10 + 1530 return self.ramp_up + self.steady_state + self.ramp_down + self.waiting @@ -30,23 +46,29 @@ def total_duration(self) -> float: def duration_no_waiting(self) -> float: return self.total_duration - self.waiting + class Scenario: - def __init__(self, pulses = None): + def __init__(self, pulses=None): self._pulses = pulses if pulses is not None else [] - + @property def pulses(self) -> List[Pulse]: return self._pulses def to_txt_file(self, filename: str): - df = pd.DataFrame([{ - "pulse_type": pulse.pulse_type, - "nb_pulses": pulse.nb_pulses, - "ramp_up": pulse.ramp_up, - "steady_state": pulse.steady_state, - "ramp_down": pulse.ramp_down, - "waiting": pulse.waiting - } for pulse in self.pulses]) + df = pd.DataFrame( + [ + { + "pulse_type": pulse.pulse_type, + "nb_pulses": pulse.nb_pulses, + "ramp_up": pulse.ramp_up, + "steady_state": pulse.steady_state, + "ramp_down": pulse.ramp_down, + "waiting": pulse.waiting, + } + for pulse in self.pulses + ] + ) df.to_csv(filename, index=False) @staticmethod @@ -60,7 +82,9 @@ def from_txt_file(filename: str, old_format=False): continue # assume this is the format - pulse_type, nb_pulses, ramp_up, steady_state, ramp_down, waiting = line.split() + pulse_type, nb_pulses, ramp_up, steady_state, ramp_down, waiting = ( + line.split() + ) pulses.append( Pulse( pulse_type=pulse_type, @@ -86,7 +110,7 @@ def from_txt_file(filename: str, old_format=False): ] return Scenario(pulses) - def get_row(self, t:float) -> int: + def get_row(self, t: float) -> int: """Returns the row of the scenario file that corresponds to the time t. Args: @@ -137,7 +161,7 @@ def get_maximum_time(self) -> float: the maximum time of the scenario in seconds """ return sum([pulse.nb_pulses * pulse.total_duration for pulse in self.pulses]) - + def get_time_start_current_pulse(self, t: float): """Returns the time (s) at which the current pulse started. @@ -149,10 +173,15 @@ def get_time_start_current_pulse(self, t: float): """ current_pulse = self.get_pulse(t) pulse_index = self.pulses.index(current_pulse) - return sum([pulse.nb_pulses * pulse.total_duration for pulse in self.pulses[:pulse_index]]) + return sum( + [ + pulse.nb_pulses * pulse.total_duration + for pulse in self.pulses[:pulse_index] + ] + ) # TODO this is the same as get_time_start_current_pulse, remove - def get_time_till_row(self, row:int) -> float: + def get_time_till_row(self, row: int) -> float: """Returns the time (s) until the row in the scenario file. Args: @@ -161,10 +190,12 @@ def get_time_till_row(self, row:int) -> float: Returns: the time until the row in the scenario file """ - return sum([pulse.nb_pulses * pulse.total_duration for pulse in self.pulses[:row]]) + return sum( + [pulse.nb_pulses * pulse.total_duration for pulse in self.pulses[:row]] + ) # TODO remove - def get_pulse_duration_no_waiting(self, row:int) -> float: + def get_pulse_duration_no_waiting(self, row: int) -> float: """Returns the total duration (without the waiting time) of a pulse in seconds for a given row in the file. Args: @@ -176,7 +207,7 @@ def get_pulse_duration_no_waiting(self, row:int) -> float: return self.pulses[row].duration_no_waiting # TODO remove - def get_pulse_duration(self, row:int) -> float: + def get_pulse_duration(self, row: int) -> float: """Returns the total duration of a pulse in seconds for a given row in the file. Args: @@ -185,4 +216,4 @@ def get_pulse_duration(self, row:int) -> float: Returns: the total duration of the pulse in seconds """ - return self.pulses[row].total_duration \ No newline at end of file + return self.pulses[row].total_duration From b73566cbe0a22bcd20b4ceedbdd4052c48c51e5a Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 13:54:39 -0400 Subject: [PATCH 41/62] docs --- src/hisp/scenario.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py index 69e6233..4f9a281 100644 --- a/src/hisp/scenario.py +++ b/src/hisp/scenario.py @@ -48,7 +48,12 @@ def duration_no_waiting(self) -> float: class Scenario: - def __init__(self, pulses=None): + def __init__(self, pulses: List[Pulse] = None): + """Initializes a Scenario object containing several pulses. + + Args: + pulses: The list of pulses in the scenario. Each pulse is a Pulse object. + """ self._pulses = pulses if pulses is not None else [] @property @@ -72,7 +77,7 @@ def to_txt_file(self, filename: str): df.to_csv(filename, index=False) @staticmethod - def from_txt_file(filename: str, old_format=False): + def from_txt_file(filename: str, old_format=False) -> "Scenario": if old_format: pulses = [] with open(filename, "r") as f: From 75f61a687d8fff05c1b4def2c743d89b49b77336 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 13:56:27 -0400 Subject: [PATCH 42/62] black + removed txt files --- test/one_line_scenario.txt | 2 -- test/scenario_test.txt | 3 --- test/test_scenario.py | 32 +++++++++++++++++++++----------- 3 files changed, 21 insertions(+), 16 deletions(-) delete mode 100644 test/one_line_scenario.txt delete mode 100644 test/scenario_test.txt diff --git a/test/one_line_scenario.txt b/test/one_line_scenario.txt deleted file mode 100644 index 328054b..0000000 --- a/test/one_line_scenario.txt +++ /dev/null @@ -1,2 +0,0 @@ -# PULSE TYPE, NUMBER OF PULSES, RAMP UP, RAMP DOWN, STEADY STATE, WAITING -FP 2 455 455 650 1000 \ No newline at end of file diff --git a/test/scenario_test.txt b/test/scenario_test.txt deleted file mode 100644 index 15ff0dc..0000000 --- a/test/scenario_test.txt +++ /dev/null @@ -1,3 +0,0 @@ -# PULSE TYPE, NUMBER OF PULSES, RAMP UP, RAMP DOWN, STEADY STATE, WAITING -FP 2 455 455 650 1000 -ICWC 2 36 36 180 1000 \ No newline at end of file diff --git a/test/test_scenario.py b/test/test_scenario.py index 31c0035..aefb7d3 100644 --- a/test/test_scenario.py +++ b/test/test_scenario.py @@ -3,6 +3,7 @@ import matplotlib.pyplot as plt import numpy as np + def test_scenario(): scenario = Scenario() assert len(scenario.pulses) == 0 @@ -37,6 +38,7 @@ def test_scenario(): assert scenario2.pulses[0].ramp_down == 0.3 assert scenario2.pulses[0].waiting == 0.4 + def test_scenario_several_pulses(): scenario = Scenario() assert len(scenario.pulses) == 0 @@ -118,7 +120,6 @@ def test_maximum_time(): ) my_scenario = Scenario([pulse1, pulse2]) - expected_maximum_time = 2 * (455 + 455 + 650 + 1000) + 2 * (36 + 36 + 180 + 1000) # RUN @@ -129,13 +130,13 @@ def test_maximum_time(): pulse1 = Pulse( - pulse_type="FP", - nb_pulses=2, - ramp_up=455, - steady_state=455, - ramp_down=650, - waiting=1000, - ) + pulse_type="FP", + nb_pulses=2, + ramp_up=455, + steady_state=455, + ramp_down=650, + waiting=1000, +) pulse2 = Pulse( pulse_type="ICWC", nb_pulses=2, @@ -144,18 +145,23 @@ def test_maximum_time(): ramp_down=180, waiting=1000, ) -@pytest.mark.parametrize("t, expected_pulse", [(0, pulse1), (6000, pulse2), (1e5, None)]) + + +@pytest.mark.parametrize( + "t, expected_pulse", [(0, pulse1), (6000, pulse2), (1e5, None)] +) def test_get_pulse(t, expected_pulse): my_scenario = Scenario([pulse1, pulse2]) - if expected_pulse is None: + if expected_pulse is None: with pytest.raises(ValueError): my_scenario.get_pulse(t=t) else: pulse = my_scenario.get_pulse(t=t) assert pulse == expected_pulse + @pytest.mark.parametrize("t, expected_pulse", [(100, pulse1)]) def test_one_pulse_scenario(t, expected_pulse): my_scenario = Scenario([expected_pulse]) @@ -164,6 +170,7 @@ def test_one_pulse_scenario(t, expected_pulse): assert pulse == expected_pulse + @pytest.mark.parametrize("row, expected_duration", [(0, 2560), (1, 1252)]) def test_get_pulse_duration(row, expected_duration): my_scenario = Scenario([pulse1, pulse2]) @@ -172,6 +179,7 @@ def test_get_pulse_duration(row, expected_duration): assert duration == expected_duration + @pytest.mark.parametrize("row, expected_duration", [(0, 1560), (1, 252)]) def test_get_pulse_duration_no_waiting(row, expected_duration): my_scenario = Scenario([pulse1, pulse2]) @@ -180,6 +188,7 @@ def test_get_pulse_duration_no_waiting(row, expected_duration): assert duration == expected_duration + @pytest.mark.parametrize("row, expected_time", [(0, 0.0), (1, 5120.0)]) def test_get_time_till_row(row, expected_time): my_scenario = Scenario([pulse1, pulse2]) @@ -188,6 +197,7 @@ def test_get_time_till_row(row, expected_time): assert elapsed_time == expected_time + def test_reading_a_file(): my_scenario = Scenario([pulse1, pulse2]) @@ -211,4 +221,4 @@ def test_reading_a_file(): for i in range(len(times) - 1): plt.plot(times[i : i + 2], np.ones_like(times[i : i + 2]), c=colors[i]) # plt.xscale("log") - # plt.show() \ No newline at end of file + # plt.show() From 0836e1e65baff713cd21c6c0adcd022304e94c99 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 14:03:29 -0400 Subject: [PATCH 43/62] added tests for Pulse + better handling of RISP --- src/hisp/scenario.py | 13 +++++--- test/test_pulse.py | 75 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 test/test_pulse.py diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py index 4f9a281..aa33012 100644 --- a/src/hisp/scenario.py +++ b/src/hisp/scenario.py @@ -36,10 +36,15 @@ def total_duration(self) -> float: and self.waiting == 0 ) if self.pulse_type == "RISP" and all_zeros: - warnings.warn( - "RISP pulse has all zeros for ramp_up, steady_state, ramp_down, waiting. Using hardcoded values. Please check the values in the scenario file." - ) - return 10 + 250 + 10 + 1530 + msg = "RISP pulse has all zeros for ramp_up, steady_state, ramp_down, waiting. " + msg += "Setting hardcoded values. Please check the values in the scenario file." + warnings.warn(msg, UserWarning) + + self.ramp_up = 10 + self.steady_state = 250 + self.ramp_down = 10 + self.waiting = 1530 + return self.ramp_up + self.steady_state + self.ramp_down + self.waiting @property diff --git a/test/test_pulse.py b/test/test_pulse.py new file mode 100644 index 0000000..631fdf6 --- /dev/null +++ b/test/test_pulse.py @@ -0,0 +1,75 @@ +from hisp import Pulse + +import pytest + +def test_pulse_initialization(): + pulse = Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=0.1, + steady_state=0.2, + ramp_down=0.3, + waiting=0.4, + ) + + assert pulse.pulse_type == "FP" + assert pulse.nb_pulses == 2 + assert pulse.ramp_up == 0.1 + assert pulse.steady_state == 0.2 + assert pulse.ramp_down == 0.3 + assert pulse.waiting == 0.4 + + +def test_pulse_total_duration(): + pulse = Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=0.1, + steady_state=0.2, + ramp_down=0.3, + waiting=0.4, + ) + + assert pulse.total_duration == 1.0 + + +def test_pulse_total_duration_with_zeros(): + pulse = Pulse( + pulse_type="RISP", + nb_pulses=1, + ramp_up=0.0, + steady_state=0.0, + ramp_down=0.0, + waiting=0.0, + ) + + assert pulse.total_duration == 1800.0 + +def test_pulse_risp_with_zeros_raises_warning(): + with pytest.warns(UserWarning): + pulse = Pulse( + pulse_type="RISP", + nb_pulses=1, + ramp_up=0.0, + steady_state=0.0, + ramp_down=0.0, + waiting=0.0, + ) + pulse.total_duration + assert pulse.ramp_up != 0.0 + assert pulse.steady_state != 0.0 + assert pulse.ramp_down != 0.0 + assert pulse.waiting != 0.0 + +def test_pulse_duration_no_waiting(): + pulse = Pulse( + pulse_type="FP", + nb_pulses=2, + ramp_up=0.1, + steady_state=0.2, + ramp_down=0.3, + waiting=0.4, + ) + + assert pulse.duration_no_waiting == 0.6 + assert pulse.duration_no_waiting == pulse.total_duration - pulse.waiting \ No newline at end of file From c2e3d6fd06cde5ce261562f78d6e0a5aeb0f9cc9 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 14:22:22 -0400 Subject: [PATCH 44/62] added one test for no waiting --- test/test_pulse.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_pulse.py b/test/test_pulse.py index 631fdf6..e5445be 100644 --- a/test/test_pulse.py +++ b/test/test_pulse.py @@ -45,6 +45,18 @@ def test_pulse_total_duration_with_zeros(): assert pulse.total_duration == 1800.0 +def test_pulse_total_duration_no_waiting_with_zeros(): + pulse = Pulse( + pulse_type="RISP", + nb_pulses=1, + ramp_up=0.0, + steady_state=0.0, + ramp_down=0.0, + waiting=0.0, + ) + + assert pulse.duration_no_waiting == 270.0 + def test_pulse_risp_with_zeros_raises_warning(): with pytest.warns(UserWarning): pulse = Pulse( From 7ef3e3240b967486f48c9174208ad2a4588ae312 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 14:35:42 -0400 Subject: [PATCH 45/62] removed unused line --- src/hisp/h_transport_class.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hisp/h_transport_class.py b/src/hisp/h_transport_class.py index f722739..bc952ef 100644 --- a/src/hisp/h_transport_class.py +++ b/src/hisp/h_transport_class.py @@ -33,7 +33,6 @@ def define_temperature(self): mesh=self.mesh.mesh, value=self.temperature(t=float(self.t)) ) else: - x = ufl.SpatialCoordinate(self.mesh.mesh) degree = 1 element_temperature = basix.ufl.element( basix.ElementFamily.P, From aeccaab637951a2f694fadd973215ce05fb1db75 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 14:39:23 -0400 Subject: [PATCH 46/62] added test for make_mb_model --- test/test_mb_model_festim.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/test_mb_model_festim.py diff --git a/test/test_mb_model_festim.py b/test/test_mb_model_festim.py new file mode 100644 index 0000000..c79cf47 --- /dev/null +++ b/test/test_mb_model_festim.py @@ -0,0 +1,29 @@ +from hisp.festim_models.mb_model import make_mb_model + +import festim as F + +import pytest + +@pytest.mark.parametrize("temp", [400, lambda t: 400 + 1, lambda x, t: 400 + t - x[0]]) +def test_mb_model(temp): + """Builds a festim model, run it, and tests the output. + """ + (mb_model, quantities) = make_mb_model( + temperature=temp, + deuterium_ion_flux=lambda _: 1e22, + deuterium_atom_flux=lambda _: 1e22, + tritium_ion_flux=lambda _: 1e22, + tritium_atom_flux=lambda _: 1e22, + final_time=50, + folder="." + ) + + mb_model.initialise() + mb_model.run() + + # TEST + assert isinstance(quantities, dict) + for key, value in quantities.items(): + assert isinstance(key, str) + assert isinstance(value, F.TotalVolume) + assert len(value.data) > 0 From f9a7671abf5f1cf01dd9c3d6096f8edb1e30dcf4 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 14:39:31 -0400 Subject: [PATCH 47/62] correct type hinting --- src/hisp/festim_models/mb_model.py | 8 ++++---- src/hisp/helpers.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hisp/festim_models/mb_model.py b/src/hisp/festim_models/mb_model.py index 3bde65a..8c8fb51 100644 --- a/src/hisp/festim_models/mb_model.py +++ b/src/hisp/festim_models/mb_model.py @@ -13,10 +13,10 @@ def make_mb_model( temperature: Callable | float | int, - deuterium_ion_flux: Callable | float | int, - tritium_ion_flux: Callable | float | int, - deuterium_atom_flux: Callable | float | int, - tritium_atom_flux: Callable | float | int, + deuterium_ion_flux: Callable, + tritium_ion_flux: Callable, + deuterium_atom_flux: Callable, + tritium_atom_flux: Callable, final_time: float, folder: str, L: float = 6e-3, diff --git a/src/hisp/helpers.py b/src/hisp/helpers.py index 751a2bf..d3062dd 100644 --- a/src/hisp/helpers.py +++ b/src/hisp/helpers.py @@ -10,7 +10,7 @@ def __init__(self, flux, distribution, volume, species): """Initalizes flux and distribution for PulsedSource. Args: - flux (float): the input flux value from DINA data + flux (callable): the input flux value from DINA data distribution (function of x): distribution of flux throughout mb volume (F.VolumeSubdomain1D): volume where this flux is imposed species (F.species): species of flux (e.g. D/T) From 5711fc0fd33b1296f76332b738421bb8f36775e0 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 14:41:47 -0400 Subject: [PATCH 48/62] black --- test/test_mb_model_festim.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_mb_model_festim.py b/test/test_mb_model_festim.py index c79cf47..34b87ce 100644 --- a/test/test_mb_model_festim.py +++ b/test/test_mb_model_festim.py @@ -4,10 +4,10 @@ import pytest + @pytest.mark.parametrize("temp", [400, lambda t: 400 + 1, lambda x, t: 400 + t - x[0]]) def test_mb_model(temp): - """Builds a festim model, run it, and tests the output. - """ + """Builds a festim model, run it, and tests the output.""" (mb_model, quantities) = make_mb_model( temperature=temp, deuterium_ion_flux=lambda _: 1e22, @@ -15,7 +15,7 @@ def test_mb_model(temp): tritium_ion_flux=lambda _: 1e22, tritium_atom_flux=lambda _: 1e22, final_time=50, - folder="." + folder=".", ) mb_model.initialise() From 29dbd72d5167b47305856a2335ec3ab405f5270d Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 17:00:22 -0400 Subject: [PATCH 49/62] everything as FilesDINA --- mb_scenario.py | 22 +++- src/hisp/dina/__init__.py | 2 +- src/hisp/dina/dina.py | 242 ++++++++++++++++++++------------------ 3 files changed, 143 insertions(+), 123 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index e6a672f..0b57479 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -7,7 +7,7 @@ from hisp.helpers import Scenario from hisp import make_mb_model -from hisp.dina import get_particle_flux, heat +from hisp.dina import FilesDINA # dolfinx.log.set_log_level(dolfinx.log.LogLevel.INFO) @@ -25,6 +25,16 @@ if __name__ == "__main__": my_scenario = Scenario("scenario_test.txt") + my_dina_files = FilesDINA( + pulse_type_to_data = { + "FP": np.loadtxt("Binned_Flux_Data.dat", skiprows=1), + "ICWC": np.loadtxt("ICWC_data.dat", skiprows=1), + "GDC": np.loadtxt("GDC_data.dat", skiprows=1), + }, + path_to_ROSP_data="ROSP_data", + path_to_RISP_data="RISP_data", + path_to_RISP_wall_data="RISP_Wall_data.dat", + ) nb_mb = 64 L = 6e-3 # m @@ -48,7 +58,7 @@ def T_function(x: NDArray, t: Constant) -> float: T_bake = 483.15 # K flat_top_value = np.full_like(x[0], T_bake) else: - heat_flux = heat(pulse_type, nb_mb, t_rel) + heat_flux = my_dina_files.heat(pulse_type, nb_mb, t_rel) T_surface = 1.1e-4 * heat_flux + COOLANT_TEMP T_rear = 2.2e-5 * heat_flux + COOLANT_TEMP a = (T_rear - T_surface) / L @@ -77,7 +87,7 @@ def deuterium_ion_flux(t: float) -> float: time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) relative_time = t - time_start_current_pulse - ion_flux = get_particle_flux( + ion_flux = my_dina_files.get_particle_flux( pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=True ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] @@ -100,7 +110,7 @@ def tritium_ion_flux(t: float) -> float: time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) relative_time = t - time_start_current_pulse - ion_flux = get_particle_flux( + ion_flux = my_dina_files.get_particle_flux( pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=True ) @@ -123,7 +133,7 @@ def deuterium_atom_flux(t: float) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) relative_time = t - time_start_current_pulse - atom_flux = get_particle_flux( + atom_flux = my_dina_files.get_particle_flux( pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=False ) @@ -146,7 +156,7 @@ def tritium_atom_flux(t: float) -> float: time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) relative_time = t - time_start_current_pulse - atom_flux = get_particle_flux( + atom_flux = my_dina_files.get_particle_flux( pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=False ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] diff --git a/src/hisp/dina/__init__.py b/src/hisp/dina/__init__.py index c3da152..e7d1bc9 100644 --- a/src/hisp/dina/__init__.py +++ b/src/hisp/dina/__init__.py @@ -1 +1 @@ -from .dina import RISP_data, heat, get_particle_flux \ No newline at end of file +from .dina import FilesDINA \ No newline at end of file diff --git a/src/hisp/dina/dina.py b/src/hisp/dina/dina.py index c2989c6..fc5133c 100644 --- a/src/hisp/dina/dina.py +++ b/src/hisp/dina/dina.py @@ -1,119 +1,129 @@ import numpy as np from numpy.typing import NDArray - -# TODO change the dat file for other pulse types -pulse_type_to_DINA_data = { - "FP": np.loadtxt("Binned_Flux_Data.dat", skiprows=1), - "ICWC": np.loadtxt("ICWC_data.dat", skiprows=1), - "GDC": np.loadtxt("GDC_data.dat", skiprows=1), -} - -def get_particle_flux(pulse_type: str, nb_mb: int, t_rel: float, ion=True) -> float: - """Returns the particle flux for a given pulse type - - Args: - pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) - nb_mb: monoblock number - t_rel: t_rel as an integer (in seconds). - t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds - ion (bool, optional): _description_. Defaults to True. - - Returns: - float: particle flux in part/m2/s - """ - if ion: - FP_index = 2 - other_index = 0 - if not ion: - FP_index = 3 - other_index = 1 - - if pulse_type == "FP": - flux = pulse_type_to_DINA_data[pulse_type][:, FP_index][nb_mb - 1] - elif pulse_type == "RISP": - assert isinstance(t_rel, float), f"t_rel should be a float, not {type(t_rel)}" - flux = RISP_data(nb_mb=nb_mb, t_rel=t_rel)[other_index] - elif pulse_type == "BAKE": - flux = 0.0 - else: - flux = pulse_type_to_DINA_data[pulse_type][:, other_index][nb_mb - 1] - - return flux - -def RISP_data(nb_mb: int, t_rel: float | int) -> NDArray: - """Returns the correct RISP data file for indicated monoblock - - Args: - nb_mb: mb number - t_rel: t_rel as an integer(in seconds). - t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds - - Returns: - data: data from correct file as a numpy array - """ - inner_swept_bins = list(range(46, 65)) - outer_swept_bins = list(range(19, 34)) - - if nb_mb in inner_swept_bins: - label = "RISP" - div = True - offset_mb = 46 - elif nb_mb in outer_swept_bins: - label = "ROSP" - div = True - offset_mb = 19 - else: - div = False - offset_mb = 0 - - t_rel = int(t_rel) # convert t_rel to an integer - - # NOTE: what is the point of this test since it takes nb_mb as an argument? - if div: - if 1 <= t_rel <= 9: - data = np.loadtxt(f"{label}_data/time0.dat", skiprows=1) - elif 10 <= t_rel <= 98: - data = np.loadtxt(f"{label}_data/time10.dat", skiprows=1) - elif 100 <= t_rel <= 260: - data = np.loadtxt(f"{label}_data/time{t_rel}.dat", skiprows=1) - elif 261 <= t_rel <= 269: - data = np.loadtxt(f"{label}_data/time270.dat", skiprows=1) - else: # NOTE: so if time is too large a MB transforms into a FW element??? - data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) - else: - data = np.loadtxt("RISP_Wall_data.dat", skiprows=1) - - return data[nb_mb - offset_mb, :] - - -def heat(pulse_type: str, nb_mb: int, t_rel: float) -> float: - """Returns the surface heat flux (W/m2) for a given pulse type - - Args: - pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) - nb_mb: monoblock number - t_rel: t_rel as an integer (in seconds). - t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds - - Raises: - ValueError: if the pulse type is unknown - - Returns: - the surface heat flux in W/m2 - """ - if pulse_type == "RISP": - data = RISP_data(nb_mb, t_rel=t_rel) - elif pulse_type in pulse_type_to_DINA_data.keys(): - data = pulse_type_to_DINA_data[pulse_type] - else: - raise ValueError(f"Invalid pulse type {pulse_type}") - - if pulse_type == "FP": - heat_val = data[:, -2][nb_mb - 1] - elif pulse_type == "RISP": - heat_val = data[-1] - else: - heat_val = data[:, -1][nb_mb - 1] - - return heat_val \ No newline at end of file +from typing import Dict + + +class FilesDINA: + def __init__( + self, + pulse_type_to_data: Dict[str, NDArray], + path_to_RISP_data: str, + path_to_ROSP_data: str, + path_to_RISP_wall_data: str, + ): + self.pulse_type_to_data = pulse_type_to_data + self.path_to_RISP_data = path_to_RISP_data + self.path_to_ROSP_data = path_to_ROSP_data + self.path_to_RISP_wall_data = path_to_RISP_wall_data + + def get_particle_flux( + self, pulse_type: str, nb_mb: int, t_rel: float, ion=True + ) -> float: + """Returns the particle flux for a given pulse type + + Args: + pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) + nb_mb: monoblock number + t_rel: t_rel as an integer (in seconds). + t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds + ion (bool, optional): _description_. Defaults to True. + + Returns: + float: particle flux in part/m2/s + """ + if ion: + FP_index = 2 + other_index = 0 + if not ion: + FP_index = 3 + other_index = 1 + + if pulse_type == "FP": + flux = self.pulse_type_to_data[pulse_type][:, FP_index][nb_mb - 1] + elif pulse_type == "RISP": + assert isinstance( + t_rel, float + ), f"t_rel should be a float, not {type(t_rel)}" + flux = self.RISP_data(nb_mb=nb_mb, t_rel=t_rel)[other_index] + elif pulse_type == "BAKE": + flux = 0.0 + else: + flux = self.pulse_type_to_data[pulse_type][:, other_index][nb_mb - 1] + + return flux + + def RISP_data(self, nb_mb: int, t_rel: float | int) -> NDArray: + """Returns the correct RISP data file for indicated monoblock + + Args: + nb_mb: mb number + t_rel: t_rel as an integer(in seconds). + t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds + + Returns: + data: data from correct file as a numpy array + """ + inner_swept_bins = list(range(46, 65)) + outer_swept_bins = list(range(19, 34)) + + if nb_mb in inner_swept_bins: + folder = self.path_to_RISP_data + div = True + offset_mb = 46 + elif nb_mb in outer_swept_bins: + folder = self.path_to_ROSP_data + div = True + offset_mb = 19 + else: + div = False + offset_mb = 0 + + t_rel = int(t_rel) + # NOTE: what is the point of this test since it takes nb_mb as an argument? + if div: + if 1 <= t_rel <= 9: + data = np.loadtxt(f"{folder}/time0.dat", skiprows=1) + elif 10 <= t_rel <= 98: + data = np.loadtxt(f"{folder}/time10.dat", skiprows=1) + elif 100 <= t_rel <= 260: + data = np.loadtxt(f"{folder}/time{t_rel}.dat", skiprows=1) + elif 261 <= t_rel <= 269: + data = np.loadtxt(f"{folder}/time270.dat", skiprows=1) + else: # NOTE: so if time is too large a MB transforms into a FW element??? + data = np.loadtxt(self.path_to_RISP_wall_data, skiprows=1) + else: + data = np.loadtxt(self.path_to_RISP_wall_data, skiprows=1) + + return data[nb_mb - offset_mb, :] + + def heat(self, pulse_type: str, nb_mb: int, t_rel: float) -> float: + """Returns the surface heat flux (W/m2) for a given pulse type + + Args: + pulse_type: pulse type (eg. FP, ICWC, RISP, GDC, BAKE) + nb_mb: monoblock number + t_rel: t_rel as an integer (in seconds). + t_rel = t - t_pulse_start where t_pulse_start is the start of the pulse in seconds + + Raises: + ValueError: if the pulse type is unknown + + Returns: + the surface heat flux in W/m2 + """ + if pulse_type == "RISP": + data = self.RISP_data(nb_mb, t_rel=t_rel) + elif pulse_type in self.pulse_type_to_data.keys(): + data = self.pulse_type_to_data[pulse_type] + else: + raise ValueError(f"Invalid pulse type {pulse_type}") + + if pulse_type == "FP": + heat_val = data[:, -2][nb_mb - 1] + elif pulse_type == "RISP": + heat_val = data[-1] + else: + heat_val = data[:, -1][nb_mb - 1] + + return heat_val From 4c5ed004e0635d7d7e8f844f3c9cf124c176775b Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 19:55:59 -0400 Subject: [PATCH 50/62] renamed class --- mb_scenario.py | 14 +++++++------- src/hisp/dina/__init__.py | 1 - src/hisp/plamsa_data_handling/__init__.py | 1 + .../{dina/dina.py => plamsa_data_handling/main.py} | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 src/hisp/dina/__init__.py create mode 100644 src/hisp/plamsa_data_handling/__init__.py rename src/hisp/{dina/dina.py => plamsa_data_handling/main.py} (99%) diff --git a/mb_scenario.py b/mb_scenario.py index 260e90a..41f5ebd 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -6,7 +6,7 @@ from numpy.typing import NDArray from hisp import make_mb_model -from hisp.dina import FilesDINA +from hisp.plamsa_data_handling import PlasmaDataHandling from hisp.festim_models import make_mb_model from hisp.scenario import Scenario @@ -26,7 +26,7 @@ if __name__ == "__main__": my_scenario = Scenario.from_txt_file("scenario_test.txt", old_format=True) - my_dina_files = FilesDINA( + plasma_data_handling = PlasmaDataHandling( pulse_type_to_data = { "FP": np.loadtxt("Binned_Flux_Data.dat", skiprows=1), "ICWC": np.loadtxt("ICWC_data.dat", skiprows=1), @@ -59,7 +59,7 @@ def T_function(x: NDArray, t: Constant) -> float: T_bake = 483.15 # K flat_top_value = np.full_like(x[0], T_bake) else: - heat_flux = my_dina_files.heat(pulse_type, nb_mb, t_rel) + heat_flux = plasma_data_handling.heat(pulse_type, nb_mb, t_rel) T_surface = 1.1e-4 * heat_flux + COOLANT_TEMP T_rear = 2.2e-5 * heat_flux + COOLANT_TEMP a = (T_rear - T_surface) / L @@ -88,7 +88,7 @@ def deuterium_ion_flux(t: float) -> float: time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) relative_time = t - time_start_current_pulse - ion_flux = my_dina_files.get_particle_flux( + ion_flux = plasma_data_handling.get_particle_flux( pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=True ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] @@ -111,7 +111,7 @@ def tritium_ion_flux(t: float) -> float: time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) relative_time = t - time_start_current_pulse - ion_flux = my_dina_files.get_particle_flux( + ion_flux = plasma_data_handling.get_particle_flux( pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=True ) @@ -134,7 +134,7 @@ def deuterium_atom_flux(t: float) -> float: total_time_pulse = my_scenario.get_pulse_duration(pulse_row) time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) relative_time = t - time_start_current_pulse - atom_flux = my_dina_files.get_particle_flux( + atom_flux = plasma_data_handling.get_particle_flux( pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=False ) @@ -157,7 +157,7 @@ def tritium_atom_flux(t: float) -> float: time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) relative_time = t - time_start_current_pulse - atom_flux = my_dina_files.get_particle_flux( + atom_flux = plasma_data_handling.get_particle_flux( pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=False ) tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] diff --git a/src/hisp/dina/__init__.py b/src/hisp/dina/__init__.py deleted file mode 100644 index e7d1bc9..0000000 --- a/src/hisp/dina/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .dina import FilesDINA \ No newline at end of file diff --git a/src/hisp/plamsa_data_handling/__init__.py b/src/hisp/plamsa_data_handling/__init__.py new file mode 100644 index 0000000..b1e6698 --- /dev/null +++ b/src/hisp/plamsa_data_handling/__init__.py @@ -0,0 +1 @@ +from .main import PlasmaDataHandling \ No newline at end of file diff --git a/src/hisp/dina/dina.py b/src/hisp/plamsa_data_handling/main.py similarity index 99% rename from src/hisp/dina/dina.py rename to src/hisp/plamsa_data_handling/main.py index fc5133c..1b2c39e 100644 --- a/src/hisp/dina/dina.py +++ b/src/hisp/plamsa_data_handling/main.py @@ -4,7 +4,7 @@ from typing import Dict -class FilesDINA: +class PlasmaDataHandling: def __init__( self, pulse_type_to_data: Dict[str, NDArray], From 2243fe4c2e688c863a343c9ef371960a857d2e82 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 20:19:19 -0400 Subject: [PATCH 51/62] moved all files to a data folder --- Binned_Flux_Data.dat => data/Binned_Flux_Data.dat | 0 GDC_data.dat => data/GDC_data.dat | 0 ICWC_data.dat => data/ICWC_data.dat | 0 RISP_Wall_data.dat => data/RISP_Wall_data.dat | 0 {RISP_data => data/RISP_data}/time0.dat | 0 {RISP_data => data/RISP_data}/time10.dat | 0 {RISP_data => data/RISP_data}/time100.dat | 0 {RISP_data => data/RISP_data}/time101.dat | 0 {RISP_data => data/RISP_data}/time102.dat | 0 {RISP_data => data/RISP_data}/time103.dat | 0 {RISP_data => data/RISP_data}/time104.dat | 0 {RISP_data => data/RISP_data}/time105.dat | 0 {RISP_data => data/RISP_data}/time106.dat | 0 {RISP_data => data/RISP_data}/time107.dat | 0 {RISP_data => data/RISP_data}/time108.dat | 0 {RISP_data => data/RISP_data}/time109.dat | 0 {RISP_data => data/RISP_data}/time110.dat | 0 {RISP_data => data/RISP_data}/time111.dat | 0 {RISP_data => data/RISP_data}/time112.dat | 0 {RISP_data => data/RISP_data}/time113.dat | 0 {RISP_data => data/RISP_data}/time114.dat | 0 {RISP_data => data/RISP_data}/time115.dat | 0 {RISP_data => data/RISP_data}/time116.dat | 0 {RISP_data => data/RISP_data}/time117.dat | 0 {RISP_data => data/RISP_data}/time118.dat | 0 {RISP_data => data/RISP_data}/time119.dat | 0 {RISP_data => data/RISP_data}/time120.dat | 0 {RISP_data => data/RISP_data}/time121.dat | 0 {RISP_data => data/RISP_data}/time122.dat | 0 {RISP_data => data/RISP_data}/time123.dat | 0 {RISP_data => data/RISP_data}/time124.dat | 0 {RISP_data => data/RISP_data}/time125.dat | 0 {RISP_data => data/RISP_data}/time126.dat | 0 {RISP_data => data/RISP_data}/time127.dat | 0 {RISP_data => data/RISP_data}/time128.dat | 0 {RISP_data => data/RISP_data}/time129.dat | 0 {RISP_data => data/RISP_data}/time130.dat | 0 {RISP_data => data/RISP_data}/time131.dat | 0 {RISP_data => data/RISP_data}/time132.dat | 0 {RISP_data => data/RISP_data}/time133.dat | 0 {RISP_data => data/RISP_data}/time134.dat | 0 {RISP_data => data/RISP_data}/time135.dat | 0 {RISP_data => data/RISP_data}/time136.dat | 0 {RISP_data => data/RISP_data}/time137.dat | 0 {RISP_data => data/RISP_data}/time138.dat | 0 {RISP_data => data/RISP_data}/time139.dat | 0 {RISP_data => data/RISP_data}/time140.dat | 0 {RISP_data => data/RISP_data}/time141.dat | 0 {RISP_data => data/RISP_data}/time142.dat | 0 {RISP_data => data/RISP_data}/time143.dat | 0 {RISP_data => data/RISP_data}/time144.dat | 0 {RISP_data => data/RISP_data}/time145.dat | 0 {RISP_data => data/RISP_data}/time146.dat | 0 {RISP_data => data/RISP_data}/time147.dat | 0 {RISP_data => data/RISP_data}/time148.dat | 0 {RISP_data => data/RISP_data}/time149.dat | 0 {RISP_data => data/RISP_data}/time150.dat | 0 {RISP_data => data/RISP_data}/time151.dat | 0 {RISP_data => data/RISP_data}/time152.dat | 0 {RISP_data => data/RISP_data}/time153.dat | 0 {RISP_data => data/RISP_data}/time154.dat | 0 {RISP_data => data/RISP_data}/time155.dat | 0 {RISP_data => data/RISP_data}/time156.dat | 0 {RISP_data => data/RISP_data}/time157.dat | 0 {RISP_data => data/RISP_data}/time158.dat | 0 {RISP_data => data/RISP_data}/time159.dat | 0 {RISP_data => data/RISP_data}/time160.dat | 0 {RISP_data => data/RISP_data}/time161.dat | 0 {RISP_data => data/RISP_data}/time162.dat | 0 {RISP_data => data/RISP_data}/time163.dat | 0 {RISP_data => data/RISP_data}/time164.dat | 0 {RISP_data => data/RISP_data}/time165.dat | 0 {RISP_data => data/RISP_data}/time166.dat | 0 {RISP_data => data/RISP_data}/time167.dat | 0 {RISP_data => data/RISP_data}/time168.dat | 0 {RISP_data => data/RISP_data}/time169.dat | 0 {RISP_data => data/RISP_data}/time170.dat | 0 {RISP_data => data/RISP_data}/time171.dat | 0 {RISP_data => data/RISP_data}/time172.dat | 0 {RISP_data => data/RISP_data}/time173.dat | 0 {RISP_data => data/RISP_data}/time174.dat | 0 {RISP_data => data/RISP_data}/time175.dat | 0 {RISP_data => data/RISP_data}/time176.dat | 0 {RISP_data => data/RISP_data}/time177.dat | 0 {RISP_data => data/RISP_data}/time178.dat | 0 {RISP_data => data/RISP_data}/time179.dat | 0 {RISP_data => data/RISP_data}/time180.dat | 0 {RISP_data => data/RISP_data}/time181.dat | 0 {RISP_data => data/RISP_data}/time182.dat | 0 {RISP_data => data/RISP_data}/time183.dat | 0 {RISP_data => data/RISP_data}/time184.dat | 0 {RISP_data => data/RISP_data}/time185.dat | 0 {RISP_data => data/RISP_data}/time186.dat | 0 {RISP_data => data/RISP_data}/time187.dat | 0 {RISP_data => data/RISP_data}/time188.dat | 0 {RISP_data => data/RISP_data}/time189.dat | 0 {RISP_data => data/RISP_data}/time190.dat | 0 {RISP_data => data/RISP_data}/time191.dat | 0 {RISP_data => data/RISP_data}/time192.dat | 0 {RISP_data => data/RISP_data}/time193.dat | 0 {RISP_data => data/RISP_data}/time194.dat | 0 {RISP_data => data/RISP_data}/time195.dat | 0 {RISP_data => data/RISP_data}/time196.dat | 0 {RISP_data => data/RISP_data}/time197.dat | 0 {RISP_data => data/RISP_data}/time198.dat | 0 {RISP_data => data/RISP_data}/time199.dat | 0 {RISP_data => data/RISP_data}/time200.dat | 0 {RISP_data => data/RISP_data}/time201.dat | 0 {RISP_data => data/RISP_data}/time202.dat | 0 {RISP_data => data/RISP_data}/time203.dat | 0 {RISP_data => data/RISP_data}/time204.dat | 0 {RISP_data => data/RISP_data}/time205.dat | 0 {RISP_data => data/RISP_data}/time206.dat | 0 {RISP_data => data/RISP_data}/time207.dat | 0 {RISP_data => data/RISP_data}/time208.dat | 0 {RISP_data => data/RISP_data}/time209.dat | 0 {RISP_data => data/RISP_data}/time210.dat | 0 {RISP_data => data/RISP_data}/time211.dat | 0 {RISP_data => data/RISP_data}/time212.dat | 0 {RISP_data => data/RISP_data}/time213.dat | 0 {RISP_data => data/RISP_data}/time214.dat | 0 {RISP_data => data/RISP_data}/time215.dat | 0 {RISP_data => data/RISP_data}/time216.dat | 0 {RISP_data => data/RISP_data}/time217.dat | 0 {RISP_data => data/RISP_data}/time218.dat | 0 {RISP_data => data/RISP_data}/time219.dat | 0 {RISP_data => data/RISP_data}/time220.dat | 0 {RISP_data => data/RISP_data}/time221.dat | 0 {RISP_data => data/RISP_data}/time222.dat | 0 {RISP_data => data/RISP_data}/time223.dat | 0 {RISP_data => data/RISP_data}/time224.dat | 0 {RISP_data => data/RISP_data}/time225.dat | 0 {RISP_data => data/RISP_data}/time226.dat | 0 {RISP_data => data/RISP_data}/time227.dat | 0 {RISP_data => data/RISP_data}/time228.dat | 0 {RISP_data => data/RISP_data}/time229.dat | 0 {RISP_data => data/RISP_data}/time230.dat | 0 {RISP_data => data/RISP_data}/time231.dat | 0 {RISP_data => data/RISP_data}/time232.dat | 0 {RISP_data => data/RISP_data}/time233.dat | 0 {RISP_data => data/RISP_data}/time234.dat | 0 {RISP_data => data/RISP_data}/time235.dat | 0 {RISP_data => data/RISP_data}/time236.dat | 0 {RISP_data => data/RISP_data}/time237.dat | 0 {RISP_data => data/RISP_data}/time238.dat | 0 {RISP_data => data/RISP_data}/time239.dat | 0 {RISP_data => data/RISP_data}/time240.dat | 0 {RISP_data => data/RISP_data}/time241.dat | 0 {RISP_data => data/RISP_data}/time242.dat | 0 {RISP_data => data/RISP_data}/time243.dat | 0 {RISP_data => data/RISP_data}/time244.dat | 0 {RISP_data => data/RISP_data}/time245.dat | 0 {RISP_data => data/RISP_data}/time246.dat | 0 {RISP_data => data/RISP_data}/time247.dat | 0 {RISP_data => data/RISP_data}/time248.dat | 0 {RISP_data => data/RISP_data}/time249.dat | 0 {RISP_data => data/RISP_data}/time250.dat | 0 {RISP_data => data/RISP_data}/time251.dat | 0 {RISP_data => data/RISP_data}/time252.dat | 0 {RISP_data => data/RISP_data}/time253.dat | 0 {RISP_data => data/RISP_data}/time254.dat | 0 {RISP_data => data/RISP_data}/time255.dat | 0 {RISP_data => data/RISP_data}/time256.dat | 0 {RISP_data => data/RISP_data}/time257.dat | 0 {RISP_data => data/RISP_data}/time258.dat | 0 {RISP_data => data/RISP_data}/time259.dat | 0 {RISP_data => data/RISP_data}/time260.dat | 0 {RISP_data => data/RISP_data}/time270.dat | 0 {ROSP_data => data/ROSP_data}/.DS_Store | Bin {ROSP_data => data/ROSP_data}/time0.dat | 0 {ROSP_data => data/ROSP_data}/time10.dat | 0 {ROSP_data => data/ROSP_data}/time100.dat | 0 {ROSP_data => data/ROSP_data}/time101.dat | 0 {ROSP_data => data/ROSP_data}/time102.dat | 0 {ROSP_data => data/ROSP_data}/time103.dat | 0 {ROSP_data => data/ROSP_data}/time104.dat | 0 {ROSP_data => data/ROSP_data}/time105.dat | 0 {ROSP_data => data/ROSP_data}/time106.dat | 0 {ROSP_data => data/ROSP_data}/time107.dat | 0 {ROSP_data => data/ROSP_data}/time108.dat | 0 {ROSP_data => data/ROSP_data}/time109.dat | 0 {ROSP_data => data/ROSP_data}/time110.dat | 0 {ROSP_data => data/ROSP_data}/time111.dat | 0 {ROSP_data => data/ROSP_data}/time112.dat | 0 {ROSP_data => data/ROSP_data}/time113.dat | 0 {ROSP_data => data/ROSP_data}/time114.dat | 0 {ROSP_data => data/ROSP_data}/time115.dat | 0 {ROSP_data => data/ROSP_data}/time116.dat | 0 {ROSP_data => data/ROSP_data}/time117.dat | 0 {ROSP_data => data/ROSP_data}/time118.dat | 0 {ROSP_data => data/ROSP_data}/time119.dat | 0 {ROSP_data => data/ROSP_data}/time120.dat | 0 {ROSP_data => data/ROSP_data}/time121.dat | 0 {ROSP_data => data/ROSP_data}/time122.dat | 0 {ROSP_data => data/ROSP_data}/time123.dat | 0 {ROSP_data => data/ROSP_data}/time124.dat | 0 {ROSP_data => data/ROSP_data}/time125.dat | 0 {ROSP_data => data/ROSP_data}/time126.dat | 0 {ROSP_data => data/ROSP_data}/time127.dat | 0 {ROSP_data => data/ROSP_data}/time128.dat | 0 {ROSP_data => data/ROSP_data}/time129.dat | 0 {ROSP_data => data/ROSP_data}/time130.dat | 0 {ROSP_data => data/ROSP_data}/time131.dat | 0 {ROSP_data => data/ROSP_data}/time132.dat | 0 {ROSP_data => data/ROSP_data}/time133.dat | 0 {ROSP_data => data/ROSP_data}/time134.dat | 0 {ROSP_data => data/ROSP_data}/time135.dat | 0 {ROSP_data => data/ROSP_data}/time136.dat | 0 {ROSP_data => data/ROSP_data}/time137.dat | 0 {ROSP_data => data/ROSP_data}/time138.dat | 0 {ROSP_data => data/ROSP_data}/time139.dat | 0 {ROSP_data => data/ROSP_data}/time140.dat | 0 {ROSP_data => data/ROSP_data}/time141.dat | 0 {ROSP_data => data/ROSP_data}/time142.dat | 0 {ROSP_data => data/ROSP_data}/time143.dat | 0 {ROSP_data => data/ROSP_data}/time144.dat | 0 {ROSP_data => data/ROSP_data}/time145.dat | 0 {ROSP_data => data/ROSP_data}/time146.dat | 0 {ROSP_data => data/ROSP_data}/time147.dat | 0 {ROSP_data => data/ROSP_data}/time148.dat | 0 {ROSP_data => data/ROSP_data}/time149.dat | 0 {ROSP_data => data/ROSP_data}/time150.dat | 0 {ROSP_data => data/ROSP_data}/time151.dat | 0 {ROSP_data => data/ROSP_data}/time152.dat | 0 {ROSP_data => data/ROSP_data}/time153.dat | 0 {ROSP_data => data/ROSP_data}/time154.dat | 0 {ROSP_data => data/ROSP_data}/time155.dat | 0 {ROSP_data => data/ROSP_data}/time156.dat | 0 {ROSP_data => data/ROSP_data}/time157.dat | 0 {ROSP_data => data/ROSP_data}/time158.dat | 0 {ROSP_data => data/ROSP_data}/time159.dat | 0 {ROSP_data => data/ROSP_data}/time160.dat | 0 {ROSP_data => data/ROSP_data}/time161.dat | 0 {ROSP_data => data/ROSP_data}/time162.dat | 0 {ROSP_data => data/ROSP_data}/time163.dat | 0 {ROSP_data => data/ROSP_data}/time164.dat | 0 {ROSP_data => data/ROSP_data}/time165.dat | 0 {ROSP_data => data/ROSP_data}/time166.dat | 0 {ROSP_data => data/ROSP_data}/time167.dat | 0 {ROSP_data => data/ROSP_data}/time168.dat | 0 {ROSP_data => data/ROSP_data}/time169.dat | 0 {ROSP_data => data/ROSP_data}/time170.dat | 0 {ROSP_data => data/ROSP_data}/time171.dat | 0 {ROSP_data => data/ROSP_data}/time172.dat | 0 {ROSP_data => data/ROSP_data}/time173.dat | 0 {ROSP_data => data/ROSP_data}/time174.dat | 0 {ROSP_data => data/ROSP_data}/time175.dat | 0 {ROSP_data => data/ROSP_data}/time176.dat | 0 {ROSP_data => data/ROSP_data}/time177.dat | 0 {ROSP_data => data/ROSP_data}/time178.dat | 0 {ROSP_data => data/ROSP_data}/time179.dat | 0 {ROSP_data => data/ROSP_data}/time180.dat | 0 {ROSP_data => data/ROSP_data}/time181.dat | 0 {ROSP_data => data/ROSP_data}/time182.dat | 0 {ROSP_data => data/ROSP_data}/time183.dat | 0 {ROSP_data => data/ROSP_data}/time184.dat | 0 {ROSP_data => data/ROSP_data}/time185.dat | 0 {ROSP_data => data/ROSP_data}/time186.dat | 0 {ROSP_data => data/ROSP_data}/time187.dat | 0 {ROSP_data => data/ROSP_data}/time188.dat | 0 {ROSP_data => data/ROSP_data}/time189.dat | 0 {ROSP_data => data/ROSP_data}/time190.dat | 0 {ROSP_data => data/ROSP_data}/time191.dat | 0 {ROSP_data => data/ROSP_data}/time192.dat | 0 {ROSP_data => data/ROSP_data}/time193.dat | 0 {ROSP_data => data/ROSP_data}/time194.dat | 0 {ROSP_data => data/ROSP_data}/time195.dat | 0 {ROSP_data => data/ROSP_data}/time196.dat | 0 {ROSP_data => data/ROSP_data}/time197.dat | 0 {ROSP_data => data/ROSP_data}/time198.dat | 0 {ROSP_data => data/ROSP_data}/time199.dat | 0 {ROSP_data => data/ROSP_data}/time200.dat | 0 {ROSP_data => data/ROSP_data}/time201.dat | 0 {ROSP_data => data/ROSP_data}/time202.dat | 0 {ROSP_data => data/ROSP_data}/time203.dat | 0 {ROSP_data => data/ROSP_data}/time204.dat | 0 {ROSP_data => data/ROSP_data}/time205.dat | 0 {ROSP_data => data/ROSP_data}/time206.dat | 0 {ROSP_data => data/ROSP_data}/time207.dat | 0 {ROSP_data => data/ROSP_data}/time208.dat | 0 {ROSP_data => data/ROSP_data}/time209.dat | 0 {ROSP_data => data/ROSP_data}/time210.dat | 0 {ROSP_data => data/ROSP_data}/time211.dat | 0 {ROSP_data => data/ROSP_data}/time212.dat | 0 {ROSP_data => data/ROSP_data}/time213.dat | 0 {ROSP_data => data/ROSP_data}/time214.dat | 0 {ROSP_data => data/ROSP_data}/time215.dat | 0 {ROSP_data => data/ROSP_data}/time216.dat | 0 {ROSP_data => data/ROSP_data}/time217.dat | 0 {ROSP_data => data/ROSP_data}/time218.dat | 0 {ROSP_data => data/ROSP_data}/time219.dat | 0 {ROSP_data => data/ROSP_data}/time220.dat | 0 {ROSP_data => data/ROSP_data}/time221.dat | 0 {ROSP_data => data/ROSP_data}/time222.dat | 0 {ROSP_data => data/ROSP_data}/time223.dat | 0 {ROSP_data => data/ROSP_data}/time224.dat | 0 {ROSP_data => data/ROSP_data}/time225.dat | 0 {ROSP_data => data/ROSP_data}/time226.dat | 0 {ROSP_data => data/ROSP_data}/time227.dat | 0 {ROSP_data => data/ROSP_data}/time228.dat | 0 {ROSP_data => data/ROSP_data}/time229.dat | 0 {ROSP_data => data/ROSP_data}/time230.dat | 0 {ROSP_data => data/ROSP_data}/time231.dat | 0 {ROSP_data => data/ROSP_data}/time232.dat | 0 {ROSP_data => data/ROSP_data}/time233.dat | 0 {ROSP_data => data/ROSP_data}/time234.dat | 0 {ROSP_data => data/ROSP_data}/time235.dat | 0 {ROSP_data => data/ROSP_data}/time236.dat | 0 {ROSP_data => data/ROSP_data}/time237.dat | 0 {ROSP_data => data/ROSP_data}/time238.dat | 0 {ROSP_data => data/ROSP_data}/time239.dat | 0 {ROSP_data => data/ROSP_data}/time240.dat | 0 {ROSP_data => data/ROSP_data}/time241.dat | 0 {ROSP_data => data/ROSP_data}/time242.dat | 0 {ROSP_data => data/ROSP_data}/time243.dat | 0 {ROSP_data => data/ROSP_data}/time244.dat | 0 {ROSP_data => data/ROSP_data}/time245.dat | 0 {ROSP_data => data/ROSP_data}/time246.dat | 0 {ROSP_data => data/ROSP_data}/time247.dat | 0 {ROSP_data => data/ROSP_data}/time248.dat | 0 {ROSP_data => data/ROSP_data}/time249.dat | 0 {ROSP_data => data/ROSP_data}/time250.dat | 0 {ROSP_data => data/ROSP_data}/time251.dat | 0 {ROSP_data => data/ROSP_data}/time252.dat | 0 {ROSP_data => data/ROSP_data}/time253.dat | 0 {ROSP_data => data/ROSP_data}/time254.dat | 0 {ROSP_data => data/ROSP_data}/time255.dat | 0 {ROSP_data => data/ROSP_data}/time256.dat | 0 {ROSP_data => data/ROSP_data}/time257.dat | 0 {ROSP_data => data/ROSP_data}/time258.dat | 0 {ROSP_data => data/ROSP_data}/time259.dat | 0 {ROSP_data => data/ROSP_data}/time260.dat | 0 {ROSP_data => data/ROSP_data}/time270.dat | 0 mb_scenario.py | 13 +++++++------ 334 files changed, 7 insertions(+), 6 deletions(-) rename Binned_Flux_Data.dat => data/Binned_Flux_Data.dat (100%) rename GDC_data.dat => data/GDC_data.dat (100%) rename ICWC_data.dat => data/ICWC_data.dat (100%) rename RISP_Wall_data.dat => data/RISP_Wall_data.dat (100%) rename {RISP_data => data/RISP_data}/time0.dat (100%) rename {RISP_data => data/RISP_data}/time10.dat (100%) rename {RISP_data => data/RISP_data}/time100.dat (100%) rename {RISP_data => data/RISP_data}/time101.dat (100%) rename {RISP_data => data/RISP_data}/time102.dat (100%) rename {RISP_data => data/RISP_data}/time103.dat (100%) rename {RISP_data => data/RISP_data}/time104.dat (100%) rename {RISP_data => data/RISP_data}/time105.dat (100%) rename {RISP_data => data/RISP_data}/time106.dat (100%) rename {RISP_data => data/RISP_data}/time107.dat (100%) rename {RISP_data => data/RISP_data}/time108.dat (100%) rename {RISP_data => data/RISP_data}/time109.dat (100%) rename {RISP_data => data/RISP_data}/time110.dat (100%) rename {RISP_data => data/RISP_data}/time111.dat (100%) rename {RISP_data => data/RISP_data}/time112.dat (100%) rename {RISP_data => data/RISP_data}/time113.dat (100%) rename {RISP_data => data/RISP_data}/time114.dat (100%) rename {RISP_data => data/RISP_data}/time115.dat (100%) rename {RISP_data => data/RISP_data}/time116.dat (100%) rename {RISP_data => data/RISP_data}/time117.dat (100%) rename {RISP_data => data/RISP_data}/time118.dat (100%) rename {RISP_data => data/RISP_data}/time119.dat (100%) rename {RISP_data => data/RISP_data}/time120.dat (100%) rename {RISP_data => data/RISP_data}/time121.dat (100%) rename {RISP_data => data/RISP_data}/time122.dat (100%) rename {RISP_data => data/RISP_data}/time123.dat (100%) rename {RISP_data => data/RISP_data}/time124.dat (100%) rename {RISP_data => data/RISP_data}/time125.dat (100%) rename {RISP_data => data/RISP_data}/time126.dat (100%) rename {RISP_data => data/RISP_data}/time127.dat (100%) rename {RISP_data => data/RISP_data}/time128.dat (100%) rename {RISP_data => data/RISP_data}/time129.dat (100%) rename {RISP_data => data/RISP_data}/time130.dat (100%) rename {RISP_data => data/RISP_data}/time131.dat (100%) rename {RISP_data => data/RISP_data}/time132.dat (100%) rename {RISP_data => data/RISP_data}/time133.dat (100%) rename {RISP_data => data/RISP_data}/time134.dat (100%) rename {RISP_data => data/RISP_data}/time135.dat (100%) rename {RISP_data => data/RISP_data}/time136.dat (100%) rename {RISP_data => data/RISP_data}/time137.dat (100%) rename {RISP_data => data/RISP_data}/time138.dat (100%) rename {RISP_data => data/RISP_data}/time139.dat (100%) rename {RISP_data => data/RISP_data}/time140.dat (100%) rename {RISP_data => data/RISP_data}/time141.dat (100%) rename {RISP_data => data/RISP_data}/time142.dat (100%) rename {RISP_data => data/RISP_data}/time143.dat (100%) rename {RISP_data => data/RISP_data}/time144.dat (100%) rename {RISP_data => data/RISP_data}/time145.dat (100%) rename {RISP_data => data/RISP_data}/time146.dat (100%) rename {RISP_data => data/RISP_data}/time147.dat (100%) rename {RISP_data => data/RISP_data}/time148.dat (100%) rename {RISP_data => data/RISP_data}/time149.dat (100%) rename {RISP_data => data/RISP_data}/time150.dat (100%) rename {RISP_data => data/RISP_data}/time151.dat (100%) rename {RISP_data => data/RISP_data}/time152.dat (100%) rename {RISP_data => data/RISP_data}/time153.dat (100%) rename {RISP_data => data/RISP_data}/time154.dat (100%) rename {RISP_data => data/RISP_data}/time155.dat (100%) rename {RISP_data => data/RISP_data}/time156.dat (100%) rename {RISP_data => data/RISP_data}/time157.dat (100%) rename {RISP_data => data/RISP_data}/time158.dat (100%) rename {RISP_data => data/RISP_data}/time159.dat (100%) rename {RISP_data => data/RISP_data}/time160.dat (100%) rename {RISP_data => data/RISP_data}/time161.dat (100%) rename {RISP_data => data/RISP_data}/time162.dat (100%) rename {RISP_data => data/RISP_data}/time163.dat (100%) rename {RISP_data => data/RISP_data}/time164.dat (100%) rename {RISP_data => data/RISP_data}/time165.dat (100%) rename {RISP_data => data/RISP_data}/time166.dat (100%) rename {RISP_data => data/RISP_data}/time167.dat (100%) rename {RISP_data => data/RISP_data}/time168.dat (100%) rename {RISP_data => data/RISP_data}/time169.dat (100%) rename {RISP_data => data/RISP_data}/time170.dat (100%) rename {RISP_data => data/RISP_data}/time171.dat (100%) rename {RISP_data => data/RISP_data}/time172.dat (100%) rename {RISP_data => data/RISP_data}/time173.dat (100%) rename {RISP_data => data/RISP_data}/time174.dat (100%) rename {RISP_data => data/RISP_data}/time175.dat (100%) rename {RISP_data => data/RISP_data}/time176.dat (100%) rename {RISP_data => data/RISP_data}/time177.dat (100%) rename {RISP_data => data/RISP_data}/time178.dat (100%) rename {RISP_data => data/RISP_data}/time179.dat (100%) rename {RISP_data => data/RISP_data}/time180.dat (100%) rename {RISP_data => data/RISP_data}/time181.dat (100%) rename {RISP_data => data/RISP_data}/time182.dat (100%) rename {RISP_data => data/RISP_data}/time183.dat (100%) rename {RISP_data => data/RISP_data}/time184.dat (100%) rename {RISP_data => data/RISP_data}/time185.dat (100%) rename {RISP_data => data/RISP_data}/time186.dat (100%) rename {RISP_data => data/RISP_data}/time187.dat (100%) rename {RISP_data => data/RISP_data}/time188.dat (100%) rename {RISP_data => data/RISP_data}/time189.dat (100%) rename {RISP_data => data/RISP_data}/time190.dat (100%) rename {RISP_data => data/RISP_data}/time191.dat (100%) rename {RISP_data => data/RISP_data}/time192.dat (100%) rename {RISP_data => data/RISP_data}/time193.dat (100%) rename {RISP_data => data/RISP_data}/time194.dat (100%) rename {RISP_data => data/RISP_data}/time195.dat (100%) rename {RISP_data => data/RISP_data}/time196.dat (100%) rename {RISP_data => data/RISP_data}/time197.dat (100%) rename {RISP_data => data/RISP_data}/time198.dat (100%) rename {RISP_data => data/RISP_data}/time199.dat (100%) rename {RISP_data => data/RISP_data}/time200.dat (100%) rename {RISP_data => data/RISP_data}/time201.dat (100%) rename {RISP_data => data/RISP_data}/time202.dat (100%) rename {RISP_data => data/RISP_data}/time203.dat (100%) rename {RISP_data => data/RISP_data}/time204.dat (100%) rename {RISP_data => data/RISP_data}/time205.dat (100%) rename {RISP_data => data/RISP_data}/time206.dat (100%) rename {RISP_data => data/RISP_data}/time207.dat (100%) rename {RISP_data => data/RISP_data}/time208.dat (100%) rename {RISP_data => data/RISP_data}/time209.dat (100%) rename {RISP_data => data/RISP_data}/time210.dat (100%) rename {RISP_data => data/RISP_data}/time211.dat (100%) rename {RISP_data => data/RISP_data}/time212.dat (100%) rename {RISP_data => data/RISP_data}/time213.dat (100%) rename {RISP_data => data/RISP_data}/time214.dat (100%) rename {RISP_data => data/RISP_data}/time215.dat (100%) rename {RISP_data => data/RISP_data}/time216.dat (100%) rename {RISP_data => data/RISP_data}/time217.dat (100%) rename {RISP_data => data/RISP_data}/time218.dat (100%) rename {RISP_data => data/RISP_data}/time219.dat (100%) rename {RISP_data => data/RISP_data}/time220.dat (100%) rename {RISP_data => data/RISP_data}/time221.dat (100%) rename {RISP_data => data/RISP_data}/time222.dat (100%) rename {RISP_data => data/RISP_data}/time223.dat (100%) rename {RISP_data => data/RISP_data}/time224.dat (100%) rename {RISP_data => data/RISP_data}/time225.dat (100%) rename {RISP_data => data/RISP_data}/time226.dat (100%) rename {RISP_data => data/RISP_data}/time227.dat (100%) rename {RISP_data => data/RISP_data}/time228.dat (100%) rename {RISP_data => data/RISP_data}/time229.dat (100%) rename {RISP_data => data/RISP_data}/time230.dat (100%) rename {RISP_data => data/RISP_data}/time231.dat (100%) rename {RISP_data => data/RISP_data}/time232.dat (100%) rename {RISP_data => data/RISP_data}/time233.dat (100%) rename {RISP_data => data/RISP_data}/time234.dat (100%) rename {RISP_data => data/RISP_data}/time235.dat (100%) rename {RISP_data => data/RISP_data}/time236.dat (100%) rename {RISP_data => data/RISP_data}/time237.dat (100%) rename {RISP_data => data/RISP_data}/time238.dat (100%) rename {RISP_data => data/RISP_data}/time239.dat (100%) rename {RISP_data => data/RISP_data}/time240.dat (100%) rename {RISP_data => data/RISP_data}/time241.dat (100%) rename {RISP_data => data/RISP_data}/time242.dat (100%) rename {RISP_data => data/RISP_data}/time243.dat (100%) rename {RISP_data => data/RISP_data}/time244.dat (100%) rename {RISP_data => data/RISP_data}/time245.dat (100%) rename {RISP_data => data/RISP_data}/time246.dat (100%) rename {RISP_data => data/RISP_data}/time247.dat (100%) rename {RISP_data => data/RISP_data}/time248.dat (100%) rename {RISP_data => data/RISP_data}/time249.dat (100%) rename {RISP_data => data/RISP_data}/time250.dat (100%) rename {RISP_data => data/RISP_data}/time251.dat (100%) rename {RISP_data => data/RISP_data}/time252.dat (100%) rename {RISP_data => data/RISP_data}/time253.dat (100%) rename {RISP_data => data/RISP_data}/time254.dat (100%) rename {RISP_data => data/RISP_data}/time255.dat (100%) rename {RISP_data => data/RISP_data}/time256.dat (100%) rename {RISP_data => data/RISP_data}/time257.dat (100%) rename {RISP_data => data/RISP_data}/time258.dat (100%) rename {RISP_data => data/RISP_data}/time259.dat (100%) rename {RISP_data => data/RISP_data}/time260.dat (100%) rename {RISP_data => data/RISP_data}/time270.dat (100%) rename {ROSP_data => data/ROSP_data}/.DS_Store (100%) rename {ROSP_data => data/ROSP_data}/time0.dat (100%) rename {ROSP_data => data/ROSP_data}/time10.dat (100%) rename {ROSP_data => data/ROSP_data}/time100.dat (100%) rename {ROSP_data => data/ROSP_data}/time101.dat (100%) rename {ROSP_data => data/ROSP_data}/time102.dat (100%) rename {ROSP_data => data/ROSP_data}/time103.dat (100%) rename {ROSP_data => data/ROSP_data}/time104.dat (100%) rename {ROSP_data => data/ROSP_data}/time105.dat (100%) rename {ROSP_data => data/ROSP_data}/time106.dat (100%) rename {ROSP_data => data/ROSP_data}/time107.dat (100%) rename {ROSP_data => data/ROSP_data}/time108.dat (100%) rename {ROSP_data => data/ROSP_data}/time109.dat (100%) rename {ROSP_data => data/ROSP_data}/time110.dat (100%) rename {ROSP_data => data/ROSP_data}/time111.dat (100%) rename {ROSP_data => data/ROSP_data}/time112.dat (100%) rename {ROSP_data => data/ROSP_data}/time113.dat (100%) rename {ROSP_data => data/ROSP_data}/time114.dat (100%) rename {ROSP_data => data/ROSP_data}/time115.dat (100%) rename {ROSP_data => data/ROSP_data}/time116.dat (100%) rename {ROSP_data => data/ROSP_data}/time117.dat (100%) rename {ROSP_data => data/ROSP_data}/time118.dat (100%) rename {ROSP_data => data/ROSP_data}/time119.dat (100%) rename {ROSP_data => data/ROSP_data}/time120.dat (100%) rename {ROSP_data => data/ROSP_data}/time121.dat (100%) rename {ROSP_data => data/ROSP_data}/time122.dat (100%) rename {ROSP_data => data/ROSP_data}/time123.dat (100%) rename {ROSP_data => data/ROSP_data}/time124.dat (100%) rename {ROSP_data => data/ROSP_data}/time125.dat (100%) rename {ROSP_data => data/ROSP_data}/time126.dat (100%) rename {ROSP_data => data/ROSP_data}/time127.dat (100%) rename {ROSP_data => data/ROSP_data}/time128.dat (100%) rename {ROSP_data => data/ROSP_data}/time129.dat (100%) rename {ROSP_data => data/ROSP_data}/time130.dat (100%) rename {ROSP_data => data/ROSP_data}/time131.dat (100%) rename {ROSP_data => data/ROSP_data}/time132.dat (100%) rename {ROSP_data => data/ROSP_data}/time133.dat (100%) rename {ROSP_data => data/ROSP_data}/time134.dat (100%) rename {ROSP_data => data/ROSP_data}/time135.dat (100%) rename {ROSP_data => data/ROSP_data}/time136.dat (100%) rename {ROSP_data => data/ROSP_data}/time137.dat (100%) rename {ROSP_data => data/ROSP_data}/time138.dat (100%) rename {ROSP_data => data/ROSP_data}/time139.dat (100%) rename {ROSP_data => data/ROSP_data}/time140.dat (100%) rename {ROSP_data => data/ROSP_data}/time141.dat (100%) rename {ROSP_data => data/ROSP_data}/time142.dat (100%) rename {ROSP_data => data/ROSP_data}/time143.dat (100%) rename {ROSP_data => data/ROSP_data}/time144.dat (100%) rename {ROSP_data => data/ROSP_data}/time145.dat (100%) rename {ROSP_data => data/ROSP_data}/time146.dat (100%) rename {ROSP_data => data/ROSP_data}/time147.dat (100%) rename {ROSP_data => data/ROSP_data}/time148.dat (100%) rename {ROSP_data => data/ROSP_data}/time149.dat (100%) rename {ROSP_data => data/ROSP_data}/time150.dat (100%) rename {ROSP_data => data/ROSP_data}/time151.dat (100%) rename {ROSP_data => data/ROSP_data}/time152.dat (100%) rename {ROSP_data => data/ROSP_data}/time153.dat (100%) rename {ROSP_data => data/ROSP_data}/time154.dat (100%) rename {ROSP_data => data/ROSP_data}/time155.dat (100%) rename {ROSP_data => data/ROSP_data}/time156.dat (100%) rename {ROSP_data => data/ROSP_data}/time157.dat (100%) rename {ROSP_data => data/ROSP_data}/time158.dat (100%) rename {ROSP_data => data/ROSP_data}/time159.dat (100%) rename {ROSP_data => data/ROSP_data}/time160.dat (100%) rename {ROSP_data => data/ROSP_data}/time161.dat (100%) rename {ROSP_data => data/ROSP_data}/time162.dat (100%) rename {ROSP_data => data/ROSP_data}/time163.dat (100%) rename {ROSP_data => data/ROSP_data}/time164.dat (100%) rename {ROSP_data => data/ROSP_data}/time165.dat (100%) rename {ROSP_data => data/ROSP_data}/time166.dat (100%) rename {ROSP_data => data/ROSP_data}/time167.dat (100%) rename {ROSP_data => data/ROSP_data}/time168.dat (100%) rename {ROSP_data => data/ROSP_data}/time169.dat (100%) rename {ROSP_data => data/ROSP_data}/time170.dat (100%) rename {ROSP_data => data/ROSP_data}/time171.dat (100%) rename {ROSP_data => data/ROSP_data}/time172.dat (100%) rename {ROSP_data => data/ROSP_data}/time173.dat (100%) rename {ROSP_data => data/ROSP_data}/time174.dat (100%) rename {ROSP_data => data/ROSP_data}/time175.dat (100%) rename {ROSP_data => data/ROSP_data}/time176.dat (100%) rename {ROSP_data => data/ROSP_data}/time177.dat (100%) rename {ROSP_data => data/ROSP_data}/time178.dat (100%) rename {ROSP_data => data/ROSP_data}/time179.dat (100%) rename {ROSP_data => data/ROSP_data}/time180.dat (100%) rename {ROSP_data => data/ROSP_data}/time181.dat (100%) rename {ROSP_data => data/ROSP_data}/time182.dat (100%) rename {ROSP_data => data/ROSP_data}/time183.dat (100%) rename {ROSP_data => data/ROSP_data}/time184.dat (100%) rename {ROSP_data => data/ROSP_data}/time185.dat (100%) rename {ROSP_data => data/ROSP_data}/time186.dat (100%) rename {ROSP_data => data/ROSP_data}/time187.dat (100%) rename {ROSP_data => data/ROSP_data}/time188.dat (100%) rename {ROSP_data => data/ROSP_data}/time189.dat (100%) rename {ROSP_data => data/ROSP_data}/time190.dat (100%) rename {ROSP_data => data/ROSP_data}/time191.dat (100%) rename {ROSP_data => data/ROSP_data}/time192.dat (100%) rename {ROSP_data => data/ROSP_data}/time193.dat (100%) rename {ROSP_data => data/ROSP_data}/time194.dat (100%) rename {ROSP_data => data/ROSP_data}/time195.dat (100%) rename {ROSP_data => data/ROSP_data}/time196.dat (100%) rename {ROSP_data => data/ROSP_data}/time197.dat (100%) rename {ROSP_data => data/ROSP_data}/time198.dat (100%) rename {ROSP_data => data/ROSP_data}/time199.dat (100%) rename {ROSP_data => data/ROSP_data}/time200.dat (100%) rename {ROSP_data => data/ROSP_data}/time201.dat (100%) rename {ROSP_data => data/ROSP_data}/time202.dat (100%) rename {ROSP_data => data/ROSP_data}/time203.dat (100%) rename {ROSP_data => data/ROSP_data}/time204.dat (100%) rename {ROSP_data => data/ROSP_data}/time205.dat (100%) rename {ROSP_data => data/ROSP_data}/time206.dat (100%) rename {ROSP_data => data/ROSP_data}/time207.dat (100%) rename {ROSP_data => data/ROSP_data}/time208.dat (100%) rename {ROSP_data => data/ROSP_data}/time209.dat (100%) rename {ROSP_data => data/ROSP_data}/time210.dat (100%) rename {ROSP_data => data/ROSP_data}/time211.dat (100%) rename {ROSP_data => data/ROSP_data}/time212.dat (100%) rename {ROSP_data => data/ROSP_data}/time213.dat (100%) rename {ROSP_data => data/ROSP_data}/time214.dat (100%) rename {ROSP_data => data/ROSP_data}/time215.dat (100%) rename {ROSP_data => data/ROSP_data}/time216.dat (100%) rename {ROSP_data => data/ROSP_data}/time217.dat (100%) rename {ROSP_data => data/ROSP_data}/time218.dat (100%) rename {ROSP_data => data/ROSP_data}/time219.dat (100%) rename {ROSP_data => data/ROSP_data}/time220.dat (100%) rename {ROSP_data => data/ROSP_data}/time221.dat (100%) rename {ROSP_data => data/ROSP_data}/time222.dat (100%) rename {ROSP_data => data/ROSP_data}/time223.dat (100%) rename {ROSP_data => data/ROSP_data}/time224.dat (100%) rename {ROSP_data => data/ROSP_data}/time225.dat (100%) rename {ROSP_data => data/ROSP_data}/time226.dat (100%) rename {ROSP_data => data/ROSP_data}/time227.dat (100%) rename {ROSP_data => data/ROSP_data}/time228.dat (100%) rename {ROSP_data => data/ROSP_data}/time229.dat (100%) rename {ROSP_data => data/ROSP_data}/time230.dat (100%) rename {ROSP_data => data/ROSP_data}/time231.dat (100%) rename {ROSP_data => data/ROSP_data}/time232.dat (100%) rename {ROSP_data => data/ROSP_data}/time233.dat (100%) rename {ROSP_data => data/ROSP_data}/time234.dat (100%) rename {ROSP_data => data/ROSP_data}/time235.dat (100%) rename {ROSP_data => data/ROSP_data}/time236.dat (100%) rename {ROSP_data => data/ROSP_data}/time237.dat (100%) rename {ROSP_data => data/ROSP_data}/time238.dat (100%) rename {ROSP_data => data/ROSP_data}/time239.dat (100%) rename {ROSP_data => data/ROSP_data}/time240.dat (100%) rename {ROSP_data => data/ROSP_data}/time241.dat (100%) rename {ROSP_data => data/ROSP_data}/time242.dat (100%) rename {ROSP_data => data/ROSP_data}/time243.dat (100%) rename {ROSP_data => data/ROSP_data}/time244.dat (100%) rename {ROSP_data => data/ROSP_data}/time245.dat (100%) rename {ROSP_data => data/ROSP_data}/time246.dat (100%) rename {ROSP_data => data/ROSP_data}/time247.dat (100%) rename {ROSP_data => data/ROSP_data}/time248.dat (100%) rename {ROSP_data => data/ROSP_data}/time249.dat (100%) rename {ROSP_data => data/ROSP_data}/time250.dat (100%) rename {ROSP_data => data/ROSP_data}/time251.dat (100%) rename {ROSP_data => data/ROSP_data}/time252.dat (100%) rename {ROSP_data => data/ROSP_data}/time253.dat (100%) rename {ROSP_data => data/ROSP_data}/time254.dat (100%) rename {ROSP_data => data/ROSP_data}/time255.dat (100%) rename {ROSP_data => data/ROSP_data}/time256.dat (100%) rename {ROSP_data => data/ROSP_data}/time257.dat (100%) rename {ROSP_data => data/ROSP_data}/time258.dat (100%) rename {ROSP_data => data/ROSP_data}/time259.dat (100%) rename {ROSP_data => data/ROSP_data}/time260.dat (100%) rename {ROSP_data => data/ROSP_data}/time270.dat (100%) diff --git a/Binned_Flux_Data.dat b/data/Binned_Flux_Data.dat similarity index 100% rename from Binned_Flux_Data.dat rename to data/Binned_Flux_Data.dat diff --git a/GDC_data.dat b/data/GDC_data.dat similarity index 100% rename from GDC_data.dat rename to data/GDC_data.dat diff --git a/ICWC_data.dat b/data/ICWC_data.dat similarity index 100% rename from ICWC_data.dat rename to data/ICWC_data.dat diff --git a/RISP_Wall_data.dat b/data/RISP_Wall_data.dat similarity index 100% rename from RISP_Wall_data.dat rename to data/RISP_Wall_data.dat diff --git a/RISP_data/time0.dat b/data/RISP_data/time0.dat similarity index 100% rename from RISP_data/time0.dat rename to data/RISP_data/time0.dat diff --git a/RISP_data/time10.dat b/data/RISP_data/time10.dat similarity index 100% rename from RISP_data/time10.dat rename to data/RISP_data/time10.dat diff --git a/RISP_data/time100.dat b/data/RISP_data/time100.dat similarity index 100% rename from RISP_data/time100.dat rename to data/RISP_data/time100.dat diff --git a/RISP_data/time101.dat b/data/RISP_data/time101.dat similarity index 100% rename from RISP_data/time101.dat rename to data/RISP_data/time101.dat diff --git a/RISP_data/time102.dat b/data/RISP_data/time102.dat similarity index 100% rename from RISP_data/time102.dat rename to data/RISP_data/time102.dat diff --git a/RISP_data/time103.dat b/data/RISP_data/time103.dat similarity index 100% rename from RISP_data/time103.dat rename to data/RISP_data/time103.dat diff --git a/RISP_data/time104.dat b/data/RISP_data/time104.dat similarity index 100% rename from RISP_data/time104.dat rename to data/RISP_data/time104.dat diff --git a/RISP_data/time105.dat b/data/RISP_data/time105.dat similarity index 100% rename from RISP_data/time105.dat rename to data/RISP_data/time105.dat diff --git a/RISP_data/time106.dat b/data/RISP_data/time106.dat similarity index 100% rename from RISP_data/time106.dat rename to data/RISP_data/time106.dat diff --git a/RISP_data/time107.dat b/data/RISP_data/time107.dat similarity index 100% rename from RISP_data/time107.dat rename to data/RISP_data/time107.dat diff --git a/RISP_data/time108.dat b/data/RISP_data/time108.dat similarity index 100% rename from RISP_data/time108.dat rename to data/RISP_data/time108.dat diff --git a/RISP_data/time109.dat b/data/RISP_data/time109.dat similarity index 100% rename from RISP_data/time109.dat rename to data/RISP_data/time109.dat diff --git a/RISP_data/time110.dat b/data/RISP_data/time110.dat similarity index 100% rename from RISP_data/time110.dat rename to data/RISP_data/time110.dat diff --git a/RISP_data/time111.dat b/data/RISP_data/time111.dat similarity index 100% rename from RISP_data/time111.dat rename to data/RISP_data/time111.dat diff --git a/RISP_data/time112.dat b/data/RISP_data/time112.dat similarity index 100% rename from RISP_data/time112.dat rename to data/RISP_data/time112.dat diff --git a/RISP_data/time113.dat b/data/RISP_data/time113.dat similarity index 100% rename from RISP_data/time113.dat rename to data/RISP_data/time113.dat diff --git a/RISP_data/time114.dat b/data/RISP_data/time114.dat similarity index 100% rename from RISP_data/time114.dat rename to data/RISP_data/time114.dat diff --git a/RISP_data/time115.dat b/data/RISP_data/time115.dat similarity index 100% rename from RISP_data/time115.dat rename to data/RISP_data/time115.dat diff --git a/RISP_data/time116.dat b/data/RISP_data/time116.dat similarity index 100% rename from RISP_data/time116.dat rename to data/RISP_data/time116.dat diff --git a/RISP_data/time117.dat b/data/RISP_data/time117.dat similarity index 100% rename from RISP_data/time117.dat rename to data/RISP_data/time117.dat diff --git a/RISP_data/time118.dat b/data/RISP_data/time118.dat similarity index 100% rename from RISP_data/time118.dat rename to data/RISP_data/time118.dat diff --git a/RISP_data/time119.dat b/data/RISP_data/time119.dat similarity index 100% rename from RISP_data/time119.dat rename to data/RISP_data/time119.dat diff --git a/RISP_data/time120.dat b/data/RISP_data/time120.dat similarity index 100% rename from RISP_data/time120.dat rename to data/RISP_data/time120.dat diff --git a/RISP_data/time121.dat b/data/RISP_data/time121.dat similarity index 100% rename from RISP_data/time121.dat rename to data/RISP_data/time121.dat diff --git a/RISP_data/time122.dat b/data/RISP_data/time122.dat similarity index 100% rename from RISP_data/time122.dat rename to data/RISP_data/time122.dat diff --git a/RISP_data/time123.dat b/data/RISP_data/time123.dat similarity index 100% rename from RISP_data/time123.dat rename to data/RISP_data/time123.dat diff --git a/RISP_data/time124.dat b/data/RISP_data/time124.dat similarity index 100% rename from RISP_data/time124.dat rename to data/RISP_data/time124.dat diff --git a/RISP_data/time125.dat b/data/RISP_data/time125.dat similarity index 100% rename from RISP_data/time125.dat rename to data/RISP_data/time125.dat diff --git a/RISP_data/time126.dat b/data/RISP_data/time126.dat similarity index 100% rename from RISP_data/time126.dat rename to data/RISP_data/time126.dat diff --git a/RISP_data/time127.dat b/data/RISP_data/time127.dat similarity index 100% rename from RISP_data/time127.dat rename to data/RISP_data/time127.dat diff --git a/RISP_data/time128.dat b/data/RISP_data/time128.dat similarity index 100% rename from RISP_data/time128.dat rename to data/RISP_data/time128.dat diff --git a/RISP_data/time129.dat b/data/RISP_data/time129.dat similarity index 100% rename from RISP_data/time129.dat rename to data/RISP_data/time129.dat diff --git a/RISP_data/time130.dat b/data/RISP_data/time130.dat similarity index 100% rename from RISP_data/time130.dat rename to data/RISP_data/time130.dat diff --git a/RISP_data/time131.dat b/data/RISP_data/time131.dat similarity index 100% rename from RISP_data/time131.dat rename to data/RISP_data/time131.dat diff --git a/RISP_data/time132.dat b/data/RISP_data/time132.dat similarity index 100% rename from RISP_data/time132.dat rename to data/RISP_data/time132.dat diff --git a/RISP_data/time133.dat b/data/RISP_data/time133.dat similarity index 100% rename from RISP_data/time133.dat rename to data/RISP_data/time133.dat diff --git a/RISP_data/time134.dat b/data/RISP_data/time134.dat similarity index 100% rename from RISP_data/time134.dat rename to data/RISP_data/time134.dat diff --git a/RISP_data/time135.dat b/data/RISP_data/time135.dat similarity index 100% rename from RISP_data/time135.dat rename to data/RISP_data/time135.dat diff --git a/RISP_data/time136.dat b/data/RISP_data/time136.dat similarity index 100% rename from RISP_data/time136.dat rename to data/RISP_data/time136.dat diff --git a/RISP_data/time137.dat b/data/RISP_data/time137.dat similarity index 100% rename from RISP_data/time137.dat rename to data/RISP_data/time137.dat diff --git a/RISP_data/time138.dat b/data/RISP_data/time138.dat similarity index 100% rename from RISP_data/time138.dat rename to data/RISP_data/time138.dat diff --git a/RISP_data/time139.dat b/data/RISP_data/time139.dat similarity index 100% rename from RISP_data/time139.dat rename to data/RISP_data/time139.dat diff --git a/RISP_data/time140.dat b/data/RISP_data/time140.dat similarity index 100% rename from RISP_data/time140.dat rename to data/RISP_data/time140.dat diff --git a/RISP_data/time141.dat b/data/RISP_data/time141.dat similarity index 100% rename from RISP_data/time141.dat rename to data/RISP_data/time141.dat diff --git a/RISP_data/time142.dat b/data/RISP_data/time142.dat similarity index 100% rename from RISP_data/time142.dat rename to data/RISP_data/time142.dat diff --git a/RISP_data/time143.dat b/data/RISP_data/time143.dat similarity index 100% rename from RISP_data/time143.dat rename to data/RISP_data/time143.dat diff --git a/RISP_data/time144.dat b/data/RISP_data/time144.dat similarity index 100% rename from RISP_data/time144.dat rename to data/RISP_data/time144.dat diff --git a/RISP_data/time145.dat b/data/RISP_data/time145.dat similarity index 100% rename from RISP_data/time145.dat rename to data/RISP_data/time145.dat diff --git a/RISP_data/time146.dat b/data/RISP_data/time146.dat similarity index 100% rename from RISP_data/time146.dat rename to data/RISP_data/time146.dat diff --git a/RISP_data/time147.dat b/data/RISP_data/time147.dat similarity index 100% rename from RISP_data/time147.dat rename to data/RISP_data/time147.dat diff --git a/RISP_data/time148.dat b/data/RISP_data/time148.dat similarity index 100% rename from RISP_data/time148.dat rename to data/RISP_data/time148.dat diff --git a/RISP_data/time149.dat b/data/RISP_data/time149.dat similarity index 100% rename from RISP_data/time149.dat rename to data/RISP_data/time149.dat diff --git a/RISP_data/time150.dat b/data/RISP_data/time150.dat similarity index 100% rename from RISP_data/time150.dat rename to data/RISP_data/time150.dat diff --git a/RISP_data/time151.dat b/data/RISP_data/time151.dat similarity index 100% rename from RISP_data/time151.dat rename to data/RISP_data/time151.dat diff --git a/RISP_data/time152.dat b/data/RISP_data/time152.dat similarity index 100% rename from RISP_data/time152.dat rename to data/RISP_data/time152.dat diff --git a/RISP_data/time153.dat b/data/RISP_data/time153.dat similarity index 100% rename from RISP_data/time153.dat rename to data/RISP_data/time153.dat diff --git a/RISP_data/time154.dat b/data/RISP_data/time154.dat similarity index 100% rename from RISP_data/time154.dat rename to data/RISP_data/time154.dat diff --git a/RISP_data/time155.dat b/data/RISP_data/time155.dat similarity index 100% rename from RISP_data/time155.dat rename to data/RISP_data/time155.dat diff --git a/RISP_data/time156.dat b/data/RISP_data/time156.dat similarity index 100% rename from RISP_data/time156.dat rename to data/RISP_data/time156.dat diff --git a/RISP_data/time157.dat b/data/RISP_data/time157.dat similarity index 100% rename from RISP_data/time157.dat rename to data/RISP_data/time157.dat diff --git a/RISP_data/time158.dat b/data/RISP_data/time158.dat similarity index 100% rename from RISP_data/time158.dat rename to data/RISP_data/time158.dat diff --git a/RISP_data/time159.dat b/data/RISP_data/time159.dat similarity index 100% rename from RISP_data/time159.dat rename to data/RISP_data/time159.dat diff --git a/RISP_data/time160.dat b/data/RISP_data/time160.dat similarity index 100% rename from RISP_data/time160.dat rename to data/RISP_data/time160.dat diff --git a/RISP_data/time161.dat b/data/RISP_data/time161.dat similarity index 100% rename from RISP_data/time161.dat rename to data/RISP_data/time161.dat diff --git a/RISP_data/time162.dat b/data/RISP_data/time162.dat similarity index 100% rename from RISP_data/time162.dat rename to data/RISP_data/time162.dat diff --git a/RISP_data/time163.dat b/data/RISP_data/time163.dat similarity index 100% rename from RISP_data/time163.dat rename to data/RISP_data/time163.dat diff --git a/RISP_data/time164.dat b/data/RISP_data/time164.dat similarity index 100% rename from RISP_data/time164.dat rename to data/RISP_data/time164.dat diff --git a/RISP_data/time165.dat b/data/RISP_data/time165.dat similarity index 100% rename from RISP_data/time165.dat rename to data/RISP_data/time165.dat diff --git a/RISP_data/time166.dat b/data/RISP_data/time166.dat similarity index 100% rename from RISP_data/time166.dat rename to data/RISP_data/time166.dat diff --git a/RISP_data/time167.dat b/data/RISP_data/time167.dat similarity index 100% rename from RISP_data/time167.dat rename to data/RISP_data/time167.dat diff --git a/RISP_data/time168.dat b/data/RISP_data/time168.dat similarity index 100% rename from RISP_data/time168.dat rename to data/RISP_data/time168.dat diff --git a/RISP_data/time169.dat b/data/RISP_data/time169.dat similarity index 100% rename from RISP_data/time169.dat rename to data/RISP_data/time169.dat diff --git a/RISP_data/time170.dat b/data/RISP_data/time170.dat similarity index 100% rename from RISP_data/time170.dat rename to data/RISP_data/time170.dat diff --git a/RISP_data/time171.dat b/data/RISP_data/time171.dat similarity index 100% rename from RISP_data/time171.dat rename to data/RISP_data/time171.dat diff --git a/RISP_data/time172.dat b/data/RISP_data/time172.dat similarity index 100% rename from RISP_data/time172.dat rename to data/RISP_data/time172.dat diff --git a/RISP_data/time173.dat b/data/RISP_data/time173.dat similarity index 100% rename from RISP_data/time173.dat rename to data/RISP_data/time173.dat diff --git a/RISP_data/time174.dat b/data/RISP_data/time174.dat similarity index 100% rename from RISP_data/time174.dat rename to data/RISP_data/time174.dat diff --git a/RISP_data/time175.dat b/data/RISP_data/time175.dat similarity index 100% rename from RISP_data/time175.dat rename to data/RISP_data/time175.dat diff --git a/RISP_data/time176.dat b/data/RISP_data/time176.dat similarity index 100% rename from RISP_data/time176.dat rename to data/RISP_data/time176.dat diff --git a/RISP_data/time177.dat b/data/RISP_data/time177.dat similarity index 100% rename from RISP_data/time177.dat rename to data/RISP_data/time177.dat diff --git a/RISP_data/time178.dat b/data/RISP_data/time178.dat similarity index 100% rename from RISP_data/time178.dat rename to data/RISP_data/time178.dat diff --git a/RISP_data/time179.dat b/data/RISP_data/time179.dat similarity index 100% rename from RISP_data/time179.dat rename to data/RISP_data/time179.dat diff --git a/RISP_data/time180.dat b/data/RISP_data/time180.dat similarity index 100% rename from RISP_data/time180.dat rename to data/RISP_data/time180.dat diff --git a/RISP_data/time181.dat b/data/RISP_data/time181.dat similarity index 100% rename from RISP_data/time181.dat rename to data/RISP_data/time181.dat diff --git a/RISP_data/time182.dat b/data/RISP_data/time182.dat similarity index 100% rename from RISP_data/time182.dat rename to data/RISP_data/time182.dat diff --git a/RISP_data/time183.dat b/data/RISP_data/time183.dat similarity index 100% rename from RISP_data/time183.dat rename to data/RISP_data/time183.dat diff --git a/RISP_data/time184.dat b/data/RISP_data/time184.dat similarity index 100% rename from RISP_data/time184.dat rename to data/RISP_data/time184.dat diff --git a/RISP_data/time185.dat b/data/RISP_data/time185.dat similarity index 100% rename from RISP_data/time185.dat rename to data/RISP_data/time185.dat diff --git a/RISP_data/time186.dat b/data/RISP_data/time186.dat similarity index 100% rename from RISP_data/time186.dat rename to data/RISP_data/time186.dat diff --git a/RISP_data/time187.dat b/data/RISP_data/time187.dat similarity index 100% rename from RISP_data/time187.dat rename to data/RISP_data/time187.dat diff --git a/RISP_data/time188.dat b/data/RISP_data/time188.dat similarity index 100% rename from RISP_data/time188.dat rename to data/RISP_data/time188.dat diff --git a/RISP_data/time189.dat b/data/RISP_data/time189.dat similarity index 100% rename from RISP_data/time189.dat rename to data/RISP_data/time189.dat diff --git a/RISP_data/time190.dat b/data/RISP_data/time190.dat similarity index 100% rename from RISP_data/time190.dat rename to data/RISP_data/time190.dat diff --git a/RISP_data/time191.dat b/data/RISP_data/time191.dat similarity index 100% rename from RISP_data/time191.dat rename to data/RISP_data/time191.dat diff --git a/RISP_data/time192.dat b/data/RISP_data/time192.dat similarity index 100% rename from RISP_data/time192.dat rename to data/RISP_data/time192.dat diff --git a/RISP_data/time193.dat b/data/RISP_data/time193.dat similarity index 100% rename from RISP_data/time193.dat rename to data/RISP_data/time193.dat diff --git a/RISP_data/time194.dat b/data/RISP_data/time194.dat similarity index 100% rename from RISP_data/time194.dat rename to data/RISP_data/time194.dat diff --git a/RISP_data/time195.dat b/data/RISP_data/time195.dat similarity index 100% rename from RISP_data/time195.dat rename to data/RISP_data/time195.dat diff --git a/RISP_data/time196.dat b/data/RISP_data/time196.dat similarity index 100% rename from RISP_data/time196.dat rename to data/RISP_data/time196.dat diff --git a/RISP_data/time197.dat b/data/RISP_data/time197.dat similarity index 100% rename from RISP_data/time197.dat rename to data/RISP_data/time197.dat diff --git a/RISP_data/time198.dat b/data/RISP_data/time198.dat similarity index 100% rename from RISP_data/time198.dat rename to data/RISP_data/time198.dat diff --git a/RISP_data/time199.dat b/data/RISP_data/time199.dat similarity index 100% rename from RISP_data/time199.dat rename to data/RISP_data/time199.dat diff --git a/RISP_data/time200.dat b/data/RISP_data/time200.dat similarity index 100% rename from RISP_data/time200.dat rename to data/RISP_data/time200.dat diff --git a/RISP_data/time201.dat b/data/RISP_data/time201.dat similarity index 100% rename from RISP_data/time201.dat rename to data/RISP_data/time201.dat diff --git a/RISP_data/time202.dat b/data/RISP_data/time202.dat similarity index 100% rename from RISP_data/time202.dat rename to data/RISP_data/time202.dat diff --git a/RISP_data/time203.dat b/data/RISP_data/time203.dat similarity index 100% rename from RISP_data/time203.dat rename to data/RISP_data/time203.dat diff --git a/RISP_data/time204.dat b/data/RISP_data/time204.dat similarity index 100% rename from RISP_data/time204.dat rename to data/RISP_data/time204.dat diff --git a/RISP_data/time205.dat b/data/RISP_data/time205.dat similarity index 100% rename from RISP_data/time205.dat rename to data/RISP_data/time205.dat diff --git a/RISP_data/time206.dat b/data/RISP_data/time206.dat similarity index 100% rename from RISP_data/time206.dat rename to data/RISP_data/time206.dat diff --git a/RISP_data/time207.dat b/data/RISP_data/time207.dat similarity index 100% rename from RISP_data/time207.dat rename to data/RISP_data/time207.dat diff --git a/RISP_data/time208.dat b/data/RISP_data/time208.dat similarity index 100% rename from RISP_data/time208.dat rename to data/RISP_data/time208.dat diff --git a/RISP_data/time209.dat b/data/RISP_data/time209.dat similarity index 100% rename from RISP_data/time209.dat rename to data/RISP_data/time209.dat diff --git a/RISP_data/time210.dat b/data/RISP_data/time210.dat similarity index 100% rename from RISP_data/time210.dat rename to data/RISP_data/time210.dat diff --git a/RISP_data/time211.dat b/data/RISP_data/time211.dat similarity index 100% rename from RISP_data/time211.dat rename to data/RISP_data/time211.dat diff --git a/RISP_data/time212.dat b/data/RISP_data/time212.dat similarity index 100% rename from RISP_data/time212.dat rename to data/RISP_data/time212.dat diff --git a/RISP_data/time213.dat b/data/RISP_data/time213.dat similarity index 100% rename from RISP_data/time213.dat rename to data/RISP_data/time213.dat diff --git a/RISP_data/time214.dat b/data/RISP_data/time214.dat similarity index 100% rename from RISP_data/time214.dat rename to data/RISP_data/time214.dat diff --git a/RISP_data/time215.dat b/data/RISP_data/time215.dat similarity index 100% rename from RISP_data/time215.dat rename to data/RISP_data/time215.dat diff --git a/RISP_data/time216.dat b/data/RISP_data/time216.dat similarity index 100% rename from RISP_data/time216.dat rename to data/RISP_data/time216.dat diff --git a/RISP_data/time217.dat b/data/RISP_data/time217.dat similarity index 100% rename from RISP_data/time217.dat rename to data/RISP_data/time217.dat diff --git a/RISP_data/time218.dat b/data/RISP_data/time218.dat similarity index 100% rename from RISP_data/time218.dat rename to data/RISP_data/time218.dat diff --git a/RISP_data/time219.dat b/data/RISP_data/time219.dat similarity index 100% rename from RISP_data/time219.dat rename to data/RISP_data/time219.dat diff --git a/RISP_data/time220.dat b/data/RISP_data/time220.dat similarity index 100% rename from RISP_data/time220.dat rename to data/RISP_data/time220.dat diff --git a/RISP_data/time221.dat b/data/RISP_data/time221.dat similarity index 100% rename from RISP_data/time221.dat rename to data/RISP_data/time221.dat diff --git a/RISP_data/time222.dat b/data/RISP_data/time222.dat similarity index 100% rename from RISP_data/time222.dat rename to data/RISP_data/time222.dat diff --git a/RISP_data/time223.dat b/data/RISP_data/time223.dat similarity index 100% rename from RISP_data/time223.dat rename to data/RISP_data/time223.dat diff --git a/RISP_data/time224.dat b/data/RISP_data/time224.dat similarity index 100% rename from RISP_data/time224.dat rename to data/RISP_data/time224.dat diff --git a/RISP_data/time225.dat b/data/RISP_data/time225.dat similarity index 100% rename from RISP_data/time225.dat rename to data/RISP_data/time225.dat diff --git a/RISP_data/time226.dat b/data/RISP_data/time226.dat similarity index 100% rename from RISP_data/time226.dat rename to data/RISP_data/time226.dat diff --git a/RISP_data/time227.dat b/data/RISP_data/time227.dat similarity index 100% rename from RISP_data/time227.dat rename to data/RISP_data/time227.dat diff --git a/RISP_data/time228.dat b/data/RISP_data/time228.dat similarity index 100% rename from RISP_data/time228.dat rename to data/RISP_data/time228.dat diff --git a/RISP_data/time229.dat b/data/RISP_data/time229.dat similarity index 100% rename from RISP_data/time229.dat rename to data/RISP_data/time229.dat diff --git a/RISP_data/time230.dat b/data/RISP_data/time230.dat similarity index 100% rename from RISP_data/time230.dat rename to data/RISP_data/time230.dat diff --git a/RISP_data/time231.dat b/data/RISP_data/time231.dat similarity index 100% rename from RISP_data/time231.dat rename to data/RISP_data/time231.dat diff --git a/RISP_data/time232.dat b/data/RISP_data/time232.dat similarity index 100% rename from RISP_data/time232.dat rename to data/RISP_data/time232.dat diff --git a/RISP_data/time233.dat b/data/RISP_data/time233.dat similarity index 100% rename from RISP_data/time233.dat rename to data/RISP_data/time233.dat diff --git a/RISP_data/time234.dat b/data/RISP_data/time234.dat similarity index 100% rename from RISP_data/time234.dat rename to data/RISP_data/time234.dat diff --git a/RISP_data/time235.dat b/data/RISP_data/time235.dat similarity index 100% rename from RISP_data/time235.dat rename to data/RISP_data/time235.dat diff --git a/RISP_data/time236.dat b/data/RISP_data/time236.dat similarity index 100% rename from RISP_data/time236.dat rename to data/RISP_data/time236.dat diff --git a/RISP_data/time237.dat b/data/RISP_data/time237.dat similarity index 100% rename from RISP_data/time237.dat rename to data/RISP_data/time237.dat diff --git a/RISP_data/time238.dat b/data/RISP_data/time238.dat similarity index 100% rename from RISP_data/time238.dat rename to data/RISP_data/time238.dat diff --git a/RISP_data/time239.dat b/data/RISP_data/time239.dat similarity index 100% rename from RISP_data/time239.dat rename to data/RISP_data/time239.dat diff --git a/RISP_data/time240.dat b/data/RISP_data/time240.dat similarity index 100% rename from RISP_data/time240.dat rename to data/RISP_data/time240.dat diff --git a/RISP_data/time241.dat b/data/RISP_data/time241.dat similarity index 100% rename from RISP_data/time241.dat rename to data/RISP_data/time241.dat diff --git a/RISP_data/time242.dat b/data/RISP_data/time242.dat similarity index 100% rename from RISP_data/time242.dat rename to data/RISP_data/time242.dat diff --git a/RISP_data/time243.dat b/data/RISP_data/time243.dat similarity index 100% rename from RISP_data/time243.dat rename to data/RISP_data/time243.dat diff --git a/RISP_data/time244.dat b/data/RISP_data/time244.dat similarity index 100% rename from RISP_data/time244.dat rename to data/RISP_data/time244.dat diff --git a/RISP_data/time245.dat b/data/RISP_data/time245.dat similarity index 100% rename from RISP_data/time245.dat rename to data/RISP_data/time245.dat diff --git a/RISP_data/time246.dat b/data/RISP_data/time246.dat similarity index 100% rename from RISP_data/time246.dat rename to data/RISP_data/time246.dat diff --git a/RISP_data/time247.dat b/data/RISP_data/time247.dat similarity index 100% rename from RISP_data/time247.dat rename to data/RISP_data/time247.dat diff --git a/RISP_data/time248.dat b/data/RISP_data/time248.dat similarity index 100% rename from RISP_data/time248.dat rename to data/RISP_data/time248.dat diff --git a/RISP_data/time249.dat b/data/RISP_data/time249.dat similarity index 100% rename from RISP_data/time249.dat rename to data/RISP_data/time249.dat diff --git a/RISP_data/time250.dat b/data/RISP_data/time250.dat similarity index 100% rename from RISP_data/time250.dat rename to data/RISP_data/time250.dat diff --git a/RISP_data/time251.dat b/data/RISP_data/time251.dat similarity index 100% rename from RISP_data/time251.dat rename to data/RISP_data/time251.dat diff --git a/RISP_data/time252.dat b/data/RISP_data/time252.dat similarity index 100% rename from RISP_data/time252.dat rename to data/RISP_data/time252.dat diff --git a/RISP_data/time253.dat b/data/RISP_data/time253.dat similarity index 100% rename from RISP_data/time253.dat rename to data/RISP_data/time253.dat diff --git a/RISP_data/time254.dat b/data/RISP_data/time254.dat similarity index 100% rename from RISP_data/time254.dat rename to data/RISP_data/time254.dat diff --git a/RISP_data/time255.dat b/data/RISP_data/time255.dat similarity index 100% rename from RISP_data/time255.dat rename to data/RISP_data/time255.dat diff --git a/RISP_data/time256.dat b/data/RISP_data/time256.dat similarity index 100% rename from RISP_data/time256.dat rename to data/RISP_data/time256.dat diff --git a/RISP_data/time257.dat b/data/RISP_data/time257.dat similarity index 100% rename from RISP_data/time257.dat rename to data/RISP_data/time257.dat diff --git a/RISP_data/time258.dat b/data/RISP_data/time258.dat similarity index 100% rename from RISP_data/time258.dat rename to data/RISP_data/time258.dat diff --git a/RISP_data/time259.dat b/data/RISP_data/time259.dat similarity index 100% rename from RISP_data/time259.dat rename to data/RISP_data/time259.dat diff --git a/RISP_data/time260.dat b/data/RISP_data/time260.dat similarity index 100% rename from RISP_data/time260.dat rename to data/RISP_data/time260.dat diff --git a/RISP_data/time270.dat b/data/RISP_data/time270.dat similarity index 100% rename from RISP_data/time270.dat rename to data/RISP_data/time270.dat diff --git a/ROSP_data/.DS_Store b/data/ROSP_data/.DS_Store similarity index 100% rename from ROSP_data/.DS_Store rename to data/ROSP_data/.DS_Store diff --git a/ROSP_data/time0.dat b/data/ROSP_data/time0.dat similarity index 100% rename from ROSP_data/time0.dat rename to data/ROSP_data/time0.dat diff --git a/ROSP_data/time10.dat b/data/ROSP_data/time10.dat similarity index 100% rename from ROSP_data/time10.dat rename to data/ROSP_data/time10.dat diff --git a/ROSP_data/time100.dat b/data/ROSP_data/time100.dat similarity index 100% rename from ROSP_data/time100.dat rename to data/ROSP_data/time100.dat diff --git a/ROSP_data/time101.dat b/data/ROSP_data/time101.dat similarity index 100% rename from ROSP_data/time101.dat rename to data/ROSP_data/time101.dat diff --git a/ROSP_data/time102.dat b/data/ROSP_data/time102.dat similarity index 100% rename from ROSP_data/time102.dat rename to data/ROSP_data/time102.dat diff --git a/ROSP_data/time103.dat b/data/ROSP_data/time103.dat similarity index 100% rename from ROSP_data/time103.dat rename to data/ROSP_data/time103.dat diff --git a/ROSP_data/time104.dat b/data/ROSP_data/time104.dat similarity index 100% rename from ROSP_data/time104.dat rename to data/ROSP_data/time104.dat diff --git a/ROSP_data/time105.dat b/data/ROSP_data/time105.dat similarity index 100% rename from ROSP_data/time105.dat rename to data/ROSP_data/time105.dat diff --git a/ROSP_data/time106.dat b/data/ROSP_data/time106.dat similarity index 100% rename from ROSP_data/time106.dat rename to data/ROSP_data/time106.dat diff --git a/ROSP_data/time107.dat b/data/ROSP_data/time107.dat similarity index 100% rename from ROSP_data/time107.dat rename to data/ROSP_data/time107.dat diff --git a/ROSP_data/time108.dat b/data/ROSP_data/time108.dat similarity index 100% rename from ROSP_data/time108.dat rename to data/ROSP_data/time108.dat diff --git a/ROSP_data/time109.dat b/data/ROSP_data/time109.dat similarity index 100% rename from ROSP_data/time109.dat rename to data/ROSP_data/time109.dat diff --git a/ROSP_data/time110.dat b/data/ROSP_data/time110.dat similarity index 100% rename from ROSP_data/time110.dat rename to data/ROSP_data/time110.dat diff --git a/ROSP_data/time111.dat b/data/ROSP_data/time111.dat similarity index 100% rename from ROSP_data/time111.dat rename to data/ROSP_data/time111.dat diff --git a/ROSP_data/time112.dat b/data/ROSP_data/time112.dat similarity index 100% rename from ROSP_data/time112.dat rename to data/ROSP_data/time112.dat diff --git a/ROSP_data/time113.dat b/data/ROSP_data/time113.dat similarity index 100% rename from ROSP_data/time113.dat rename to data/ROSP_data/time113.dat diff --git a/ROSP_data/time114.dat b/data/ROSP_data/time114.dat similarity index 100% rename from ROSP_data/time114.dat rename to data/ROSP_data/time114.dat diff --git a/ROSP_data/time115.dat b/data/ROSP_data/time115.dat similarity index 100% rename from ROSP_data/time115.dat rename to data/ROSP_data/time115.dat diff --git a/ROSP_data/time116.dat b/data/ROSP_data/time116.dat similarity index 100% rename from ROSP_data/time116.dat rename to data/ROSP_data/time116.dat diff --git a/ROSP_data/time117.dat b/data/ROSP_data/time117.dat similarity index 100% rename from ROSP_data/time117.dat rename to data/ROSP_data/time117.dat diff --git a/ROSP_data/time118.dat b/data/ROSP_data/time118.dat similarity index 100% rename from ROSP_data/time118.dat rename to data/ROSP_data/time118.dat diff --git a/ROSP_data/time119.dat b/data/ROSP_data/time119.dat similarity index 100% rename from ROSP_data/time119.dat rename to data/ROSP_data/time119.dat diff --git a/ROSP_data/time120.dat b/data/ROSP_data/time120.dat similarity index 100% rename from ROSP_data/time120.dat rename to data/ROSP_data/time120.dat diff --git a/ROSP_data/time121.dat b/data/ROSP_data/time121.dat similarity index 100% rename from ROSP_data/time121.dat rename to data/ROSP_data/time121.dat diff --git a/ROSP_data/time122.dat b/data/ROSP_data/time122.dat similarity index 100% rename from ROSP_data/time122.dat rename to data/ROSP_data/time122.dat diff --git a/ROSP_data/time123.dat b/data/ROSP_data/time123.dat similarity index 100% rename from ROSP_data/time123.dat rename to data/ROSP_data/time123.dat diff --git a/ROSP_data/time124.dat b/data/ROSP_data/time124.dat similarity index 100% rename from ROSP_data/time124.dat rename to data/ROSP_data/time124.dat diff --git a/ROSP_data/time125.dat b/data/ROSP_data/time125.dat similarity index 100% rename from ROSP_data/time125.dat rename to data/ROSP_data/time125.dat diff --git a/ROSP_data/time126.dat b/data/ROSP_data/time126.dat similarity index 100% rename from ROSP_data/time126.dat rename to data/ROSP_data/time126.dat diff --git a/ROSP_data/time127.dat b/data/ROSP_data/time127.dat similarity index 100% rename from ROSP_data/time127.dat rename to data/ROSP_data/time127.dat diff --git a/ROSP_data/time128.dat b/data/ROSP_data/time128.dat similarity index 100% rename from ROSP_data/time128.dat rename to data/ROSP_data/time128.dat diff --git a/ROSP_data/time129.dat b/data/ROSP_data/time129.dat similarity index 100% rename from ROSP_data/time129.dat rename to data/ROSP_data/time129.dat diff --git a/ROSP_data/time130.dat b/data/ROSP_data/time130.dat similarity index 100% rename from ROSP_data/time130.dat rename to data/ROSP_data/time130.dat diff --git a/ROSP_data/time131.dat b/data/ROSP_data/time131.dat similarity index 100% rename from ROSP_data/time131.dat rename to data/ROSP_data/time131.dat diff --git a/ROSP_data/time132.dat b/data/ROSP_data/time132.dat similarity index 100% rename from ROSP_data/time132.dat rename to data/ROSP_data/time132.dat diff --git a/ROSP_data/time133.dat b/data/ROSP_data/time133.dat similarity index 100% rename from ROSP_data/time133.dat rename to data/ROSP_data/time133.dat diff --git a/ROSP_data/time134.dat b/data/ROSP_data/time134.dat similarity index 100% rename from ROSP_data/time134.dat rename to data/ROSP_data/time134.dat diff --git a/ROSP_data/time135.dat b/data/ROSP_data/time135.dat similarity index 100% rename from ROSP_data/time135.dat rename to data/ROSP_data/time135.dat diff --git a/ROSP_data/time136.dat b/data/ROSP_data/time136.dat similarity index 100% rename from ROSP_data/time136.dat rename to data/ROSP_data/time136.dat diff --git a/ROSP_data/time137.dat b/data/ROSP_data/time137.dat similarity index 100% rename from ROSP_data/time137.dat rename to data/ROSP_data/time137.dat diff --git a/ROSP_data/time138.dat b/data/ROSP_data/time138.dat similarity index 100% rename from ROSP_data/time138.dat rename to data/ROSP_data/time138.dat diff --git a/ROSP_data/time139.dat b/data/ROSP_data/time139.dat similarity index 100% rename from ROSP_data/time139.dat rename to data/ROSP_data/time139.dat diff --git a/ROSP_data/time140.dat b/data/ROSP_data/time140.dat similarity index 100% rename from ROSP_data/time140.dat rename to data/ROSP_data/time140.dat diff --git a/ROSP_data/time141.dat b/data/ROSP_data/time141.dat similarity index 100% rename from ROSP_data/time141.dat rename to data/ROSP_data/time141.dat diff --git a/ROSP_data/time142.dat b/data/ROSP_data/time142.dat similarity index 100% rename from ROSP_data/time142.dat rename to data/ROSP_data/time142.dat diff --git a/ROSP_data/time143.dat b/data/ROSP_data/time143.dat similarity index 100% rename from ROSP_data/time143.dat rename to data/ROSP_data/time143.dat diff --git a/ROSP_data/time144.dat b/data/ROSP_data/time144.dat similarity index 100% rename from ROSP_data/time144.dat rename to data/ROSP_data/time144.dat diff --git a/ROSP_data/time145.dat b/data/ROSP_data/time145.dat similarity index 100% rename from ROSP_data/time145.dat rename to data/ROSP_data/time145.dat diff --git a/ROSP_data/time146.dat b/data/ROSP_data/time146.dat similarity index 100% rename from ROSP_data/time146.dat rename to data/ROSP_data/time146.dat diff --git a/ROSP_data/time147.dat b/data/ROSP_data/time147.dat similarity index 100% rename from ROSP_data/time147.dat rename to data/ROSP_data/time147.dat diff --git a/ROSP_data/time148.dat b/data/ROSP_data/time148.dat similarity index 100% rename from ROSP_data/time148.dat rename to data/ROSP_data/time148.dat diff --git a/ROSP_data/time149.dat b/data/ROSP_data/time149.dat similarity index 100% rename from ROSP_data/time149.dat rename to data/ROSP_data/time149.dat diff --git a/ROSP_data/time150.dat b/data/ROSP_data/time150.dat similarity index 100% rename from ROSP_data/time150.dat rename to data/ROSP_data/time150.dat diff --git a/ROSP_data/time151.dat b/data/ROSP_data/time151.dat similarity index 100% rename from ROSP_data/time151.dat rename to data/ROSP_data/time151.dat diff --git a/ROSP_data/time152.dat b/data/ROSP_data/time152.dat similarity index 100% rename from ROSP_data/time152.dat rename to data/ROSP_data/time152.dat diff --git a/ROSP_data/time153.dat b/data/ROSP_data/time153.dat similarity index 100% rename from ROSP_data/time153.dat rename to data/ROSP_data/time153.dat diff --git a/ROSP_data/time154.dat b/data/ROSP_data/time154.dat similarity index 100% rename from ROSP_data/time154.dat rename to data/ROSP_data/time154.dat diff --git a/ROSP_data/time155.dat b/data/ROSP_data/time155.dat similarity index 100% rename from ROSP_data/time155.dat rename to data/ROSP_data/time155.dat diff --git a/ROSP_data/time156.dat b/data/ROSP_data/time156.dat similarity index 100% rename from ROSP_data/time156.dat rename to data/ROSP_data/time156.dat diff --git a/ROSP_data/time157.dat b/data/ROSP_data/time157.dat similarity index 100% rename from ROSP_data/time157.dat rename to data/ROSP_data/time157.dat diff --git a/ROSP_data/time158.dat b/data/ROSP_data/time158.dat similarity index 100% rename from ROSP_data/time158.dat rename to data/ROSP_data/time158.dat diff --git a/ROSP_data/time159.dat b/data/ROSP_data/time159.dat similarity index 100% rename from ROSP_data/time159.dat rename to data/ROSP_data/time159.dat diff --git a/ROSP_data/time160.dat b/data/ROSP_data/time160.dat similarity index 100% rename from ROSP_data/time160.dat rename to data/ROSP_data/time160.dat diff --git a/ROSP_data/time161.dat b/data/ROSP_data/time161.dat similarity index 100% rename from ROSP_data/time161.dat rename to data/ROSP_data/time161.dat diff --git a/ROSP_data/time162.dat b/data/ROSP_data/time162.dat similarity index 100% rename from ROSP_data/time162.dat rename to data/ROSP_data/time162.dat diff --git a/ROSP_data/time163.dat b/data/ROSP_data/time163.dat similarity index 100% rename from ROSP_data/time163.dat rename to data/ROSP_data/time163.dat diff --git a/ROSP_data/time164.dat b/data/ROSP_data/time164.dat similarity index 100% rename from ROSP_data/time164.dat rename to data/ROSP_data/time164.dat diff --git a/ROSP_data/time165.dat b/data/ROSP_data/time165.dat similarity index 100% rename from ROSP_data/time165.dat rename to data/ROSP_data/time165.dat diff --git a/ROSP_data/time166.dat b/data/ROSP_data/time166.dat similarity index 100% rename from ROSP_data/time166.dat rename to data/ROSP_data/time166.dat diff --git a/ROSP_data/time167.dat b/data/ROSP_data/time167.dat similarity index 100% rename from ROSP_data/time167.dat rename to data/ROSP_data/time167.dat diff --git a/ROSP_data/time168.dat b/data/ROSP_data/time168.dat similarity index 100% rename from ROSP_data/time168.dat rename to data/ROSP_data/time168.dat diff --git a/ROSP_data/time169.dat b/data/ROSP_data/time169.dat similarity index 100% rename from ROSP_data/time169.dat rename to data/ROSP_data/time169.dat diff --git a/ROSP_data/time170.dat b/data/ROSP_data/time170.dat similarity index 100% rename from ROSP_data/time170.dat rename to data/ROSP_data/time170.dat diff --git a/ROSP_data/time171.dat b/data/ROSP_data/time171.dat similarity index 100% rename from ROSP_data/time171.dat rename to data/ROSP_data/time171.dat diff --git a/ROSP_data/time172.dat b/data/ROSP_data/time172.dat similarity index 100% rename from ROSP_data/time172.dat rename to data/ROSP_data/time172.dat diff --git a/ROSP_data/time173.dat b/data/ROSP_data/time173.dat similarity index 100% rename from ROSP_data/time173.dat rename to data/ROSP_data/time173.dat diff --git a/ROSP_data/time174.dat b/data/ROSP_data/time174.dat similarity index 100% rename from ROSP_data/time174.dat rename to data/ROSP_data/time174.dat diff --git a/ROSP_data/time175.dat b/data/ROSP_data/time175.dat similarity index 100% rename from ROSP_data/time175.dat rename to data/ROSP_data/time175.dat diff --git a/ROSP_data/time176.dat b/data/ROSP_data/time176.dat similarity index 100% rename from ROSP_data/time176.dat rename to data/ROSP_data/time176.dat diff --git a/ROSP_data/time177.dat b/data/ROSP_data/time177.dat similarity index 100% rename from ROSP_data/time177.dat rename to data/ROSP_data/time177.dat diff --git a/ROSP_data/time178.dat b/data/ROSP_data/time178.dat similarity index 100% rename from ROSP_data/time178.dat rename to data/ROSP_data/time178.dat diff --git a/ROSP_data/time179.dat b/data/ROSP_data/time179.dat similarity index 100% rename from ROSP_data/time179.dat rename to data/ROSP_data/time179.dat diff --git a/ROSP_data/time180.dat b/data/ROSP_data/time180.dat similarity index 100% rename from ROSP_data/time180.dat rename to data/ROSP_data/time180.dat diff --git a/ROSP_data/time181.dat b/data/ROSP_data/time181.dat similarity index 100% rename from ROSP_data/time181.dat rename to data/ROSP_data/time181.dat diff --git a/ROSP_data/time182.dat b/data/ROSP_data/time182.dat similarity index 100% rename from ROSP_data/time182.dat rename to data/ROSP_data/time182.dat diff --git a/ROSP_data/time183.dat b/data/ROSP_data/time183.dat similarity index 100% rename from ROSP_data/time183.dat rename to data/ROSP_data/time183.dat diff --git a/ROSP_data/time184.dat b/data/ROSP_data/time184.dat similarity index 100% rename from ROSP_data/time184.dat rename to data/ROSP_data/time184.dat diff --git a/ROSP_data/time185.dat b/data/ROSP_data/time185.dat similarity index 100% rename from ROSP_data/time185.dat rename to data/ROSP_data/time185.dat diff --git a/ROSP_data/time186.dat b/data/ROSP_data/time186.dat similarity index 100% rename from ROSP_data/time186.dat rename to data/ROSP_data/time186.dat diff --git a/ROSP_data/time187.dat b/data/ROSP_data/time187.dat similarity index 100% rename from ROSP_data/time187.dat rename to data/ROSP_data/time187.dat diff --git a/ROSP_data/time188.dat b/data/ROSP_data/time188.dat similarity index 100% rename from ROSP_data/time188.dat rename to data/ROSP_data/time188.dat diff --git a/ROSP_data/time189.dat b/data/ROSP_data/time189.dat similarity index 100% rename from ROSP_data/time189.dat rename to data/ROSP_data/time189.dat diff --git a/ROSP_data/time190.dat b/data/ROSP_data/time190.dat similarity index 100% rename from ROSP_data/time190.dat rename to data/ROSP_data/time190.dat diff --git a/ROSP_data/time191.dat b/data/ROSP_data/time191.dat similarity index 100% rename from ROSP_data/time191.dat rename to data/ROSP_data/time191.dat diff --git a/ROSP_data/time192.dat b/data/ROSP_data/time192.dat similarity index 100% rename from ROSP_data/time192.dat rename to data/ROSP_data/time192.dat diff --git a/ROSP_data/time193.dat b/data/ROSP_data/time193.dat similarity index 100% rename from ROSP_data/time193.dat rename to data/ROSP_data/time193.dat diff --git a/ROSP_data/time194.dat b/data/ROSP_data/time194.dat similarity index 100% rename from ROSP_data/time194.dat rename to data/ROSP_data/time194.dat diff --git a/ROSP_data/time195.dat b/data/ROSP_data/time195.dat similarity index 100% rename from ROSP_data/time195.dat rename to data/ROSP_data/time195.dat diff --git a/ROSP_data/time196.dat b/data/ROSP_data/time196.dat similarity index 100% rename from ROSP_data/time196.dat rename to data/ROSP_data/time196.dat diff --git a/ROSP_data/time197.dat b/data/ROSP_data/time197.dat similarity index 100% rename from ROSP_data/time197.dat rename to data/ROSP_data/time197.dat diff --git a/ROSP_data/time198.dat b/data/ROSP_data/time198.dat similarity index 100% rename from ROSP_data/time198.dat rename to data/ROSP_data/time198.dat diff --git a/ROSP_data/time199.dat b/data/ROSP_data/time199.dat similarity index 100% rename from ROSP_data/time199.dat rename to data/ROSP_data/time199.dat diff --git a/ROSP_data/time200.dat b/data/ROSP_data/time200.dat similarity index 100% rename from ROSP_data/time200.dat rename to data/ROSP_data/time200.dat diff --git a/ROSP_data/time201.dat b/data/ROSP_data/time201.dat similarity index 100% rename from ROSP_data/time201.dat rename to data/ROSP_data/time201.dat diff --git a/ROSP_data/time202.dat b/data/ROSP_data/time202.dat similarity index 100% rename from ROSP_data/time202.dat rename to data/ROSP_data/time202.dat diff --git a/ROSP_data/time203.dat b/data/ROSP_data/time203.dat similarity index 100% rename from ROSP_data/time203.dat rename to data/ROSP_data/time203.dat diff --git a/ROSP_data/time204.dat b/data/ROSP_data/time204.dat similarity index 100% rename from ROSP_data/time204.dat rename to data/ROSP_data/time204.dat diff --git a/ROSP_data/time205.dat b/data/ROSP_data/time205.dat similarity index 100% rename from ROSP_data/time205.dat rename to data/ROSP_data/time205.dat diff --git a/ROSP_data/time206.dat b/data/ROSP_data/time206.dat similarity index 100% rename from ROSP_data/time206.dat rename to data/ROSP_data/time206.dat diff --git a/ROSP_data/time207.dat b/data/ROSP_data/time207.dat similarity index 100% rename from ROSP_data/time207.dat rename to data/ROSP_data/time207.dat diff --git a/ROSP_data/time208.dat b/data/ROSP_data/time208.dat similarity index 100% rename from ROSP_data/time208.dat rename to data/ROSP_data/time208.dat diff --git a/ROSP_data/time209.dat b/data/ROSP_data/time209.dat similarity index 100% rename from ROSP_data/time209.dat rename to data/ROSP_data/time209.dat diff --git a/ROSP_data/time210.dat b/data/ROSP_data/time210.dat similarity index 100% rename from ROSP_data/time210.dat rename to data/ROSP_data/time210.dat diff --git a/ROSP_data/time211.dat b/data/ROSP_data/time211.dat similarity index 100% rename from ROSP_data/time211.dat rename to data/ROSP_data/time211.dat diff --git a/ROSP_data/time212.dat b/data/ROSP_data/time212.dat similarity index 100% rename from ROSP_data/time212.dat rename to data/ROSP_data/time212.dat diff --git a/ROSP_data/time213.dat b/data/ROSP_data/time213.dat similarity index 100% rename from ROSP_data/time213.dat rename to data/ROSP_data/time213.dat diff --git a/ROSP_data/time214.dat b/data/ROSP_data/time214.dat similarity index 100% rename from ROSP_data/time214.dat rename to data/ROSP_data/time214.dat diff --git a/ROSP_data/time215.dat b/data/ROSP_data/time215.dat similarity index 100% rename from ROSP_data/time215.dat rename to data/ROSP_data/time215.dat diff --git a/ROSP_data/time216.dat b/data/ROSP_data/time216.dat similarity index 100% rename from ROSP_data/time216.dat rename to data/ROSP_data/time216.dat diff --git a/ROSP_data/time217.dat b/data/ROSP_data/time217.dat similarity index 100% rename from ROSP_data/time217.dat rename to data/ROSP_data/time217.dat diff --git a/ROSP_data/time218.dat b/data/ROSP_data/time218.dat similarity index 100% rename from ROSP_data/time218.dat rename to data/ROSP_data/time218.dat diff --git a/ROSP_data/time219.dat b/data/ROSP_data/time219.dat similarity index 100% rename from ROSP_data/time219.dat rename to data/ROSP_data/time219.dat diff --git a/ROSP_data/time220.dat b/data/ROSP_data/time220.dat similarity index 100% rename from ROSP_data/time220.dat rename to data/ROSP_data/time220.dat diff --git a/ROSP_data/time221.dat b/data/ROSP_data/time221.dat similarity index 100% rename from ROSP_data/time221.dat rename to data/ROSP_data/time221.dat diff --git a/ROSP_data/time222.dat b/data/ROSP_data/time222.dat similarity index 100% rename from ROSP_data/time222.dat rename to data/ROSP_data/time222.dat diff --git a/ROSP_data/time223.dat b/data/ROSP_data/time223.dat similarity index 100% rename from ROSP_data/time223.dat rename to data/ROSP_data/time223.dat diff --git a/ROSP_data/time224.dat b/data/ROSP_data/time224.dat similarity index 100% rename from ROSP_data/time224.dat rename to data/ROSP_data/time224.dat diff --git a/ROSP_data/time225.dat b/data/ROSP_data/time225.dat similarity index 100% rename from ROSP_data/time225.dat rename to data/ROSP_data/time225.dat diff --git a/ROSP_data/time226.dat b/data/ROSP_data/time226.dat similarity index 100% rename from ROSP_data/time226.dat rename to data/ROSP_data/time226.dat diff --git a/ROSP_data/time227.dat b/data/ROSP_data/time227.dat similarity index 100% rename from ROSP_data/time227.dat rename to data/ROSP_data/time227.dat diff --git a/ROSP_data/time228.dat b/data/ROSP_data/time228.dat similarity index 100% rename from ROSP_data/time228.dat rename to data/ROSP_data/time228.dat diff --git a/ROSP_data/time229.dat b/data/ROSP_data/time229.dat similarity index 100% rename from ROSP_data/time229.dat rename to data/ROSP_data/time229.dat diff --git a/ROSP_data/time230.dat b/data/ROSP_data/time230.dat similarity index 100% rename from ROSP_data/time230.dat rename to data/ROSP_data/time230.dat diff --git a/ROSP_data/time231.dat b/data/ROSP_data/time231.dat similarity index 100% rename from ROSP_data/time231.dat rename to data/ROSP_data/time231.dat diff --git a/ROSP_data/time232.dat b/data/ROSP_data/time232.dat similarity index 100% rename from ROSP_data/time232.dat rename to data/ROSP_data/time232.dat diff --git a/ROSP_data/time233.dat b/data/ROSP_data/time233.dat similarity index 100% rename from ROSP_data/time233.dat rename to data/ROSP_data/time233.dat diff --git a/ROSP_data/time234.dat b/data/ROSP_data/time234.dat similarity index 100% rename from ROSP_data/time234.dat rename to data/ROSP_data/time234.dat diff --git a/ROSP_data/time235.dat b/data/ROSP_data/time235.dat similarity index 100% rename from ROSP_data/time235.dat rename to data/ROSP_data/time235.dat diff --git a/ROSP_data/time236.dat b/data/ROSP_data/time236.dat similarity index 100% rename from ROSP_data/time236.dat rename to data/ROSP_data/time236.dat diff --git a/ROSP_data/time237.dat b/data/ROSP_data/time237.dat similarity index 100% rename from ROSP_data/time237.dat rename to data/ROSP_data/time237.dat diff --git a/ROSP_data/time238.dat b/data/ROSP_data/time238.dat similarity index 100% rename from ROSP_data/time238.dat rename to data/ROSP_data/time238.dat diff --git a/ROSP_data/time239.dat b/data/ROSP_data/time239.dat similarity index 100% rename from ROSP_data/time239.dat rename to data/ROSP_data/time239.dat diff --git a/ROSP_data/time240.dat b/data/ROSP_data/time240.dat similarity index 100% rename from ROSP_data/time240.dat rename to data/ROSP_data/time240.dat diff --git a/ROSP_data/time241.dat b/data/ROSP_data/time241.dat similarity index 100% rename from ROSP_data/time241.dat rename to data/ROSP_data/time241.dat diff --git a/ROSP_data/time242.dat b/data/ROSP_data/time242.dat similarity index 100% rename from ROSP_data/time242.dat rename to data/ROSP_data/time242.dat diff --git a/ROSP_data/time243.dat b/data/ROSP_data/time243.dat similarity index 100% rename from ROSP_data/time243.dat rename to data/ROSP_data/time243.dat diff --git a/ROSP_data/time244.dat b/data/ROSP_data/time244.dat similarity index 100% rename from ROSP_data/time244.dat rename to data/ROSP_data/time244.dat diff --git a/ROSP_data/time245.dat b/data/ROSP_data/time245.dat similarity index 100% rename from ROSP_data/time245.dat rename to data/ROSP_data/time245.dat diff --git a/ROSP_data/time246.dat b/data/ROSP_data/time246.dat similarity index 100% rename from ROSP_data/time246.dat rename to data/ROSP_data/time246.dat diff --git a/ROSP_data/time247.dat b/data/ROSP_data/time247.dat similarity index 100% rename from ROSP_data/time247.dat rename to data/ROSP_data/time247.dat diff --git a/ROSP_data/time248.dat b/data/ROSP_data/time248.dat similarity index 100% rename from ROSP_data/time248.dat rename to data/ROSP_data/time248.dat diff --git a/ROSP_data/time249.dat b/data/ROSP_data/time249.dat similarity index 100% rename from ROSP_data/time249.dat rename to data/ROSP_data/time249.dat diff --git a/ROSP_data/time250.dat b/data/ROSP_data/time250.dat similarity index 100% rename from ROSP_data/time250.dat rename to data/ROSP_data/time250.dat diff --git a/ROSP_data/time251.dat b/data/ROSP_data/time251.dat similarity index 100% rename from ROSP_data/time251.dat rename to data/ROSP_data/time251.dat diff --git a/ROSP_data/time252.dat b/data/ROSP_data/time252.dat similarity index 100% rename from ROSP_data/time252.dat rename to data/ROSP_data/time252.dat diff --git a/ROSP_data/time253.dat b/data/ROSP_data/time253.dat similarity index 100% rename from ROSP_data/time253.dat rename to data/ROSP_data/time253.dat diff --git a/ROSP_data/time254.dat b/data/ROSP_data/time254.dat similarity index 100% rename from ROSP_data/time254.dat rename to data/ROSP_data/time254.dat diff --git a/ROSP_data/time255.dat b/data/ROSP_data/time255.dat similarity index 100% rename from ROSP_data/time255.dat rename to data/ROSP_data/time255.dat diff --git a/ROSP_data/time256.dat b/data/ROSP_data/time256.dat similarity index 100% rename from ROSP_data/time256.dat rename to data/ROSP_data/time256.dat diff --git a/ROSP_data/time257.dat b/data/ROSP_data/time257.dat similarity index 100% rename from ROSP_data/time257.dat rename to data/ROSP_data/time257.dat diff --git a/ROSP_data/time258.dat b/data/ROSP_data/time258.dat similarity index 100% rename from ROSP_data/time258.dat rename to data/ROSP_data/time258.dat diff --git a/ROSP_data/time259.dat b/data/ROSP_data/time259.dat similarity index 100% rename from ROSP_data/time259.dat rename to data/ROSP_data/time259.dat diff --git a/ROSP_data/time260.dat b/data/ROSP_data/time260.dat similarity index 100% rename from ROSP_data/time260.dat rename to data/ROSP_data/time260.dat diff --git a/ROSP_data/time270.dat b/data/ROSP_data/time270.dat similarity index 100% rename from ROSP_data/time270.dat rename to data/ROSP_data/time270.dat diff --git a/mb_scenario.py b/mb_scenario.py index 41f5ebd..99da067 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -26,15 +26,16 @@ if __name__ == "__main__": my_scenario = Scenario.from_txt_file("scenario_test.txt", old_format=True) + data_folder = "data" plasma_data_handling = PlasmaDataHandling( pulse_type_to_data = { - "FP": np.loadtxt("Binned_Flux_Data.dat", skiprows=1), - "ICWC": np.loadtxt("ICWC_data.dat", skiprows=1), - "GDC": np.loadtxt("GDC_data.dat", skiprows=1), + "FP": np.loadtxt(data_folder + "/Binned_Flux_Data.dat", skiprows=1), + "ICWC": np.loadtxt(data_folder + "/ICWC_data.dat", skiprows=1), + "GDC": np.loadtxt(data_folder + "/GDC_data.dat", skiprows=1), }, - path_to_ROSP_data="ROSP_data", - path_to_RISP_data="RISP_data", - path_to_RISP_wall_data="RISP_Wall_data.dat", + path_to_ROSP_data=data_folder + "/ROSP_data", + path_to_RISP_data=data_folder + "/RISP_data", + path_to_RISP_wall_data=data_folder + "/RISP_Wall_data.dat", ) nb_mb = 64 From 9d3798b0232f3fb3f35b450c2f0020c687d1dc07 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 20:34:18 -0400 Subject: [PATCH 52/62] test scenario (shorter) --- mb_scenario.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 99da067..8fc3c44 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -8,7 +8,7 @@ from hisp import make_mb_model from hisp.plamsa_data_handling import PlasmaDataHandling from hisp.festim_models import make_mb_model -from hisp.scenario import Scenario +from hisp.scenario import Scenario, Pulse # dolfinx.log.set_log_level(dolfinx.log.LogLevel.INFO) @@ -25,7 +25,34 @@ } if __name__ == "__main__": - my_scenario = Scenario.from_txt_file("scenario_test.txt", old_format=True) + # my_scenario = Scenario.from_txt_file("scenario_test.txt", old_format=True) + fp = Pulse( + pulse_type="FP", + nb_pulses=1, + ramp_up=10, + steady_state=10, + ramp_down=10, + waiting=100, + ) + icwc = Pulse( + pulse_type="ICWC", + nb_pulses=1, + ramp_up=10, + steady_state=10, + ramp_down=10, + waiting=100, + ) + risp = Pulse( + pulse_type="RISP", + nb_pulses=1, + ramp_up=10, + steady_state=10, + ramp_down=10, + waiting=100, + ) + my_scenario = Scenario(pulses=[fp, icwc, risp]) + + data_folder = "data" plasma_data_handling = PlasmaDataHandling( pulse_type_to_data = { From 4d37f906b6dd33b82c1c86bb15e28fd0ce4720d3 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 20:54:28 -0400 Subject: [PATCH 53/62] removed unused file --- one_line_scenario.txt | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 one_line_scenario.txt diff --git a/one_line_scenario.txt b/one_line_scenario.txt deleted file mode 100644 index 328054b..0000000 --- a/one_line_scenario.txt +++ /dev/null @@ -1,2 +0,0 @@ -# PULSE TYPE, NUMBER OF PULSES, RAMP UP, RAMP DOWN, STEADY STATE, WAITING -FP 2 455 455 650 1000 \ No newline at end of file From ed72cae0a2ac34faddca6c9c946464011e74111d Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 20:54:37 -0400 Subject: [PATCH 54/62] minor refactor for T_function --- mb_scenario.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 8fc3c44..3fba933 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -79,9 +79,9 @@ def T_function(x: NDArray, t: Constant) -> float: pulsed monoblock temperature in K """ resting_value = np.full_like(x[0], COOLANT_TEMP) - pulse_row = my_scenario.get_row(float(t)) - pulse_type = my_scenario.get_pulse_type(float(t)) - t_rel = t - my_scenario.get_time_till_row(pulse_row) + pulse = my_scenario.get_pulse(t) + pulse_type = pulse.pulse_type + t_rel = t - my_scenario.get_time_start_current_pulse(t) if pulse_type == "BAKE": T_bake = 483.15 # K @@ -94,17 +94,15 @@ def T_function(x: NDArray, t: Constant) -> float: b = T_surface flat_top_value = a * x[0] + b - total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) - total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + total_time_on = pulse.duration_no_waiting + total_time_pulse = pulse.total_duration + + pulse_active = 0.0 < t_rel % total_time_pulse < total_time_on + if pulse_active: + return flat_top_value + else: + return resting_value - relative_time = t - time_start_current_pulse - return ( - flat_top_value - if relative_time % total_time_pulse < total_time_on - and relative_time % total_time_pulse != 0.0 - else resting_value - ) def deuterium_ion_flux(t: float) -> float: assert isinstance(t, float), f"t should be a float, not {type(t)}" From 533fe5f577a9fb5681af8a9e38cf63255ff3c53a Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 20:58:18 -0400 Subject: [PATCH 55/62] some more refca --- mb_scenario.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 3fba933..24ded56 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -1,11 +1,9 @@ -# simple monoblock simulation in festim import numpy as np import matplotlib.pyplot as plt from dolfinx.fem.function import Constant from numpy.typing import NDArray -from hisp import make_mb_model from hisp.plamsa_data_handling import PlasmaDataHandling from hisp.festim_models import make_mb_model from hisp.scenario import Scenario, Pulse @@ -78,16 +76,15 @@ def T_function(x: NDArray, t: Constant) -> float: Returns: pulsed monoblock temperature in K """ - resting_value = np.full_like(x[0], COOLANT_TEMP) + pulse = my_scenario.get_pulse(t) - pulse_type = pulse.pulse_type t_rel = t - my_scenario.get_time_start_current_pulse(t) - if pulse_type == "BAKE": + if pulse.pulse_type == "BAKE": T_bake = 483.15 # K flat_top_value = np.full_like(x[0], T_bake) else: - heat_flux = plasma_data_handling.heat(pulse_type, nb_mb, t_rel) + heat_flux = plasma_data_handling.heat(pulse.pulse_type, nb_mb, t_rel) T_surface = 1.1e-4 * heat_flux + COOLANT_TEMP T_rear = 2.2e-5 * heat_flux + COOLANT_TEMP a = (T_rear - T_surface) / L @@ -101,6 +98,7 @@ def T_function(x: NDArray, t: Constant) -> float: if pulse_active: return flat_top_value else: + resting_value = np.full_like(x[0], COOLANT_TEMP) return resting_value From 50d9b14fc38da1ba8cafb892aa99d534ccf14875 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 21:43:56 -0400 Subject: [PATCH 56/62] fixed get_row inclusive --- src/hisp/scenario.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py index b21dc2d..6bf8339 100644 --- a/src/hisp/scenario.py +++ b/src/hisp/scenario.py @@ -136,7 +136,7 @@ def get_row(self, t: float) -> int: current_time = 0 for i, pulse in enumerate(self.pulses): phase_duration = pulse.nb_pulses * pulse.total_duration - if t <= current_time + phase_duration: + if t < current_time + phase_duration: return i else: current_time += phase_duration From d4020a9adde63ebc839b1fc788151304d172b017 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 21:44:30 -0400 Subject: [PATCH 57/62] fixed docstrings --- src/hisp/scenario.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py index 6bf8339..ae8a970 100644 --- a/src/hisp/scenario.py +++ b/src/hisp/scenario.py @@ -125,13 +125,13 @@ def from_txt_file(filename: str, old_format=False) -> "Scenario": return Scenario(pulses) def get_row(self, t: float) -> int: - """Returns the row of the scenario file that corresponds to the time t. + """Returns the index of the pulse at time t. Args: t: the time in seconds Returns: - int: the row index of the scenario file corresponding to the time t + the index of the pulse at time t """ current_time = 0 for i, pulse in enumerate(self.pulses): From 6dcb794ddfe969bb247f0a105fbf7a5db5607b42 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 21:49:10 -0400 Subject: [PATCH 58/62] added new test --- test/test_scenario.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_scenario.py b/test/test_scenario.py index aefb7d3..9e0b9f4 100644 --- a/test/test_scenario.py +++ b/test/test_scenario.py @@ -148,7 +148,8 @@ def test_maximum_time(): @pytest.mark.parametrize( - "t, expected_pulse", [(0, pulse1), (6000, pulse2), (1e5, None)] + "t, expected_pulse", + [(0, pulse1), (6000, pulse2), (1e5, None), (pulse1.total_duration, pulse2)], ) def test_get_pulse(t, expected_pulse): From 4748ba74a675aabcbda07fd4e3bc1664aef52e6b Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 21:52:15 -0400 Subject: [PATCH 59/62] fixed error message --- src/hisp/__init__.py | 2 +- src/hisp/helpers.py | 13 +++++++++++++ src/hisp/scenario.py | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/hisp/__init__.py b/src/hisp/__init__.py index 430e4b4..bfdbbf4 100644 --- a/src/hisp/__init__.py +++ b/src/hisp/__init__.py @@ -1,4 +1,4 @@ -from .helpers import PulsedSource +from .helpers import PulsedSource, gaussian_distribution, periodic_step_function from .h_transport_class import CustomProblem diff --git a/src/hisp/helpers.py b/src/hisp/helpers.py index d798b48..1b91471 100644 --- a/src/hisp/helpers.py +++ b/src/hisp/helpers.py @@ -38,3 +38,16 @@ def update(self, t: float): def gaussian_distribution(x: npt.NDArray, mean:float, width:float, mod=ufl) -> ufl.core.expr.Expr: return mod.exp(-((x[0] - mean) ** 2) / (2 * width**2)) + +def periodic_step_function(x, period_on, period_total, value, value_off=0.0): + """ + Creates a periodic step function with two periods. + """ + + if period_total < period_on: + raise ValueError("period_total must be greater than period_on") + + if x % period_total < period_on: + return value + else: + return value_off \ No newline at end of file diff --git a/src/hisp/scenario.py b/src/hisp/scenario.py index ae8a970..e752d35 100644 --- a/src/hisp/scenario.py +++ b/src/hisp/scenario.py @@ -142,7 +142,7 @@ def get_row(self, t: float) -> int: current_time += phase_duration raise ValueError( - f"Time t {t} is out of bounds of the scenario file. Maximum time is {self.get_maximum_time()}" + f"Time t {t} is out of bounds of the scenario file. Valid times are t < {self.get_maximum_time()}" ) def get_pulse(self, t: float) -> Pulse: From 30ecc2f2ccf9dde417a82cdd5c936efaca339a30 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 21:52:52 -0400 Subject: [PATCH 60/62] refactoring --- mb_scenario.py | 119 ++++++++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 56 deletions(-) diff --git a/mb_scenario.py b/mb_scenario.py index 24ded56..e2da90a 100644 --- a/mb_scenario.py +++ b/mb_scenario.py @@ -1,12 +1,12 @@ import numpy as np import matplotlib.pyplot as plt -from dolfinx.fem.function import Constant from numpy.typing import NDArray from hisp.plamsa_data_handling import PlasmaDataHandling from hisp.festim_models import make_mb_model from hisp.scenario import Scenario, Pulse +from hisp.helpers import periodic_step_function # dolfinx.log.set_log_level(dolfinx.log.LogLevel.INFO) @@ -50,10 +50,9 @@ ) my_scenario = Scenario(pulses=[fp, icwc, risp]) - data_folder = "data" plasma_data_handling = PlasmaDataHandling( - pulse_type_to_data = { + pulse_type_to_data={ "FP": np.loadtxt(data_folder + "/Binned_Flux_Data.dat", skiprows=1), "ICWC": np.loadtxt(data_folder + "/ICWC_data.dat", skiprows=1), "GDC": np.loadtxt(data_folder + "/GDC_data.dat", skiprows=1), @@ -66,7 +65,7 @@ nb_mb = 64 L = 6e-3 # m - def T_function(x: NDArray, t: Constant) -> float: + def T_function(x: NDArray, t: float) -> float: """Monoblock temperature function. Args: @@ -76,7 +75,7 @@ def T_function(x: NDArray, t: Constant) -> float: Returns: pulsed monoblock temperature in K """ - + assert isinstance(t, float), f"t should be a float, not {type(t)}" pulse = my_scenario.get_pulse(t) t_rel = t - my_scenario.get_time_start_current_pulse(t) @@ -93,23 +92,22 @@ def T_function(x: NDArray, t: Constant) -> float: total_time_on = pulse.duration_no_waiting total_time_pulse = pulse.total_duration - - pulse_active = 0.0 < t_rel % total_time_pulse < total_time_on - if pulse_active: - return flat_top_value - else: - resting_value = np.full_like(x[0], COOLANT_TEMP) - return resting_value - + return periodic_step_function( + t_rel, + period_on=total_time_on, + period_total=total_time_pulse, + value=flat_top_value, + value_off=np.full_like(x[0], COOLANT_TEMP), + ) def deuterium_ion_flux(t: float) -> float: assert isinstance(t, float), f"t should be a float, not {type(t)}" - pulse_type = my_scenario.get_pulse_type(t) + pulse = my_scenario.get_pulse(t) + pulse_type = pulse.pulse_type - pulse_row = my_scenario.get_row(t) - total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) - total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + total_time_on = pulse.duration_no_waiting + total_time_pulse = pulse.total_duration + time_start_current_pulse = my_scenario.get_time_start_current_pulse(t) relative_time = t - time_start_current_pulse ion_flux = plasma_data_handling.get_particle_flux( @@ -118,21 +116,22 @@ def deuterium_ion_flux(t: float) -> float: tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = ion_flux * (1 - tritium_fraction) resting_value = 0 - - is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on - if is_pulse_active: - return flat_top_value - else: - return resting_value + return periodic_step_function( + relative_time, + period_on=total_time_on, + period_total=total_time_pulse, + value=flat_top_value, + value_off=resting_value, + ) def tritium_ion_flux(t: float) -> float: assert isinstance(t, float), f"t should be a float, not {type(t)}" - pulse_type = my_scenario.get_pulse_type(t) + pulse = my_scenario.get_pulse(t) + pulse_type = pulse.pulse_type - pulse_row = my_scenario.get_row(t) - total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) - total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + total_time_on = pulse.duration_no_waiting + total_time_pulse = pulse.total_duration + time_start_current_pulse = my_scenario.get_time_start_current_pulse(t) relative_time = t - time_start_current_pulse ion_flux = plasma_data_handling.get_particle_flux( @@ -143,21 +142,24 @@ def tritium_ion_flux(t: float) -> float: flat_top_value = ion_flux * tritium_fraction resting_value = 0.0 - is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on - if is_pulse_active: - return flat_top_value - else: - return resting_value + return periodic_step_function( + relative_time, + period_on=total_time_on, + period_total=total_time_pulse, + value=flat_top_value, + value_off=resting_value, + ) def deuterium_atom_flux(t: float) -> float: assert isinstance(t, float), f"t should be a float, not {type(t)}" - pulse_type = my_scenario.get_pulse_type(t) + pulse = my_scenario.get_pulse(t) + pulse_type = pulse.pulse_type - pulse_row = my_scenario.get_row(t) - total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) - total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + total_time_on = pulse.duration_no_waiting + total_time_pulse = pulse.total_duration + time_start_current_pulse = my_scenario.get_time_start_current_pulse(t) relative_time = t - time_start_current_pulse + atom_flux = plasma_data_handling.get_particle_flux( pulse_type=pulse_type, nb_mb=nb_mb, t_rel=relative_time, ion=False ) @@ -165,20 +167,22 @@ def deuterium_atom_flux(t: float) -> float: tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * (1 - tritium_fraction) resting_value = 0.0 - is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on - if is_pulse_active: - return flat_top_value - else: - return resting_value + return periodic_step_function( + relative_time, + period_on=total_time_on, + period_total=total_time_pulse, + value=flat_top_value, + value_off=resting_value, + ) def tritium_atom_flux(t: float) -> float: assert isinstance(t, float), f"t should be a float, not {type(t)}" - pulse_type = my_scenario.get_pulse_type(t) + pulse = my_scenario.get_pulse(t) + pulse_type = pulse.pulse_type - pulse_row = my_scenario.get_row(t) - total_time_on = my_scenario.get_pulse_duration_no_waiting(pulse_row) - total_time_pulse = my_scenario.get_pulse_duration(pulse_row) - time_start_current_pulse = my_scenario.get_time_till_row(pulse_row) + total_time_on = pulse.duration_no_waiting + total_time_pulse = pulse.total_duration + time_start_current_pulse = my_scenario.get_time_start_current_pulse(t) relative_time = t - time_start_current_pulse atom_flux = plasma_data_handling.get_particle_flux( @@ -187,11 +191,13 @@ def tritium_atom_flux(t: float) -> float: tritium_fraction = PULSE_TYPE_TO_TRITIUM_FRACTION[pulse_type] flat_top_value = atom_flux * tritium_fraction resting_value = 0.0 - is_pulse_active = 0.0 < relative_time % total_time_pulse < total_time_on - if is_pulse_active: - return flat_top_value - else: - return resting_value + return periodic_step_function( + relative_time, + period_on=total_time_on, + period_total=total_time_pulse, + value=flat_top_value, + value_off=resting_value, + ) my_model, quantities = make_mb_model( temperature=T_function, @@ -199,7 +205,8 @@ def tritium_atom_flux(t: float) -> float: tritium_ion_flux=tritium_ion_flux, deuterium_atom_flux=deuterium_atom_flux, tritium_atom_flux=tritium_atom_flux, - final_time=my_scenario.get_maximum_time(), + # FIXME: -1s here to avoid last time step spike + final_time=my_scenario.get_maximum_time()-1, L=6e-3, folder=f"mb{nb_mb}_results", ) @@ -212,7 +219,7 @@ def tritium_atom_flux(t: float) -> float: ############# Results Plotting ############# for name, quantity in quantities.items(): - plt.plot(quantity.t, quantity.data, label=name) + plt.plot(quantity.t, quantity.data, label=name, marker="o") plt.xlabel("Time (s)") plt.ylabel("Total quantity (atoms/m2)") From ebbb4a1b0b6b77578d7e52b54008eae6c052e40f Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 22:04:12 -0400 Subject: [PATCH 61/62] load RISP data only once --- src/hisp/plamsa_data_handling/main.py | 44 +++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/src/hisp/plamsa_data_handling/main.py b/src/hisp/plamsa_data_handling/main.py index 1b2c39e..2782c85 100644 --- a/src/hisp/plamsa_data_handling/main.py +++ b/src/hisp/plamsa_data_handling/main.py @@ -17,6 +17,8 @@ def __init__( self.path_to_ROSP_data = path_to_ROSP_data self.path_to_RISP_wall_data = path_to_RISP_wall_data + self._time_to_RISP_data = {} + def get_particle_flux( self, pulse_type: str, nb_mb: int, t_rel: float, ion=True ) -> float: @@ -83,17 +85,47 @@ def RISP_data(self, nb_mb: int, t_rel: float | int) -> NDArray: # NOTE: what is the point of this test since it takes nb_mb as an argument? if div: if 1 <= t_rel <= 9: - data = np.loadtxt(f"{folder}/time0.dat", skiprows=1) + key = f"{folder}_1_9" + if key not in self._time_to_RISP_data.keys(): + self._time_to_RISP_data[key] = np.loadtxt( + f"{folder}/time0.dat", skiprows=1 + ) + data = self._time_to_RISP_data[key] elif 10 <= t_rel <= 98: - data = np.loadtxt(f"{folder}/time10.dat", skiprows=1) + key = f"{folder}_10_98" + if key not in self._time_to_RISP_data.keys(): + self._time_to_RISP_data[key] = np.loadtxt( + f"{folder}/time10.dat", skiprows=1 + ) + data = self._time_to_RISP_data[key] elif 100 <= t_rel <= 260: - data = np.loadtxt(f"{folder}/time{t_rel}.dat", skiprows=1) + key = f"{folder}_{t_rel}" + if key not in self._time_to_RISP_data.keys(): + self._time_to_RISP_data[key] = np.loadtxt( + f"{folder}/time{t_rel}.dat", skiprows=1 + ) + data = self._time_to_RISP_data[key] elif 261 <= t_rel <= 269: - data = np.loadtxt(f"{folder}/time270.dat", skiprows=1) + key = f"{folder}_261_269" + if key not in self._time_to_RISP_data.keys(): + self._time_to_RISP_data[key] = np.loadtxt( + f"{folder}/time260.dat", skiprows=1 + ) + data = self._time_to_RISP_data[key] else: # NOTE: so if time is too large a MB transforms into a FW element??? - data = np.loadtxt(self.path_to_RISP_wall_data, skiprows=1) + key = "wall_data" + if key not in self._time_to_RISP_data.keys(): + self._time_to_RISP_data[key] = np.loadtxt( + self.path_to_RISP_wall_data, skiprows=1 + ) + data = self._time_to_RISP_data[key] else: - data = np.loadtxt(self.path_to_RISP_wall_data, skiprows=1) + key = "wall_data" + if key not in self._time_to_RISP_data.keys(): + self._time_to_RISP_data[key] = np.loadtxt( + self.path_to_RISP_wall_data, skiprows=1 + ) + data = self._time_to_RISP_data[key] return data[nb_mb - offset_mb, :] From cd281f8bc2c4b561b6d212c43b71ad68ff39ed1d Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Nov 2024 22:10:21 -0400 Subject: [PATCH 62/62] fixed test --- test/test_scenario.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_scenario.py b/test/test_scenario.py index 9e0b9f4..57b94d3 100644 --- a/test/test_scenario.py +++ b/test/test_scenario.py @@ -149,7 +149,7 @@ def test_maximum_time(): @pytest.mark.parametrize( "t, expected_pulse", - [(0, pulse1), (6000, pulse2), (1e5, None), (pulse1.total_duration, pulse2)], + [(0, pulse1), (6000, pulse2), (1e5, None), (pulse1.nb_pulses * pulse1.total_duration, pulse2)], ) def test_get_pulse(t, expected_pulse): @@ -160,6 +160,7 @@ def test_get_pulse(t, expected_pulse): my_scenario.get_pulse(t=t) else: pulse = my_scenario.get_pulse(t=t) + print(pulse.pulse_type) assert pulse == expected_pulse @@ -202,7 +203,7 @@ def test_get_time_till_row(row, expected_time): def test_reading_a_file(): my_scenario = Scenario([pulse1, pulse2]) - times = np.linspace(0, my_scenario.get_maximum_time(), 1000) + times = np.linspace(0, my_scenario.get_maximum_time(), 1000, endpoint=False) pulse_types = [] for t in times: pulse_type = my_scenario.get_pulse_type(t)