- variableThe name of the variable that this residual object operates on
C++ Type:NonlinearVariableName
Unit:(no unit assumed)
Controllable:No
Description:The name of the variable that this residual object operates on
ADScalarTimeDerivative
This scalar kernel adds the time derivative of the paired scalar variable to the nonlinear residual : The Jacobian of this residual contribution is computed using automatic differentiation.
Input Parameters
- absolute_value_vector_tagsThe tags for the vectors this residual object should fill with the absolute value of the residual contribution
C++ Type:std::vector<TagName>
Controllable:No
Description:The tags for the vectors this residual object should fill with the absolute value of the residual contribution
- extra_matrix_tagsThe extra tags for the matrices this Kernel should fill
C++ Type:std::vector<TagName>
Controllable:No
Description:The extra tags for the matrices this Kernel should fill
- extra_vector_tagsThe extra tags for the vectors this Kernel should fill
C++ Type:std::vector<TagName>
Controllable:No
Description:The extra tags for the vectors this Kernel should fill
- matrix_onlyFalseWhether this object is only doing assembly to matrices (no vectors)
Default:False
C++ Type:bool
Controllable:No
Description:Whether this object is only doing assembly to matrices (no vectors)
- matrix_tagssystem timeThe tag for the matrices this Kernel should fill
Default:system time
C++ Type:MultiMooseEnum
Options:nontime, system, time
Controllable:No
Description:The tag for the matrices this Kernel should fill
- vector_tagstimeThe tag for the vectors this Kernel should fill
Default:time
C++ Type:MultiMooseEnum
Options:nontime, time
Controllable:No
Description:The tag for the vectors this Kernel should fill
Contribution To Tagged Field Data Parameters
- 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.
- implicitTrueDetermines whether this object is calculated using an implicit or explicit form
Default:True
C++ Type:bool
Controllable:No
Description:Determines whether this object is calculated using an implicit or explicit form
- seed0The seed for the master random number generator
Default:0
C++ Type:unsigned int
Controllable:No
Description:The seed for the master random number generator
- 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
- (test/tests/scalar_kernels/ad_scalar_kernel/ad_scalar_kernel.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADgrav.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfull_exp.i)
- (test/tests/scalar_kernels/ad_scalar_time_derivative/ad_scalar_time_derivative.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_ambient_radiation.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat_exp.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADregular_reverse.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpump.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADregular_twoseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfriction.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat_threeseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_ambient.i)
- (test/tests/scalar_kernels/ad_scalar_kernel/ad_functor_scalar_test_kernel.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat_twoseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_heatflux.i)
- (test/tests/functors/scalar_variable/test.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfull.i)
- (test/tests/misc/rename-parameters/rename-coupled-scalar-var.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheatreverse.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_secondary.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADforms.i)
Child Objects
(test/tests/scalar_kernels/ad_scalar_kernel/ad_scalar_kernel.i)
# This input file is used to test the Jacobian of an arbitrary ADScalarKernel.
# A test ADScalarKernel is used that uses values from other scalar variables,
# as well as a quantity computed in an elemental user object using a field
# variable.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 10
[]
[Kernels]
[time_w]
type = TimeDerivative
variable = w
[]
[diff_w]
type = Diffusion
variable = w
[]
[]
[ScalarKernels]
[time_u]
type = ADScalarTimeDerivative
variable = u
[]
[test_u]
type = TestADScalarKernel
variable = u
v = v
test_uo = test_uo
[]
[time_v]
type = ADScalarTimeDerivative
variable = v
[]
[]
[UserObjects]
[test_uo]
type = TestADScalarKernelUserObject
variable = w
execute_on = 'LINEAR NONLINEAR'
[]
[]
[BCs]
[left]
type = DirichletBC
value = 0
variable = w
boundary = 'left'
[]
[right]
type = DirichletBC
value = 1
variable = w
boundary = 'right'
[]
[]
[Variables]
[u]
family = SCALAR
order = FIRST
initial_condition = 1.0
[]
[v]
family = SCALAR
order = FIRST
initial_condition = 3.0
[]
[w]
family = LAGRANGE
order = FIRST
initial_condition = 3.0
[]
[]
[Executioner]
type = Transient
dt = 0.1
num_steps = 1
solve_type = NEWTON
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADgrav.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'mdot / ${area} * 2 * ${R} / ${mu}'
pp_names = 'mdot'
execute_on = 'TIMESTEP_END'
[]
[f]
type = ParsedPostprocessor
expression = '0.25 / ((log10(${epsilon} / 2 / 3.7 / ${R} + 5.74 / Re ^ 0.9 ))^2)'
pp_names = 'Re'
execute_on = 'TIMESTEP_END'
[]
[analytical_mdot]
type = ParsedPostprocessor
expression = 'sqrt(-(${dP} + ${rho} * ${gravity} * ${dH} - ${pump}) / (f * ${length} / 4 / ${R} / ${rho} / ${area}^2 + ${forms} / 2 / ${rho} / ${area}^2))'
pp_names = 'f'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_mdot - mdot)/analytical_mdot)'
pp_names = 'analytical_mdot mdot'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfull_exp.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'mdot / ${area} * 2 * ${R} / ${mu}'
pp_names = 'mdot'
execute_on = 'TIMESTEP_END'
[]
[f]
type = ParsedPostprocessor
expression = '0.25 / ((log10(${epsilon} / 2 / 3.7 / ${R} + 5.74 / Re ^ 0.9 ))^2)'
pp_names = 'Re'
execute_on = 'TIMESTEP_END'
[]
[analytical_mdot]
type = ParsedPostprocessor
expression = 'sqrt(-(${dP} + ${rho} * ${gravity} * ${dH} - ${pump}) / (f * ${length} / 4 / ${R} / ${rho} / ${area}^2 + ${forms} / 2 / ${rho} / ${area}^2))'
pp_names = 'f'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_mdot - mdot)/analytical_mdot)'
pp_names = 'analytical_mdot mdot'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(test/tests/scalar_kernels/ad_scalar_time_derivative/ad_scalar_time_derivative.i)
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[u]
family = SCALAR
order = FIRST
initial_condition = 0
[]
[]
[ScalarKernels]
inactive = 'coupled_dot'
[time]
type = ADScalarTimeDerivative
variable = u
[]
[coupled_dot]
type = ADCoupledScalarDot
variable = u
v = u
[]
[source]
type = ParsedODEKernel
variable = u
expression = '-5'
[]
[]
[Executioner]
type = Transient
scheme = implicit-euler
dt = 1.0
num_steps = 3
solve_type = NEWTON
nl_abs_tol = 1e-10
[]
[Outputs]
csv = true
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_ambient_radiation.i)
# Same two-node series circuit as ADpipewall_ambient.i (fluid convection, then radial
# conduction, into the outer wall node), but the outer node now loses heat to ambient
# through two parallel paths: convection (linear in T,
# ADPipeOuterWallAmbientTemperatureScalarKernel) and radiation (quartic in T,
# ADPipeOuterWallRadiationScalarKernel). That makes the steady state the root of a single
# nonlinear equation in Tout rather than a plain series-resistor network; see the
# derivation and tolerance comment just below Tin_analytical/Tout_analytical.
#
# The remaining ~2e-4 relative mismatch against the analytical values is incomplete
# transient decay rather than a property-evaluation or solve-tolerance effect: raising
# end_time from 100 s to 5000 s drops it to ~3e-6. The Dittus-Boelter coefficient comes
# from ADDittusBoelterHTCFunctorMaterial, which evaluates Water97FluidProperties at the
# segment's bulk film temperature instead of the single fixed Tf1 used to build the
# cross-check; that is worth only ~0.17% in h, well below the transient contribution.
length = 1.0
Di = 0.05
Do = 0.06
Dm = '${fparse ( Di + Do ) / 2}'
k_wall = 15.0
cp_wall = 500.0
rho_wall = 8000.0
Pin = 101300
m1 = 1.0
Tf1 = 293.15
Tamb = 273.15
htc_amb = 50.0
emissivity = 0.8
flow_area1 = '${fparse pi / 4 * Di^2}'
wetted_perimeter1 = '${fparse pi * Di}'
area_in = '${fparse pi / 4 * ( Dm^2 - Di^2 )}'
area_out = '${fparse pi / 4 * ( Do^2 - Dm^2 )}'
interface_perimeter = '${fparse pi * Dm}'
wall_thickness = '${fparse ( Do - Di ) / 2}'
ambient_perimeter = '${fparse pi * Do}'
# Independent analytical steady state: a series thermal-resistance circuit
# Tf1 --[fluid convection]-- Tin_wall --[radial conduction]-- Tout_wall --[parallel ambient
# convection + radiation]-- Tamb
#
# Unlike pipewall_ambient.i, the outer node now loses heat through two parallel paths to
# ambient (convection, linear in T, and radiation, quartic in T), so the steady state is
# the root of a single nonlinear equation in Tout rather than a plain series-resistor
# network. Eliminating Tin via the (linear) inner-node balance collapses the fluid-side and
# radial conductances into a single series conductance Gseries = G1*G2/(G1+G2), leaving:
# Gseries*(Tf1 - Tout) = htc_amb*ambient_perimeter*(Tout - Tamb)
# + sigma*emissivity*ambient_perimeter*(Tout^4 - Tamb^4)
# which was solved for Tout by Newton's method offline (not at parse time, since fparse
# cannot solve a nonlinear equation), then Tin recovered from the linear relation. The
# values below were verified to satisfy both nodes' original flux-balance equations to
# within 1e-11 W/m.
Tin_analytical = 292.53408744418897
Tout_analytical = 292.1600915387281
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1v]
family = SCALAR
initial_condition = ${m1}
[]
[Tf1v]
family = SCALAR
initial_condition = ${Tf1}
[]
[Tin_wall]
family = SCALAR
initial_condition = ${Tf1}
[]
[Tout_wall]
family = SCALAR
initial_condition = ${Tamb}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[SolidProperties]
[wall_sp]
type = ThermalFunctionSolidProperties
k = ${k_wall}
cp = ${cp_wall}
rho = ${rho_wall}
[]
[]
[ScalarKernels]
[m1_const]
type = ParsedODEKernel
expression = 'm1v - ${m1}'
variable = m1v
[]
[Tf1_const]
type = ParsedODEKernel
expression = 'Tf1v - ${Tf1}'
variable = Tf1v
[]
[inner]
type = ADPipeInnerWallTemperatureScalarKernel
variable = Tin_wall
mass_flow_rate = m1v
outer_wall_temperature = Tout_wall
upstream_wall_temperature = Tin_wall
downstream_wall_temperature = Tin_wall
fluid_temperature = Tf1v
upstream_fluid_temperature = Tf1v
downstream_fluid_temperature = Tf1v
solid_properties = wall_sp
heat_transfer_coefficient = h1
wetted_perimeter = ${wetted_perimeter1}
area = ${area_in}
interface_perimeter = ${interface_perimeter}
wall_thickness = ${wall_thickness}
length = ${length}
upstream_spacing = ${length}
downstream_spacing = ${length}
upstream_area = ${area_in}
downstream_area = ${area_in}
is_implicit = true
[]
[inner_dt]
type = ADScalarTimeDerivative
variable = Tin_wall
[]
[outer]
type = ADPipeOuterWallAmbientTemperatureScalarKernel
variable = Tout_wall
inner_wall_temperature = Tin_wall
upstream_wall_temperature = Tout_wall
downstream_wall_temperature = Tout_wall
solid_properties = wall_sp
T_ambient = ${Tamb}
htc_ambient = ${htc_amb}
ambient_perimeter = ${ambient_perimeter}
area = ${area_out}
interface_perimeter = ${interface_perimeter}
wall_thickness = ${wall_thickness}
length = ${length}
upstream_spacing = ${length}
downstream_spacing = ${length}
upstream_area = ${area_out}
downstream_area = ${area_out}
is_implicit = true
[]
[outer_radiation]
type = ADPipeOuterWallRadiationScalarKernel
variable = Tout_wall
solid_properties = wall_sp
area = ${area_out}
perimeter = ${ambient_perimeter}
T_ambient = ${Tamb}
emissivity = ${emissivity}
is_implicit = true
[]
[outer_dt]
type = ADScalarTimeDerivative
variable = Tout_wall
[]
[]
[FunctorMaterials]
[h1]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1v
fluid_properties = water
T_fluid = Tf1v
T_fluid_inlet = Tf1v
T_fluid_outlet = Tf1v
reference_pressure = ${Pin}
flow_area = ${flow_area1}
wetted_perimeter = ${wetted_perimeter1}
[]
[]
[Postprocessors]
[Tin]
type = ScalarVariable
variable = Tin_wall
execute_on = 'TIMESTEP_END'
[]
[Tout]
type = ScalarVariable
variable = Tout_wall
execute_on = 'TIMESTEP_END'
[]
[relative_error_in]
type = ParsedPostprocessor
expression = 'abs((${Tin_analytical} - Tin) / ${Tin_analytical})'
pp_names = 'Tin'
execute_on = 'TIMESTEP_END'
[]
[relative_error_out]
type = ParsedPostprocessor
expression = 'abs((${Tout_analytical} - Tout) / ${Tout_analytical})'
pp_names = 'Tout'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-08
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat_exp.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
Tout = 323.15
mu = 0.001002
cp = 4185.0
k = 0.598
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T0]
family = SCALAR
initial_condition = ${Tin}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[Tw]
family = SCALAR
initial_condition = ${Tout}
[]
[T2]
family = SCALAR
initial_condition = ${Tout}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp1]
type = ADIncompressibleEnergySPScalarKernel
use_fluid_node_temp = false
mass_flow_rate = 'm1'
inlet_temperature = 'T0'
outlet_temperature = 'T2'
wall_temperature = 'Tw'
area = ${area}
fp = water
length = ${length}
perimeter = '${fparse 2*3.14159* ${R}}'
reference_pressure = ${Pin}
variable = T1
is_implicit = True
heat_transfer_coefficient = h1
[]
[temp1_DT]
type = ADScalarTimeDerivative
variable = 'T1'
[]
[temp0]
type = ParsedODEKernel
expression = 'T0 - ${Tin}'
variable = T0
[]
[temp2]
type = ParsedODEKernel
expression = 'T2 - ${Tout}'
variable = T2
[]
[walltemp]
type = ParsedODEKernel
expression = 'Tw - ${Tout}'
variable = Tw
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[FunctorMaterials]
[h1]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1
fluid_properties = water
T_fluid = T1
T_fluid_inlet = T0
T_fluid_outlet = T2
reference_pressure = ${Pin}
flow_area = ${area}
wetted_perimeter = '${fparse 2*3.14159* ${R}}'
[]
[]
[Postprocessors]
[T]
type = ScalarVariable
variable = T1
execute_on = 'TIMESTEP_END'
[]
[M]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'abs(M) / ${area} * 2 * ${R} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Pr]
type = ParsedPostprocessor
expression = '${cp} * ${mu} / ${k}'
execute_on = 'TIMESTEP_END'
[]
[h]
type = ParsedPostprocessor
expression = '0.023 * Re^0.8 * Pr^0.4'
pp_names = 'Re Pr'
execute_on = 'TIMESTEP_END'
[]
[in]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * ${Tout}
+ 1 / 2 * (1 + abs(M)/M) * ${Tin}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[q]
type = ParsedPostprocessor
expression = 'h * ${fparse 2*3.14159* ${R}} / 2 * ( 2 * ${Tout} - T - in)'
pp_names = 'T h in'
execute_on = 'TIMESTEP_END'
[]
[analytical_T]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q * ${length} - M / 2 * (1 - abs(M)/M) * ${cp} * ${Tout}
+ M / 2 * (1 + abs(M)/M) * ${cp} * ${Tin}) '
pp_names = 'T q M'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_T - T)/analytical_T)'
pp_names = 'analytical_T T'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-08
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADregular_reverse.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'abs(mdot) / ${area} * 2 * ${R} / ${mu}'
pp_names = 'mdot'
execute_on = 'TIMESTEP_END'
[]
[f]
type = ParsedPostprocessor
expression = '0.25 / ((log10(${epsilon} / 2 / 3.7 / ${R} + 5.74 / Re ^ 0.9 ))^2)'
pp_names = 'Re'
execute_on = 'TIMESTEP_END'
[]
[analytical_mdot]
type = ParsedPostprocessor
expression = '-sqrt(abs(-(${dP} + ${rho} * ${gravity} * ${dH} - ${pump}) / (f * ${length} / 4 / ${R} / ${rho} / ${area}^2 + ${forms} / 2 / ${rho} / ${area}^2)))'
pp_names = 'f'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_mdot - mdot)/analytical_mdot)'
pp_names = 'analytical_mdot mdot'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpump.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'mdot / ${area} * 2 * ${R} / ${mu}'
pp_names = 'mdot'
execute_on = 'TIMESTEP_END'
[]
[f]
type = ParsedPostprocessor
expression = '0.25 / ((log10(${epsilon} / 2 / 3.7 / ${R} + 5.74 / Re ^ 0.9 ))^2)'
pp_names = 'Re'
execute_on = 'TIMESTEP_END'
[]
[analytical_mdot]
type = ParsedPostprocessor
expression = 'sqrt(-(${dP} + ${rho} * ${gravity} * ${dH} - ${pump}) / (f * ${length} / 4 / ${R} / ${rho} / ${area}^2 + ${forms} / 2 / ${rho} / ${area}^2))'
pp_names = 'f'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_mdot - mdot)/analytical_mdot)'
pp_names = 'analytical_mdot mdot'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADregular_twoseg.i)
length1 = 1.0
length2 = 2.0
R1 = 0.025
R2 = 0.05
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
dH1 = 0.0
dH2 = '${fparse length2*sin(3.14159/2)}'
epsilon1 = 0.0001
epsilon2 = 0.0002
forms1 = 0.0
forms2 = 1.0
pump1 = '${fparse - ${dP}}'
pump2 = 0.0
gravity = 9.81
area1 = '${fparse 3.14159* ${R1}^2}'
area2 = '${fparse 3.14159* ${R2}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length1}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1 T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area1} ${area2}'
perimeters = '${fparse 2*3.14159* ${R1}} ${fparse 2*3.14159* ${R2}}'
lengths = '${length1} ${length2}'
height_changes = '${dH1} ${dH2}'
forms_losses = '${forms1} ${forms2}'
pump_pressures = '${pump1} ${pump2}'
roughnesses = '${epsilon1} ${epsilon2}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re1]
type = ParsedPostprocessor
expression = 'mdot / ${area1} * 2 * ${R1} / ${mu}'
pp_names = 'mdot'
execute_on = 'TIMESTEP_END'
[]
[Re2]
type = ParsedPostprocessor
expression = 'mdot / ${area2} * 2 * ${R2} / ${mu}'
pp_names = 'mdot'
execute_on = 'TIMESTEP_END'
[]
[f1]
type = ParsedPostprocessor
expression = '0.25 / ((log10(${epsilon1} / 2 / 3.7 / ${R1} + 5.74 / Re1 ^ 0.9 ))^2)'
pp_names = 'Re1'
execute_on = 'TIMESTEP_END'
[]
[f2]
type = ParsedPostprocessor
expression = '0.25 / ((log10(${epsilon2} / 2 / 3.7 / ${R2} + 5.74 / Re2 ^ 0.9 ))^2)'
pp_names = 'Re2'
execute_on = 'TIMESTEP_END'
[]
[analytical_mdot]
type = ParsedPostprocessor
expression = 'sqrt(-(${dP} + ${rho} * ${gravity} * ${dH1}
+ ${rho} * ${gravity} * ${dH2}
- ${pump1} - ${pump2})
/ (f1 * ${length1} / 4 / ${R1} / ${rho} / ${area1}^2
+ f2 * ${length2} / 4 / ${R2} / ${rho} / ${area2}^2
+ ${forms1} / 2 / ${rho} / ${area1}^2
+ ${forms2} / 2 / ${rho} / ${area2}^2))'
pp_names = 'f1 f2'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_mdot - mdot)/analytical_mdot)'
pp_names = 'analytical_mdot mdot'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfriction.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'mdot / ${area} * 2 * ${R} / ${mu}'
pp_names = 'mdot'
execute_on = 'TIMESTEP_END'
[]
[f]
type = ParsedPostprocessor
expression = '0.25 / ((log10(${epsilon} / 2 / 3.7 / ${R} + 5.74 / Re ^ 0.9 ))^2)'
pp_names = 'Re'
execute_on = 'TIMESTEP_END'
[]
[analytical_mdot]
type = ParsedPostprocessor
expression = 'sqrt(-(${dP} + ${rho} * ${gravity} * ${dH} - ${pump}) / (f * ${length} / 4 / ${R} / ${rho} / ${area}^2 + ${forms} / 2 / ${rho} / ${area}^2))'
pp_names = 'f'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_mdot - mdot)/analytical_mdot)'
pp_names = 'analytical_mdot mdot'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat_threeseg.i)
length1 = 1.0
length2 = 1.0
length3 = 1.0
R1 = 0.025
R2 = 0.05
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
Tout = 343.15
mu = 0.001002
cp = 4185.0
k = 0.598
dH1 = 0.0
dH2 = '${fparse length2*sin(3.14159/2)}'
epsilon1 = 0.0001
epsilon2 = 0.0002
forms1 = 0.0
forms2 = 1.0
pump1 = '${fparse - ${dP}}'
pump2 = 0.0
gravity = 9.81
area1 = '${fparse 3.14159* ${R1}^2}'
area2 = '${fparse 3.14159* ${R2}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length1}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T0]
family = SCALAR
initial_condition = ${Tin}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[Tw1]
family = SCALAR
initial_condition = ${Tout}
[]
[T2]
family = SCALAR
initial_condition = ${Tout}
[]
[Tw2]
family = SCALAR
initial_condition = ${Tout}
[]
[T3]
family = SCALAR
initial_condition = ${Tout}
[]
[Tw3]
family = SCALAR
initial_condition = ${Tout}
[]
[T4]
family = SCALAR
initial_condition = ${Tout}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1 T2 T3'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area1} ${area2} ${area2}'
perimeters = '${fparse 2*3.14159* ${R1}} ${fparse 2*3.14159* ${R2}} ${fparse 2*3.14159* ${R2}}'
lengths = '${length1} ${length2} ${length2}'
height_changes = '${dH1} ${dH2} ${dH2}'
forms_losses = '${forms1} ${forms2} ${forms2}'
pump_pressures = '${pump1} ${pump2} ${pump2}'
roughnesses = '${epsilon1} ${epsilon2} ${epsilon2}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp0]
type = ParsedODEKernel
expression = 'T0 - ${Tin}'
variable = T0
[]
[temp1]
type = ADIncompressibleEnergySPScalarKernel
use_fluid_node_temp = false
mass_flow_rate = 'm1'
inlet_temperature = 'T0'
outlet_temperature = 'T2'
wall_temperature = 'Tw1'
area = ${area1}
fp = water
length = ${length1}
perimeter = '${fparse 2*3.14159* ${R1}}'
reference_pressure = ${Pin}
variable = T1
is_implicit = True
heat_transfer_coefficient = htc1
[]
[temp1_DT]
type = ADScalarTimeDerivative
variable = 'T1'
[]
[temp2]
type = ADIncompressibleEnergySPScalarKernel
use_fluid_node_temp = false
mass_flow_rate = 'm1'
inlet_temperature = 'T1'
outlet_temperature = 'T3'
wall_temperature = 'Tw2'
area = ${area2}
fp = water
length = ${length2}
perimeter = '${fparse 2*3.14159* ${R2}}'
reference_pressure = ${Pin}
variable = T2
is_implicit = True
heat_transfer_coefficient = htc2
[]
[temp2_DT]
type = ADScalarTimeDerivative
variable = 'T2'
[]
[temp3]
type = ADIncompressibleEnergySPScalarKernel
use_fluid_node_temp = false
mass_flow_rate = 'm1'
inlet_temperature = 'T2'
outlet_temperature = 'T4'
wall_temperature = 'Tw3'
area = ${area2}
fp = water
length = ${length3}
perimeter = '${fparse 2*3.14159* ${R2}}'
reference_pressure = ${Pin}
variable = T3
is_implicit = True
heat_transfer_coefficient = htc3
[]
[temp3_DT]
type = ADScalarTimeDerivative
variable = 'T3'
[]
[temp4]
type = ParsedODEKernel
expression = 'T4 - ${Tout}'
variable = T4
[]
[walltemp1]
type = ParsedODEKernel
expression = 'Tw1 - ${Tout}'
variable = Tw1
[]
[walltemp2]
type = ParsedODEKernel
expression = 'Tw2 - ${Tout}'
variable = Tw2
[]
[walltemp3]
type = ParsedODEKernel
expression = 'Tw3 - ${Tout}'
variable = Tw3
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[FunctorMaterials]
[htc1]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1
fluid_properties = water
T_fluid = T1
T_fluid_inlet = T0
T_fluid_outlet = T2
reference_pressure = ${Pin}
flow_area = ${area1}
wetted_perimeter = '${fparse 2*3.14159* ${R1}}'
[]
[htc2]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1
fluid_properties = water
T_fluid = T2
T_fluid_inlet = T1
T_fluid_outlet = T3
reference_pressure = ${Pin}
flow_area = ${area2}
wetted_perimeter = '${fparse 2*3.14159* ${R2}}'
[]
[htc3]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1
fluid_properties = water
T_fluid = T3
T_fluid_inlet = T2
T_fluid_outlet = T4
reference_pressure = ${Pin}
flow_area = ${area2}
wetted_perimeter = '${fparse 2*3.14159* ${R2}}'
[]
[]
[Postprocessors]
[Tone]
type = ScalarVariable
variable = T1
execute_on = 'TIMESTEP_END'
[]
[Ttwo]
type = ScalarVariable
variable = T2
execute_on = 'TIMESTEP_END'
[]
[Tthree]
type = ScalarVariable
variable = T3
execute_on = 'TIMESTEP_END'
[]
[M]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re1]
type = ParsedPostprocessor
expression = 'abs(M) / ${area1} * 2 * ${R1} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Re2]
type = ParsedPostprocessor
expression = 'abs(M) / ${area2} * 2 * ${R2} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Pr]
type = ParsedPostprocessor
expression = '${cp} * ${mu} / ${k}'
execute_on = 'TIMESTEP_END'
[]
[h1]
type = ParsedPostprocessor
expression = '0.023 * Re1^0.8 * Pr^0.4'
pp_names = 'Re1 Pr'
execute_on = 'TIMESTEP_END'
[]
[h2]
type = ParsedPostprocessor
expression = '0.023 * Re2^0.8 * Pr^0.4'
pp_names = 'Re2 Pr'
execute_on = 'TIMESTEP_END'
[]
[in1]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * Ttwo
+ 1 / 2 * (1 + abs(M)/M) * ${Tin}'
pp_names = 'Ttwo M'
execute_on = 'TIMESTEP_END'
[]
[in2]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * Tthree
+ 1 / 2 * (1 + abs(M)/M) * Tone'
pp_names = 'Tone Tthree M'
execute_on = 'TIMESTEP_END'
[]
[in3]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * ${Tout}
+ 1 / 2 * (1 + abs(M)/M) * Ttwo'
pp_names = 'Ttwo M'
execute_on = 'TIMESTEP_END'
[]
[q1]
type = ParsedPostprocessor
expression = 'h1 * ${fparse 2*3.14159* ${R1}} / 2 * ( 2 * ${Tout} - Tone - in1)'
pp_names = 'Tone h1 in1'
execute_on = 'TIMESTEP_END'
[]
[q2]
type = ParsedPostprocessor
expression = 'h2 * ${fparse 2*3.14159* ${R2}} / 2 * ( 2 * ${Tout} - Ttwo - in2)'
pp_names = 'Ttwo h2 in2'
execute_on = 'TIMESTEP_END'
[]
[q3]
type = ParsedPostprocessor
expression = 'h2 * ${fparse 2*3.14159* ${R2}} / 2 * ( 2 * ${Tout} - Tthree - in3)'
pp_names = 'Tthree h2 in3'
execute_on = 'TIMESTEP_END'
[]
[analytical_T1]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q1 * ${length1} - M / 2 * (1 - abs(M)/M) * ${cp} * Ttwo
+ M / 2 * (1 + abs(M)/M) * ${cp} * ${Tin})'
pp_names = 'Ttwo q1 M'
[]
[analytical_T2]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q2 * ${length2} - M / 2 * (1 - abs(M)/M) * ${cp} * Tthree
+ M / 2 * (1 + abs(M)/M) * ${cp} * Tone)'
pp_names = 'Tone Tthree q2 M'
[]
[analytical_T3]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q3 * ${length3} - M / 2 * (1 - abs(M)/M) * ${cp} * ${Tout}
+ M / 2 * (1 + abs(M)/M) * ${cp} * Ttwo)'
pp_names = 'Ttwo q3 M'
[]
[relative_error1]
type = ParsedPostprocessor
expression = 'abs((analytical_T1 - Tone)/analytical_T1)'
pp_names = 'analytical_T1 Tone'
execute_on = 'TIMESTEP_END'
[]
[relative_error2]
type = ParsedPostprocessor
expression = 'abs((analytical_T2 - Ttwo)/analytical_T2)'
pp_names = 'analytical_T2 Ttwo'
execute_on = 'TIMESTEP_END'
[]
[relative_error3]
type = ParsedPostprocessor
expression = 'abs((analytical_T3 - Tthree)/analytical_T3)'
pp_names = 'analytical_T3 Tthree'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_ambient.i)
# Two radial wall nodes (inner surface, outer surface) bridge a fixed primary-fluid
# temperature Tf1 to a fixed ambient temperature Tamb through three conductances in
# series: fluid-side convection (ADPipeInnerWallTemperatureScalarKernel, with the
# Dittus-Boelter coefficient supplied by ADDittusBoelterHTCFunctorMaterial), radial conduction
# through the wall, and ambient convection
# (ADPipeOuterWallAmbientTemperatureScalarKernel). The analytical Tin/Tout below are the
# steady state of that series-resistance circuit, solved algebraically at parse time with
# fluid properties evaluated once at the fixed Tf1 (mu1, cp1, k1 below), giving a simple
# linear system.
#
# The remaining ~2e-4 relative mismatch against those analytical values is incomplete
# transient decay, not a property-evaluation or solve-tolerance artifact: the wall is still
# approaching steady state at end_time = 100 s. Raising end_time to 5000 s drops the
# mismatch to ~3e-6 while leaving everything else unchanged. Two smaller effects are
# present but are an order of magnitude below that: the HTC object evaluates water
# properties through the fluid_properties Water97FluidProperties rather than the fixed
# mu1/cp1/k1 constants (worth ~0.17% in h, hence ~2e-5 in Tin here), and it evaluates them
# at the segment's bulk film temperature, which in this input equals Tf1 exactly because
# Tf1v is held constant and both the upstream and downstream fluid temperatures are Tf1v.
# The test therefore only requires approximate agreement with the analytical values, not
# agreement to roundoff.
length = 1.0
Di = 0.05
Do = 0.06
Dm = '${fparse ( Di + Do ) / 2}'
k_wall = 15.0
cp_wall = 500.0
rho_wall = 8000.0
Pin = 101300
m1 = 1.0
Tf1 = 293.15
Tamb = 273.15
htc_amb = 50.0
# Representative water properties near Tf1, used only to build the independent
# analytical steady-state cross-check below (same constants as the other
# IncompressibleVerification heat tests, e.g. ADheat.i)
mu1 = 0.001002
cp1 = 4185.0
k1 = 0.598
flow_area1 = '${fparse pi / 4 * Di^2}'
wetted_perimeter1 = '${fparse pi * Di}'
Dh1 = '${fparse 4 * flow_area1 / wetted_perimeter1}'
area_in = '${fparse pi / 4 * ( Dm^2 - Di^2 )}'
area_out = '${fparse pi / 4 * ( Do^2 - Dm^2 )}'
interface_perimeter = '${fparse pi * Dm}'
wall_thickness = '${fparse ( Do - Di ) / 2}'
ambient_perimeter = '${fparse pi * Do}'
# Independent analytical steady state: a series thermal-resistance circuit
# Tf1 --[fluid convection]-- Tin_wall --[radial conduction]-- Tout_wall --[ambient convection]-- Tamb
Re1 = '${fparse m1 / flow_area1 * Dh1 / mu1}'
Pr1 = '${fparse mu1 * cp1 / k1}'
h1 = '${fparse 0.023 * Re1^0.8 * Pr1^0.4 * k1 / Dh1}'
G1 = '${fparse h1 * wetted_perimeter1}'
G2 = '${fparse k_wall * interface_perimeter / wall_thickness}'
G3 = '${fparse htc_amb * ambient_perimeter}'
q = '${fparse ( Tf1 - Tamb ) / ( 1 / G1 + 1 / G2 + 1 / G3 )}'
Tin_analytical = '${fparse Tf1 - q / G1}'
Tout_analytical = '${fparse Tamb + q / G3}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1v]
family = SCALAR
initial_condition = ${m1}
[]
[Tf1v]
family = SCALAR
initial_condition = ${Tf1}
[]
[Tin_wall]
family = SCALAR
initial_condition = ${Tf1}
[]
[Tout_wall]
family = SCALAR
initial_condition = ${Tamb}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[SolidProperties]
[wall_sp]
type = ThermalFunctionSolidProperties
k = ${k_wall}
cp = ${cp_wall}
rho = ${rho_wall}
[]
[]
[ScalarKernels]
[m1_const]
type = ParsedODEKernel
expression = 'm1v - ${m1}'
variable = m1v
[]
[Tf1_const]
type = ParsedODEKernel
expression = 'Tf1v - ${Tf1}'
variable = Tf1v
[]
[inner]
type = ADPipeInnerWallTemperatureScalarKernel
variable = Tin_wall
mass_flow_rate = m1v
outer_wall_temperature = Tout_wall
upstream_wall_temperature = Tin_wall
downstream_wall_temperature = Tin_wall
fluid_temperature = Tf1v
upstream_fluid_temperature = Tf1v
downstream_fluid_temperature = Tf1v
solid_properties = wall_sp
heat_transfer_coefficient = h
wetted_perimeter = ${wetted_perimeter1}
area = ${area_in}
interface_perimeter = ${interface_perimeter}
wall_thickness = ${wall_thickness}
length = ${length}
upstream_spacing = ${length}
downstream_spacing = ${length}
upstream_area = ${area_in}
downstream_area = ${area_in}
is_implicit = true
[]
[inner_dt]
type = ADScalarTimeDerivative
variable = Tin_wall
[]
[outer]
type = ADPipeOuterWallAmbientTemperatureScalarKernel
variable = Tout_wall
inner_wall_temperature = Tin_wall
upstream_wall_temperature = Tout_wall
downstream_wall_temperature = Tout_wall
solid_properties = wall_sp
T_ambient = ${Tamb}
htc_ambient = ${htc_amb}
ambient_perimeter = ${ambient_perimeter}
area = ${area_out}
interface_perimeter = ${interface_perimeter}
wall_thickness = ${wall_thickness}
length = ${length}
upstream_spacing = ${length}
downstream_spacing = ${length}
upstream_area = ${area_out}
downstream_area = ${area_out}
is_implicit = true
[]
[outer_dt]
type = ADScalarTimeDerivative
variable = Tout_wall
[]
[]
[FunctorMaterials]
[h]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1v
fluid_properties = water
T_fluid = Tf1v
T_fluid_inlet = Tf1v
T_fluid_outlet = Tf1v
reference_pressure = ${Pin}
flow_area = ${flow_area1}
wetted_perimeter = ${wetted_perimeter1}
[]
[]
[Postprocessors]
[Tin]
type = ScalarVariable
variable = Tin_wall
execute_on = 'TIMESTEP_END'
[]
[Tout]
type = ScalarVariable
variable = Tout_wall
execute_on = 'TIMESTEP_END'
[]
[relative_error_in]
type = ParsedPostprocessor
expression = 'abs((${Tin_analytical} - Tin) / ${Tin_analytical})'
pp_names = 'Tin'
execute_on = 'TIMESTEP_END'
[]
[relative_error_out]
type = ParsedPostprocessor
expression = 'abs((${Tout_analytical} - Tout) / ${Tout_analytical})'
pp_names = 'Tout'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-08
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(test/tests/scalar_kernels/ad_scalar_kernel/ad_functor_scalar_test_kernel.i)
# Solves du/dt = (2 * t + x) + 1 + 2 + w and dw/dt = 1 with implicit Euler, where the right-hand
# sides are sums of functors that an ADScalarKernel evaluates at points given in the input:
# - the function 2 * t + x at x = 1,
# - a functor material with value 1,
# - a postprocessor with value 2, and
# - the scalar variable w.
# The exact solution at the end of each step n (dt = 1) is w_n = n and
# u_n = 3 * n * (n + 1) / 2 + 4 * n, so u (postprocessor u_value) is 7, 17, and 30 at steps 1, 2,
# and 3.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[u]
family = SCALAR
order = FIRST
initial_condition = 0
[]
[w]
family = SCALAR
order = FIRST
initial_condition = 0
[]
[]
[Functions]
[ramp]
type = ParsedFunction
expression = '2 * t + x'
[]
[]
[FunctorMaterials]
[fmat]
type = ADGenericConstantFunctorMaterial
prop_names = prop
prop_values = 1
[]
[]
[ScalarKernels]
[time]
type = ADScalarTimeDerivative
variable = u
[]
[ramp_source]
type = ADFunctorScalarTestKernel
variable = u
functor = ramp
point = '1 0 0'
[]
[constant_source]
type = ADFunctorScalarTestKernel
variable = u
functor = prop
[]
[pp_source]
type = ADFunctorScalarTestKernel
variable = u
functor = source_pp
[]
[scalar_source]
type = ADFunctorScalarTestKernel
variable = u
functor = w
[]
[time_w]
type = ADScalarTimeDerivative
variable = w
[]
[w_source]
type = ADFunctorScalarTestKernel
variable = w
functor = prop
[]
[]
[Postprocessors]
[source_pp]
type = ConstantPostprocessor
value = 2
[]
[u_value]
type = ScalarVariable
variable = u
execute_on = 'initial timestep_end'
[]
[]
[Executioner]
type = Transient
scheme = implicit-euler
dt = 1
num_steps = 3
solve_type = NEWTON
nl_abs_tol = 1e-12
[]
[Outputs]
csv = true
show = 'u_value'
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat_twoseg.i)
length1 = 1.0
length2 = 2.0
R1 = 0.025
R2 = 0.05
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
Tout = 343.15
mu = 0.001002
cp = 4185.0
k = 0.598
dH1 = 0.0
dH2 = '${fparse length2*sin(3.14159/2)}'
epsilon1 = 0.0001
epsilon2 = 0.0002
forms1 = 0.0
forms2 = 1.0
pump1 = '${fparse - ${dP}}'
pump2 = 0.0
gravity = 9.81
area1 = '${fparse 3.14159* ${R1}^2}'
area2 = '${fparse 3.14159* ${R2}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length1}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T0]
family = SCALAR
initial_condition = ${Tin}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[Tw1]
family = SCALAR
initial_condition = ${Tout}
[]
[T2]
family = SCALAR
initial_condition = ${Tout}
[]
[Tw2]
family = SCALAR
initial_condition = ${Tout}
[]
[T3]
family = SCALAR
initial_condition = ${Tout}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1 T2'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area1} ${area2}'
perimeters = '${fparse 2*3.14159* ${R1}} ${fparse 2*3.14159* ${R2}}'
lengths = '${length1} ${length2}'
height_changes = '${dH1} ${dH2}'
forms_losses = '${forms1} ${forms2}'
pump_pressures = '${pump1} ${pump2}'
roughnesses = '${epsilon1} ${epsilon2}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp1]
type = ADIncompressibleEnergySPScalarKernel
use_fluid_node_temp = false
mass_flow_rate = 'm1'
inlet_temperature = 'T0'
outlet_temperature = 'T2'
wall_temperature = 'Tw1'
area = ${area1}
fp = water
length = ${length1}
perimeter = '${fparse 2*3.14159* ${R1}}'
reference_pressure = ${Pin}
variable = T1
is_implicit = True
heat_transfer_coefficient = htc1
[]
[temp1_DT]
type = ADScalarTimeDerivative
variable = 'T1'
[]
[temp0]
type = ParsedODEKernel
expression = 'T0 - ${Tin}'
variable = T0
[]
[temp2]
type = ADIncompressibleEnergySPScalarKernel
use_fluid_node_temp = false
mass_flow_rate = 'm1'
inlet_temperature = 'T1'
outlet_temperature = 'T3'
wall_temperature = 'Tw2'
area = ${area2}
fp = water
length = ${length2}
perimeter = '${fparse 2*3.14159* ${R2}}'
reference_pressure = ${Pin}
variable = T2
is_implicit = True
heat_transfer_coefficient = htc2
[]
[temp2_DT]
type = ADScalarTimeDerivative
variable = 'T2'
[]
[temp3]
type = ParsedODEKernel
expression = 'T3 - ${Tout}'
variable = T3
[]
[walltemp1]
type = ParsedODEKernel
expression = 'Tw1 - ${Tout}'
variable = Tw1
[]
[walltemp2]
type = ParsedODEKernel
expression = 'Tw2 - ${Tout}'
variable = Tw2
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[FunctorMaterials]
[htc1]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1
fluid_properties = water
T_fluid = T1
T_fluid_inlet = T0
T_fluid_outlet = T2
reference_pressure = ${Pin}
flow_area = ${area1}
wetted_perimeter = '${fparse 2*3.14159* ${R1}}'
[]
[htc2]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1
fluid_properties = water
T_fluid = T2
T_fluid_inlet = T1
T_fluid_outlet = T3
reference_pressure = ${Pin}
flow_area = ${area2}
wetted_perimeter = '${fparse 2*3.14159* ${R2}}'
[]
[]
[Postprocessors]
[Tone]
type = ScalarVariable
variable = T1
execute_on = 'TIMESTEP_END'
[]
[Ttwo]
type = ScalarVariable
variable = T2
execute_on = 'TIMESTEP_END'
[]
[M]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re1]
type = ParsedPostprocessor
expression = 'abs(M) / ${area1} * 2 * ${R1} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Re2]
type = ParsedPostprocessor
expression = 'abs(M) / ${area2} * 2 * ${R2} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Pr]
type = ParsedPostprocessor
expression = '${cp} * ${mu} / ${k}'
execute_on = 'TIMESTEP_END'
[]
[h1]
type = ParsedPostprocessor
expression = '0.023 * Re1^0.8 * Pr^0.4'
pp_names = 'Re1 Pr'
execute_on = 'TIMESTEP_END'
[]
[h2]
type = ParsedPostprocessor
expression = '0.023 * Re2^0.8 * Pr^0.4'
pp_names = 'Re2 Pr'
execute_on = 'TIMESTEP_END'
[]
[in1]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * Ttwo
+ 1 / 2 * (1 + abs(M)/M) * ${Tin}'
pp_names = 'Ttwo M'
execute_on = 'TIMESTEP_END'
[]
[in2]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * ${Tout}
+ 1 / 2 * (1 + abs(M)/M) * Tone'
pp_names = 'Tone M'
execute_on = 'TIMESTEP_END'
[]
[q1]
type = ParsedPostprocessor
expression = 'h1 * ${fparse 2*3.14159* ${R1}} / 2 * ( 2 * ${Tout} - Tone - in1)'
pp_names = 'Tone h1 in1'
execute_on = 'TIMESTEP_END'
[]
[q2]
type = ParsedPostprocessor
expression = 'h2 * ${fparse 2*3.14159* ${R2}} / 2 * ( 2 * ${Tout} - Ttwo - in2)'
pp_names = 'Ttwo h2 in2'
execute_on = 'TIMESTEP_END'
[]
[analytical_T1]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q1 * ${length1} - M / 2 * (1 - abs(M)/M) * ${cp} * Ttwo
+ M / 2 * (1 + abs(M)/M) * ${cp} * ${Tin})'
pp_names = 'Ttwo q1 M'
[]
[analytical_T2]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q2 * ${length2} - M / 2 * (1 - abs(M)/M) * ${cp} * ${Tout}
+ M / 2 * (1 + abs(M)/M) * ${cp} * Tone)'
pp_names = 'Tone q2 M'
[]
[relative_error1]
type = ParsedPostprocessor
expression = 'abs((analytical_T1 - Tone)/analytical_T1)'
pp_names = 'analytical_T1 Tone'
execute_on = 'TIMESTEP_END'
[]
[relative_error2]
type = ParsedPostprocessor
expression = 'abs((analytical_T2 - Ttwo)/analytical_T2)'
pp_names = 'analytical_T2 Ttwo'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_heatflux.i)
# Two radial wall nodes bridge a fixed primary-fluid temperature Tf1 to a prescribed
# outer-wall heat flux q_flux (ADPipeOuterWallHeatFluxScalarKernel), with no other path
# out of the outer node. In steady state all of the applied heat must flow inward through
# the fluid-side convection (ADPipeInnerWallTemperatureScalarKernel, with the
# Dittus-Boelter coefficient supplied by ADDittusBoelterHTCFunctorMaterial) and radial
# conduction resistances in series, which is the series circuit solved algebraically below
# for Tin_analytical/Tout_analytical using fluid properties fixed at Tf1 (mu1, cp1, k1).
#
# The remaining ~4e-5 relative mismatch against those analytical values is incomplete
# transient decay rather than a property-evaluation or solve-tolerance effect: raising
# end_time from 100 s to 5000 s drops it to ~7e-6. The HTC object's use of
# Water97FluidProperties at the segment's bulk film temperature, rather than the fixed
# mu1/cp1/k1 constants, is worth only ~0.17% in h here, well below that.
length = 1.0
Di = 0.05
Do = 0.06
Dm = '${fparse ( Di + Do ) / 2}'
k_wall = 15.0
cp_wall = 500.0
rho_wall = 8000.0
Pin = 101300
m1 = 1.0
Tf1 = 293.15
q_flux = 2000.0
# Representative water properties near Tf1, used only to build the independent
# analytical steady-state cross-check below (same constants as the other
# IncompressibleVerification heat tests, e.g. ADheat.i)
mu1 = 0.001002
cp1 = 4185.0
k1 = 0.598
flow_area1 = '${fparse pi / 4 * Di^2}'
wetted_perimeter1 = '${fparse pi * Di}'
Dh1 = '${fparse 4 * flow_area1 / wetted_perimeter1}'
area_in = '${fparse pi / 4 * ( Dm^2 - Di^2 )}'
area_out = '${fparse pi / 4 * ( Do^2 - Dm^2 )}'
interface_perimeter = '${fparse pi * Dm}'
wall_thickness = '${fparse ( Do - Di ) / 2}'
heated_perimeter = '${fparse pi * Do}'
# Independent analytical steady state: a series thermal-resistance circuit
# Tf1 --[fluid convection]-- Tin_wall --[radial conduction]-- Tout_wall, with a
# prescribed heat flux injected directly at the outer node and no other path out of
# the outer node, so in steady state all of the applied heat flows inward through the
# fluid-side convection and radial conduction resistances in series.
Re1 = '${fparse m1 / flow_area1 * Dh1 / mu1}'
Pr1 = '${fparse mu1 * cp1 / k1}'
h1 = '${fparse 0.023 * Re1^0.8 * Pr1^0.4 * k1 / Dh1}'
G1 = '${fparse h1 * wetted_perimeter1}'
G2 = '${fparse k_wall * interface_perimeter / wall_thickness}'
Qflux = '${fparse q_flux * heated_perimeter}'
Tin_analytical = '${fparse Tf1 + Qflux / G1}'
Tout_analytical = '${fparse Tin_analytical + Qflux / G2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1v]
family = SCALAR
initial_condition = ${m1}
[]
[Tf1v]
family = SCALAR
initial_condition = ${Tf1}
[]
[Tin_wall]
family = SCALAR
initial_condition = ${Tf1}
[]
[Tout_wall]
family = SCALAR
initial_condition = ${Tf1}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[SolidProperties]
[wall_sp]
type = ThermalFunctionSolidProperties
k = ${k_wall}
cp = ${cp_wall}
rho = ${rho_wall}
[]
[]
[ScalarKernels]
[m1_const]
type = ParsedODEKernel
expression = 'm1v - ${m1}'
variable = m1v
[]
[Tf1_const]
type = ParsedODEKernel
expression = 'Tf1v - ${Tf1}'
variable = Tf1v
[]
[inner]
type = ADPipeInnerWallTemperatureScalarKernel
variable = Tin_wall
mass_flow_rate = m1v
outer_wall_temperature = Tout_wall
upstream_wall_temperature = Tin_wall
downstream_wall_temperature = Tin_wall
fluid_temperature = Tf1v
upstream_fluid_temperature = Tf1v
downstream_fluid_temperature = Tf1v
solid_properties = wall_sp
heat_transfer_coefficient = h1
wetted_perimeter = ${wetted_perimeter1}
area = ${area_in}
interface_perimeter = ${interface_perimeter}
wall_thickness = ${wall_thickness}
length = ${length}
upstream_spacing = ${length}
downstream_spacing = ${length}
upstream_area = ${area_in}
downstream_area = ${area_in}
is_implicit = true
[]
[inner_dt]
type = ADScalarTimeDerivative
variable = Tin_wall
[]
[outer]
type = ADPipeOuterWallHeatFluxScalarKernel
variable = Tout_wall
inner_wall_temperature = Tin_wall
upstream_wall_temperature = Tout_wall
downstream_wall_temperature = Tout_wall
solid_properties = wall_sp
heat_flux = ${q_flux}
heated_perimeter = ${heated_perimeter}
area = ${area_out}
interface_perimeter = ${interface_perimeter}
wall_thickness = ${wall_thickness}
length = ${length}
upstream_spacing = ${length}
downstream_spacing = ${length}
upstream_area = ${area_out}
downstream_area = ${area_out}
is_implicit = true
[]
[outer_dt]
type = ADScalarTimeDerivative
variable = Tout_wall
[]
[]
[FunctorMaterials]
[h1]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1v
fluid_properties = water
T_fluid = Tf1v
T_fluid_inlet = Tf1v
T_fluid_outlet = Tf1v
reference_pressure = ${Pin}
flow_area = ${flow_area1}
wetted_perimeter = ${wetted_perimeter1}
[]
[]
[Postprocessors]
[Tin]
type = ScalarVariable
variable = Tin_wall
execute_on = 'TIMESTEP_END'
[]
[Tout]
type = ScalarVariable
variable = Tout_wall
execute_on = 'TIMESTEP_END'
[]
[relative_error_in]
type = ParsedPostprocessor
expression = 'abs((${Tin_analytical} - Tin) / ${Tin_analytical})'
pp_names = 'Tin'
execute_on = 'TIMESTEP_END'
[]
[relative_error_out]
type = ParsedPostprocessor
expression = 'abs((${Tout_analytical} - Tout) / ${Tout_analytical})'
pp_names = 'Tout'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-08
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(test/tests/functors/scalar_variable/test.i)
# Domain on (0,1) with 1 element
#
# du/dt = v, u(0) = 0
# dv/dt = 1, v(0) = 0
#
# Taking 3 time steps of 1 second each. Values should be the following:
#
# t = 0: u = 0, v = 0
# t = 1: u = 1, v = 1
# t = 2: u = 3, v = 2
# t = 3: u = 6, v = 3
u0 = 0
v0 = 0
v_source = 1
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 1
nx = 1
xmin = 0
xmax = 1
[]
[]
[Variables]
[u]
family = LAGRANGE
order = FIRST
initial_condition = ${u0}
[]
[v]
family = SCALAR
order = FIRST
initial_condition = ${v0}
[]
[]
[Kernels]
[time_deriv_u]
type = ADTimeDerivative
variable = u
[]
[source_u]
type = FunctorKernel
variable = u
functor = source_u
functor_on_rhs = true
[]
[]
[FunctorMaterials]
[u_source_mat]
type = ADParsedFunctorMaterial
expression = 'v'
functor_names = 'v'
property_name = source_u
[]
[]
[ScalarKernels]
[time_deriv_v]
type = ADScalarTimeDerivative
variable = v
[]
[source_v]
type = ParsedODEKernel
variable = v
expression = '-${v_source}'
[]
[]
[Postprocessors]
[u_avg]
type = ElementAverageValue
variable = u
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
dt = 1
num_steps = 3
solve_type = NEWTON
[]
[Outputs]
csv = true
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfull.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'mdot / ${area} * 2 * ${R} / ${mu}'
pp_names = 'mdot'
execute_on = 'TIMESTEP_END'
[]
[f]
type = ParsedPostprocessor
expression = '0.25 / ((log10(${epsilon} / 2 / 3.7 / ${R} + 5.74 / Re ^ 0.9 ))^2)'
pp_names = 'Re'
execute_on = 'TIMESTEP_END'
[]
[analytical_mdot]
type = ParsedPostprocessor
expression = 'sqrt(-(${dP} + ${rho} * ${gravity} * ${dH} - ${pump}) / (f * ${length} / 4 / ${R} / ${rho} / ${area}^2 + ${forms} / 2 / ${rho} / ${area}^2))'
pp_names = 'f'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_mdot - mdot)/analytical_mdot)'
pp_names = 'analytical_mdot mdot'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(test/tests/misc/rename-parameters/rename-coupled-scalar-var.i)
# This input file is used to test the Jacobian of an arbitrary ADScalarKernel.
# A test ADScalarKernel is used that uses values from other scalar variables,
# as well as a quantity computed in an elemental user object using a field
# variable.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 10
[]
[Kernels]
[time_w]
type = TimeDerivative
variable = w
[]
[diff_w]
type = Diffusion
variable = w
[]
[]
[ScalarKernels]
[time_u]
type = ADScalarTimeDerivative
variable = u
[]
[test_u]
type = RenameCoupledScalarVarScalarKernel
variable = u
coupled_scalar_variable = v
test_uo = test_uo
[]
[time_v]
type = ADScalarTimeDerivative
variable = v
[]
[]
[UserObjects]
[test_uo]
type = TestADScalarKernelUserObject
variable = w
execute_on = 'LINEAR NONLINEAR'
[]
[]
[BCs]
[left]
type = DirichletBC
value = 0
variable = w
boundary = 'left'
[]
[right]
type = DirichletBC
value = 1
variable = w
boundary = 'right'
[]
[]
[Variables]
[u]
family = SCALAR
order = FIRST
initial_condition = 1.0
[]
[v]
family = SCALAR
order = FIRST
initial_condition = 3.0
[]
[w]
family = LAGRANGE
order = FIRST
initial_condition = 3.0
[]
[]
[Executioner]
type = Transient
dt = 0.1
num_steps = 1
solve_type = NEWTON
[]
[Outputs]
csv = true
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheatreverse.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 323.15
Tout = 293.15
mu = 0.001002
cp = 4185.0
k = 0.598
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T0]
family = SCALAR
initial_condition = ${Tin}
[]
[T1]
family = SCALAR
initial_condition = ${Tout}
[]
[Tw]
family = SCALAR
initial_condition = ${Tin}
[]
[T2]
family = SCALAR
initial_condition = ${Tout}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp1]
type = ADIncompressibleEnergySPScalarKernel
use_fluid_node_temp = false
mass_flow_rate = 'm1'
inlet_temperature = 'T0'
outlet_temperature = 'T2'
wall_temperature = 'Tw'
area = ${area}
fp = water
length = ${length}
perimeter = '${fparse 2*3.14159* ${R}}'
reference_pressure = ${Pin}
variable = T1
is_implicit = True
heat_transfer_coefficient = h1
[]
[temp1_DT]
type = ADScalarTimeDerivative
variable = 'T1'
[]
[temp0]
type = ParsedODEKernel
expression = 'T0 - ${Tin}'
variable = T0
[]
[temp2]
type = ParsedODEKernel
expression = 'T2 - ${Tout}'
variable = T2
[]
[walltemp]
type = ParsedODEKernel
expression = 'Tw - ${Tin}'
variable = Tw
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[FunctorMaterials]
[h1]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1
fluid_properties = water
T_fluid = T1
T_fluid_inlet = T0
T_fluid_outlet = T2
reference_pressure = ${Pin}
flow_area = ${area}
wetted_perimeter = '${fparse 2*3.14159* ${R}}'
[]
[]
[Postprocessors]
[T]
type = ScalarVariable
variable = T1
execute_on = 'TIMESTEP_END'
[]
[M]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'abs(M) / ${area} * 2 * ${R} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Pr]
type = ParsedPostprocessor
expression = '${cp} * ${mu} / ${k}'
execute_on = 'TIMESTEP_END'
[]
[h]
type = ParsedPostprocessor
expression = '0.023 * Re^0.8 * Pr^0.4'
pp_names = 'Re Pr'
execute_on = 'TIMESTEP_END'
[]
[in]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * ${Tout}
+ 1 / 2 * (1 + abs(M)/M) * ${Tin}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[q]
type = ParsedPostprocessor
expression = 'h * ${fparse 2*3.14159* ${R}} / 2 * ( 2 * ${Tin} - T - in)'
pp_names = 'T h in'
execute_on = 'TIMESTEP_END'
[]
[analytical_T]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q * ${length} - M / 2 * (1 - abs(M)/M) * ${cp} * ${Tout}
+ M / 2 * (1 + abs(M)/M) * ${cp} * ${Tin}) '
pp_names = 'T q M'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_T - T)/analytical_T)'
pp_names = 'analytical_T T'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
line_search = 'none'
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-08
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
Tout = 323.15
mu = 0.001002
cp = 4185.0
k = 0.598
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T0]
family = SCALAR
initial_condition = ${Tin}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[Tw]
family = SCALAR
initial_condition = ${Tout}
[]
[T2]
family = SCALAR
initial_condition = ${Tout}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp1]
type = ADIncompressibleEnergySPScalarKernel
use_fluid_node_temp = false
mass_flow_rate = 'm1'
inlet_temperature = 'T0'
outlet_temperature = 'T2'
wall_temperature = 'Tw'
area = ${area}
fp = water
length = ${length}
perimeter = '${fparse 2*3.14159* ${R}}'
reference_pressure = ${Pin}
variable = T1
is_implicit = True
heat_transfer_coefficient = h1
[]
[temp1_DT]
type = ADScalarTimeDerivative
variable = 'T1'
[]
[temp0]
type = ParsedODEKernel
expression = 'T0 - ${Tin}'
variable = T0
[]
[temp2]
type = ParsedODEKernel
expression = 'T2 - ${Tout}'
variable = T2
[]
[walltemp]
type = ParsedODEKernel
expression = 'Tw - ${Tout}'
variable = Tw
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[FunctorMaterials]
[h1]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1
fluid_properties = water
T_fluid = T1
T_fluid_inlet = T0
T_fluid_outlet = T2
reference_pressure = ${Pin}
flow_area = ${area}
wetted_perimeter = '${fparse 2*3.14159* ${R}}'
[]
[]
[Postprocessors]
[T]
type = ScalarVariable
variable = T1
execute_on = 'TIMESTEP_END'
[]
[M]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'abs(M) / ${area} * 2 * ${R} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Pr]
type = ParsedPostprocessor
expression = '${cp} * ${mu} / ${k}'
execute_on = 'TIMESTEP_END'
[]
[h]
type = ParsedPostprocessor
expression = '0.023 * Re^0.8 * Pr^0.4'
pp_names = 'Re Pr'
execute_on = 'TIMESTEP_END'
[]
[in]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * ${Tout}
+ 1 / 2 * (1 + abs(M)/M) * ${Tin}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[q]
type = ParsedPostprocessor
expression = 'h * ${fparse 2*3.14159* ${R}} / 2 * ( 2 * ${Tout} - T - in)'
pp_names = 'T h in'
execute_on = 'TIMESTEP_END'
[]
[analytical_T]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q * ${length} - M / 2 * (1 - abs(M)/M) * ${cp} * ${Tout}
+ M / 2 * (1 + abs(M)/M) * ${cp} * ${Tin}) '
pp_names = 'T q M'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_T - T)/analytical_T)'
pp_names = 'analytical_T T'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-08
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_secondary.i)
# Two radial wall nodes bridge a fixed primary-fluid temperature Tf1 to a fixed
# secondary-fluid temperature Tf2 through three conductances in series: primary-side
# convection (ADPipeInnerWallTemperatureScalarKernel), radial conduction through the wall,
# and secondary-side convection
# (ADPipeOuterWallCoupledConvectiveTemperatureScalarKernel) - a double-pipe-style
# conjugate heat transfer arrangement. Each side's Dittus-Boelter coefficient is supplied
# by its own ADDittusBoelterHTCFunctorMaterial. The analytical Tin/Tout below are the steady
# state of that series-resistance circuit, solved algebraically at parse time with both
# streams' water properties fixed at representative constants (mu_f, cp_f, k_f), giving a
# simple linear system.
#
# The ~7e-4 to 1e-3 relative mismatch against those analytical values comes from the
# constants, not from the solve: the HTC objects evaluate water properties through the
# fluid_properties Water97FluidProperties at each stream's bulk film temperature. The
# secondary stream sits at Tf2 = 283.15 K, where water's viscosity is about 30% higher
# than the mu_f used in the cross-check, which lowers h2 by about 11% and accounts for
# essentially all of the difference. This system is at steady state by end_time = 100 s
# (raising end_time to 5000 s leaves the result unchanged), so transient decay contributes
# nothing here. The test therefore only requires approximate agreement with the analytical
# values, not agreement to roundoff.
length = 1.0
Di = 0.05
Do = 0.06
Dm = '${fparse ( Di + Do ) / 2}'
k_wall = 15.0
cp_wall = 500.0
rho_wall = 8000.0
Pin = 101300
m1 = 1.0
Tf1 = 293.15
m2 = 0.5
Tf2 = 283.15
# Representative water properties, used only to build the independent
# analytical steady-state cross-check below (same constants as the other
# IncompressibleVerification heat tests, e.g. ADheat.i). Both streams are
# water in this test, evaluated with the same representative constants.
mu_f = 0.001002
cp_f = 4185.0
k_f = 0.598
flow_area1 = '${fparse pi / 4 * Di^2}'
wetted_perimeter1 = '${fparse pi * Di}'
Dh1 = '${fparse 4 * flow_area1 / wetted_perimeter1}'
area_in = '${fparse pi / 4 * ( Dm^2 - Di^2 )}'
area_out = '${fparse pi / 4 * ( Do^2 - Dm^2 )}'
interface_perimeter = '${fparse pi * Dm}'
wall_thickness = '${fparse ( Do - Di ) / 2}'
flow_area2 = 0.003
wetted_perimeter2 = 0.3
Dh2 = '${fparse 4 * flow_area2 / wetted_perimeter2}'
# Independent analytical steady state: a series thermal-resistance circuit
# Tf1 --[primary convection]-- Tin_wall --[radial conduction]-- Tout_wall --[secondary convection]-- Tf2
Re1 = '${fparse m1 / flow_area1 * Dh1 / mu_f}'
Pr1 = '${fparse mu_f * cp_f / k_f}'
h1 = '${fparse 0.023 * Re1^0.8 * Pr1^0.4 * k_f / Dh1}'
G1 = '${fparse h1 * wetted_perimeter1}'
G2 = '${fparse k_wall * interface_perimeter / wall_thickness}'
Re2 = '${fparse m2 / flow_area2 * Dh2 / mu_f}'
Pr2 = '${fparse mu_f * cp_f / k_f}'
h2 = '${fparse 0.023 * Re2^0.8 * Pr2^0.4 * k_f / Dh2}'
G3 = '${fparse h2 * wetted_perimeter2}'
q = '${fparse ( Tf1 - Tf2 ) / ( 1 / G1 + 1 / G2 + 1 / G3 )}'
Tin_analytical = '${fparse Tf1 - q / G1}'
Tout_analytical = '${fparse Tf2 + q / G3}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1v]
family = SCALAR
initial_condition = ${m1}
[]
[Tf1v]
family = SCALAR
initial_condition = ${Tf1}
[]
[m2v]
family = SCALAR
initial_condition = ${m2}
[]
[Tf2v]
family = SCALAR
initial_condition = ${Tf2}
[]
[Tin_wall]
family = SCALAR
initial_condition = ${Tf1}
[]
[Tout_wall]
family = SCALAR
initial_condition = ${Tf2}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[SolidProperties]
[wall_sp]
type = ThermalFunctionSolidProperties
k = ${k_wall}
cp = ${cp_wall}
rho = ${rho_wall}
[]
[]
[ScalarKernels]
[m1_const]
type = ParsedODEKernel
expression = 'm1v - ${m1}'
variable = m1v
[]
[Tf1_const]
type = ParsedODEKernel
expression = 'Tf1v - ${Tf1}'
variable = Tf1v
[]
[m2_const]
type = ParsedODEKernel
expression = 'm2v - ${m2}'
variable = m2v
[]
[Tf2_const]
type = ParsedODEKernel
expression = 'Tf2v - ${Tf2}'
variable = Tf2v
[]
[inner]
type = ADPipeInnerWallTemperatureScalarKernel
variable = Tin_wall
mass_flow_rate = m1v
outer_wall_temperature = Tout_wall
upstream_wall_temperature = Tin_wall
downstream_wall_temperature = Tin_wall
fluid_temperature = Tf1v
upstream_fluid_temperature = Tf1v
downstream_fluid_temperature = Tf1v
solid_properties = wall_sp
heat_transfer_coefficient = h1
wetted_perimeter = ${wetted_perimeter1}
area = ${area_in}
interface_perimeter = ${interface_perimeter}
wall_thickness = ${wall_thickness}
length = ${length}
upstream_spacing = ${length}
downstream_spacing = ${length}
upstream_area = ${area_in}
downstream_area = ${area_in}
is_implicit = true
[]
[inner_dt]
type = ADScalarTimeDerivative
variable = Tin_wall
[]
[outer]
type = ADPipeOuterWallCoupledConvectiveTemperatureScalarKernel
variable = Tout_wall
mass_flow_rate = m2v
inner_wall_temperature = Tin_wall
upstream_wall_temperature = Tout_wall
downstream_wall_temperature = Tout_wall
fluid_temperature = Tf2v
upstream_fluid_temperature = Tf2v
downstream_fluid_temperature = Tf2v
solid_properties = wall_sp
heat_transfer_coefficient = h2
wetted_perimeter = ${wetted_perimeter2}
area = ${area_out}
interface_perimeter = ${interface_perimeter}
wall_thickness = ${wall_thickness}
length = ${length}
upstream_spacing = ${length}
downstream_spacing = ${length}
upstream_area = ${area_out}
downstream_area = ${area_out}
is_implicit = true
[]
[outer_dt]
type = ADScalarTimeDerivative
variable = Tout_wall
[]
[]
[FunctorMaterials]
[h1]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m1v
fluid_properties = water
T_fluid = Tf1v
T_fluid_inlet = Tf1v
T_fluid_outlet = Tf1v
reference_pressure = ${Pin}
flow_area = ${flow_area1}
wetted_perimeter = ${wetted_perimeter1}
[]
[h2]
type = ADDittusBoelterHTCFunctorMaterial
mass_flow_rate = m2v
fluid_properties = water
T_fluid = Tf2v
T_fluid_inlet = Tf2v
T_fluid_outlet = Tf2v
reference_pressure = ${Pin}
flow_area = ${flow_area2}
wetted_perimeter = ${wetted_perimeter2}
[]
[]
[Postprocessors]
[Tin]
type = ScalarVariable
variable = Tin_wall
execute_on = 'TIMESTEP_END'
[]
[Tout]
type = ScalarVariable
variable = Tout_wall
execute_on = 'TIMESTEP_END'
[]
[relative_error_in]
type = ParsedPostprocessor
expression = 'abs((${Tin_analytical} - Tin) / ${Tin_analytical})'
pp_names = 'Tin'
execute_on = 'TIMESTEP_END'
[]
[relative_error_out]
type = ParsedPostprocessor
expression = 'abs((${Tout_analytical} - Tout) / ${Tout_analytical})'
pp_names = 'Tout'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-08
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADforms.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
dH = 0.0
epsilon = 0.0001
forms = 0.0
pump = 0.0
gravity = 0.0
area = '${fparse 3.14159* ${R}^2}'
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = ${length}
nx = 1
[]
[Variables]
[m1]
family = SCALAR
initial_condition = ${min}
[]
[dPc]
family = SCALAR
initial_condition = ${dP}
[]
[T1]
family = SCALAR
initial_condition = ${Tin}
[]
[]
[FluidProperties]
[water]
type = Water97FluidProperties
[]
[]
[ScalarKernels]
[pipe1_mom]
type = ADIncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
height_changes = '${dH}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ADScalarTimeDerivative
variable = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[dPk]
type = ParsedODEKernel
expression = 'dPc - ${dP}'
variable = dPc
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re]
type = ParsedPostprocessor
expression = 'mdot / ${area} * 2 * ${R} / ${mu}'
pp_names = 'mdot'
execute_on = 'TIMESTEP_END'
[]
[f]
type = ParsedPostprocessor
expression = '0.25 / ((log10(${epsilon} / 2 / 3.7 / ${R} + 5.74 / Re ^ 0.9 ))^2)'
pp_names = 'Re'
execute_on = 'TIMESTEP_END'
[]
[analytical_mdot]
type = ParsedPostprocessor
expression = 'sqrt(-(${dP} + ${rho} * ${gravity} * ${dH} - ${pump}) / (f * ${length} / 4 / ${R} / ${rho} / ${area}^2 + ${forms} / 2 / ${rho} / ${area}^2))'
pp_names = 'f'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_mdot - mdot)/analytical_mdot)'
pp_names = 'analytical_mdot mdot'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/include/scalarkernels/ADShaftTimeDerivativeScalarKernel.h)
// This file is part of the MOOSE framework
// https://mooseframework.inl.gov
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "ADScalarTimeDerivative.h"
class ADShaftConnectableUserObjectInterface;
/**
* Time derivative for angular speed of shaft
*/
class ADShaftTimeDerivativeScalarKernel : public ADScalarTimeDerivative
{
public:
ADShaftTimeDerivativeScalarKernel(const InputParameters & parameters);
protected:
virtual ADReal computeQpResidual() override;
/// List of names of shaft connected user objects
const std::vector<UserObjectName> & _uo_names;
/// Number of shaft connected user objects
unsigned int _n_components;
/// List of shaft connected user objects
std::vector<const ADShaftConnectableUserObjectInterface *> _shaft_connected_uos;
public:
static InputParameters validParams();
};