- expressionfunction expression
C++ Type:FunctionExpression
Unit:(no unit assumed)
Controllable:No
Description:function expression
- 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
ParsedODEKernel
This scalar kernel adds a source term : where is the variable the source acts upon, are other scalar variables, and are post-processor values.
The parameter expression is a string expression for the source term as it appears on the left-hand-side of the equation; thus it represents . The expression may use the following quantities:
the name of the scalar variable upon which the kernel acts,
the names of any scalar variables specified in the
coupled_variablesparameter,the names of any post-processors specified in the
postprocessorsparameter, andthe names supplied in the
constant_namesparameter, defined to have the values provided by theconstant_expressionsparameters.
Currently, the function expression cannot be a function of time.
[ScalarKernels<<<{"href": "../../syntax/ScalarKernels/index.html"}>>>]
[td1]
type = ODETimeDerivative<<<{"description": "Returns the time derivative contribution to the residual for a scalar variable.", "href": "ODETimeDerivative.html"}>>>
variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = x
[]
#
# This parsed expression ODE Kernel behaves exactly as the ImplicitODEx kernel
# in the main example. Checkout ImplicitODEx::computeQpResidual() in the
# source code file ImplicitODEx.C to see the matching residual function.
#
# The ParsedODEKernel automaticaly generates the On- and Off-Diagonal Jacobian
# entries.
#
[ode1]
type = ParsedODEKernel<<<{"description": "Parsed expression ODE kernel.", "href": "ParsedODEKernel.html"}>>>
expression<<<{"description": "function expression"}>>> = '-3*x - 2*y'
variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = x
coupled_variables<<<{"description": "Scalar variables coupled in the parsed expression."}>>> = y
[]
[td2]
type = ODETimeDerivative<<<{"description": "Returns the time derivative contribution to the residual for a scalar variable.", "href": "ODETimeDerivative.html"}>>>
variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = y
[]
#
# This parsed expression ODE Kernel behaves exactly as the ImplicitODEy Kernel
# in the main example.
#
[ode2]
type = ParsedODEKernel<<<{"description": "Parsed expression ODE kernel.", "href": "ParsedODEKernel.html"}>>>
expression<<<{"description": "function expression"}>>> = '-4*x - y'
variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = y
coupled_variables<<<{"description": "Scalar variables coupled in the parsed expression."}>>> = x
[]
[](examples/ex18_scalar_kernel/ex18_parsed.i)Input Parameters
- constant_expressionsVector of values for the constants in constant_names (can be an FParser expression)
C++ Type:std::vector<std::string>
Controllable:No
Description:Vector of values for the constants in constant_names (can be an FParser expression)
- constant_namesVector of constants used in the parsed expression
C++ Type:std::vector<std::string>
Controllable:No
Description:Vector of constants used in the parsed expression
- coupled_variablesScalar variables coupled in the parsed expression.
C++ Type:std::vector<VariableName>
Unit:(no unit assumed)
Controllable:No
Description:Scalar variables coupled in the parsed expression.
- epsilon0Fuzzy comparison tolerance
Default:0
C++ Type:Real
Unit:(no unit assumed)
Controllable:No
Description:Fuzzy comparison tolerance
- postprocessorsVector of postprocessor names used in the function expression
C++ Type:std::vector<PostprocessorName>
Unit:(no unit assumed)
Controllable:No
Description:Vector of postprocessor names used in the function expression
Optional 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_tagssystemThe tag for the matrices this Kernel should fill
Default:system
C++ Type:MultiMooseEnum
Options:nontime, system
Controllable:No
Description:The tag for the matrices this Kernel should fill
- vector_tagsnontimeThe tag for the vectors this Kernel should fill
Default:nontime
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
- disable_fpoptimizerFalseDisable the function parser algebraic optimizer
Default:False
C++ Type:bool
Controllable:No
Description:Disable the function parser algebraic optimizer
- enable_ad_cacheTrueEnable caching of function derivatives for faster startup time
Default:True
C++ Type:bool
Controllable:No
Description:Enable caching of function derivatives for faster startup time
- enable_auto_optimizeTrueEnable automatic immediate optimization of derivatives
Default:True
C++ Type:bool
Controllable:No
Description:Enable automatic immediate optimization of derivatives
- enable_jitTrueEnable just-in-time compilation of function expressions for faster evaluation
Default:True
C++ Type:bool
Controllable:No
Description:Enable just-in-time compilation of function expressions for faster evaluation
- evalerror_behaviornanWhat to do if evaluation error occurs. Options are to pass a nan, pass a nan with a warning, throw a error, or throw an exception
Default:nan
C++ Type:MooseEnum
Options:nan, nan_warning, error, exception
Controllable:No
Description:What to do if evaluation error occurs. Options are to pass a nan, pass a nan with a warning, throw a error, or throw an exception
Parsed Expression Advanced Parameters
Input Files
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADgrav.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfull_exp.i)
- (test/tests/time_integrators/explicit_ssp_runge_kutta/explicit_ssp_runge_kutta.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfrictionCP.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADgravCP.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/ode_coef_time_derivative/test.i)
- (test/tests/scalar_kernels/ad_scalar_time_derivative/ad_scalar_time_derivative.i)
- (examples/ex18_scalar_kernel/ex18_parsed.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_ambient_radiation.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpumpCP.i)
- (test/tests/kernels/ode/parsedode_pp_test.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat_exp.i)
- (test/tests/kernels/ode/coupled_ode_td_var_ic_from_mesh.i)
- (test/tests/tag/scalar_tag_vector.i)
- (test/tests/problems/eigen_problem/eigensolvers/scalar.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADregular_reverse.i)
- (test/tests/scaling/ignore-variables/ignore.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfullCP.i)
- (test/tests/kernels/ode/coupled_ode_td.i)
- (test/tests/controls/conditional_functional_enable/conditional_function_enable.i)
- (test/tests/kernels/ode/coupled_ode_td_auxvar_ic_from_mesh.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADregular_twoseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpump.i)
- (test/tests/kernels/bad_scaling_scalar_kernels/ill_conditioned_field_scalar_system.i)
- (test/tests/multiapps/picard_postprocessor/sub_relaxed_initial_main.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADcoupledpressure_twoseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADformsCP.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfriction.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat_threeseg.i)
- (test/tests/time_integrators/scalar/stiff.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_ambient.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat_twoseg.i)
- (test/tests/controls/time_periods/scalarkernels/scalarkernels.i)
- (test/tests/ics/function_scalar_ic/function_scalar_ic.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_heatflux.i)
- (test/tests/functors/scalar_variable/test.i)
- (test/tests/variables/block_restricted_scalar/block_restricted_scalar.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfull.i)
- (modules/optimization/test/tests/controls/inverse_solve/forward_cubic.i)
- (test/tests/outputs/nemesis/nemesis_scalar.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheatreverse.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfullCP_exp.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADheat.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADpipewall_secondary.i)
- (test/tests/multiapps/picard_postprocessor/sub_relaxed_initial_sub.i)
- (test/tests/time_integrators/scalar/scalar.i)
- (test/tests/time_integrators/actually_explicit_euler_verification/ee-ode.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADcoupledpressure_reverse.i)
- (modules/optimization/test/tests/controls/inverse_solve/forward_linear.i)
- (test/tests/kernels/ode/parsedode_sys_impl_test.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADforms.i)
(examples/ex18_scalar_kernel/ex18_parsed.i)
#
# Example 18 modified to use parsed ODE kernels.
#
# The ParsedODEKernel takes expression expressions in the input file and computes
# Jacobian entries via automatic differentiation. It allows for rapid development
# of new models without the need for code recompilation.
#
# This input file should produce the exact same result as ex18.i
#
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 10
ny = 10
elem_type = QUAD4
[]
[Functions]
# ODEs
[exact_x_fn]
type = ParsedFunction
expression = (-1/3)*exp(-t)+(4/3)*exp(5*t)
[]
[exact_y_fn]
type = ParsedFunction
expression = (2/3)*exp(-t)+(4/3)*exp(5*t)
[]
[]
[Variables]
[diffused]
order = FIRST
family = LAGRANGE
[]
# ODE variables
[x]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[y]
family = SCALAR
order = FIRST
initial_condition = 2
[]
[]
[Kernels]
[td]
type = TimeDerivative
variable = diffused
[]
[diff]
type = Diffusion
variable = diffused
[]
[]
[ScalarKernels]
[td1]
type = ODETimeDerivative
variable = x
[]
#
# This parsed expression ODE Kernel behaves exactly as the ImplicitODEx kernel
# in the main example. Checkout ImplicitODEx::computeQpResidual() in the
# source code file ImplicitODEx.C to see the matching residual function.
#
# The ParsedODEKernel automaticaly generates the On- and Off-Diagonal Jacobian
# entries.
#
[ode1]
type = ParsedODEKernel
expression = '-3*x - 2*y'
variable = x
coupled_variables = y
[]
[td2]
type = ODETimeDerivative
variable = y
[]
#
# This parsed expression ODE Kernel behaves exactly as the ImplicitODEy Kernel
# in the main example.
#
[ode2]
type = ParsedODEKernel
expression = '-4*x - y'
variable = y
coupled_variables = x
[]
[]
[BCs]
[right]
type = ScalarDirichletBC
variable = diffused
boundary = 1
scalar_var = x
[]
[left]
type = ScalarDirichletBC
variable = diffused
boundary = 3
scalar_var = y
[]
[]
[Postprocessors]
# to print the values of x, y into a file so we can plot it
[x_pp]
type = ScalarVariable
variable = x
execute_on = timestep_end
[]
[y_pp]
type = ScalarVariable
variable = y
execute_on = timestep_end
[]
[exact_x]
type = FunctionValuePostprocessor
function = exact_x_fn
execute_on = timestep_end
[]
[exact_y]
type = FunctionValuePostprocessor
function = exact_y_fn
execute_on = timestep_end
point = '0 0 0'
[]
# Measure the error in ODE solution for 'x'.
[l2err_x]
type = ScalarL2Error
variable = x
function = exact_x_fn
[]
# Measure the error in ODE solution for 'y'.
[l2err_y]
type = ScalarL2Error
variable = y
function = exact_y_fn
[]
[]
[Executioner]
type = Transient
start_time = 0
dt = 0.01
num_steps = 10
solve_type = 'PJFNK'
[]
[Outputs]
file_base = 'ex18_out'
exodus = true
[]
(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/time_integrators/explicit_ssp_runge_kutta/explicit_ssp_runge_kutta.i)
# This test solves the following IVP:
# du/dt = f(u(t), t), u(0) = 1
# f(u(t), t) = -u(t) + t^3 + 3t^2
# The exact solution is the following:
# u(t) = exp(-t) + t^3
[Mesh]
[mesh]
type = GeneratedMeshGenerator
dim = 1
nx = 1
[]
[]
[Variables]
[u]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[]
[ScalarKernels]
[time_derivative]
type = ODETimeDerivative
variable = u
[]
[source_part1]
type = ParsedODEKernel
variable = u
expression = 'u'
[]
[source_part2]
type = PostprocessorSinkScalarKernel
variable = u
postprocessor = sink_pp
[]
[]
[Functions]
[sink_fn]
type = ParsedFunction
expression = '-t^3 - 3*t^2'
[]
[]
[Postprocessors]
[sink_pp]
type = FunctionValuePostprocessor
function = sink_fn
execute_on = 'LINEAR NONLINEAR'
[]
[l2_err]
type = ScalarL2Error
variable = u
function = ${fparse exp(-0.5) + 0.5^3}
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ExplicitSSPRungeKutta
order = 1
[]
end_time = 0.5
dt = 0.1
[]
[Outputs]
file_base = 'first_order'
[csv]
type = CSV
show = 'u'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfrictionCP.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 = ADCoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
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_coupledDT]
type = CoupledODETimeDerivative
variable = 'dPc'
v = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[m1k]
type = ParsedODEKernel
expression = 'm1 - ${min}'
variable = m1
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[dP]
type = ScalarVariable
variable = dPc
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_dP]
type = ParsedPostprocessor
expression = '-${pump} + f * ${length} * mdot^2 / 4 / ${R} / ${rho} / ${area}^2 + ${forms} * mdot^2 / 2 / ${rho} / ${area}^2 + ${rho} * ${gravity} * ${dH}'
pp_names = 'f mdot'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_dP - dP)/analytical_dP)'
pp_names = 'analytical_dP dP'
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/ADgravCP.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 = ADCoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
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_coupledDT]
type = CoupledODETimeDerivative
variable = 'dPc'
v = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[m1k]
type = ParsedODEKernel
expression = 'm1 - ${min}'
variable = m1
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[dP]
type = ScalarVariable
variable = dPc
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_dP]
type = ParsedPostprocessor
expression = '-${pump} + f * ${length} * mdot^2 / 4 / ${R} / ${rho} / ${area}^2 + ${forms} * mdot^2 / 2 / ${rho} / ${area}^2 + ${rho} * ${gravity} * ${dH}'
pp_names = 'f mdot'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_dP - dP)/analytical_dP)'
pp_names = 'analytical_dP dP'
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/ode_coef_time_derivative/test.i)
[Mesh]
type = GeneratedMesh
dim = 1
[]
[Variables]
[u]
[]
[n]
family = SCALAR
order = FIRST
[]
[]
[ICs]
[n_ic]
type = ScalarConstantIC
variable = n
value = 0
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[]
[BCs]
[left_u]
type = DirichletBC
variable = u
boundary = left
value = 1
[]
[]
[ScalarKernels]
[ctd]
type = ODECoefTimeDerivative
variable = n
coef = 2.
[]
[ode1]
type = ParsedODEKernel
variable = n
expression = '-4'
[]
[]
[BCs]
[]
[Executioner]
type = Transient
num_steps = 10
dt = 0.1
abort_on_solve_fail = true
[]
[Outputs]
csv = true
[]
(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
[]
(examples/ex18_scalar_kernel/ex18_parsed.i)
#
# Example 18 modified to use parsed ODE kernels.
#
# The ParsedODEKernel takes expression expressions in the input file and computes
# Jacobian entries via automatic differentiation. It allows for rapid development
# of new models without the need for code recompilation.
#
# This input file should produce the exact same result as ex18.i
#
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 10
ny = 10
elem_type = QUAD4
[]
[Functions]
# ODEs
[exact_x_fn]
type = ParsedFunction
expression = (-1/3)*exp(-t)+(4/3)*exp(5*t)
[]
[exact_y_fn]
type = ParsedFunction
expression = (2/3)*exp(-t)+(4/3)*exp(5*t)
[]
[]
[Variables]
[diffused]
order = FIRST
family = LAGRANGE
[]
# ODE variables
[x]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[y]
family = SCALAR
order = FIRST
initial_condition = 2
[]
[]
[Kernels]
[td]
type = TimeDerivative
variable = diffused
[]
[diff]
type = Diffusion
variable = diffused
[]
[]
[ScalarKernels]
[td1]
type = ODETimeDerivative
variable = x
[]
#
# This parsed expression ODE Kernel behaves exactly as the ImplicitODEx kernel
# in the main example. Checkout ImplicitODEx::computeQpResidual() in the
# source code file ImplicitODEx.C to see the matching residual function.
#
# The ParsedODEKernel automaticaly generates the On- and Off-Diagonal Jacobian
# entries.
#
[ode1]
type = ParsedODEKernel
expression = '-3*x - 2*y'
variable = x
coupled_variables = y
[]
[td2]
type = ODETimeDerivative
variable = y
[]
#
# This parsed expression ODE Kernel behaves exactly as the ImplicitODEy Kernel
# in the main example.
#
[ode2]
type = ParsedODEKernel
expression = '-4*x - y'
variable = y
coupled_variables = x
[]
[]
[BCs]
[right]
type = ScalarDirichletBC
variable = diffused
boundary = 1
scalar_var = x
[]
[left]
type = ScalarDirichletBC
variable = diffused
boundary = 3
scalar_var = y
[]
[]
[Postprocessors]
# to print the values of x, y into a file so we can plot it
[x_pp]
type = ScalarVariable
variable = x
execute_on = timestep_end
[]
[y_pp]
type = ScalarVariable
variable = y
execute_on = timestep_end
[]
[exact_x]
type = FunctionValuePostprocessor
function = exact_x_fn
execute_on = timestep_end
[]
[exact_y]
type = FunctionValuePostprocessor
function = exact_y_fn
execute_on = timestep_end
point = '0 0 0'
[]
# Measure the error in ODE solution for 'x'.
[l2err_x]
type = ScalarL2Error
variable = x
function = exact_x_fn
[]
# Measure the error in ODE solution for 'y'.
[l2err_y]
type = ScalarL2Error
variable = y
function = exact_y_fn
[]
[]
[Executioner]
type = Transient
start_time = 0
dt = 0.01
num_steps = 10
solve_type = 'PJFNK'
[]
[Outputs]
file_base = 'ex18_out'
exodus = 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/ADpumpCP.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 = ADCoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
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_coupledDT]
type = CoupledODETimeDerivative
variable = 'dPc'
v = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[m1k]
type = ParsedODEKernel
expression = 'm1 - ${min}'
variable = m1
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[dP]
type = ScalarVariable
variable = dPc
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_dP]
type = ParsedPostprocessor
expression = '-${pump} + f * ${length} * mdot^2 / 4 / ${R} / ${rho} / ${area}^2 + ${forms} * mdot^2 / 2 / ${rho} / ${area}^2 + ${rho} * ${gravity} * ${dH}'
pp_names = 'f mdot'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_dP - dP)/analytical_dP)'
pp_names = 'analytical_dP dP'
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/kernels/ode/parsedode_pp_test.i)
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 2
ny = 2
elem_type = QUAD4
[]
[Variables]
[x]
family = SCALAR
order = FIRST
initial_condition = 0
[]
[]
[ScalarKernels]
[dt]
type = ODETimeDerivative
variable = x
[]
[ode1]
type = ParsedODEKernel
expression = '-mytime'
postprocessors = mytime
variable = x
[]
[]
[Postprocessors]
[computed_x]
type = ScalarVariable
variable = x
execute_on = 'initial timestep_end'
[]
[mytime]
type = FunctionValuePostprocessor
function = t
execute_on = 'initial timestep_begin'
[]
[exact_x]
type = FunctionValuePostprocessor
function = '0.5*t^2'
execute_on = 'initial timestep_end'
[]
[l2err_x]
type = ScalarL2Error
variable = x
function = '0.5*t^2'
execute_on = 'initial timestep_end'
[]
[]
[Executioner]
type = Transient
scheme = bdf2
dt = 0.1
num_steps = 10
solve_type = 'NEWTON'
[]
[Outputs]
file_base = ode_pp_test_out
hide = 'x mytime'
csv = true
[]
(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'
[]
[]
(test/tests/kernels/ode/coupled_ode_td_var_ic_from_mesh.i)
[Mesh]
type = FileMesh
file = 'coupled_ode_td_out.e'
[]
[Variables]
[f]
family = SCALAR
order = FIRST
initial_from_file_var = f
initial_from_file_timestep = 'LATEST'
[]
[f_times_mult]
family = SCALAR
order = FIRST
initial_from_file_var = f_times_mult
initial_from_file_timestep = 'LATEST'
[]
[]
[ScalarKernels]
[dT]
type = CoupledODETimeDerivative
variable = f
v = f_times_mult
[]
[src]
type = ParsedODEKernel
variable = f
expression = '-1'
[]
[f_times_mult_1]
type = ParsedODEKernel
variable = f_times_mult
expression = 'f_times_mult'
[]
[f_times_mult_2]
type = ParsedODEKernel
variable = f_times_mult
expression = '-f * g'
coupled_variables = 'f g'
[]
[]
[AuxVariables]
[g]
family = SCALAR
order = FIRST
[]
[]
[Functions]
[function_g]
type = ParsedFunction
expression = '(1 + t)'
[]
[]
[AuxScalarKernels]
[set_g]
type = FunctionScalarAux
function = function_g
variable = g
execute_on = 'linear initial'
[]
[]
[Executioner]
type = Transient
dt = 1
num_steps = 3
nl_abs_tol = 1e-9
[]
[Outputs]
csv = true
[]
(test/tests/tag/scalar_tag_vector.i)
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 1
ny = 1
elem_type = QUAD4
[]
[Variables]
[n]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[]
[AuxVariables]
[tag_vector_var1]
family = SCALAR
order = FIRST
[]
[tag_vector_var2]
family = SCALAR
order = FIRST
[]
[tag_matrix_var2]
family = SCALAR
order = FIRST
[]
[]
[ScalarKernels]
[dn]
type = ODETimeDerivative
variable = n
extra_matrix_tags = 'mat_tag1 mat_tag2'
extra_vector_tags = 'vec_tag1'
[]
[ode1]
type = ParsedODEKernel
expression = '-n'
variable = n
extra_matrix_tags = 'mat_tag1'
extra_vector_tags = 'vec_tag1'
[]
[ode2]
type = ParsedODEKernel
expression = '-n'
variable = n
vector_tags = 'vec_tag2'
matrix_tags = 'mat_tag2'
[]
[]
[AuxScalarKernels]
[TagVectorAux]
type = ScalarTagVectorAux
variable = tag_vector_var1
v = n
vector_tag = vec_tag1
[]
[TagVectorAux2]
type = ScalarTagVectorAux
variable = tag_vector_var2
v = n
vector_tag = vec_tag2
[]
[TagMatrixAux2]
type = ScalarTagMatrixAux
variable = tag_matrix_var2
v = n
matrix_tag = mat_tag2
[]
[]
[Problem]
type = TagTestProblem
test_tag_vectors = 'time nontime residual vec_tag1 vec_tag2'
test_tag_matrices = 'mat_tag1 mat_tag2'
extra_tag_matrices = 'mat_tag1 mat_tag2'
extra_tag_vectors = 'vec_tag1 vec_tag2'
[]
[Executioner]
type = Transient
start_time = 0
num_steps = 10
dt = 0.001
dtmin = 0.001 # Don't allow timestep cutting
solve_type = NEWTON
nl_max_its = 2
nl_abs_tol = 1.e-12 # This is an ODE, so nl_abs_tol makes sense.
[]
[Functions]
[exact_solution]
type = ParsedFunction
expression = exp(t)
[]
[]
[Postprocessors]
[error_n]
# Post processor that computes the difference between the computed
# and exact solutions. For the exact solution used here, the
# error at the final time should converge at O(dt^p), where p is
# the order of the method.
type = ScalarL2Error
variable = n
function = exact_solution
[]
[]
[Outputs]
csv = true
[]
(test/tests/problems/eigen_problem/eigensolvers/scalar.i)
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = 1
nx = 1
[]
[Variables]
[f1]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[f2]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[]
[ScalarKernels]
[row1]
type = ParsedODEKernel
variable = f1
expression = '5*f1 + 2*f2'
coupled_variables = 'f2'
[]
[row2]
type = ParsedODEKernel
variable = f2
expression = '2*f1 + 5*f2'
coupled_variables = 'f1'
[]
[]
[VectorPostprocessors]
[eigenvalues]
type = Eigenvalues
execute_on = 'timestep_end'
[]
[]
[Preconditioning]
[smp]
type = SMP
full = true
[]
[]
[Executioner]
type = Eigenvalue
which_eigen_pairs = LARGEST_MAGNITUDE
eigen_problem_type = HERMITIAN
n_eigen_pairs = 2
n_basis_vectors = 4
eigen_max_its = 10
solve_type = KRYLOVSCHUR
petsc_options = '-eps_view'
[]
[Outputs]
csv = true
[]
(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'
[]
[]
(test/tests/scaling/ignore-variables/ignore.i)
[Mesh]
type = GeneratedMesh
dim = 1
nx = 3
[]
[Variables]
[u][]
[v][]
[x]
family = SCALAR
type = MooseVariableBase
[]
[y]
family = SCALAR
[]
[]
[Kernels]
[dt_u]
type = TimeDerivative
variable = u
[]
[diff_u]
type = Diffusion
variable = u
[]
[dt_v]
type = TimeDerivative
variable = v
[]
[diff_v]
type = MatDiffusion
variable = v
diffusivity = 1e-3
[]
[]
[ScalarKernels]
[dt_x]
type = ODETimeDerivative
variable = x
[]
[ode_x]
type = ParsedODEKernel
variable = x
coupled_variables = y
expression = '-3*x - 2*y'
[]
[dt_y]
type = ODETimeDerivative
variable = y
[]
[ode_y ]
type = ParsedODEKernel
variable = y
expression = '10*y'
[]
[]
[Executioner]
type = Transient
num_steps = 2
automatic_scaling = true
compute_scaling_once = false
ignore_variables_for_autoscaling = 'v y'
solve_type = NEWTON
verbose = true
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADfullCP.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 = ADCoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
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_coupledDT]
type = CoupledODETimeDerivative
variable = 'dPc'
v = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[m1k]
type = ParsedODEKernel
expression = 'm1 - ${min}'
variable = m1
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[dP]
type = ScalarVariable
variable = dPc
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_dP]
type = ParsedPostprocessor
expression = '-${pump} + f * ${length} * mdot^2 / 4 / ${R} / ${rho} / ${area}^2 + ${forms} * mdot^2 / 2 / ${rho} / ${area}^2 + ${rho} * ${gravity} * ${dH}'
pp_names = 'f mdot'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_dP - dP)/analytical_dP)'
pp_names = 'analytical_dP dP'
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/kernels/ode/coupled_ode_td.i)
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = 1
nx = 1
[]
[Variables]
[f]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[f_times_mult]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[]
[ScalarKernels]
[dT]
type = CoupledODETimeDerivative
variable = f
v = f_times_mult
[]
[src]
type = ParsedODEKernel
variable = f
expression = '-1'
[]
[f_times_mult_1]
type = ParsedODEKernel
variable = f_times_mult
expression = 'f_times_mult'
[]
[f_times_mult_2]
type = ParsedODEKernel
variable = f_times_mult
expression = '-f * g'
coupled_variables = 'f g'
[]
[]
[AuxVariables]
[g]
family = SCALAR
order = FIRST
[]
[]
[Functions]
[function_g]
type = ParsedFunction
expression = '(1 + t)'
[]
[]
[AuxScalarKernels]
[set_g]
type = FunctionScalarAux
function = function_g
variable = g
execute_on = 'linear initial'
[]
[]
[Executioner]
type = Transient
dt = 1
num_steps = 3
nl_abs_tol = 1e-9
[]
[Outputs]
csv = true
[]
(test/tests/controls/conditional_functional_enable/conditional_function_enable.i)
# This tests controllability of the enable parameter of a MOOSE object via a
# conditional function.
#
# There are 2 scalar variables, {u, v}, with the ODEs:
# du/dt = 1 u(0) = 0
# v = u v(0) = -10
# A control switches the ODE 'v = u' to the following ODE when u >= 1.99:
# dv/dt = 2
#
# 5 time steps (of size dt = 1) will be taken, and the predicted values are as follows:
# t u v
# ------------------
# 0 0 -10
# 1 1 1
# 2 2 2
# 3 3 4
# 4 4 6
# 5 5 8
u_initial = 0
u_growth = 1
u_threshold = 1.99
v_initial = -10
v_growth = 2
[Mesh]
type = GeneratedMesh
dim = 1
nx = 10
[]
[Variables]
[u]
family = SCALAR
order = FIRST
[]
[v]
family = SCALAR
order = FIRST
[]
[]
[ICs]
[u_ic]
type = ScalarConstantIC
variable = u
value = ${u_initial}
[]
[v_ic]
type = ScalarConstantIC
variable = v
value = ${v_initial}
[]
[]
[ScalarKernels]
[u_time]
type = ODETimeDerivative
variable = u
[]
[u_src]
type = ParsedODEKernel
variable = u
expression = '-${u_growth}'
[]
[v_time]
type = ODETimeDerivative
variable = v
enable = false
[]
[v_src]
type = ParsedODEKernel
variable = v
expression = '-${v_growth}'
enable = false
[]
[v_constraint]
type = ParsedODEKernel
variable = v
coupled_variables = 'u'
expression = 'v - u'
[]
[]
[Functions]
[conditional_function]
type = ParsedFunction
symbol_names = 'u_sol'
symbol_values = 'u'
expression = 'u_sol >= ${u_threshold}'
[]
[]
[Controls]
[u_threshold]
type = ConditionalFunctionEnableControl
conditional_function = conditional_function
enable_objects = 'ScalarKernel::v_time ScalarKernel::v_src'
disable_objects = 'ScalarKernel::v_constraint'
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
scheme = implicit-euler
dt = 1
num_steps = 5
abort_on_solve_fail = true
nl_rel_tol = 1e-8
nl_abs_tol = 1e-8
[]
[Outputs]
csv = true
[]
(test/tests/kernels/ode/coupled_ode_td_auxvar_ic_from_mesh.i)
[Mesh]
type = FileMesh
file = 'coupled_ode_td_out.e'
[]
[Variables]
[f]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[f_times_mult]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[]
[ScalarKernels]
[dT]
type = CoupledODETimeDerivative
variable = f
v = f_times_mult
[]
[src]
type = ParsedODEKernel
variable = f
expression = '-1'
[]
[f_times_mult_1]
type = ParsedODEKernel
variable = f_times_mult
expression = 'f_times_mult'
[]
[f_times_mult_2]
type = ParsedODEKernel
variable = f_times_mult
expression = '-f * g'
coupled_variables = 'f g'
[]
[]
[AuxVariables]
[g]
family = SCALAR
order = FIRST
initial_from_file_var = g
initial_from_file_timestep = 'LATEST'
[]
[]
[Functions]
[function_g]
type = ParsedFunction
expression = '(1 + t)'
[]
[]
[AuxScalarKernels]
[set_g]
type = FunctionScalarAux
function = function_g
variable = g
execute_on = 'timestep_end'
[]
[]
[Problem]
# There are initial conditions overwriting the restart on the nonlinear variables
# However this test is targeted at the auxiliary variable restart so it's ok
allow_initial_conditions_with_restart = true
[]
[Executioner]
type = Transient
dt = 1
num_steps = 3
nl_abs_tol = 1e-9
[]
[Outputs]
csv = true
[]
(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/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'
[]
[]
(test/tests/kernels/bad_scaling_scalar_kernels/ill_conditioned_field_scalar_system.i)
[Mesh]
type = GeneratedMesh
dim = 1
nx = 2
[]
[Variables]
[u]
[]
[v]
family = SCALAR
initial_condition = 1
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[scalar]
type = ScalarLagrangeMultiplier
variable = u
lambda = v
[]
[]
[BCs]
[left]
type = DirichletBC
variable = u
boundary = left
value = 0
[]
[right]
type = DirichletBC
variable = u
boundary = right
value = 1
[]
[]
[ScalarKernels]
[reaction]
type = ParsedODEKernel
expression = '10^20 * v'
variable = v
[]
[time]
type = ODETimeDerivative
variable = v
[]
[]
[Executioner]
type = Transient
num_steps = 1
dtmin = 1
solve_type = NEWTON
petsc_options = '-pc_svd_monitor -ksp_view_pmat -snes_converged_reason -ksp_converged_reason'
petsc_options_iname = '-pc_type -snes_stol'
petsc_options_value = 'svd 0'
[]
[Outputs]
exodus = true
[]
(test/tests/multiapps/picard_postprocessor/sub_relaxed_initial_main.i)
# Tight coupling of two scalar equations, relaxed on the sub-application side.
# main: x = 1 + y/2 sub: y = 1 + x/4
# The fixed point is x = 12/7, y = 10/7.
#
# The sub-application relaxes the postprocessor it receives. The relaxation at the first
# iteration must use the initial value of that postprocessor, not zero, so the number of
# iterations is pinned to keep the relaxed values away from the converged solution.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[x]
family = SCALAR
order = FIRST
initial_condition = 1.0
[]
[]
[ScalarKernels]
[ode]
type = ParsedODEKernel
variable = x
expression = 'x - 1 - 0.5 * y_recv'
postprocessors = 'y_recv'
[]
[]
[Postprocessors]
[y_recv]
type = Receiver
default = 1.0
execute_on = 'initial timestep_begin'
[]
[x_out]
type = ScalarVariable
variable = x
execute_on = 'initial timestep_end'
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-12
fixed_point_max_its = 20
# loose, so the solve terminates while the relaxed values are still away from the
# fixed point and therefore still sensitive to the first relaxed update
fixed_point_rel_tol = 1e-2
[]
[MultiApps]
[sub]
type = FullSolveMultiApp
app_type = MooseTestApp
positions = '0 0 0'
input_files = sub_relaxed_initial_sub.i
execute_on = 'timestep_begin'
# we keep the full postprocessor output history of the subapp
keep_full_output_history = true
relaxation_factor = 0.8
transformed_postprocessors = 'x_recv'
[]
[]
[Transfers]
[from_sub]
type = MultiAppPostprocessorTransfer
from_multi_app = sub
from_postprocessor = 'y_out'
to_postprocessor = 'y_recv'
reduction_type = 'average'
[]
[to_sub]
type = MultiAppPostprocessorTransfer
to_multi_app = sub
from_postprocessor = 'x_out'
to_postprocessor = 'x_recv'
[]
[]
[Outputs]
csv = true
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADcoupledpressure_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 = ADCoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
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_coupledDT]
type = CoupledODETimeDerivative
variable = 'dPc'
v = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[m1k]
type = ParsedODEKernel
expression = 'm1 - ${min}'
variable = m1
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[dP]
type = ScalarVariable
variable = dPc
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_dP]
type = ParsedPostprocessor
expression = '- ${pump1} - ${pump2}
+ f1 * ${length1} * mdot^2 / 4 / ${R1} / ${rho} / ${area1}^2
+ f2 * ${length2} * mdot^2 / 4 / ${R2} / ${rho} / ${area2}^2
+ ${forms1} * mdot^2 / 2 / ${rho} / ${area1}^2
+ ${forms2} * mdot^2 / 2 / ${rho} / ${area2}^2
+ ${rho} * ${gravity} * ${dH1}
+ ${rho} * ${gravity} * ${dH2}'
pp_names = 'f1 f2 mdot'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_dP - dP)/analytical_dP)'
pp_names = 'analytical_dP dP'
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-12
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADformsCP.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 = ADCoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
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_coupledDT]
type = CoupledODETimeDerivative
variable = 'dPc'
v = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[m1k]
type = ParsedODEKernel
expression = 'm1 - ${min}'
variable = m1
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[dP]
type = ScalarVariable
variable = dPc
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_dP]
type = ParsedPostprocessor
expression = '-${pump} + f * ${length} * mdot^2 / 4 / ${R} / ${rho} / ${area}^2 + ${forms} * mdot^2 / 2 / ${rho} / ${area}^2 + ${rho} * ${gravity} * ${dH}'
pp_names = 'f mdot'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_dP - dP)/analytical_dP)'
pp_names = 'analytical_dP dP'
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'
[]
[]
(test/tests/time_integrators/scalar/stiff.i)
# This is a linear model problem described in Frank et al, "Order
# results for implicit Runge-Kutta methods applied to stiff systems",
# SIAM J. Numerical Analysis, vol. 22, no. 3, 1985, pp. 515-534.
#
# Problems "PL" and "PNL" from page 527 of the paper:
# { dy1/dt = lambda*y1 + y2**p, y1(0) = -1/(lambda+p)
# { dy2/dt = -y2, y2(0) = 1
#
# The exact solution is:
# y1 = -exp(-p*t)/(lambda+p)
# y2 = exp(-t)
#
# According to the following paragraph from the reference above, the
# p=1 version of this problem should not exhibit order reductions
# regardless of stiffness, while the nonlinear version (p>=2) will
# exhibit order reductions down to the "stage order" of the method for
# lambda large, negative.
# Use Dollar Bracket Expressions (DBEs) to set the value of LAMBDA in
# a single place. You can also set this on the command line with
# e.g. LAMBDA=-4, but note that this does not seem to override the
# value set in the input file. This is a bit different from the way
# that command line values normally work...
# Note that LAMBDA == Y2_EXPONENT is not allowed!
# LAMBDA = -10
# Y2_EXPONENT = 2
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 1
ny = 1
elem_type = QUAD4
[]
[Variables]
[y1]
family = SCALAR
order = FIRST
[]
[y2]
family = SCALAR
order = FIRST
[]
[]
[ICs]
[y1_init]
type = FunctionScalarIC
variable = y1
function = y1_exact
[]
[y2_init]
type = FunctionScalarIC
variable = y2
function = y2_exact
[]
[]
[ScalarKernels]
[y1_time]
type = ODETimeDerivative
variable = y1
[]
[y1_space]
type = ParsedODEKernel
variable = y1
expression = '-(${LAMBDA})*y1 - y2^${Y2_EXPONENT}'
coupled_variables = 'y2'
[]
[y2_time]
type = ODETimeDerivative
variable = y2
[]
[y2_space]
type = ParsedODEKernel
variable = y2
expression = 'y2'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = LStableDirk2
[]
start_time = 0
end_time = 1
dt = 0.125
solve_type = 'PJFNK'
nl_max_its = 6
nl_abs_tol = 1.e-13
nl_rel_tol = 1.e-32 # Force nl_abs_tol to be used.
line_search = 'none'
[]
[Functions]
[y1_exact]
type = ParsedFunction
expression = '-exp(-${Y2_EXPONENT}*t)/(lambda+${Y2_EXPONENT})'
symbol_names = 'lambda'
symbol_values = ${LAMBDA}
[]
[y2_exact]
type = ParsedFunction
expression = exp(-t)
[]
[]
[Postprocessors]
[error_y1]
type = ScalarL2Error
variable = y1
function = y1_exact
execute_on = 'initial timestep_end'
[]
[error_y2]
type = ScalarL2Error
variable = y2
function = y2_exact
execute_on = 'initial timestep_end'
[]
[max_error_y1]
# Estimate ||e_1||_{\infty}
type = TimeExtremeValue
value_type = max
postprocessor = error_y1
execute_on = 'initial timestep_end'
[]
[max_error_y2]
# Estimate ||e_2||_{\infty}
type = TimeExtremeValue
value_type = max
postprocessor = error_y2
execute_on = 'initial timestep_end'
[]
[value_y1]
type = ScalarVariable
variable = y1
execute_on = 'initial timestep_end'
[]
[value_y2]
type = ScalarVariable
variable = y2
execute_on = 'initial timestep_end'
[]
[value_y1_abs_max]
type = TimeExtremeValue
value_type = abs_max
postprocessor = value_y1
execute_on = 'initial timestep_end'
[]
[value_y2_abs_max]
type = TimeExtremeValue
value_type = abs_max
postprocessor = value_y2
execute_on = 'initial timestep_end'
[]
[]
[Outputs]
csv = true
[]
(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'
[]
[]
(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'
[]
[]
(test/tests/controls/time_periods/scalarkernels/scalarkernels.i)
# This tests controllability of the enable parameter of scalar kernels.
#
# There are 2 scalar variables, {u, v}, with the ODEs:
# du/dt = 1 u(0) = 0
# v = u v(0) = -10
# A control switches the ODE 'v = u' to the following ODE when t >= 2:
# dv/dt = 2
#
# 5 time steps (of size dt = 1) will be taken, and the predicted values are as follows:
# t u v
# ------------------
# 0 0 -10
# 1 1 1
# 2 2 2
# 3 3 4
# 4 4 6
# 5 5 8
u_initial = 0
u_growth = 1
v_initial = -10
v_growth = 2
t_transition = 2
[Mesh]
type = GeneratedMesh
dim = 1
nx = 10
[]
[Variables]
[u]
family = SCALAR
order = FIRST
[]
[v]
family = SCALAR
order = FIRST
[]
[]
[ICs]
[u_ic]
type = ScalarConstantIC
variable = u
value = ${u_initial}
[]
[v_ic]
type = ScalarConstantIC
variable = v
value = ${v_initial}
[]
[]
[ScalarKernels]
[u_time]
type = ODETimeDerivative
variable = u
[]
[u_src]
type = ParsedODEKernel
variable = u
expression = '-${u_growth}'
[]
[v_time]
type = ODETimeDerivative
variable = v
enable = false
[]
[v_src]
type = ParsedODEKernel
variable = v
expression = '-${v_growth}'
enable = false
[]
[v_constraint]
type = ParsedODEKernel
variable = v
coupled_variables = 'u'
expression = 'v - u'
[]
[]
[Controls]
[time_period_control]
type = TimePeriod
end_time = ${t_transition}
enable_objects = 'ScalarKernel::v_constraint'
disable_objects = 'ScalarKernel::v_time ScalarKernel::v_src'
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
scheme = implicit-euler
dt = 1
num_steps = 5
abort_on_solve_fail = true
nl_rel_tol = 1e-8
nl_abs_tol = 1e-8
[]
[Outputs]
csv = true
[]
(test/tests/ics/function_scalar_ic/function_scalar_ic.i)
[Mesh]
# a dummy mesh
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 1
ny = 1
elem_type = QUAD4
[]
[Variables]
[n]
family = SCALAR
order = FIRST
[]
[]
[Functions]
[f]
type = ParsedFunction
expression = cos(t)
[]
[]
[ICs]
[f]
type = FunctionScalarIC
variable = n
function = f
[]
[]
[ScalarKernels]
[dn]
type = ODETimeDerivative
variable = n
[]
[ode1]
type = ParsedODEKernel
expression = '-n'
variable = n
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 1
dt = 0.01
scheme = bdf2
solve_type = 'PJFNK'
timestep_tolerance = 1e-12
[]
[Outputs]
csv = true
[]
(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
[]
(test/tests/variables/block_restricted_scalar/block_restricted_scalar.i)
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
nx = 4
ny = 4
[]
[right_half]
type = SubdomainBoundingBoxGenerator
input = gen
block_id = 1
bottom_left = '0.5 0 0'
top_right = '1 1 0'
[]
[]
[Variables]
[u]
[]
[lambda]
family = SCALAR
block = 1
[]
[lambda2]
family = SCALAR
block = 1
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[lm]
type = ScalarLagrangeMultiplier
variable = u
lambda = lambda
[]
[]
[ScalarKernels]
[constraint]
type = AverageValueConstraint
variable = lambda
pp_name = average
value = 0.5
[]
[coupled]
type = ParsedODEKernel
variable = lambda
expression = 'lambda2'
coupled_variables = lambda2
[]
[null]
type = NullScalarKernel
variable = lambda2
jacobian_fill = 1
[]
[]
[Postprocessors]
[average]
type = ElementIntegralVariablePostprocessor
variable = u
execute_on = linear
[]
[]
[Preconditioning]
[smp]
type = SMP
full = true
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
# The Lagrange multiplier makes the system indefinite, so use a direct solve
# on this small problem.
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
(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'
[]
[]
(modules/optimization/test/tests/controls/inverse_solve/forward_cubic.i)
# Nonlinear forward model shared by the secant, Newton, and action drivers in this directory.
#
# Solves the scalar ODE: du/dt = param_pp^3, u(0) = 0
# After one unit step (dt = 1) the output is u = param_pp^3, so the per-step map y(p) = p^3 is
# strongly nonlinear (an inflection at p = 0).
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[u]
family = SCALAR
order = FIRST
initial_condition = 0.0
[]
[]
[ScalarKernels]
[time_deriv]
type = ODETimeDerivative
variable = u
[]
[source]
type = ParsedODEKernel
variable = u
expression = '-param_pp^3'
postprocessors = param_pp
[]
[]
[Postprocessors]
[param_pp]
type = Receiver
default = 0.0
[]
[output_pp]
type = ScalarVariable
variable = u
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
num_steps = 5
dt = 1
solve_type = NEWTON
[]
[Outputs]
csv = false
[]
(test/tests/outputs/nemesis/nemesis_scalar.i)
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = 1
nx = 4
[]
[Variables]
[f]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[f_times_mult]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[]
[ScalarKernels]
[dT]
type = CoupledODETimeDerivative
variable = f
v = f_times_mult
[]
[src]
type = ParsedODEKernel
variable = f
expression = '-1'
[]
[f_times_mult_1]
type = ParsedODEKernel
variable = f_times_mult
expression = 'f_times_mult'
[]
[f_times_mult_2]
type = ParsedODEKernel
variable = f_times_mult
expression = '-f * g'
coupled_variables = 'f g'
[]
[]
[AuxVariables]
[g]
family = SCALAR
order = FIRST
[]
[]
[Functions]
[function_g]
type = ParsedFunction
expression = '(1 + t)'
[]
[]
[AuxScalarKernels]
[set_g]
type = FunctionScalarAux
function = function_g
variable = g
execute_on = 'linear initial'
[]
[]
[Executioner]
type = Transient
dt = 1
num_steps = 3
nl_abs_tol = 1e-9
[]
[Outputs]
nemesis = 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/ADfullCP_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 = ADCoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
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_coupledDT]
type = CoupledODETimeDerivative
variable = 'dPc'
v = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[m1k]
type = ParsedODEKernel
expression = 'm1 - ${min}'
variable = m1
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[dP]
type = ScalarVariable
variable = dPc
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_dP]
type = ParsedPostprocessor
expression = '-${pump} + f * ${length} * mdot^2 / 4 / ${R} / ${rho} / ${area}^2 + ${forms} * mdot^2 / 2 / ${rho} / ${area}^2 + ${rho} * ${gravity} * ${dH}'
pp_names = 'f mdot'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_dP - dP)/analytical_dP)'
pp_names = 'analytical_dP dP'
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.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'
[]
[]
(test/tests/multiapps/picard_postprocessor/sub_relaxed_initial_sub.i)
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[y]
family = SCALAR
order = FIRST
initial_condition = 1.0
[]
[]
[ScalarKernels]
[ode]
type = ParsedODEKernel
variable = y
expression = 'y - 1 - 0.25 * x_recv'
postprocessors = 'x_recv'
[]
[]
[Postprocessors]
[x_recv]
type = Receiver
default = 1.0
execute_on = 'initial timestep_begin'
[]
[y_out]
type = ScalarVariable
variable = y
execute_on = 'initial timestep_end'
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-12
[]
[Outputs]
csv = true
[]
(test/tests/time_integrators/scalar/scalar.i)
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 1
ny = 1
elem_type = QUAD4
[]
[Variables]
[n]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[]
[ScalarKernels]
[dn]
type = ODETimeDerivative
variable = n
[]
[ode1]
type = ParsedODEKernel
expression = '-n'
variable = n
# implicit = false
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
# type = ImplicitEuler
# type = BDF2
type = CrankNicolson
# type = ImplicitMidpoint
# type = LStableDirk2
# type = LStableDirk3
# type = LStableDirk4
# type = AStableDirk4
#
# Explicit methods
# type = ExplicitEuler
# type = ExplicitMidpoint
# type = Heun
# type = Ralston
[]
start_time = 0
end_time = 1
dt = 0.001
dtmin = 0.001 # Don't allow timestep cutting
solve_type = 'PJFNK'
nl_max_its = 2
nl_abs_tol = 1.e-12 # This is an ODE, so nl_abs_tol makes sense.
[]
[Functions]
[exact_solution]
type = ParsedFunction
expression = exp(t)
[]
[]
[Postprocessors]
[error_n]
# Post processor that computes the difference between the computed
# and exact solutions. For the exact solution used here, the
# error at the final time should converge at O(dt^p), where p is
# the order of the method.
type = ScalarL2Error
variable = n
function = exact_solution
# final is not currently supported for Postprocessor execute_on...
# execute_on = 'final'
[]
[]
[Outputs]
csv = true
[]
(test/tests/time_integrators/actually_explicit_euler_verification/ee-ode.i)
# Tests that ActuallyExplicitEuler works with scalar variables.
#
# The ODE and IC used are the following:
# du/dt = 2, u(0) = 0
# Thus the solution is u(t) = 2*t.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[u]
family = SCALAR
order = FIRST
initial_condition = 0
[]
[]
[ScalarKernels]
[time]
type = ODETimeDerivative
variable = u
[]
[source]
type = ParsedODEKernel
variable = u
expression = -2
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
[]
dt = 1
num_steps = 5
[]
[Outputs]
csv = true
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/PathIntegratedIncompressibleVerification/ADcoupledpressure_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 = ADCoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
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_coupledDT]
type = CoupledODETimeDerivative
variable = 'dPc'
v = 'm1'
[]
[temp]
type = ParsedODEKernel
expression = 'T1 - ${Tin}'
variable = T1
[]
[m1k]
type = ParsedODEKernel
expression = 'm1 - ${min}'
variable = m1
[]
[]
[Postprocessors]
[mdot]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[dP]
type = ScalarVariable
variable = dPc
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_dP]
type = ParsedPostprocessor
expression = '-${pump} + f * ${length} * mdot * abs(mdot) / 4 / ${R} / ${rho} / ${area}^2 + ${forms} * mdot * abs(mdot) / 2 / ${rho} / ${area}^2 + ${rho} * ${gravity} * ${dH}'
pp_names = 'f mdot'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_dP - dP)/analytical_dP)'
pp_names = 'analytical_dP dP'
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-12
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/optimization/test/tests/controls/inverse_solve/forward_linear.i)
# Linear forward model shared by the secant, Newton, and action drivers in this directory.
#
# Solves the scalar ODE: du/dt = param_pp, u(0) = 0
# param_pp is a Receiver set by the parent each fixed-point iteration.
# Accumulates: u(t_n) = u(t_{n-1}) + param_pp * dt, so the per-step map y(p) is linear in p.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[u]
family = SCALAR
order = FIRST
initial_condition = 0.0
[]
[]
[ScalarKernels]
[time_deriv]
type = ODETimeDerivative
variable = u
[]
[source]
type = ParsedODEKernel
variable = u
expression = '-param_pp'
postprocessors = param_pp
[]
[]
[Postprocessors]
[param_pp]
type = Receiver
default = 0.0
[]
[output_pp]
type = ScalarVariable
variable = u
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
num_steps = 5
dt = 1
solve_type = NEWTON
[]
[Outputs]
csv = false
[]
(test/tests/kernels/ode/parsedode_sys_impl_test.i)
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 2
ny = 2
elem_type = QUAD4
[]
[Functions]
[f_fn]
type = ParsedFunction
expression = -4
[]
[bc_all_fn]
type = ParsedFunction
expression = x*x+y*y
[]
# ODEs
[exact_x_fn]
type = ParsedFunction
expression = (-1/3)*exp(-t)+(4/3)*exp(5*t)
[]
[]
# NL
[Variables]
[u]
family = LAGRANGE
order = FIRST
[]
# ODE variables
[x]
family = SCALAR
order = FIRST
initial_condition = 1
[]
[y]
family = SCALAR
order = FIRST
initial_condition = 2
[]
[]
[Kernels]
[td]
type = TimeDerivative
variable = u
[]
[diff]
type = Diffusion
variable = u
[]
[uff]
type = BodyForce
variable = u
function = f_fn
[]
[]
[ScalarKernels]
[td1]
type = ODETimeDerivative
variable = x
[]
[ode1]
type = ParsedODEKernel
expression = '-3*x - 2*y'
variable = x
coupled_variables = y
[]
[td2]
type = ODETimeDerivative
variable = y
[]
[ode2]
type = ParsedODEKernel
expression = '-4*x - y'
variable = y
coupled_variables = x
[]
[]
[BCs]
[all]
type = FunctionDirichletBC
variable = u
boundary = '0 1 2 3'
function = bc_all_fn
[]
[]
[Postprocessors]
active = 'exact_x l2err_x'
[exact_x]
type = FunctionValuePostprocessor
function = exact_x_fn
execute_on = 'initial timestep_end'
point = '0 0 0'
[]
[l2err_x]
type = ScalarL2Error
variable = x
function = exact_x_fn
execute_on = 'initial timestep_end'
[]
[]
[Executioner]
type = Transient
start_time = 0
dt = 0.01
num_steps = 100
solve_type = 'PJFNK'
[]
[Outputs]
file_base = ode_sys_impl_test_out
exodus = true
[]
(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'
[]
[]