-
Notifications
You must be signed in to change notification settings - Fork 34
[WIP] Deuterium retention in neutron-irradiated single-crystal tungsten #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
cticenhour
wants to merge
16
commits into
idaholab:devel
Choose a base branch
from
cticenhour:isfnt-val-2g
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4710292
Add temperature series plotting script for ISFNT case
cticenhour ae35b1d
Add initial val-2g input file
cticenhour 715db34
Refine simple mesh, turn on timestep limiting guidelines in adaptive …
cticenhour 07db6bf
Add source aux for troubleshooting
cticenhour c0c2fff
Allow easier adjustment of font sizes for labels and axes for tempera…
cticenhour ae8c0a2
Add lower bounds for concentration and trapped_1 variables
cticenhour 6e19f27
Add reflection coefficient impact to source term to be more consisten…
cticenhour 3f8ee7a
Parameter adjustments to be more consistent with paper usage of trap …
cticenhour 71d22cb
Switch to CartesianMeshGenerator to refine in source region a bit better
cticenhour 8f1e771
Adjust trap_per_free and refine in implantation region to get to 8148 s
cticenhour 4c88923
Adjust tolerances to get case running and add initial plotting script
cticenhour 68e9355
Make adjustments to better match simulation and presentation of resul…
cticenhour a87a5a6
Adjustments to clean up commented out items or otherwise unnecessary …
cticenhour 8db39db
Add TMAP4 run data to plot comparison script
cticenhour 756619a
Add Masa's experimental data for comparison
cticenhour 176cba9
Improve readability of plot by adjusting grid and alpha (transparency…
cticenhour File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'] | ||
| simulation_temperature_TMAP4 = simulation_TMAP4_data['temperature'] | ||
| simulation_flux_TMAP4_673 = simulation_TMAP4_data['TMAP - 400C'] | ||
| simulation_flux_TMAP4_873 = simulation_TMAP4_data['TMAP - 600C'] | ||
| simulation_flux_TMAP4_973 = simulation_TMAP4_data['TMAP - 700C'] | ||
|
|
||
| # 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'] | ||
| experiment_temperature = experiment_data['temperature'] | ||
| experiment_flux_673 = experiment_data['Exp - 400C'] | ||
| experiment_flux_873 = experiment_data['Exp - 600C'] | ||
| experiment_flux_973 = experiment_data['Exp - 700C'] | ||
|
|
||
| # 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) | ||
|
|
||
|
|
||
| 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
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| 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) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.