Skip to content

Commit

Permalink
Simplify input files
Browse files Browse the repository at this point in the history
  • Loading branch information
lin-yang-ly committed Oct 15, 2024
1 parent a762efe commit 4b57cac
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/content/verification_and_validation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ TMAP8 also contains [example cases](examples/tmap_index.md), which showcase how

| Case | Title |
| ------ | ---------------------------------------------- |
| val-2a | [Ion Beam Experiment](val-2a.md) |
| val-2b | [Diffusion Experiment in Beryllium](val-2b.md) |
Binary file removed test/tests/val-2a/gold/val-2a_TMAP4_out.e
Binary file not shown.
Binary file removed test/tests/val-2a/gold/val-2a_TMAP7_out.e
Binary file not shown.
8 changes: 2 additions & 6 deletions test/tests/val-2a/tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
validation = 'val-2a.md'
[val-2a_TMAP7_csvdiff]
type = CSVDiff
input = val-2a.i
input = 'val-2a_base.i val-2a_TMAP7.i'
csvdiff = val-2a_TMAP7_out.csv
requirement = 'The system shall be able to model Ion implantation based on the requirements and conditions listed in the TMAP7 V&V report'
[]
[val-2a_TMAP4_csvdiff]
type = CSVDiff
input = val-2a.i
cli_args = 'Mesh/active="cartesian_mesh_TMAP4"
Kernels/source/function=concentration_source_func_TMAP4
BCs/active="left_balance_TMAP4 right_balance"
Outputs/file_base="val-2a_TMAP4_out"'
input = 'val-2a_base.i val-2a_TMAP4.i'
csvdiff = val-2a_TMAP4_out.csv
requirement = 'The system shall be able to model Ion implantation based on the requirements and conditions listed in the TMAP4 V&V report'
[]
Expand Down
82 changes: 82 additions & 0 deletions test/tests/val-2a/val-2a_TMAP4.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
nx_scale = 1



[Mesh]
[cartesian_mesh_TMAP4]
type = CartesianMeshGenerator
dim = 1
# num
dx = '${fparse 5 * 4e-3} 1e-2 1e-1 1e0 1e1 ${fparse 10 * 4.88e1}'
ix = '${fparse 5 * ${nx_scale}} ${nx_scale} ${nx_scale} ${nx_scale} ${nx_scale} ${fparse 10 * ${nx_scale}}'
[]
[]

[BCs]
# [left_balance]
# type = ADFunctionNeumannBC
# boundary = left
# variable = concentration
# function = 0
# []
[left_balance]
type = EquilibriumBC
Ko = '${fparse sqrt( ${dissociation_coefficient_parameter_enclos1} / ${recombination_coefficient_parameter_enclos1_TMAP4} )}'
boundary = left
enclosure_var = pressure_left
temperature = ${Temperature}
variable = concentration
p = 0.5
[]
[]

[Functions]
################# TMAP4
[Kd_left_func]
type = ParsedFunction
expression = '${dissociation_coefficient_parameter_enclos1} * (1 - 0.9999 * exp(-6e-5 * t))'
[]

[Kr_left_func]
type = ParsedFunction
expression = '${recombination_coefficient_parameter_enclos1_TMAP4} * (1 - 0.9999 * exp(-6e-5 * t))'
[]

[pressure_func]
type = ParsedFunction
expression = 'if(t<6420.0, ${pressure_high},
if(t<9420.0, ${pressure_low},
if(t<12480, ${pressure_high},
if(t<14940, ${pressure_low},
if(t<18180, ${pressure_high}, ${pressure_low})))))'
[]

[surface_flux_func]
type = ParsedFunction
expression = 'if(t<6420.0, ${flux_high},
if(t<9420.0, ${flux_low},
if(t<12480, ${flux_high},
if(t<14940, ${flux_low},
if(t<18180, ${flux_high}, ${flux_low}))))) * 0.75'
[]

[concentration_source_func]
type = ParsedFunction
symbol_names = 'surface_flux_func pressure_func Kd_left_func Kr_left_func'
symbol_values = 'surface_flux_func pressure_func Kd_left_func Kr_left_func'
expression = 'if(x<8e-3, 0,
if(x<12e-3, sqrt((0.25 * surface_flux_func + pressure_func * Kd_left_func) / Kr_left_func),
if(x<16e-3, sqrt((1.00 * surface_flux_func + pressure_func * Kd_left_func) / Kr_left_func),
if(x<20e-3, sqrt((0.25 * surface_flux_func + pressure_func * Kd_left_func) / Kr_left_func), 0))))'
[]
[]

[Outputs]
# checkpoint = true
file_base = 'val-2a_TMAP4_out'
csv = true
[exodus]
type = Exodus
output_material_properties = true
[]
[]
87 changes: 87 additions & 0 deletions test/tests/val-2a/val-2a_TMAP7.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

nx_scale = 1

[Mesh]
[cartesian_mesh_TMAP7]
type = CartesianMeshGenerator
dim = 1

# # 0 1 2 3 4 5 6 7 8 9 num
# dx = '1e-3 4e-3 4e-3 4e-3 4e-3 4e-3 1e-2 1e-1 1e-0 1e1
# 5.4319e1 5.4319e1 5.4319e1 5.4319e1 5.4319e1 5.4319e1 5.4319e1 5.4319e1 5.4319e1'
# # 10 11 12 13 14 15 16 17 18

# num
dx = '1e-3 ${fparse 5 * 4e-3} 1e-2 1e-1 1e0 1e1 ${fparse 9 * 5.4319e1}'
ix = '${nx_scale} ${fparse 5 * ${nx_scale}} ${nx_scale} ${nx_scale} ${nx_scale} ${nx_scale} ${fparse 9 * ${nx_scale}}'
[]
[]

[BCs]
# [left_balance]
# type = ADFunctionNeumannBC
# boundary = left
# variable = concentration
# function = 0
# []
[left_balance]
type = EquilibriumBC
Ko = '${fparse sqrt( ${dissociation_coefficient_parameter_enclos1} / ${recombination_coefficient_parameter_enclos1_TMAP7} )}'
boundary = left
enclosure_var = pressure_left
temperature = ${Temperature}
variable = concentration
p = 0.5
[]
[]

[Functions]
################## TMAP7
[Kd_left_func]
type = ParsedFunction
expression = '${dissociation_coefficient_parameter_enclos1} * (1 - 0.999997 * exp(-1.2e-4 * t))'
[]

[Kr_left_func]
type = ParsedFunction
expression = '${recombination_coefficient_parameter_enclos1_TMAP7} * (1 - 0.999997 * exp(-1.2e-4 * t))'
[]

[pressure_func]
type = ParsedFunction
expression = 'if(t<5820.0, ${pressure_high},
if(t<9060.0, ${pressure_low},
if(t<12160, ${pressure_high},
if(t<14472, ${pressure_low},
if(t<17678, ${pressure_high}, ${pressure_low})))))'
[]

[surface_flux_func]
type = ParsedFunction
expression = 'if(t<5820.0, ${flux_high},
if(t<9060.0, ${flux_low},
if(t<12160, ${flux_high},
if(t<14472, ${flux_low},
if(t<17678, ${flux_high}, ${flux_low}))))) * 0.75'
[]

[concentration_source_func]
type = ParsedFunction
symbol_names = 'surface_flux_func pressure_func Kd_left_func Kr_left_func'
symbol_values = 'surface_flux_func pressure_func Kd_left_func Kr_left_func'
expression = 'if(x<5e-3, 0,
if(x<9e-3, sqrt((0.15 * surface_flux_func + pressure_func * Kd_left_func) / Kr_left_func),
if(x<13e-3, sqrt((0.70 * surface_flux_func + pressure_func * Kd_left_func) / Kr_left_func),
if(x<17e-3, sqrt((0.15 * surface_flux_func + pressure_func * Kd_left_func) / Kr_left_func), 0))))'
[]
[]

[Outputs]
# checkpoint = true
file_base = 'val-2a_TMAP7_out'
csv = true
[exodus]
type = Exodus
output_material_properties = true
[]
[]
166 changes: 166 additions & 0 deletions test/tests/val-2a/val-2a_base.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
length_scale = '${units 1e6 num/m}'
# length = '${units ${fparse 5e-4 * length_scale} m}'
# nx_num = 100
Temperature = '${units 703 K}'
simulation_time = '${units 2e4 s}'
diffusivity_D = '${units ${fparse 3e-10 * length_scale^2} m^2/s}'
dissociation_parameter_enclos2 = '${units ${fparse 1.7918e15 / length_scale^2} at/m^2/s/Pa^0.5}' # d2/m^2/s/pa^0.5
recombination_parameter_enclos2 = '${units ${fparse 2e-31 * length_scale^4} m^4/at/s}' # m^4/atom/s
pressure_high = '${units 4e-5 Pa}'
pressure_low = '${units 9e-6 Pa}'
pressure_right = '${units 2e-6 Pa}'
flux_high = '${units ${fparse 4.9e19 / length_scale^2} atom/m^2/s}'
flux_low = '${units ${fparse 0 / length_scale^2} atom/m^2/s}'
dissociation_coefficient_parameter_enclos1 = '${units ${fparse 8.959e18 / length_scale^2} at/m^2/s/Pa^0.5}' # d2/m^2/s/pa^0.5
# Data in TMAP4
recombination_coefficient_parameter_enclos1_TMAP4 = '${units ${fparse 1e-27 * length_scale^4} m^4/at/s}' # m^4/atom/s
# Data in TMAP7
recombination_coefficient_parameter_enclos1_TMAP7 = '${units ${fparse 7e-27 * length_scale^4} m^4/at/s}' # m^4/atom/s


[Variables]
[concentration]
order = FIRST
family = LAGRANGE
[]
[]

[Kernels]
[diffusion]
type = ADMatDiffusion
variable = concentration
diffusivity = ${diffusivity_D}
[]
[time_diffusion]
type = ADTimeDerivative
variable = concentration
[]
[source]
type = ADBodyForce
variable = concentration
function = concentration_source_func
[]
[]

[AuxVariables]
[pressure_left]
[]
[concentration_source]
[]
[recombination_TMAP4]
[]
[recombination_TMAP7]
[]
[]

[AuxKernels]
[pressure_aux]
type = FunctionAux
variable = pressure_left
function = pressure_func
execute_on = 'INITIAL TIMESTEP_END'
[]
[concentration_source_aux]
type = FunctionAux
variable = concentration_source
function = concentration_source_func
execute_on = 'INITIAL TIMESTEP_END'
[]
[recombination_aux_TMAP4]
type = FunctionAux
variable = recombination_TMAP4
function = '${recombination_coefficient_parameter_enclos1_TMAP4}'
execute_on = 'INITIAL TIMESTEP_END'
[]
[recombination_aux_TMAP7]
type = FunctionAux
variable = recombination_TMAP7
function = '${recombination_coefficient_parameter_enclos1_TMAP7}'
execute_on = 'INITIAL TIMESTEP_END'
[]
[]

[BCs]
# [right_balance]
# type = ADFunctionNeumannBC
# boundary = right
# variable = concentration
# function = 0
# []
[right_balance]
type = EquilibriumBC
Ko = '${fparse sqrt( ${dissociation_parameter_enclos2} / ${recombination_parameter_enclos2} )}'
boundary = right
enclosure_var = ${pressure_right}
temperature = ${Temperature}
variable = concentration
p = 0.5
[]
[]

[Postprocessors]
[flux_surface_left]
type = SideDiffusiveFluxIntegral
variable = concentration
diffusivity = '${diffusivity_D}'
boundary = 'left'
execute_on = 'initial nonlinear linear timestep_end'
outputs = 'console csv exodus'
[]
[scaled_flux_surface_left]
type = ScalePostprocessor
scaling_factor = '${fparse ${length_scale}^2}'
value = flux_surface_left
execute_on = 'initial nonlinear linear timestep_end'
outputs = 'console csv exodus'
[]
[flux_surface_right]
type = SideDiffusiveFluxIntegral
variable = concentration
diffusivity = '${diffusivity_D}'
boundary = 'right'
execute_on = 'initial nonlinear linear timestep_end'
outputs = 'console csv exodus'
[]
[scaled_flux_surface_right]
type = ScalePostprocessor
scaling_factor = '${fparse ${length_scale}^2}'
value = flux_surface_right
execute_on = 'initial nonlinear linear timestep_end'
outputs = 'console csv exodus'
[]
[]

[Preconditioning]
[SMP]
type = SMP
full = true
[]
[]

[Executioner]
type = Transient
scheme = bdf2
solve_type = NEWTON
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-7
l_tol = 1e-4
end_time = ${simulation_time}
automatic_scaling = true
line_search = 'none'
dtmax = 100

[TimeStepper]
type = IterationAdaptiveDT
dt = 0.1
optimal_iterations = 4
growth_factor = 1.1
cutback_factor = 0.5
[]
[]

# [Debug]
# show_var_residual_norms = true
# []

0 comments on commit 4b57cac

Please sign in to comment.