Skip to content

Commit

Permalink
Add a component version of ver-1a
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud committed Jan 13, 2025
1 parent 64e7f2a commit 59386eb
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 69 deletions.
200 changes: 137 additions & 63 deletions test/tests/ver-1a/component-ver-1a.i
Original file line number Diff line number Diff line change
@@ -1,85 +1,158 @@
top_level_temperature=2.373e3
initial_pressure=1e6
kb=1.38e-23
top_level_length_unit=1e6 # number of length units in a meter
pressure_unit=1 # number of pressure units in a Pascal

[Problem]
error_on_jacobian_nonzero_reallocation = false
[]
# Verification Problem #1a from TMAP4/TMAP7 V&V document
# Tritium diffusion through SiC layer with depleting source at 2100 C.
# No Soret effect, solubility, or trapping included.

[GlobalParams]
species = 'u'
length_unit = ${top_level_length_unit}
temperature = ${top_level_temperature}
[]
# Physical Constants
# Note that we do NOT use the same number of digits as in TMAP4/TMAP7.
# This is to be consistent with PhysicalConstant.h
kb = 1.380649e-23 # Boltzmann constant J/K
R = 8.31446261815324 # Gas constant J/mol/K

# Data used in TMAP4/TMAP7 case
length_unit = 1e6 # conversion from meters to microns
temperature = 2373 # K
initial_pressure = 1e6 # Pa
volume_enclosure = '${fparse 5.20e-11*length_unit^3}' # microns^3
surface_area = '${fparse 2.16e-6*length_unit^2}' # microns^2
diffusivity_SiC = '${fparse 1.58e-4*exp(-308000.0/(R*temperature))*length_unit^2}' # microns^2/s
solubility_constant = '${fparse 7.244e22/(temperature * length_unit^3)}' # atoms/microns^3/Pa = atoms*s^2/m^2/kg
slab_thickness = '${fparse 3.30e-5*length_unit}' # microns

# Useful equations/conversions
concentration_to_pressure_conversion_factor = '${fparse kb*temperature*length_unit^3}' # J = Pa*microns^3
pressure_unit = 1 # number of pressure units in a Pascal

[Physics]
[TMAP8]
[SpeciesTrapping]
[0d_trapping]
species = 'v'
equilibrium_constants = ${solubility_constant}

[Functions]
[D_u]
type = ParsedFunction
value = '1.58e-4*exp(-308000/(8.314*temperature))'
vars = 'temperature'
vals = '${top_level_temperature}'
# These parameters can be passed for each component here in lieu of fetching them from the components
# initial_values = '${initial_pressure}'
# temperatures = ${temperature}

verbose = true

# If the initial pressure had not been scaled (=1 right now)
pressure_unit_scaling = ${pressure_unit}
# Volume and area have been pre-scaled
length_unit_scaling = 1
[]
[]
[]
[K_u]
type = ParsedFunction
value = '7.244e22/temperature'
vars = 'temperature'
vals = '${top_level_temperature}'
[Diffusion]
[ContinuousGalerkin]
[multi-D]
variable_name = 'u'
diffusivity_matprop = ${diffusivity_SiC}

# To help coupling to trapping
compute_diffusive_fluxes_on = 'structure_left'

dirichlet_boundaries = 'structure_right'
boundary_values = '0'
[]
[]
[]
[]

[Components]
[SystemComponents]
[structure]
type = Structure1D
species = 'u'
diffusivities = 'D_u'
nx = 10
xmax = 3.3e-5
physics = 'multi-D'

# Geometry
nx = 150
xmax = ${slab_thickness}
length_unit_scaling = 1
[]

[enc]
type = FunctionalEnclosure0D
type = Enclosure0D
species = 'v'
physics = '0d_trapping'

# Conditions
temperature = ${temperature}
species_initial_pressures = '${initial_pressure}'
pressure_unit = ${pressure_unit}

# Geometry
surface_area = 2.16e-6
volume = 5.2e-11
equilibrium_constants = 'K_u'
structure = 'structure'
boundary = 'left'

# Connection to structures
connected_structure = 'structure'
boundary = 'structure_left'
[]
[]

[BCs]
[right]
type = DirichletBC
value = 0
[Postprocessors]
# flux of tritium through the outer SiC surface - compare to TMAP7
[flux_surface_right]
type = SideDiffusiveFluxIntegral
variable = u
diffusivity = '${diffusivity_SiC}'
boundary = 'structure_right'
execute_on = 'initial nonlinear linear timestep_end'
outputs = 'console csv exodus'
[]
[]

[Postprocessors]
[rhs_timestep]
# flux of tritium through the surface of SiC layer in contact with enclosure
[flux_surface_left]
type = SideDiffusiveFluxIntegral
variable = u
diffusivity = '${diffusivity_SiC}'
boundary = 'structure_left'
execute_on = 'initial nonlinear linear timestep_end'
outputs = ''
[]
# scale the flux to get inward direction
[scaled_flux_surface_left]
type = ScalePostprocessor
scaling_factor = -1
value = flux_surface_left
execute_on = 'initial nonlinear linear timestep_end'
outputs = 'console csv exodus'
[]
# integral of the tritium flux through outer surface of SiC layer
[integral_release_flux_right]
type = PressureReleaseFluxIntegral
variable = u
boundary = 'structure_right'
diffusivity = ${fparse 1.58e-4*exp(-308000/(8.314*top_level_temperature))*top_level_length_unit^2}
surface_area = ${fparse 2.16e-6*top_level_length_unit^2}
volume = ${fparse 5.2e-11*top_level_length_unit^3}
concentration_to_pressure_conversion_factor = ${fparse kb*top_level_length_unit^3*top_level_temperature*pressure_unit}
diffusivity = '${diffusivity_SiC}'
surface_area = '${surface_area}'
volume = '${volume_enclosure}'
concentration_to_pressure_conversion_factor = '${concentration_to_pressure_conversion_factor}'
outputs = 'console'
[]
[rhs_aggregate]
# cumulative sum of integral_release_flux_right over time (i.e. cumulative amount released)
[cumulative_release_right]
type = CumulativeValuePostprocessor
postprocessor = 'rhs_timestep'
postprocessor = 'integral_release_flux_right'
outputs = 'console'
[]
[rhs_release]
# released fraction based on outer layer flux - compare to TMAP4
[released_fraction_right]
type = ScalePostprocessor
value = rhs_aggregate
scaling_factor = ${fparse 1./(initial_pressure*pressure_unit)}
value = 'cumulative_release_right'
scaling_factor = '${fparse 1./(initial_pressure)}'
outputs = 'console csv exodus'
[]
# Make a postprocessor take the value of the scalar value v
[v_value]
type = ScalarVariable
variable = v_enc
[]
# released fraction based on inner layer flux on v - compare to TMAP7
[released_fraction_left]
type = LinearCombinationPostprocessor
pp_names = 'v_value'
pp_coefs = '${fparse -1./(initial_pressure)}'
b = 1
[]
[]

[Preconditioning]
Expand All @@ -91,35 +164,36 @@ pressure_unit=1 # number of pressure units in a Pascal

[Executioner]
type = Transient

# num_steps = 2

# Time stepping and integration
dt = .1
end_time = 140
dtmin = .1
scheme = 'bdf2'
timestep_tolerance = 1e-8

# Nonlinear solver
solve_type = PJFNK
automatic_scaling = true
dtmin = .1
l_max_its = 30
nl_max_its = 5
petsc_options = '-snes_converged_reason -ksp_monitor_true_residual'
# petsc_options = '-snes_converged_reason -ksp_monitor_true_residual'
petsc_options_iname = '-pc_type -mat_mffd_err'
petsc_options_value = 'lu 1e-5'
line_search = 'bt'
scheme = 'crank-nicolson'
timestep_tolerance = 1e-8
[]

[Debug]
show_var_residual_norms = true
[]

[Outputs]
exodus = true
print_linear_residuals = false
perf_graph = true
[dof]
type = DOFMap
execute_on = 'initial'
[]
[csv]
type = CSV
execute_on = 'initial timestep_end'
[]
[console]
type = Console
time_step_interval = 10
[]
[]
11 changes: 5 additions & 6 deletions test/tests/ver-1a/ver-1a.i
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ concentration_to_pressure_conversion_factor = '${units ${fparse kb*temperature}
automatic_scaling = true
l_max_its = 30
nl_max_its = 5
petsc_options = '-snes_converged_reason -ksp_monitor_true_residual'
# petsc_options = '-snes_converged_reason -ksp_monitor_true_residual'
petsc_options_iname = '-pc_type -mat_mffd_err'
petsc_options_value = 'lu 1e-5'
line_search = 'bt'
Expand All @@ -174,13 +174,12 @@ concentration_to_pressure_conversion_factor = '${units ${fparse kb*temperature}
[Outputs]
exodus = true
print_linear_residuals = false
perf_graph = true
[dof]
type = DOFMap
execute_on = 'initial'
[]
[csv]
type = CSV
execute_on = 'initial timestep_end'
[]
[console]
type = Console
time_step_interval = 10
[]
[]

0 comments on commit 59386eb

Please sign in to comment.