- value1First post-processor
C++ Type:PostprocessorName
Controllable:No
Description:First post-processor
- value2Second post-processor, base for relative difference
C++ Type:PostprocessorName
Controllable:No
Description:Second post-processor, base for relative difference
RelativeDifferencePostprocessor
Description
This post-processor computes the absolute value of the relative difference between 2 post-processor values: where and are the 2 post-processor values. Note that is used as the base for the relative difference. If , then the absolute difference is used instead to prevent division by zero:
Example Syntax
The following example demonstrates how this post-processor is used:
# Tests the RelativeDifferencePostprocessor post-processor, which computes
# the relative difference between 2 post-processor values.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 2
[]
[Problem]
solve = false
[]
[Executioner]
type = Steady
[]
[Postprocessors]
[./num_elems]
# number of elements, equal to 2
type = NumElems
[../]
[./num_nodes]
# number of nodes, equal to 3
type = NumNodes
[../]
[./zero]
# zero post-processor value
type = EmptyPostprocessor
[../]
# For the case in this input file, this will be computed as
# y = abs((num_nodes - num_elems) / num_elems)
# y = abs((3 - 2 ) / 2 ) = 0.5
# When the command-line modification "Postprocessors/relative_difference/value2=zero" is used,
# y = abs(num_nodes - zero)
# y = abs(3 - 0 ) = 3
[./relative_difference]
type = RelativeDifferencePostprocessor
value1 = num_nodes
value2 = num_elems
[../]
[]
[Outputs]
[./out]
type = CSV
show = relative_difference
[../]
[]
(test/tests/postprocessors/relative_difference/relative_difference.i)Input Parameters
- execute_onTIMESTEP_ENDThe list of flag(s) indicating when this object should be executed, the available options include FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.
Default:TIMESTEP_END
C++ Type:ExecFlagEnum
Options:FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, TRANSFER
Controllable:No
Description:The list of flag(s) indicating when this object should be executed, the available options include FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.
- prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
C++ Type:MaterialPropertyName
Controllable:No
Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
- use_interpolated_stateFalseFor the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
Default:False
C++ Type:bool
Controllable:No
Description:For the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
Optional Parameters
- allow_duplicate_execution_on_initialFalseIn the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).
Default:False
C++ Type:bool
Controllable:No
Description:In the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
- enableTrueSet the enabled status of the MooseObject.
Default:True
C++ Type:bool
Controllable:Yes
Description:Set the enabled status of the MooseObject.
- execution_order_group0Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.
Default:0
C++ Type:int
Controllable:No
Description:Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.
- force_postauxFalseForces the UserObject to be executed in POSTAUX
Default:False
C++ Type:bool
Controllable:No
Description:Forces the UserObject to be executed in POSTAUX
- force_preauxFalseForces the UserObject to be executed in PREAUX
Default:False
C++ Type:bool
Controllable:No
Description:Forces the UserObject to be executed in PREAUX
- force_preicFalseForces the UserObject to be executed in PREIC during initial setup
Default:False
C++ Type:bool
Controllable:No
Description:Forces the UserObject to be executed in PREIC during initial setup
- outputsVector of output names where you would like to restrict the output of variables(s) associated with this object
C++ Type:std::vector<OutputName>
Controllable:No
Description:Vector of output names where you would like to restrict the output of variables(s) associated with this object
- use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Default:False
C++ Type:bool
Controllable:No
Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Advanced Parameters
Input Files
- (modules/rdg/test/tests/postprocessors/boundary_flux_postprocessor/boundary_flux_postprocessor.i)
- (modules/thermal_hydraulics/test/tests/components/junction_parallel_channels_1phase/phy.unequal_area.i)
- (modules/thermal_hydraulics/test/tests/postprocessors/element_integral_material_property_rz/element_integral_material_property_rz.i)
- (modules/thermal_hydraulics/test/tests/components/heat_source_from_power_density/phy.conservation_from_file_3d.i)
- (test/tests/multiapps/picard/picard_custom_postprocessor.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/plate.i)
- (test/tests/postprocessors/function_element_integral/function_element_integral.i)
- (modules/thermal_hydraulics/test/tests/components/heat_source_from_total_power/phy.conservation.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/plate.i)
- (modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_1phase/phy.heat_structure_multiple_3eqn.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/cylindrical.i)
- (test/tests/coord_type/coord_type_rz_general.i)
- (modules/thermal_hydraulics/test/tests/components/heat_source_from_total_power/phy.conservation_from_file_3d.i)
- (modules/thermal_hydraulics/test/tests/components/volume_junction_1phase/phy.unequal_area.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/from_file_3d.i)
- (modules/thermal_hydraulics/test/tests/components/volume_junction_1phase/phy.deadend.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/from_file_3d.i)
- (test/tests/postprocessors/function_side_average/function_side_average.i)
- (modules/thermal_hydraulics/test/tests/postprocessors/heat_rate_conduction_rz/heat_rate_conduction_rz.i)
- (modules/thermal_hydraulics/test/tests/components/junction_parallel_channels_1phase/phy.shower.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/cylindrical.i)
- (test/tests/postprocessors/relative_difference/relative_difference.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/cylindrical.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_external_app_heat_flux/sub.i)
- (modules/thermal_hydraulics/test/tests/components/volume_junction_1phase/phy.shower.i)
- (modules/thermal_hydraulics/test/tests/components/pump_1phase/pump_pressure_check.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/plate.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/from_file_3d.i)
- (test/tests/postprocessors/function_element_average/function_element_average.i)
(test/tests/postprocessors/relative_difference/relative_difference.i)
# Tests the RelativeDifferencePostprocessor post-processor, which computes
# the relative difference between 2 post-processor values.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 2
[]
[Problem]
solve = false
[]
[Executioner]
type = Steady
[]
[Postprocessors]
[./num_elems]
# number of elements, equal to 2
type = NumElems
[../]
[./num_nodes]
# number of nodes, equal to 3
type = NumNodes
[../]
[./zero]
# zero post-processor value
type = EmptyPostprocessor
[../]
# For the case in this input file, this will be computed as
# y = abs((num_nodes - num_elems) / num_elems)
# y = abs((3 - 2 ) / 2 ) = 0.5
# When the command-line modification "Postprocessors/relative_difference/value2=zero" is used,
# y = abs(num_nodes - zero)
# y = abs(3 - 0 ) = 3
[./relative_difference]
type = RelativeDifferencePostprocessor
value1 = num_nodes
value2 = num_elems
[../]
[]
[Outputs]
[./out]
type = CSV
show = relative_difference
[../]
[]
(modules/rdg/test/tests/postprocessors/boundary_flux_postprocessor/boundary_flux_postprocessor.i)
# This input file is used to test BoundaryFluxPostprocessor, which queries
# fluxes computed using user objects derived from BoundaryFluxBase. The boundary
# flux used in this test is TestBoundaryFlux, which expects a solution vector
# of size 3 (call this U = {A, B, C}) and computes a flux of size 2 with the
# following entries:
#
# flux[0] = (A - B) * C * nx
# flux[1] = A * B * nx
#
# where the normal vector used is {nx, ny, nz}.
A = 1
B = 2
C = 3
# Multiple cases are computed in this test. Each corresponds to a different PP object:
# * flux0_boundary0: boundary 0, flux entry 0, default normal ({-1, 0, 0})
# * flux0_boundary1: boundary 1, flux entry 0, default normal ({1, 0, 0})
# * flux0_provided: boundary 0, flux entry 0, user-provided normal ({2, 0, 0})
# * flux1_boundary0: boundary 0, flux entry 1, default normal ({-1, 0, 0})
nx_boundary0 = -1
nx_boundary1 = 1
nx_provided = 2
flux0_boundary0 = ${fparse (A - B) * C * nx_boundary0}
flux0_boundary1 = ${fparse (A - B) * C * nx_boundary1}
flux0_provided = ${fparse (A - B) * C * nx_provided}
flux1_boundary0 = ${fparse A * B * nx_boundary0}
[GlobalParams]
order = CONSTANT
family = MONOMIAL
execute_on = 'initial timestep_end'
variables = 'A B C'
[]
[Postprocessors]
[./flux0_boundary0]
type = BoundaryFluxPostprocessor
boundary_flux_uo = boundary_flux_flux0_boundary0
boundary = 0
flux_index = 0
[../]
[./flux0_boundary1]
type = BoundaryFluxPostprocessor
boundary_flux_uo = boundary_flux_flux0_boundary1
boundary = 1
flux_index = 0
[../]
[./flux0_provided]
type = BoundaryFluxPostprocessor
boundary_flux_uo = boundary_flux_flux0_provided
boundary = 0
flux_index = 0
normal = '${nx_provided} 0 0'
[../]
[./flux1_boundary0]
type = BoundaryFluxPostprocessor
boundary_flux_uo = boundary_flux_flux1_boundary0
boundary = 0
flux_index = 1
[../]
[./flux0_boundary0_err]
type = RelativeDifferencePostprocessor
value1 = flux0_boundary0
value2 = ${flux0_boundary0}
[../]
[./flux0_boundary1_err]
type = RelativeDifferencePostprocessor
value1 = flux0_boundary1
value2 = ${flux0_boundary1}
[../]
[./flux0_provided_err]
type = RelativeDifferencePostprocessor
value1 = flux0_provided
value2 = ${flux0_provided}
[../]
[./flux1_boundary0_err]
type = RelativeDifferencePostprocessor
value1 = flux1_boundary0
value2 = ${flux1_boundary0}
[../]
[]
[UserObjects]
[./boundary_flux_flux0_boundary0]
type = TestBoundaryFlux
[../]
[./boundary_flux_flux0_boundary1]
type = TestBoundaryFlux
[../]
[./boundary_flux_flux0_provided]
type = TestBoundaryFlux
[../]
[./boundary_flux_flux1_boundary0]
type = TestBoundaryFlux
[../]
[]
[Variables]
[./A]
[../]
[./B]
[../]
[./C]
[../]
[]
[ICs]
[./A_ic]
type = ConstantIC
variable = A
value = ${A}
[../]
[./B_ic]
type = ConstantIC
variable = B
value = ${B}
[../]
[./C_ic]
type = ConstantIC
variable = C
value = ${C}
[../]
[]
[Mesh]
type = GeneratedMesh
dim = 1
[]
[Problem]
kernel_coverage_check = false
solve = false
[]
[Executioner]
type = Transient
scheme = implicit-euler
dt = 1
num_steps = 1
[]
[Outputs]
csv = true
show = 'flux0_boundary0_err flux0_boundary1_err flux0_provided_err flux1_boundary0_err'
[]
(modules/thermal_hydraulics/test/tests/components/junction_parallel_channels_1phase/phy.unequal_area.i)
# Junction between 2 pipes where the second has half the area of the first.
# The momentum density of the second should be twice that of the first.
[GlobalParams]
gravity_vector = '0 0 0'
initial_T = 300
initial_p = 1e5
initial_vel_x = 50
initial_vel_y = 0
initial_vel_z = 0
f = 0
fp = eos
scaling_factor_1phase = '1 1e-2 1e-5'
closures = simple_closures
[]
[FluidProperties]
[eos]
type = StiffenedGasFluidProperties
gamma = 1.4
cv = 725
p_inf = 0
q = 0
q_prime = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[inlet]
type = InletMassFlowRateTemperature1Phase
input = 'pipe1:in'
m_dot = 10
T = 250
[]
[pipe1]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
length = 1
A = 1
n_elems = 20
initial_vel = 20
[]
[junction]
type = JunctionParallelChannels1Phase
connections = 'pipe1:out pipe2:in'
scaling_factor_rhouV = 1e-4
scaling_factor_rhoEV = 1e-5
position = '1 0 0'
volume = 1e-8
[]
[pipe2]
type = FlowChannel1Phase
position = '1 0 0'
orientation = '1 0 0'
length = 1
A = 0.5
n_elems = 20
initial_vel = 15
[]
[outlet]
type = Outlet1Phase
input = 'pipe2:out'
p = 1e5
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'NEWTON'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-10
l_max_its = 10
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
start_time = 0
end_time = 3
dt = 0.1
abort_on_solve_fail = true
[]
[Postprocessors]
# These post-processors are used to test that the outlet side of the junction,
# which has half the area of the inlet side, has twice the momentum density
# that the inlet side does.
[rhouA_pipe1]
type = SideAverageValue
variable = rhouA
boundary = pipe1:out
[]
[rhouA_pipe2]
type = SideAverageValue
variable = rhouA
boundary = pipe2:out
[]
[test_rel_err]
type = RelativeDifferencePostprocessor
value1 = rhouA_pipe1
value2 = rhouA_pipe2
[]
[]
[Outputs]
[out]
type = CSV
show = test_rel_err
execute_on = 'final'
[]
[]
[Debug]
show_var_residual_norms = true
[]
(modules/thermal_hydraulics/test/tests/postprocessors/element_integral_material_property_rz/element_integral_material_property_rz.i)
# Tests the ADElementIntegralMaterialPropertyRZ post-processor.
R_o = 0.2
thickness = 0.05
R_i = ${fparse R_o - thickness}
L = 3.0
V = ${fparse pi * (R_o^2 - R_i^2) * L}
rho_value = 5.0
mass = ${fparse rho_value * V}
[Materials]
[hs_mat]
type = ADGenericConstantMaterial
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '${rho_value} 1.0 1.0'
[]
[]
[Components]
[heat_structure]
type = HeatStructureCylindrical
position = '1 2 3'
orientation = '1 1 1'
inner_radius = ${R_i}
length = ${L}
n_elems = 50
names = 'region1'
widths = '${thickness}'
n_part_elems = '5'
initial_T = 300
[]
[]
[Postprocessors]
[mass]
type = ADElementIntegralMaterialPropertyRZ
axis_point = '1 2 3'
axis_dir = '1 1 1'
mat_prop = density
execute_on = 'INITIAL'
[]
[mass_error]
type = RelativeDifferencePostprocessor
value1 = mass
value2 = ${mass}
execute_on = 'INITIAL'
[]
[]
[Problem]
solve = false
[]
[Executioner]
type = Transient
num_steps = 1
[]
[Outputs]
file_base = 'element_integral_material_property_rz'
[csv]
type = CSV
show = 'mass_error'
execute_on = 'INITIAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/heat_source_from_power_density/phy.conservation_from_file_3d.i)
t = 0.5
# these are the dimensions of rgn1 from box.e
width = 1.5
height = 5
depth = 2
density = 3
specific_heat_capacity = 1
conductivity = 5
power_density = 20
E_change = ${fparse power_density * width * height * depth * t}
[Functions]
[power_density_fn]
type = ConstantFunction
value = ${power_density}
[]
[]
[AuxVariables]
[power_density]
family = MONOMIAL
order = CONSTANT
block = 'heat_structure:rgn1'
[]
[]
[AuxKernels]
[mock_power_aux]
type = FunctionAux
variable = power_density
function = power_density_fn
[]
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'heat_structure:rgn1 heat_structure:rgn2'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '${density} ${specific_heat_capacity} ${conductivity}'
[]
[]
[Components]
[heat_structure]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = 300
[]
[heat_generation]
type = HeatSourceFromPowerDensity
hs = heat_structure
regions = 'rgn1'
power_density = power_density
[]
[]
[Postprocessors]
[E_tot]
type = ADHeatStructureEnergy3D
block = 'heat_structure:rgn1 heat_structure:rgn2'
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
[E_tot_change_rel_err]
type = RelativeDifferencePostprocessor
value1 = E_tot_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'newton'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-3
l_max_its = 10
start_time = 0.0
dt = 0.5
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
csv = true
show = 'E_tot_change_rel_err'
execute_on = 'final'
[]
(test/tests/multiapps/picard/picard_custom_postprocessor.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
parallel_type = replicated
[]
[Variables]
[u]
[]
[]
[AuxVariables]
[v]
[]
[]
[Kernels]
[diff]
type = CoefDiffusion
variable = u
coef = 0.1
[]
[force_u]
type = CoupledForce
variable = u
v = v
[]
[]
[BCs]
[left]
type = DirichletBC
variable = u
boundary = left
value = 0
[]
[right]
type = DirichletBC
variable = u
boundary = right
value = 1
[]
[]
[Postprocessors]
[unorm_begin]
type = ElementL2Norm
variable = u
execute_on = 'initial timestep_begin'
outputs = none
[]
[unorm]
type = ElementL2Norm
variable = u
execute_on = 'initial timestep_end'
[]
[unorm_err]
type = RelativeDifferencePostprocessor
value1 = unorm
value2 = unorm_begin
outputs = none
[]
[vnorm]
type = ElementL2Norm
variable = v
execute_on = 'initial timestep_end'
[]
[]
[Executioner]
type = Steady
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
fixed_point_max_its = 30
disable_fixed_point_residual_norm_check = true
custom_pp = unorm_err
nl_abs_tol = 1e-14
[]
[Outputs]
exodus = true
[]
[MultiApps]
[sub]
type = FullSolveMultiApp
input_files = steady_picard_sub.i
no_backup_and_restore = true
[]
[]
[Transfers]
[v_from_sub]
type = MultiAppGeneralFieldNearestLocationTransfer
from_multi_app = sub
source_variable = v
variable = v
[]
[u_to_sub]
type = MultiAppGeneralFieldNearestLocationTransfer
to_multi_app = sub
source_variable = u
variable = u
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/plate.i)
T_hs = 300
T_ambient1 = 500
htc1 = 100
T_ambient2 = 400
htc2 = 300
t = 0.001
L = 2
thickness = 0.5
depth = 0.6
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
A = ${fparse L * depth}
heat_flux_avg = ${fparse 0.5 * (htc1 * (T_ambient1 - T_hs) + htc2 * (T_ambient2 - T_hs))}
heat_flux_integral = ${fparse heat_flux_avg * A}
scale = 0.8
E_change = ${fparse scale * heat_flux_integral * t}
[Functions]
[T_ambient_fn]
type = PiecewiseConstant
axis = z
x = '0 1'
y = '${T_ambient1} ${T_ambient2}'
[]
[htc_ambient_fn]
type = PiecewiseConstant
axis = z
x = '0 1'
y = '${htc1} ${htc2}'
[]
[]
[SolidProperties]
[hs_mat]
type = ThermalFunctionSolidProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructurePlate
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
depth = ${depth}
widths = '${thickness}'
n_part_elems = '10'
solid_properties = 'hs_mat'
solid_properties_T_ref = '300'
names = 'region'
initial_T = ${T_hs}
[]
[ambient_convection]
type = HSBoundaryAmbientConvection
boundary = 'hs:outer'
hs = hs
T_ambient = T_ambient_fn
htc_ambient = htc_ambient_fn
scale = ${scale}
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergy
block = 'hs:region'
plate_depth = ${depth}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(test/tests/postprocessors/function_element_integral/function_element_integral.i)
dx = 2
y1 = 3
y2 = 6
y3 = 8
integral = ${fparse dx * ((y1 + y2) * 0.5 + (y2 + y3) * 0.5)}
[Mesh]
type = GeneratedMesh
dim = 1
nx = 2
xmax = 4
[]
[Functions]
[./function]
type = PiecewiseLinear
axis = x
x = '0 2 4'
y = '${y1} ${y2} ${y3}'
[../]
[]
[Postprocessors]
[./integral_pp]
type = FunctionElementIntegral
function = function
execute_on = 'initial'
[../]
[./integral_rel_err]
type = RelativeDifferencePostprocessor
value1 = integral_pp
value2 = ${integral}
execute_on = 'initial'
[../]
[]
[Problem]
solve = false
[]
[Executioner]
type = Steady
[]
[Outputs]
csv = true
show = 'integral_rel_err'
[]
(modules/thermal_hydraulics/test/tests/components/heat_source_from_total_power/phy.conservation.i)
# Tests energy conservation for HeatGeneration component when a power component is used
n_units = 5
power = 1e5
power_fraction = 0.3
t = 1
energy_change = ${fparse power_fraction * power * t}
[GlobalParams]
scaling_factor_temperature = 1e-3
[]
[Functions]
[power_shape]
type = ConstantFunction
value = 0.4
[]
[]
[SolidProperties]
[main-material]
type = ThermalFunctionSolidProperties
k = 1e4
cp = 500.0
rho = 100.0
[]
[]
[Components]
[heat_structure]
type = HeatStructureCylindrical
num_rods = ${n_units}
position = '0 1 0'
orientation = '1 0 0'
length = 0.8
n_elems = 100
names = 'rgn1 rgn2 rgn3'
solid_properties = 'main-material main-material main-material'
solid_properties_T_ref = '300 300 300'
widths = '0.4 0.1 0.5'
n_part_elems = '2 2 2'
initial_T = 300
[]
[heat_generation]
type = HeatSourceFromTotalPower
hs = heat_structure
regions = 'rgn1 rgn2'
power = total_power
power_fraction = ${power_fraction}
[]
[total_power]
type = TotalPower
power = ${power}
[]
[]
[Postprocessors]
[E_tot]
type = ADHeatStructureEnergyRZ
block = 'heat_structure:rgn1 heat_structure:rgn2 heat_structure:rgn3'
n_units = ${n_units}
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
[E_tot_change_rel_err]
type = RelativeDifferencePostprocessor
value1 = E_tot_change
value2 = ${energy_change}
execute_on = 'initial timestep_end'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'NEWTON'
line_search = 'basic'
petsc_options_iname = '-pc_type'
petsc_options_value = ' lu'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-3
l_max_its = 10
start_time = 0.0
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Outputs]
csv = true
show = 'E_tot_change_rel_err'
execute_on = 'final'
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/plate.i)
T_hs = 1200
T_ambient = 1500
emissivity = 0.3
view_factor = 0.6
t = 5.0
L = 2
thickness = 0.5
depth = 0.6
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
stefan_boltzmann = 5.670367e-8
A = ${fparse L * depth}
heat_flux = ${fparse stefan_boltzmann * emissivity * view_factor * (T_ambient^4 - T_hs^4)}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[SolidProperties]
[hs_mat]
type = ThermalFunctionSolidProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructurePlate
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
depth = ${depth}
widths = '${thickness}'
n_part_elems = '10'
solid_properties = 'hs_mat'
solid_properties_T_ref = '300'
names = 'region'
initial_T = ${T_hs}
[]
[hs_boundary]
type = HSBoundaryRadiation
boundary = 'hs:outer'
hs = hs
T_ambient = ${T_ambient}
emissivity = ${emissivity}
view_factor = ${view_factor}
scale = ${scale}
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergy
block = 'hs:region'
plate_depth = ${depth}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_1phase/phy.heat_structure_multiple_3eqn.i)
# Tests that energy conservation is satisfied in 1-phase flow when there are
# multiple heat structures are connected to the same pipe.
#
# This problem has 2 heat structures with different material properties and
# initial conditions connected to the same flow channel, which has solid wall
# boundary conditions at both ends. An ideal gas equation of state is used for
# the fluid:
# e(T) = cv * T
# From energy conservation, an analytic expression for the steady-state
# temperature results:
# (rho(p,T)*e(T)*V)_fluid + (rho*cp*T*V)_hs1 + (rho*cp*T*V)_hs2 = constant
# The following are constant:
# V_i domain volumes for flow channel and heat structures
# rho_fluid fluid density (due to conservation of mass)
# rho_hsi heat structure densities
# cp_hsi heat structure specific heats
# Furthermore, all volumes are set equal to 1. Therefore the expression for the
# steady-state temperature is the following:
# T = E0 / C0
# where
# E0 = (rho(p0,T0)*e(T0))_fluid + (rho*cp*T0)_hs1 + (rho*cp*T0)_hs2
# C0 = (rho(p0,T0)*cv)_fluid + (rho*cp)_hs1 + (rho*cp)_hs2
#
# An ideal gas is defined by (gamma, R), and the relation between R and cv is as
# follows:
# cp = gamma * R / (gamma - 1)
# cv = cp / gamma = R / (gamma - 1)
# For the EOS parameters
# gamma = 1.0001
# R = 100 J/kg-K
# the relevant specific heat is
# cv = 1e6 J/kg-K
#
# For the initial conditions
# p = 100 kPa
# T = 300 K
# the density and specific internal energy should be
# rho = 3.3333333333333 kg/m^3
# e = 300000000 J/kg
#
# The following heat structure parameters are used:
# T0_hs1 = 290 K T0_hs2 = 310 K
# rho_hs1 = 8000 kg/m^3 rho_hs2 = 6000 kg/m^3
# cp_hs1 = 500 J/kg-K cp_hs2 = 600 J/kg-K
#
# E0 = 1e9 + 8000 * 500 * 290 + 6000 * 600 * 310
# = 3276000000 J
# C0 = 3.3333333333333e6 + 8000 * 500 + 6000 * 600
# = 10933333.3333333 J/K
# T = E0 / C0
# = 3276000000 / 10933333.3333333
# = 299.6341463414643 K
#
T1 = 290
k1 = 50
rho1 = 8000
cp1 = 500
T2 = 310
k2 = 100
rho2 = 6000
cp2 = 600
[GlobalParams]
gravity_vector = '0 0 0'
initial_T = 300
initial_p = 100e3
initial_vel = 0
scaling_factor_1phase = '1e-3 1e-3 1e-8'
closures = simple_closures
[]
[FluidProperties]
[fp]
type = IdealGasFluidProperties
gamma = 1.0001
molar_mass = 0.083144598
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[SolidProperties]
[hs1_mat]
type = ThermalFunctionSolidProperties
k = ${k1}
rho = ${rho1}
cp = ${cp1}
[]
[hs2_mat]
type = ThermalFunctionSolidProperties
k = ${k2}
rho = ${rho2}
cp = ${cp2}
[]
[]
[Components]
[pipe]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
length = 1
n_elems = 10
A = 1
f = 0
fp = fp
[]
[hs1]
type = HeatStructurePlate
position = '0 -1 0'
orientation = '1 0 0'
length = 1
depth = 1
n_elems = 10
solid_properties = 'hs1_mat'
solid_properties_T_ref = '300'
n_part_elems = '5'
widths = '1'
names = 'solid'
initial_T = ${T1}
[]
[hs2]
type = HeatStructurePlate
position = '0 -1 0'
orientation = '1 0 0'
length = 1
depth = 1
n_elems = 10
solid_properties = 'hs2_mat'
solid_properties_T_ref = '300'
n_part_elems = '5'
widths = '1'
names = 'solid'
initial_T = ${T2}
[]
[ht1]
type = HeatTransferFromHeatStructure1Phase
hs = hs1
hs_side = outer
flow_channel = pipe
Hw = 1e5
P_hf = 0.5
[]
[ht2]
type = HeatTransferFromHeatStructure1Phase
hs = hs2
hs_side = outer
flow_channel = pipe
Hw = 1e5
P_hf = 0.5
[]
[left]
type = SolidWall1Phase
input = 'pipe:in'
[]
[right]
type = SolidWall1Phase
input = 'pipe:out'
[]
[]
[Preconditioning]
[preconditioner]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
start_time = 0
end_time = 4e5
dt = 1e4
abort_on_solve_fail = true
solve_type = 'newton'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 10
l_tol = 1e-3
l_max_its = 100
[Quadrature]
type = GAUSS
order = SECOND
[]
petsc_options_iname = '-pc_type'
petsc_options_value = ' lu'
[]
[Postprocessors]
[T_steady_state_predicted]
type = FunctionValuePostprocessor
# This value is computed in the input file description
function = 299.6341463414643
[]
[T_fluid_average]
type = ElementAverageValue
variable = T
block = pipe
[]
[relative_error]
type = RelativeDifferencePostprocessor
value1 = T_steady_state_predicted
value2 = T_fluid_average
[]
[]
[Outputs]
[out]
type = CSV
show = 'relative_error'
execute_on = 'final'
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/cylindrical.i)
T_hs = 300
heat_flux = 1000
t = 0.001
L = 2
D_i = 0.2
thickness = 0.5
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
R_i = ${fparse 0.5 * D_i}
D_o = ${fparse D_i + 2 * thickness}
A = ${fparse pi * D_o * L}
scale = 0.8
power = ${fparse scale * heat_flux * A}
E_change = ${fparse power * t}
[Functions]
[q_fn]
type = ConstantFunction
value = ${heat_flux}
[]
[]
[SolidProperties]
[hs_mat]
type = ThermalFunctionSolidProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructureCylindrical
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
inner_radius = ${R_i}
widths = '${thickness}'
n_part_elems = '10'
solid_properties = 'hs_mat'
solid_properties_T_ref = '300'
names = 'region'
initial_T = ${T_hs}
[]
[heat_flux_boundary]
type = HSBoundaryHeatFlux
boundary = 'hs:outer'
hs = hs
q = q_fn
scale = ${scale}
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergyRZ
block = 'hs:region'
axis_dir = '0 0 1'
axis_point = '0 0 0'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[heat_rate_pp_relerr]
type = RelativeDifferencePostprocessor
value1 = heat_flux_boundary_integral
value2 = ${power}
execute_on = 'INITIAL'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr heat_rate_pp_relerr'
execute_on = 'FINAL'
[]
[]
(test/tests/coord_type/coord_type_rz_general.i)
# Tests using different coordinate systems in different blocks:
# block1: XYZ translated by (0,-1,0)
# block2: RZ with origin=(0,0,0) and direction=(0,1,0)
# block3: RZ with origin=(0,0,1) and direction=(1,0,0)
# block4: RZ with origin=(-1,-2,-3) and direction=(1,1,0)
#
# A transient heat conduction equation is solved with uniform properties.
# The same power is applied to each block via a uniform heat flux boundary
# condition on the outer cylindrical surface (top surface for block1).
# Conservation is checked for each via post-processors.
# Blocks block2, block3, and block4 should have identical solutions.
rho = 1000.0
cp = 500.0
k = 15.0
length = 1.5
radius = 0.5
perimeter = ${fparse 2 * pi * radius}
nz = 10
nr = 5
power = 1e3
heat_flux = ${fparse power / (perimeter * length)}
[Mesh]
# block1
[genmesh1]
type = GeneratedMeshGenerator
dim = 2
nx = ${nz}
ny = ${nr}
xmin = 0.0
xmax = ${length}
ymin = -1.0
ymax = ${fparse -1.0 + radius}
boundary_id_offset = 10
[]
[renumberblock1]
type = RenameBlockGenerator
input = genmesh1
old_block = 0
new_block = 1
[]
[renameblock1]
type = RenameBlockGenerator
input = renumberblock1
old_block = 1
new_block = block1
[]
[renameboundary1]
type = RenameBoundaryGenerator
input = renameblock1
old_boundary = '10 11 12 13'
new_boundary = 'bottom1 right1 top1 left1'
[]
# block2
[genmesh2]
type = GeneratedMeshGenerator
dim = 2
nx = ${nr}
ny = ${nz}
xmin = 0.0
xmax = ${radius}
ymin = 0
ymax = ${length}
boundary_id_offset = 20
[]
[renumberblock2]
type = RenameBlockGenerator
input = genmesh2
old_block = 0
new_block = 2
[]
[renameblock2]
type = RenameBlockGenerator
input = renumberblock2
old_block = 2
new_block = block2
[]
[renameboundary2]
type = RenameBoundaryGenerator
input = renameblock2
old_boundary = '20 21 22 23'
new_boundary = 'bottom2 right2 top2 left2'
[]
# block3
[genmesh3]
type = GeneratedMeshGenerator
dim = 2
nx = ${nz}
ny = ${nr}
xmin = 0.0
xmax = ${length}
ymin = 0
ymax = ${radius}
boundary_id_offset = 30
[]
[translate3]
type = TransformGenerator
input = genmesh3
transform = TRANSLATE
vector_value = '0 0 1'
[]
[renumberblock3]
type = RenameBlockGenerator
input = translate3
old_block = 0
new_block = 3
[]
[renameblock3]
type = RenameBlockGenerator
input = renumberblock3
old_block = 3
new_block = block3
[]
[renameboundary3]
type = RenameBoundaryGenerator
input = renameblock3
old_boundary = '30 31 32 33'
new_boundary = 'bottom3 right3 top3 left3'
[]
# block4
[genmesh4]
type = GeneratedMeshGenerator
dim = 2
nx = ${nz}
ny = ${nr}
xmin = 0.0
xmax = ${length}
ymin = 0
ymax = ${radius}
boundary_id_offset = 40
[]
[rotate4]
type = TransformGenerator
input = genmesh4
transform = ROTATE
vector_value = '45 0 0'
[]
[translate4]
type = TransformGenerator
input = rotate4
transform = TRANSLATE
vector_value = '-1 -2 -3'
[]
[renumberblock4]
type = RenameBlockGenerator
input = translate4
old_block = 0
new_block = 4
[]
[renameblock4]
type = RenameBlockGenerator
input = renumberblock4
old_block = 4
new_block = block4
[]
[renameboundary4]
type = RenameBoundaryGenerator
input = renameblock4
old_boundary = '40 41 42 43'
new_boundary = 'bottom4 right4 top4 left4'
[]
[combiner]
type = CombinerGenerator
inputs = 'renameboundary1 renameboundary2 renameboundary3 renameboundary4'
[]
coord_block = 'block1 block2 block3 block4'
coord_type = 'XYZ RZ RZ RZ'
rz_coord_blocks = 'block2 block3 block4'
rz_coord_origins = '0 0 0
0 0 1
-1 -2 -3'
rz_coord_directions = '0 1 0
1 0 0
1 1 0'
[]
[Variables]
[T]
family = LAGRANGE
order = FIRST
[]
[]
[Functions]
[T_ic_fn]
type = ParsedFunction
expression = 'x'
[]
[theoretical_energy_added_fn]
type = ParsedFunction
expression = '${power} * t'
[]
[]
[ICs]
[T_ic]
type = FunctionIC
variable = T
function = T_ic_fn
[]
[]
[Kernels]
[time_derivative]
type = ADTimeDerivative
variable = T
[]
[heat_conduction]
type = CoefDiffusion
variable = T
coef = ${fparse k / (rho * cp)}
[]
[]
[BCs]
[heat_flux_bc]
type = ADFunctionNeumannBC
variable = T
boundary = 'top1 right2 top3 top4'
# The heat conduction equation has been divided by rho*cp
function = '${fparse heat_flux / (rho * cp)}'
[]
[]
[Postprocessors]
[theoretical_energy_change]
type = FunctionValuePostprocessor
function = theoretical_energy_added_fn
execute_on = 'INITIAL TIMESTEP_END'
[]
# block1 conservation
[T_integral1]
type = ElementIntegralVariablePostprocessor
variable = T
block = 'block1'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy1]
type = ParsedPostprocessor
pp_names = 'T_integral1'
function = 'T_integral1 * ${rho} * ${cp} * ${perimeter}'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change1]
type = ChangeOverTimePostprocessor
postprocessor = energy1
change_with_respect_to_initial = true
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change_error1]
type = RelativeDifferencePostprocessor
value1 = energy_change1
value2 = theoretical_energy_change
execute_on = 'INITIAL TIMESTEP_END'
[]
# block2 conservation
[T_integral2]
type = ElementIntegralVariablePostprocessor
variable = T
block = 'block2'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy2]
type = ParsedPostprocessor
pp_names = 'T_integral2'
function = 'T_integral2 * ${rho} * ${cp}'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change2]
type = ChangeOverTimePostprocessor
postprocessor = energy2
change_with_respect_to_initial = true
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change_error2]
type = RelativeDifferencePostprocessor
value1 = energy_change2
value2 = theoretical_energy_change
execute_on = 'INITIAL TIMESTEP_END'
[]
# block3 conservation
[T_integral3]
type = ElementIntegralVariablePostprocessor
variable = T
block = 'block3'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy3]
type = ParsedPostprocessor
pp_names = 'T_integral3'
function = 'T_integral3 * ${rho} * ${cp}'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change3]
type = ChangeOverTimePostprocessor
postprocessor = energy3
change_with_respect_to_initial = true
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change_error3]
type = RelativeDifferencePostprocessor
value1 = energy_change3
value2 = theoretical_energy_change
execute_on = 'INITIAL TIMESTEP_END'
[]
# block4 conservation
[T_integral4]
type = ElementIntegralVariablePostprocessor
variable = T
block = 'block4'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy4]
type = ParsedPostprocessor
pp_names = 'T_integral4'
function = 'T_integral4 * ${rho} * ${cp}'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change4]
type = ChangeOverTimePostprocessor
postprocessor = energy4
change_with_respect_to_initial = true
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change_error4]
type = RelativeDifferencePostprocessor
value1 = energy_change4
value2 = theoretical_energy_change
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = bdf2
dt = 1.0
num_steps = 10
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
nl_rel_tol = 1e-10
[]
[Outputs]
file_base = 'coord_type_rz_general'
[console]
type = Console
show = 'energy_change_error1 energy_change_error2 energy_change_error3 energy_change_error4'
[]
[exodus]
type = Exodus
show = 'T energy_change_error1 energy_change_error2 energy_change_error3 energy_change_error4'
[]
[]
(modules/thermal_hydraulics/test/tests/components/heat_source_from_total_power/phy.conservation_from_file_3d.i)
# Tests energy conservation for HeatStructureFromFile3D in combination with HeatSourceFromTotalPower
power = 1e5
power_fraction = 0.3
t = 1
energy_change = ${fparse power_fraction * power * t}
[Functions]
[power_shape]
type = ConstantFunction
value = 0.4
[]
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'heat_structure:rgn1 heat_structure:rgn2'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '100 500 1e4'
[]
[]
[Components]
[heat_structure]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = 300
[]
[heat_generation]
type = HeatSourceFromTotalPower
hs = heat_structure
regions = 'rgn1'
power = total_power
power_fraction = ${power_fraction}
[]
[total_power]
type = TotalPower
power = ${power}
[]
[]
[Postprocessors]
[E_tot]
type = ADHeatStructureEnergy3D
block = 'heat_structure:rgn1 heat_structure:rgn2'
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
[E_tot_change_rel_err]
type = RelativeDifferencePostprocessor
value1 = E_tot_change
value2 = ${energy_change}
execute_on = 'initial timestep_end'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'PJFNK'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-3
l_max_its = 10
start_time = 0.0
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
csv = true
show = 'E_tot_change_rel_err'
execute_on = 'final'
[]
(modules/thermal_hydraulics/test/tests/components/volume_junction_1phase/phy.unequal_area.i)
# Junction between 2 pipes where the second has half the area of the first.
# The momentum density of the second should be twice that of the first.
[GlobalParams]
gravity_vector = '0 0 0'
initial_T = 250
initial_p = 1e5
initial_vel = 1
initial_vel_x = 1
initial_vel_y = 0
initial_vel_z = 0
f = 0
fp = eos
scaling_factor_1phase = '1 1 1e-5'
closures = simple_closures
[]
[FluidProperties]
[eos]
type = StiffenedGasFluidProperties
gamma = 1.4
cv = 725
p_inf = 0
q = 0
q_prime = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[inlet]
type = InletDensityVelocity1Phase
input = 'pipe1:in'
rho = 1.37931034483
vel = 1
[]
[pipe1]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
length = 1
A = 1
n_elems = 20
[]
[junction]
type = VolumeJunction1Phase
connections = 'pipe1:out pipe2:in'
position = '1 0 0'
volume = 1e-8
[]
[pipe2]
type = FlowChannel1Phase
position = '1 0 0'
orientation = '1 0 0'
length = 1
A = 0.5
n_elems = 20
[]
[outlet]
type = Outlet1Phase
input = 'pipe2:out'
p = 1e5
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'NEWTON'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 10
l_tol = 1e-10
l_max_its = 10
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
start_time = 0
end_time = 3
dt = 0.1
abort_on_solve_fail = true
[]
[Postprocessors]
# These post-processors are used to test that the outlet side of the junction,
# which has half the area of the inlet side, has twice the momentum density
# that the inlet side does.
[rhouA_pipe1]
type = SideAverageValue
variable = rhouA
boundary = pipe1:out
[]
[rhouA_pipe2]
type = SideAverageValue
variable = rhouA
boundary = pipe2:out
[]
[test_rel_err]
type = RelativeDifferencePostprocessor
value1 = rhouA_pipe1
value2 = rhouA_pipe2
[]
[]
[Outputs]
[out]
type = CSV
show = test_rel_err
execute_on = 'final'
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/from_file_3d.i)
T_hs = 1200
T_ambient = 1500
emissivity = 0.3
view_factor = 0.6
t = 5.0
# dimensions of the side 'left'
height = 5
depth = 2
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
stefan_boltzmann = 5.670367e-8
A = ${fparse height * depth}
heat_flux = ${fparse stefan_boltzmann * emissivity * view_factor * (T_ambient^4 - T_hs^4)}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'hs:brick'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '${density} ${specific_heat_capacity} ${conductivity}'
[]
[]
[Components]
[hs]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = ${T_hs}
[]
[hs_boundary]
type = HSBoundaryRadiation
boundary = 'hs:left'
hs = hs
T_ambient = ${T_ambient}
emissivity = ${emissivity}
view_factor = ${view_factor}
scale = ${scale}
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergy3D
block = 'hs:brick'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/volume_junction_1phase/phy.deadend.i)
# Junction between 3 pipes, 1 of which goes to a dead-end. In the steady-state,
# no flow should go into the dead-end pipe.
[GlobalParams]
gravity_vector = '0 0 0'
scaling_factor_1phase = '1 1 1e-5'
initial_T = 250
initial_p = 1e5
initial_vel_x = 1
initial_vel_y = 0
initial_vel_z = 0
closures = simple_closures
[]
[AuxVariables]
[p0]
family = MONOMIAL
order = CONSTANT
[]
[]
[AuxKernels]
[p0_kernel]
type = StagnationPressureAux
variable = p0
fp = eos
e = e
v = v
vel = vel
[]
[]
[FluidProperties]
[eos]
type = StiffenedGasFluidProperties
gamma = 1.4
cv = 725
q = 0
q_prime = 0
p_inf = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Functions]
[T0]
type = ParsedFunction
expression = 'if (x < 1, 300 + 50 * sin(2*pi*x + 1.5*pi), 250)'
[]
[]
[Components]
[inlet]
type = InletDensityVelocity1Phase
input = 'inlet_pipe:in'
rho = 1.37931034483
vel = 1
[]
[inlet_pipe]
type = FlowChannel1Phase
fp = eos
position = '0 0 0'
orientation = '1 0 0'
length = 1
A = 1
f = 0
initial_T = T0
initial_p = 1e5
initial_vel = 1
n_elems = 20
[]
[junction1]
type = VolumeJunction1Phase
connections = 'inlet_pipe:out deadend_pipe:in outlet_pipe:in'
position = '1 0 0'
volume = 1e-8
[]
[outlet_pipe]
type = FlowChannel1Phase
fp = eos
position = '1 0 0'
orientation = '1 0 0'
length = 1
A = 1
f = 0
initial_T = 250
initial_p = 1e5
initial_vel = 1
n_elems = 20
[]
[outlet]
type = Outlet1Phase
input = 'outlet_pipe:out'
p = 1e5
[]
[deadend_pipe]
type = FlowChannel1Phase
fp = eos
position = '1 0 0'
orientation = '0 1 0'
length = 1
A = 1
f = 0
initial_T = 250
initial_p = 1e5
initial_vel = 0
n_elems = 20
[]
[deadend]
type = SolidWall1Phase
input = 'deadend_pipe:out'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'NEWTON'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 10
l_tol = 1e-6
l_max_its = 10
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
start_time = 0
end_time = 5
dt = 0.1
abort_on_solve_fail = true
[]
[Postprocessors]
# These post-processors are used for testing that the stagnation pressure in
# the dead-end pipe is equal to the inlet stagnation pressure.
[p0_inlet]
type = SideAverageValue
variable = p0
boundary = inlet_pipe:in
[]
[p0_deadend]
type = SideAverageValue
variable = p0
boundary = deadend_pipe:out
[]
[test_rel_err]
type = RelativeDifferencePostprocessor
value1 = p0_deadend
value2 = p0_inlet
[]
[]
[Outputs]
[out]
type = CSV
show = test_rel_err
sync_only = true
sync_times = '1 2 3 4 5'
[]
velocity_as_vector = false
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/from_file_3d.i)
T_hs = 300
T_ambient1 = 500
htc1 = 100
T_ambient2 = 400
htc2 = 300
t = 0.001
# dimensions of the side 'left'
height = 5
depth = 2
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
A = ${fparse height * depth}
heat_flux_avg = ${fparse 0.5 * (htc1 * (T_ambient1 - T_hs) + htc2 * (T_ambient2 - T_hs))}
heat_flux_integral = ${fparse heat_flux_avg * A}
scale = 0.8
E_change = ${fparse scale * heat_flux_integral * t}
[Functions]
[T_ambient_fn]
type = PiecewiseConstant
axis = z
x = '-2.5 0'
y = '${T_ambient1} ${T_ambient2}'
[]
[htc_ambient_fn]
type = PiecewiseConstant
axis = z
x = '-2.5 0'
y = '${htc1} ${htc2}'
[]
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'hs:brick'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '${density} ${specific_heat_capacity} ${conductivity}'
[]
[]
[Components]
[hs]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = ${T_hs}
[]
[ambient_convection]
type = HSBoundaryAmbientConvection
boundary = 'hs:left'
hs = hs
T_ambient = T_ambient_fn
htc_ambient = htc_ambient_fn
scale = ${scale}
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergy3D
block = 'hs:brick'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(test/tests/postprocessors/function_side_average/function_side_average.i)
A = 2
B = 5
x2 = 4
y2 = 3
integral_exact = ${fparse A * x2 * y2 + 0.5 * B * y2^2}
avg_exact = ${fparse integral_exact / y2}
[Mesh]
type = GeneratedMesh
dim = 2
nx = 2
ny = 2
xmax = ${x2}
ymax = ${y2}
[]
[Functions]
[test_fn]
type = ParsedFunction
expression = '${A}*x + ${B}*y'
[]
[]
[Postprocessors]
[avg]
type = FunctionSideAverage
boundary = 'right'
function = test_fn
execute_on = 'INITIAL'
[]
[avg_err]
type = RelativeDifferencePostprocessor
value1 = avg
value2 = ${avg_exact}
execute_on = 'INITIAL'
[]
[]
[Problem]
solve = false
[]
[Executioner]
type = Steady
[]
[Outputs]
csv = true
show = 'avg_err'
[]
(modules/thermal_hydraulics/test/tests/postprocessors/heat_rate_conduction_rz/heat_rate_conduction_rz.i)
# Tests the HeatRateConductionRZ post-processor.
R_i = 0.1
thickness = 0.2
L = 3.0
R_o = ${fparse R_i + thickness}
S = ${fparse 2 * pi * R_o * L}
k = 20.0
T_i = 300.0
T_o = 500.0
dT_dr = ${fparse (T_o - T_i) / thickness}
Q_exact = ${fparse k * dT_dr * S}
[Materials]
[hs_mat]
type = ADGenericConstantMaterial
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '1.0 1.0 ${k}'
[]
[]
[Functions]
[T_fn]
type = ParsedFunction
expression = '${T_i} + (y - ${R_i}) * ${dT_dr}'
[]
[]
[Components]
[heat_structure]
type = HeatStructureCylindrical
position = '0 0 0'
orientation = '1 0 0'
inner_radius = ${R_i}
length = ${L}
n_elems = 50
names = 'region1'
widths = '${thickness}'
n_part_elems = '5'
initial_T = T_fn
[]
[]
[Postprocessors]
[Q_pp]
type = HeatRateConductionRZ
boundary = heat_structure:outer
axis_point = '0 0 0'
axis_dir = '1 0 0'
temperature = T_solid
thermal_conductivity = thermal_conductivity
inward = true
execute_on = 'INITIAL'
[]
[Q_err]
type = RelativeDifferencePostprocessor
value1 = Q_pp
value2 = ${Q_exact}
execute_on = 'INITIAL'
[]
[]
[Problem]
solve = false
[]
[Executioner]
type = Transient
num_steps = 0
[]
[Outputs]
file_base = 'heat_rate_conduction_rz'
[csv]
type = CSV
show = 'Q_err'
execute_on = 'INITIAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/junction_parallel_channels_1phase/phy.shower.i)
# This problem models a "shower": water from two pipes, one hot and one cold,
# mixes together to produce a temperature between the two.
[GlobalParams]
gravity_vector = '0 0 0'
initial_T = 300
initial_p = 1e5
initial_vel = 1
initial_vel_x = 1
initial_vel_y = 0
initial_vel_z = 0
# global parameters for pipes
fp = eos
orientation = '1 0 0'
length = 1
n_elems = 20
f = 0
scaling_factor_1phase = '1 1 1e-6'
closures = simple_closures
[]
[FluidProperties]
[eos]
type = IdealGasFluidProperties
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[inlet_hot]
type = InletDensityVelocity1Phase
input = 'pipe_hot:in'
# rho @ (p = 1e5, T = 310 K)
rho = 1315.9279785683
vel = 1
[]
[inlet_cold]
type = InletDensityVelocity1Phase
input = 'pipe_cold:in'
# rho @ (p = 1e5, T = 280 K)
rho = 1456.9202619863
vel = 1
[]
[outlet]
type = Outlet1Phase
input = 'pipe_warm:out'
p = 1e5
[]
[pipe_hot]
type = FlowChannel1Phase
position = '0 1 0'
A = 1
[]
[pipe_cold]
type = FlowChannel1Phase
position = '0 0 0'
A = 1
[]
[pipe_warm]
type = FlowChannel1Phase
position = '1 0.5 0'
A = 2
initial_vel = 0.5
[]
[junction]
type = JunctionParallelChannels1Phase
connections = 'pipe_cold:out pipe_hot:out pipe_warm:in'
position = '1 0.5 0'
volume = 1e-8
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'NEWTON'
line_search = 'basic'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-5
nl_max_its = 10
l_tol = 1e-2
l_max_its = 10
start_time = 0
end_time = 5
dt = 0.05
abort_on_solve_fail = true
[]
[Postprocessors]
# These post-processors are used to test that the energy flux on
# the warm side of the junction is equal to the sum of the energy
# fluxes of the hot and cold inlets to the junction.
[energy_flux_hot]
type = EnergyFluxIntegral
boundary = pipe_hot:out
arhouA = rhouA
H = H
[]
[energy_flux_cold]
type = EnergyFluxIntegral
boundary = pipe_cold:out
arhouA = rhouA
H = H
[]
[energy_flux_warm]
type = EnergyFluxIntegral
boundary = pipe_warm:in
arhouA = rhouA
H = H
[]
[energy_flux_inlet_sum]
type = SumPostprocessor
values = 'energy_flux_hot energy_flux_cold'
[]
[test_rel_err]
type = RelativeDifferencePostprocessor
value1 = energy_flux_warm
value2 = energy_flux_inlet_sum
[]
[]
[Outputs]
[out]
type = CSV
show = test_rel_err
sync_only = true
sync_times = '3 4 5'
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/cylindrical.i)
T_hs = 1200
T_ambient = 1500
emissivity = 0.3
view_factor = 0.6
t = 5.0
L = 2
D_i = 0.2
thickness = 0.5
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
stefan_boltzmann = 5.670367e-8
R_i = ${fparse 0.5 * D_i}
D_o = ${fparse D_i + 2 * thickness}
A = ${fparse pi * D_o * L}
heat_flux = ${fparse stefan_boltzmann * emissivity * view_factor * (T_ambient^4 - T_hs^4)}
scale = 0.8
power = ${fparse scale * heat_flux * A}
E_change = ${fparse power * t}
[SolidProperties]
[hs_mat]
type = ThermalFunctionSolidProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructureCylindrical
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
inner_radius = ${R_i}
widths = '${thickness}'
n_part_elems = '10'
solid_properties = 'hs_mat'
solid_properties_T_ref = '300'
names = 'region'
initial_T = ${T_hs}
[]
[hs_boundary]
type = HSBoundaryRadiation
boundary = 'hs:outer'
hs = hs
T_ambient = ${T_ambient}
emissivity = ${emissivity}
view_factor = ${view_factor}
scale = ${scale}
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergyRZ
block = 'hs:region'
axis_dir = '0 0 1'
axis_point = '0 0 0'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[heat_rate_pp_relerr]
type = RelativeDifferencePostprocessor
value1 = hs_boundary_integral
value2 = ${power}
execute_on = 'INITIAL'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr heat_rate_pp_relerr'
execute_on = 'FINAL'
[]
[]
(test/tests/postprocessors/relative_difference/relative_difference.i)
# Tests the RelativeDifferencePostprocessor post-processor, which computes
# the relative difference between 2 post-processor values.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 2
[]
[Problem]
solve = false
[]
[Executioner]
type = Steady
[]
[Postprocessors]
[./num_elems]
# number of elements, equal to 2
type = NumElems
[../]
[./num_nodes]
# number of nodes, equal to 3
type = NumNodes
[../]
[./zero]
# zero post-processor value
type = EmptyPostprocessor
[../]
# For the case in this input file, this will be computed as
# y = abs((num_nodes - num_elems) / num_elems)
# y = abs((3 - 2 ) / 2 ) = 0.5
# When the command-line modification "Postprocessors/relative_difference/value2=zero" is used,
# y = abs(num_nodes - zero)
# y = abs(3 - 0 ) = 3
[./relative_difference]
type = RelativeDifferencePostprocessor
value1 = num_nodes
value2 = num_elems
[../]
[]
[Outputs]
[./out]
type = CSV
show = relative_difference
[../]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/cylindrical.i)
T_hs = 300
T_ambient1 = 500
htc1 = 100
T_ambient2 = 400
htc2 = 300
t = 0.001
L = 2
D_i = 0.2
thickness = 0.5
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
R_i = ${fparse 0.5 * D_i}
D_o = ${fparse D_i + 2 * thickness}
A = ${fparse pi * D_o * L}
heat_flux_avg = ${fparse 0.5 * (htc1 * (T_ambient1 - T_hs) + htc2 * (T_ambient2 - T_hs))}
heat_flux_integral = ${fparse heat_flux_avg * A}
scale = 0.8
power = ${fparse scale * heat_flux_integral}
E_change = ${fparse power * t}
[Functions]
[T_ambient_fn]
type = PiecewiseConstant
axis = z
x = '0 1'
y = '${T_ambient1} ${T_ambient2}'
[]
[htc_ambient_fn]
type = PiecewiseConstant
axis = z
x = '0 1'
y = '${htc1} ${htc2}'
[]
[]
[SolidProperties]
[hs_mat]
type = ThermalFunctionSolidProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructureCylindrical
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
inner_radius = ${R_i}
widths = '${thickness}'
n_part_elems = '10'
solid_properties = 'hs_mat'
solid_properties_T_ref = '300'
names = 'region'
initial_T = ${T_hs}
[]
[ambient_convection]
type = HSBoundaryAmbientConvection
boundary = 'hs:outer'
hs = hs
T_ambient = T_ambient_fn
htc_ambient = htc_ambient_fn
scale = ${scale}
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergyRZ
block = 'hs:region'
axis_dir = '0 0 1'
axis_point = '0 0 0'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[heat_rate_pp_relerr]
type = RelativeDifferencePostprocessor
value1 = ambient_convection_integral
value2 = ${power}
execute_on = 'INITIAL'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr heat_rate_pp_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_external_app_heat_flux/sub.i)
# Sub input file.
L = 5.0
radius = 0.01
n_elems_axial = 10
n_elems_radial = 5
T_initial = 300.0
power = 1000.0
t = 10.0
E_change = ${fparse power * t}
rho = 8000.0
cp = 500.0
k = 15.0
[SolidProperties]
[hs_mat]
type = ThermalFunctionSolidProperties
rho = ${rho}
cp = ${cp}
k = ${k}
[]
[]
[Components]
[hs]
type = HeatStructureCylindrical
position = '0 0 0'
orientation = '0 0 1'
length = ${L}
n_elems = ${n_elems_axial}
names = 'body'
widths = '${radius}'
n_part_elems = '${n_elems_radial}'
solid_properties = 'hs_mat'
solid_properties_T_ref = '300'
initial_T = ${T_initial}
[]
[hs_boundary]
type = HSBoundaryExternalAppHeatFlux
hs = hs
boundary = 'hs:outer'
heat_flux_name = q_ext
heat_flux_is_inward = true
perimeter_ext = P_ext
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergyRZ
block = 'hs:body'
axis_dir = '0 0 1'
axis_point = '0 0 0'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[integral_relerr]
type = RelativeDifferencePostprocessor
value1 = hs_boundary_integral
value2 = ${power}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = bdf2
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
solve_type = NEWTON
nl_abs_tol = 1e-10
nl_rel_tol = 1e-8
nl_max_its = 10
l_tol = 1e-3
l_max_its = 10
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Outputs]
csv = true
show = 'E_change_relerr integral_relerr'
execute_on = 'FINAL'
[]
(modules/thermal_hydraulics/test/tests/components/volume_junction_1phase/phy.shower.i)
# This problem models a "shower": water from two pipes, one hot and one cold,
# mixes together to produce a temperature between the two.
[GlobalParams]
gravity_vector = '0 0 0'
initial_T = 300
initial_p = 1e5
initial_vel = 0
initial_vel_x = 0
initial_vel_y = 0
initial_vel_z = 0
# global parameters for pipes
fp = eos
orientation = '1 0 0'
length = 1
n_elems = 20
f = 0
scaling_factor_1phase = '1 1 1e-6'
closures = simple_closures
[]
[FluidProperties]
[eos]
type = StiffenedGasFluidProperties
gamma = 2.35
cv = 1816.0
q = -1.167e6
p_inf = 1.0e9
q_prime = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[inlet_hot]
type = InletDensityVelocity1Phase
input = 'pipe_hot:in'
# rho @ (p = 1e5, T = 310 K)
rho = 1315.9279785683
vel = 1
[]
[inlet_cold]
type = InletDensityVelocity1Phase
input = 'pipe_cold:in'
# rho @ (p = 1e5, T = 280 K)
rho = 1456.9202619863
vel = 1
[]
[outlet]
type = Outlet1Phase
input = 'pipe_warm:out'
p = 1e5
[]
[pipe_hot]
type = FlowChannel1Phase
position = '0 1 0'
A = 1
[]
[pipe_cold]
type = FlowChannel1Phase
position = '0 0 0'
A = 1
[]
[pipe_warm]
type = FlowChannel1Phase
position = '1 0.5 0'
A = 2
[]
[junction]
type = VolumeJunction1Phase
connections = 'pipe_cold:out pipe_hot:out pipe_warm:in'
position = '1 0.5 0'
volume = 1e-8
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'NEWTON'
line_search = 'basic'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-5
nl_max_its = 10
l_tol = 1e-2
l_max_its = 10
start_time = 0
end_time = 5
dt = 0.05
# abort_on_solve_fail = true
[]
[Postprocessors]
# These post-processors are used to test that the energy flux on
# the warm side of the junction is equal to the sum of the energy
# fluxes of the hot and cold inlets to the junction.
[energy_flux_hot]
type = EnergyFluxIntegral
boundary = pipe_hot:out
arhouA = rhouA
H = H
[]
[energy_flux_cold]
type = EnergyFluxIntegral
boundary = pipe_cold:out
arhouA = rhouA
H = H
[]
[energy_flux_warm]
type = EnergyFluxIntegral
boundary = pipe_warm:in
arhouA = rhouA
H = H
[]
[energy_flux_inlet_sum]
type = SumPostprocessor
values = 'energy_flux_hot energy_flux_cold'
[]
[test_rel_err]
type = RelativeDifferencePostprocessor
value1 = energy_flux_warm
value2 = energy_flux_inlet_sum
[]
[]
[Outputs]
[out]
type = CSV
show = test_rel_err
sync_only = true
sync_times = '3 4 5'
[]
[console]
type = Console
max_rows = 1
[]
print_linear_residuals = false
[]
(modules/thermal_hydraulics/test/tests/components/pump_1phase/pump_pressure_check.i)
# This test checks that the expected pressure rise due to the user supplied
# pump head matches the actual pressure rise across the pump.
# The orientation of flow channels in this test have no components in the z-direction
# due to the expected_pressure_rise_fcn not accounting for hydrostatic pressure.
head = 95.
dt = 0.1
g = 9.81
volume = 0.567
[GlobalParams]
initial_T = 393.15
initial_vel = 0.0372
A = 0.567
f = 0
fp = fp
scaling_factor_1phase = '1 1 1e-5'
closures = simple_closures
[]
[FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 2.35
q = -1167e3
q_prime = 0
p_inf = 1.e9
cv = 1816
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Functions]
[expected_pressure_rise_fcn]
type = ParsedFunction
expression = 'rhoV * g * head / volume'
symbol_names = 'rhoV g head volume'
symbol_values = 'pump:rhoV ${g} ${head} ${volume}'
[]
[]
[Components]
[inlet]
type = InletMassFlowRateTemperature1Phase
input = 'pipe1:in'
m_dot = 20
T = 393.15
[]
[pipe1]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
length = 1
initial_p = 1.318964e+07
n_elems = 10
[]
[pump]
type = Pump1Phase
connections = 'pipe1:out pipe2:in'
position = '1.02 0 0'
initial_p = 1.318964e+07
scaling_factor_rhoEV = 1e-5
head = ${head}
volume = ${volume}
A_ref = 0.567
initial_vel_x = 1
initial_vel_y = 1
initial_vel_z = 0
[]
[pipe2]
type = FlowChannel1Phase
position = '1.04 0 0'
orientation = '0 2 0'
length = 0.96
initial_p = 1.4072E+07
n_elems = 10
[]
[outlet]
type = Outlet1Phase
input = 'pipe2:out'
p = 1.4072E+07
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'implicit-euler'
start_time = 0
dt = ${dt}
num_steps = 4
abort_on_solve_fail = true
solve_type = 'PJFNK'
line_search = 'basic'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-4
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Postprocessors]
[pump_rhoV]
type = ScalarVariable
variable = pump:rhoV
execute_on = 'initial timestep_end'
[]
[expected_pressure_rise]
type = FunctionValuePostprocessor
function = expected_pressure_rise_fcn
execute_on = 'initial linear'
[]
[p_inlet]
type = SideAverageValue
variable = p
boundary = 'pipe1:out'
execute_on = 'initial linear'
[]
[p_outlet]
type = SideAverageValue
variable = p
boundary = 'pipe2:in'
execute_on = 'initial linear'
[]
[actual_pressure_rise]
type = DifferencePostprocessor
value1 = p_outlet
value2 = p_inlet
execute_on = 'timestep_end'
[]
[pressure_rise_diff]
type = RelativeDifferencePostprocessor
value1 = actual_pressure_rise
value2 = expected_pressure_rise
execute_on = 'timestep_end'
[]
[]
[Outputs]
[out]
type = CSV
execute_on = 'FINAL'
show = 'pressure_rise_diff'
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/plate.i)
T_hs = 300
heat_flux = 1000
t = 0.001
L = 2
thickness = 0.5
depth = 0.6
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
A = ${fparse L * depth}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[Functions]
[q_fn]
type = ConstantFunction
value = ${heat_flux}
[]
[]
[SolidProperties]
[hs_mat]
type = ThermalFunctionSolidProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructurePlate
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
depth = ${depth}
widths = '${thickness}'
n_part_elems = '10'
solid_properties = 'hs_mat'
solid_properties_T_ref = '300'
names = 'region'
initial_T = ${T_hs}
[]
[heat_flux_boundary]
type = HSBoundaryHeatFlux
boundary = 'hs:outer'
hs = hs
q = q_fn
scale = ${scale}
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergy
block = 'hs:region'
plate_depth = ${depth}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/from_file_3d.i)
T_hs = 300
heat_flux = 1000
t = 0.001
# dimensions of the side 'left'
height = 5
depth = 2
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
A = ${fparse height * depth}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[Functions]
[q_fn]
type = ConstantFunction
value = ${heat_flux}
[]
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'hs:brick'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '${density} ${specific_heat_capacity} ${conductivity}'
[]
[]
[Components]
[hs]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = ${T_hs}
[]
[heat_flux_boundary]
type = HSBoundaryHeatFlux
boundary = 'hs:left'
hs = hs
q = q_fn
scale = ${scale}
[]
[]
[Postprocessors]
[E_hs]
type = ADHeatStructureEnergy3D
block = 'hs:brick'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(test/tests/postprocessors/function_element_average/function_element_average.i)
A = 2
B = 5
x2 = 4
y2 = 3
integral_exact = ${fparse 0.5 * A * x2^2 * y2 + 0.5 * B * x2 * y2^2}
avg_exact = ${fparse integral_exact / (x2 * y2)}
[Mesh]
type = GeneratedMesh
dim = 2
nx = 2
ny = 2
xmax = ${x2}
ymax = ${y2}
[]
[Functions]
[test_fn]
type = ParsedFunction
expression = '${A}*x + ${B}*y'
[]
[]
[Postprocessors]
[avg]
type = FunctionElementAverage
function = test_fn
execute_on = 'INITIAL'
[]
[avg_err]
type = RelativeDifferencePostprocessor
value1 = avg
value2 = ${avg_exact}
execute_on = 'INITIAL'
[]
[]
[Problem]
solve = false
[]
[Executioner]
type = Steady
[]
[Outputs]
csv = true
show = 'avg_err'
[]