Skip to content

Commit

Permalink
Updated references in verification standards and added new requiremen…
Browse files Browse the repository at this point in the history
…ts ( idaholab#123 )
  • Loading branch information
chaibhave committed Nov 3, 2024
1 parent 839ec1b commit 2fbd6ea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 34 deletions.
20 changes: 11 additions & 9 deletions doc/content/verification_and_validation/verification_standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@ To guarantee that all verification cases in TMAP8 are readily grasped, transpare
## Input files

1. +Comprehensive Comments+: Include clear comments within the input file explaining its purpose and any specific requirements for running it successfully.
2. +Documented Units+: Ensure all values within the input file have their units clearly documented.
3. +Unit Conversions+: If unit conversions are necessary, utilize the built-in unit conversion functionality documented in the [MOOSE input file syntax](https://mooseframework.inl.gov/application_usage/input_syntax.html). Additional details on the units system can be found in the [MOOSE units](https://mooseframework.inl.gov/source/utils/Units.html) documentation.
2. +Constants declaration+: Define all constant values used in the input file at the start of the input file, with self documenting variable names wherever possible.
3. +Documented Units+: Ensure all values within the input file have their units clearly documented using the units functionality in [input file syntax](https://mooseframework.inl.gov/application_usage/input_syntax.html). Use the same functionality for unit conversions. Additional details on the units system can be found in the [MOOSE units](https://mooseframework.inl.gov/source/utils/Units.html) documentation. As a rule, use the easiest-to-read units and convert them to the required units for the numerical solve.
4. +Outputs+: By default, all outputs required for verification should be enabled. These can be selectively disabled within the test specification for each specific test as needed.
5. +Streamlined Input Files+: Whenever possible, leverage command-line arguments (CLI) to manage input files with minor variations instead of creating duplicate files.
5. +Streamlined Input Files+: Whenever possible, leverage [command-line arguments (CLI)](https://mooseframework.inl.gov/moose/application_usage/command_line_usage.html) to manage input files with minor variations instead of creating duplicate files.

## Python scripts

1. +Analytical Solution+: The Python script for verification should directly calculate the original analytical solution, not rely on pre-tabulated CSV data.
2. +Unit Clarity+: Utilize comments within the script to specify the units for all values employed in the analytical solution.
3. +Standardized Constants+: Whenever possible, employ values from the National Institute of Standards and Technology (NIST) CODATA NIST CODATA: https://pml.nist.gov/cuu/Constants/ for fundamental constants within the analytical solution.
4. +Gold File Verification+: The Python scripts should run on the gold files associated with the verification case.
5. +Visualization Consistency+: In verification plots, consistently use solid lines to represent TMAP8 results and dashed lines for analytical solutions. Points should only be used when the focus is on specific data points (e.g., validation or benchmarking).
2. +Quantified Comparisons+: When performing a comparison of a TMAP8 result against an analytical equation or experimental data, a Root Mean Square Percentage Error (RMSPE) or other relevant quantitative metric should be calculated. This error metric should be clearly displayed next to the plot line in the comparison plot figures.
3. +Unit Clarity+: Utilize comments within the script to specify the units for all values employed in the analytical solution.
4. +Standardized Constants+: Whenever possible, employ values from [PhysicalConstants](source/utils/PhysicalConstants.md).
5. +Gold File Verification+: The Python scripts should run on the gold files associated with the verification case.
6. +Visualization Consistency+: In verification plots, consistently use solid lines to represent TMAP8 results and dashed lines for analytical solutions. Points should only be used when the focus is on specific data points (e.g., validation or benchmarking).
7. +Write Pythonic code+: When writing Python scripts, aim to follow the [PEP8](https://peps.python.org/pep-0008/) style guide. A key principle is to use existing Python functionality whenever possible instead of writing your own code to do the same thing.

## Tests

1. +Comprehensive Testing+: Every input file for verification should have corresponding EXODIFF and CSVDIFF tests to ensure accuracy.
1. +Comprehensive Testing+: Every input file for verification should have corresponding [EXODIFF](https://mooseframework.inl.gov/moose/python/testers/Exodiff.html) and [CSVDIFF](https://mooseframework.inl.gov/moose/python/testers/CSVDiff_tester.html) tests to ensure accuracy. EXODIFF tests are not required if the simulation is 0D (single element), and the [PostProcessors](https://mooseframework.inl.gov/moose/syntax/Postprocessors/index.html) to the CSVDIFF already test all the important variables.
2. +Test specification+: Test requirements should detail what the particular test is checking, as well as mention the general physics the tested input file is modeling.
3. +Heavy tests+: If a heavy test is used for verification, the test specification should mention that a finer mesh and/or small time step size is being used for verification
3. +Heavy tests+: If a heavy test is used for verification, the test specification should mention that a finer mesh and/or small time step size is being used for verification. A test can be declared to be a heavy test by adding the ```heavy = true``` to the test specification.
4. +Script Verification+: The Python scripts used for verification should themselves be subjected to testing to guarantee their reliability.

## Documentation
Expand Down
45 changes: 20 additions & 25 deletions test/tests/ver-1b/comparison_ver-1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
script_folder = os.path.dirname(__file__)
os.chdir(script_folder)

# ========= Comparison of concentration as a function of time =================
#========= Comparison of concentration as a function of time ===================

fig = plt.figure(figsize=[6.5, 5.5])
gs = gridspec.GridSpec(1, 1)
fig = plt.figure(figsize=[6.5,5.5])
gs = gridspec.GridSpec(1,1)
ax = fig.add_subplot(gs[0])

if "/TMAP8/doc/" in script_folder: # if in documentation folder
Expand All @@ -28,10 +28,9 @@
x = 0.2
C_o = 1
D = 1
analytical_conc = C_o * special.erfc(x / (2 * np.sqrt(D*analytical_time)))
ax.plot(tmap_time, tmap_conc, label=r"TMAP8", c='tab:gray')
ax.plot(analytical_time, analytical_conc,
label=r"Analytical", c='k', linestyle='--')
analytical_conc = C_o * special.erfc( x / (2 * np.sqrt(D*analytical_time)))
ax.plot(tmap_time,tmap_conc,label=r"TMAP8",c='tab:gray')
ax.plot(analytical_time,analytical_conc,label=r"Analytical",c='k', linestyle='--')


ax.set_xlabel(u'Time(s)')
Expand All @@ -45,14 +44,14 @@
RMSPE = RMSE*100/np.mean(analytical_conc[idx:])
ax.text(5,0.9, 'RMSPE = %.2f '%RMSPE+'%',fontweight='bold')
ax.minorticks_on()
plt.savefig('ver-1b_comparison_time.png', bbox_inches='tight')
plt.savefig('ver-1b_comparison_time.png', bbox_inches='tight', dpi=300)
plt.close(fig)


# ============ Comparison of concentration as a function of distance ==========
#============ Comparison of concentration as a function of distance ============

fig = plt.figure(figsize=[6.5, 5.5])
gs = gridspec.GridSpec(1, 1)
fig = plt.figure(figsize=[6.5,5.5])
gs = gridspec.GridSpec(1,1)
ax = fig.add_subplot(gs[0])

if "/TMAP8/doc/" in script_folder: # if in documentation folder
Expand All @@ -67,12 +66,10 @@
time = 25
C_o = 1
D = 1
analytical_conc = C_o * \
special.erfc(analytical_distance / (2 * np.sqrt(D * time)))
analytical_conc = C_o * special.erfc( analytical_distance / (2 * np.sqrt(D * time)))

ax.plot(tmap_distance, tmap_conc, label=r"TMAP8", c='tab:gray')
ax.plot(analytical_distance, analytical_conc,
label=r"Analytical", c='k', linestyle='--')
ax.plot(tmap_distance,tmap_conc,label=r"TMAP8",c='tab:gray')
ax.plot(analytical_distance,analytical_conc,label=r"Analytical",c='k', linestyle='--')

ax.set_xlabel(u'Distance (m)')
ax.set_ylabel(r"Normalized specie concentration")
Expand All @@ -85,12 +82,12 @@
RMSPE = RMSE*100/np.mean(analytical_conc[idx:])
ax.text(10,0.4, 'RMSPE = %.2f '%RMSPE+'%',fontweight='bold')
ax.minorticks_on()
plt.savefig('ver-1b_comparison_dist.png', bbox_inches='tight')
plt.savefig('ver-1b_comparison_dist.png', bbox_inches='tight', dpi=300)
plt.close(fig)
# ================== Comparison of flux as a function of time =================
#================== Comparison of flux as a function of time ===================

fig = plt.figure(figsize=[6.5, 5.5])
gs = gridspec.GridSpec(1, 1)
fig = plt.figure(figsize=[6.5,5.5])
gs = gridspec.GridSpec(1,1)
ax = fig.add_subplot(gs[0])

if "/TMAP8/doc/" in script_folder: # if in documentation folder
Expand All @@ -106,10 +103,9 @@
C_o = 1
D = 1
analytical_flux = C_o * np.sqrt(D/(np.pi * analytical_time)) * \
np.exp(x / (2 * np.sqrt(D * analytical_time)))
ax.plot(tmap_time, tmap_flux, label=r"TMAP8", c='tab:gray')
ax.plot(analytical_time, analytical_flux,
label=r"Analytical", c='k', linestyle='--')
np.exp( x / (2 * np.sqrt(D * analytical_time)))
ax.plot(tmap_time[1:],tmap_flux[1:],label=r"TMAP8",c='tab:gray')
ax.plot(analytical_time[1:],analytical_flux[1:],label=r"Analytical",c='k', linestyle='--')


ax.set_xlabel(u'Time(s)')
Expand All @@ -124,5 +120,4 @@
ax.text(10,0.25, 'RMSPE = %.2f '%RMSPE+'%',fontweight='bold')
ax.minorticks_on()
plt.savefig('ver-1b_comparison_flux.png', bbox_inches='tight', dpi=300)
plt.savefig('ver-1b_comparison_flux.png', bbox_inches='tight')
plt.close(fig)

0 comments on commit 2fbd6ea

Please # to comment.