Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
da3d544
Add temperature series plotting script for ISFNT case
cticenhour Nov 5, 2025
00286fa
Add initial val-2g input file
cticenhour Nov 7, 2025
7da6824
Refine simple mesh, turn on timestep limiting guidelines in adaptive …
cticenhour Nov 7, 2025
690deae
Add source aux for troubleshooting
cticenhour Nov 7, 2025
c1f16a8
Allow easier adjustment of font sizes for labels and axes for tempera…
cticenhour Nov 10, 2025
059fb45
Add lower bounds for concentration and trapped_1 variables
cticenhour Nov 10, 2025
84a851c
Add reflection coefficient impact to source term to be more consisten…
cticenhour Nov 10, 2025
d471f2a
Parameter adjustments to be more consistent with paper usage of trap …
cticenhour Nov 10, 2025
9d340b4
Switch to CartesianMeshGenerator to refine in source region a bit better
cticenhour Nov 10, 2025
96f6a4c
Adjust trap_per_free and refine in implantation region to get to 8148 s
cticenhour Nov 11, 2025
497a224
Adjust tolerances to get case running and add initial plotting script
cticenhour Nov 11, 2025
4bb98fd
Make adjustments to better match simulation and presentation of resul…
cticenhour Nov 24, 2025
4ce7215
Adjustments to clean up commented out items or otherwise unnecessary …
cticenhour Nov 24, 2025
9d19efd
Add TMAP4 run data to plot comparison script
cticenhour Nov 25, 2025
61688ac
Add Masa's experimental data for comparison
cticenhour Nov 25, 2025
79d875a
Improve readability of plot by adjusting grid and alpha (transparency…
cticenhour Dec 4, 2025
af28955
Apply suggestions from code review
cticenhour Jan 22, 2026
adad02e
Add units to experimental and TMAP4 data for val-2g
cticenhour Jan 22, 2026
58ea5cd
Add header information to val-2g input file
cticenhour Jan 22, 2026
a9d8db5
Adjust temperature plotting script to include temperature profile dir…
cticenhour Jan 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions test/tests/val-2g/comparison_val-2g.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import gridspec
import pandas as pd
from scipy import special
import os

# Changes working directory to script directory (for consistent MooseDocs usage)
script_folder = os.path.dirname(__file__)
os.chdir(script_folder)

# Read TMAP8 simulation data
if "/tmap8/doc/" in script_folder.lower(): # if in documentation folder
csv_folder = "../../../../test/tests/val-2g/val-2g_673_out.csv"
else: # if in test folder
csv_folder = "./val-2g_673_out.csv"
simulation_673_data = pd.read_csv(csv_folder)
simulation_time_673 = simulation_673_data['time']
simulation_flux_left_673 = simulation_673_data['scaled_flux_surface_left']

if "/tmap8/doc/" in script_folder.lower(): # if in documentation folder
csv_folder = "../../../../test/tests/val-2g/val-2g_873_out.csv"
else: # if in test folder
csv_folder = "./val-2g_873_out.csv"
simulation_873_data = pd.read_csv(csv_folder)
simulation_time_873 = simulation_873_data['time']
simulation_flux_left_873 = simulation_873_data['scaled_flux_surface_left']

if "/tmap8/doc/" in script_folder.lower(): # if in documentation folder
csv_folder = "../../../../test/tests/val-2g/val-2g_973_out.csv"
else: # if in test folder
csv_folder = "./val-2g_973_out.csv"
simulation_973_data = pd.read_csv(csv_folder)
simulation_time_973 = simulation_973_data['time']
simulation_flux_left_973 = simulation_973_data['scaled_flux_surface_left']

# Read TMAP4 simulation data
if "/tmap8/doc/" in script_folder.lower(): # if in documentation folder
csv_folder = "../../../../test/tests/val-2g/tmap4_data.csv"
else: # if in test folder
csv_folder = "./tmap4_data.csv"
simulation_TMAP4_data = pd.read_csv(csv_folder)
simulation_time_TMAP4 = simulation_TMAP4_data['time (s)']
simulation_temperature_TMAP4 = simulation_TMAP4_data['temperature (K)']
simulation_flux_TMAP4_673 = simulation_TMAP4_data['TMAP - 400C (D m^-2 s^-1)']
simulation_flux_TMAP4_873 = simulation_TMAP4_data['TMAP - 600C (D m^-2 s^-1)']
simulation_flux_TMAP4_973 = simulation_TMAP4_data['TMAP - 700C (D m^-2 s^-1)']

# Read experiment data
if "/tmap8/doc/" in script_folder.lower(): # if in documentation folder
csv_folder = "../../../../test/tests/val-2g/experimental_data.csv"
else: # if in test folder
csv_folder = "./experimental_data.csv"
experiment_data = pd.read_csv(csv_folder)
experiment_time = experiment_data['time (s)']
experiment_temperature = experiment_data['temperature (K)']
experiment_flux_673 = experiment_data['Exp - 400C (D m^-2 s^-1)']
experiment_flux_873 = experiment_data['Exp - 600C (D m^-2 s^-1)']
experiment_flux_973 = experiment_data['Exp - 700C (D m^-2 s^-1)']

# Setup mask using a random sampling method to reduce density of scatter plot points in experimental
# data (there is a lot of "noise").
# These preserve 10% of the data points. (adjusted within the 'size' parameter).
mask = np.random.choice(len(experiment_flux_673), size=int(len(experiment_flux_673) * 0.1), replace=False)
Comment on lines +61 to +64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see, outside of this PR, the figures both with and without this mask to see why it's needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sent you a message just now on Teams - interested in hearing what you think! Left some context on "why" there as well.



file_base = 'val-2g_comparison'
############################ desorption flux atom/m$^2$/s ############################
fig = plt.figure(figsize=[6.5, 5.5])
gs = gridspec.GridSpec(1, 1)
ax = fig.add_subplot(gs[0])

# TMAP8
ax.semilogy(simulation_time_673-12000, simulation_flux_left_673, linestyle='-', label=r"673 K", c='blue', linewidth=3.0)
ax.semilogy(simulation_time_873-12000, simulation_flux_left_873, linestyle='-', label=r"873 K", c='red', linewidth=3.0)
ax.semilogy(simulation_time_973-12000, simulation_flux_left_973, linestyle='-', label=r"973 K", c='green', linewidth=3.0)

# TMAP4
ax.semilogy(simulation_time_TMAP4, simulation_flux_TMAP4_673, linestyle='--', label=r"TMAP4 - 673 K", c='blue', linewidth=3.0, alpha=0.7)
ax.semilogy(simulation_time_TMAP4, simulation_flux_TMAP4_873, linestyle='--', label=r"TMAP4 - 873 K", c='red', linewidth=3.0, alpha=0.7)
ax.semilogy(simulation_time_TMAP4, simulation_flux_TMAP4_973, linestyle='--', label=r"TMAP4 - 973 K", c='green', linewidth=3.0, alpha=0.7)

# Experimental Data
s = (3.0)**2
ax.scatter(experiment_time[mask], experiment_flux_673[mask], marker='o', s=s, label=r"Exp - 673 K", c='blue')
ax.scatter(experiment_time[mask], experiment_flux_873[mask], marker='o', s=s, label=r"Exp - 873 K", c='red')
ax.scatter(experiment_time[mask], experiment_flux_973[mask], marker='o', s=s, label=r"Exp - 973 K", c='green')


# Font sizes for labels and axes
SMALL_SIZE = 10
MEDIUM_SIZE = 14
BIGGER_SIZE = 16

ax.set_xlabel(u'Time (s)', weight='bold', fontsize=BIGGER_SIZE)
ax.set_ylabel(u"Desorption flux (H$_2$/m$^2$/s)", weight='bold', fontsize=BIGGER_SIZE)
ax.legend(loc="upper left", fontsize=SMALL_SIZE)
ax.set_ylim(bottom=6e15, top=4.0e18)
ax.set_xlim(left=0,right=7200)
ax.xaxis.set_ticks(np.arange(0, 7205, 1800))
plt.grid(visible=True, which='major', color='0.65', linestyle='--', alpha=0.3)
# tmap_flux_for_rmspe = numerical_solution_on_experiment_input(experiment_time, simulation_time_TMAP7, simulation_flux_left_TMAP7/2 + flux_environment)
# RMSE = np.sqrt(np.mean((tmap_flux_for_rmspe-experiment_flux)**2) )
# RMSPE = RMSE*100/np.mean(experiment_flux)
# ax.text(6000.0,0.85e18, 'RMSPE = %.2f '%RMSPE+'%',fontweight='bold')
Comment on lines +102 to +105
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out? Maybe it's just because this is still in WIP stage, but calculating the RMSPE between TMAP8's predictions and the experimental data is a good thing to add.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was commented out because it added complexity while I was working through adjusting the rest of the plot. It is planned to be re-added before this is merged.

ax.tick_params(axis='both', which='both', direction='out', bottom=True, top=True, left=True,
right=True, labelsize=MEDIUM_SIZE)
ax.grid(True, which='minor', color='0.9', linestyle='--')
ax.set_axisbelow(True) # Ensures that grid is drawn behind data. Without this, sometimes the grid is seen atop marker points.
plt.savefig(f'{file_base}.png', bbox_inches='tight', dpi=300)
plt.close(fig)
Loading