- 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
- (test/tests/time_integrators/explicit_ssp_runge_kutta/explicit_ssp_runge_kutta.i)
- (test/tests/time_integrators/actually_explicit_euler_verification/ee-ode.i)
- (test/tests/variables/block_restricted_scalar/block_restricted_scalar.i)
- (test/tests/controls/time_periods/scalarkernels/scalarkernels.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADfrictionCP.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADheat_twoseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADgrav.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADgravCP.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADfull_exp.i)
- (test/tests/kernels/ode/coupled_ode_td_var_ic_from_mesh.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADfriction.i)
- (test/tests/tag/scalar_tag_vector.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADheat_threeseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/full.i)
- (test/tests/kernels/ode/parsedode_pp_test.i)
- (test/tests/time_integrators/scalar/stiff.i)
- (test/tests/kernels/bad_scaling_scalar_kernels/ill_conditioned_field_scalar_system.i)
- (test/tests/ics/function_scalar_ic/function_scalar_ic.i)
- (examples/ex18_scalar_kernel/ex18_parsed.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/regular.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADpumpCP.i)
- (test/tests/outputs/nemesis/nemesis_scalar.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/coupledpressure_twoseg.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/IncompressibleVerification/ADforms.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADcoupledpressure_twoseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/ode_coef_time_derivative/test.i)
- (modules/optimization/test/tests/controls/inverse_solve/forward_linear.i)
- (test/tests/problems/eigen_problem/eigensolvers/scalar.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADregular_reverse.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADfull.i)
- (test/tests/scalar_kernels/ad_scalar_time_derivative/ad_scalar_time_derivative.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/coupledpressure_reverse.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/fullCP.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADregular_twoseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/coupledpressure.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADheatreverse.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADcoupledpressure_reverse.i)
- (test/tests/time_integrators/scalar/scalar.i)
- (test/tests/kernels/ode/coupled_ode_td.i)
- (test/tests/functors/scalar_variable/test.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/regular_reverse.i)
- (modules/optimization/test/tests/controls/inverse_solve/forward_cubic.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADfullCP.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADfullCP_exp.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADheat.i)
- (test/tests/kernels/ode/parsedode_sys_impl_test.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/heatreverse.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADpump.i)
- (test/tests/scaling/ignore-variables/ignore.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADformsCP.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADheat_exp.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/regular_twoseg.i)
- (modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/heat_threeseg.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
[]
(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'
[../]
[]
(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
[]
(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'
[]
(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
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADfrictionCP.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = 10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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/IncompressibleVerification/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
alpha1 = 0.0
alpha2 = '${fparse 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 = IncompressibleMomentumSPScalarKernel
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}'
alphas = '${alpha1} ${alpha2}'
forms_losses = '${forms1} ${forms2}'
pump_pressures = '${pump1} ${pump2}'
roughnesses = '${epsilon1} ${epsilon2}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
variable = 'm1'
[]
[temp1]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp1_DT]
type = ODETimeDerivative
variable = 'T1'
[]
[temp0]
type = ParsedODEKernel
expression = 'T0 - ${Tin}'
variable = T0
[]
[temp2]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp2_DT]
type = ODETimeDerivative
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
[]
[]
[Postprocessors]
[Tone]
type = ScalarVariable
variable = T1
execute_on = 'TIMESTEP_END'
[]
[Ttwo]
type = ScalarVariable
variable = T2
execute_on = 'TIMESTEP_END'
[]
[M]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re1]
type = ParsedPostprocessor
expression = 'abs(M) / ${area1} * 2 * ${R1} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Re2]
type = ParsedPostprocessor
expression = 'abs(M) / ${area2} * 2 * ${R2} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Pr]
type = ParsedPostprocessor
expression = '${cp} * ${mu} / ${k}'
execute_on = 'TIMESTEP_END'
[]
[h1]
type = ParsedPostprocessor
expression = '0.023 * Re1^0.8 * Pr^0.4'
pp_names = 'Re1 Pr'
execute_on = 'TIMESTEP_END'
[]
[h2]
type = ParsedPostprocessor
expression = '0.023 * Re2^0.8 * Pr^0.4'
pp_names = 'Re2 Pr'
execute_on = 'TIMESTEP_END'
[]
[in1]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * Ttwo
+ 1 / 2 * (1 + abs(M)/M) * ${Tin}'
pp_names = 'Ttwo M'
execute_on = 'TIMESTEP_END'
[]
[in2]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * ${Tout}
+ 1 / 2 * (1 + abs(M)/M) * Tone'
pp_names = 'Tone M'
execute_on = 'TIMESTEP_END'
[]
[q1]
type = ParsedPostprocessor
expression = 'h1 * ${fparse 2*3.14159* ${R1}} / 2 * ( 2 * ${Tout} - Tone - in1)'
pp_names = 'Tone h1 in1'
execute_on = 'TIMESTEP_END'
[]
[q2]
type = ParsedPostprocessor
expression = 'h2 * ${fparse 2*3.14159* ${R2}} / 2 * ( 2 * ${Tout} - Ttwo - in2)'
pp_names = 'Ttwo h2 in2'
execute_on = 'TIMESTEP_END'
[]
[analytical_T1]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q1 * ${length1} - M / 2 * (1 - abs(M)/M) * ${cp} * Ttwo
+ M / 2 * (1 + abs(M)/M) * ${cp} * ${Tin})'
pp_names = 'Ttwo q1 M'
[]
[analytical_T2]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q2 * ${length2} - M / 2 * (1 - abs(M)/M) * ${cp} * ${Tout}
+ M / 2 * (1 + abs(M)/M) * ${cp} * Tone)'
pp_names = 'Tone q2 M'
[]
[relative_error1]
type = ParsedPostprocessor
expression = 'abs((analytical_T1 - Tone)/analytical_T1)'
pp_names = 'analytical_T1 Tone'
execute_on = 'TIMESTEP_END'
[]
[relative_error2]
type = ParsedPostprocessor
expression = 'abs((analytical_T2 - Ttwo)/analytical_T2)'
pp_names = 'analytical_T2 Ttwo'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADgrav.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${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/IncompressibleVerification/ADgravCP.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = 10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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/IncompressibleVerification/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
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${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/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
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADfriction.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${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/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
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/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
alpha1 = 0.0
alpha2 = '${fparse 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 = IncompressibleMomentumSPScalarKernel
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}'
alphas = '${alpha1} ${alpha2} ${alpha2}'
forms_losses = '${forms1} ${forms2} ${forms2}'
pump_pressures = '${pump1} ${pump2} ${pump2}'
roughnesses = '${epsilon1} ${epsilon2} ${epsilon2}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
variable = 'm1'
[]
[temp0]
type = ParsedODEKernel
expression = 'T0 - ${Tin}'
variable = T0
[]
[temp1]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp1_DT]
type = ODETimeDerivative
variable = 'T1'
[]
[temp2]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp2_DT]
type = ODETimeDerivative
variable = 'T2'
[]
[temp3]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp3_DT]
type = ODETimeDerivative
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
[]
[]
[Postprocessors]
[Tone]
type = ScalarVariable
variable = T1
execute_on = 'TIMESTEP_END'
[]
[Ttwo]
type = ScalarVariable
variable = T2
execute_on = 'TIMESTEP_END'
[]
[Tthree]
type = ScalarVariable
variable = T3
execute_on = 'TIMESTEP_END'
[]
[M]
type = ScalarVariable
variable = m1
execute_on = 'TIMESTEP_END'
[]
[Re1]
type = ParsedPostprocessor
expression = 'abs(M) / ${area1} * 2 * ${R1} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Re2]
type = ParsedPostprocessor
expression = 'abs(M) / ${area2} * 2 * ${R2} / ${mu}'
pp_names = 'M'
execute_on = 'TIMESTEP_END'
[]
[Pr]
type = ParsedPostprocessor
expression = '${cp} * ${mu} / ${k}'
execute_on = 'TIMESTEP_END'
[]
[h1]
type = ParsedPostprocessor
expression = '0.023 * Re1^0.8 * Pr^0.4'
pp_names = 'Re1 Pr'
execute_on = 'TIMESTEP_END'
[]
[h2]
type = ParsedPostprocessor
expression = '0.023 * Re2^0.8 * Pr^0.4'
pp_names = 'Re2 Pr'
execute_on = 'TIMESTEP_END'
[]
[in1]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * Ttwo
+ 1 / 2 * (1 + abs(M)/M) * ${Tin}'
pp_names = 'Ttwo M'
execute_on = 'TIMESTEP_END'
[]
[in2]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * Tthree
+ 1 / 2 * (1 + abs(M)/M) * Tone'
pp_names = 'Tone Tthree M'
execute_on = 'TIMESTEP_END'
[]
[in3]
type = ParsedPostprocessor
expression = '1 / 2 * (1 - abs(M)/M) * ${Tout}
+ 1 / 2 * (1 + abs(M)/M) * Ttwo'
pp_names = 'Ttwo M'
execute_on = 'TIMESTEP_END'
[]
[q1]
type = ParsedPostprocessor
expression = 'h1 * ${fparse 2*3.14159* ${R1}} / 2 * ( 2 * ${Tout} - Tone - in1)'
pp_names = 'Tone h1 in1'
execute_on = 'TIMESTEP_END'
[]
[q2]
type = ParsedPostprocessor
expression = 'h2 * ${fparse 2*3.14159* ${R2}} / 2 * ( 2 * ${Tout} - Ttwo - in2)'
pp_names = 'Ttwo h2 in2'
execute_on = 'TIMESTEP_END'
[]
[q3]
type = ParsedPostprocessor
expression = 'h2 * ${fparse 2*3.14159* ${R2}} / 2 * ( 2 * ${Tout} - Tthree - in3)'
pp_names = 'Tthree h2 in3'
execute_on = 'TIMESTEP_END'
[]
[analytical_T1]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q1 * ${length1} - M / 2 * (1 - abs(M)/M) * ${cp} * Ttwo
+ M / 2 * (1 + abs(M)/M) * ${cp} * ${Tin})'
pp_names = 'Ttwo q1 M'
[]
[analytical_T2]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q2 * ${length2} - M / 2 * (1 - abs(M)/M) * ${cp} * Tthree
+ M / 2 * (1 + abs(M)/M) * ${cp} * Tone)'
pp_names = 'Tone Tthree q2 M'
[]
[analytical_T3]
type = ParsedPostprocessor
expression = '1 / abs(M) / ${cp} * (q3 * ${length3} - M / 2 * (1 - abs(M)/M) * ${cp} * ${Tout}
+ M / 2 * (1 + abs(M)/M) * ${cp} * Ttwo)'
pp_names = 'Ttwo q3 M'
[]
[relative_error1]
type = ParsedPostprocessor
expression = 'abs((analytical_T1 - Tone)/analytical_T1)'
pp_names = 'analytical_T1 Tone'
execute_on = 'TIMESTEP_END'
[]
[relative_error2]
type = ParsedPostprocessor
expression = 'abs((analytical_T2 - Ttwo)/analytical_T2)'
pp_names = 'analytical_T2 Ttwo'
execute_on = 'TIMESTEP_END'
[]
[relative_error3]
type = ParsedPostprocessor
expression = 'abs((analytical_T3 - Tthree)/analytical_T3)'
pp_names = 'analytical_T3 Tthree'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/full.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${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/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
[]
(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
[]
(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/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
[]
(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/IncompressibleVerification/regular.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${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/IncompressibleVerification/ADpumpCP.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = 10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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/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/IncompressibleVerification/coupledpressure_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
alpha1 = 0.0
alpha2 = '${fparse 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
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}'
alphas = '${alpha1} ${alpha2}'
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} * ${length1} * sin(${alpha1})
+ ${rho} * ${gravity} * ${length2} * sin(${alpha2})'
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-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(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/IncompressibleVerification/ADforms.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${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/IncompressibleVerification/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
alpha1 = 0.0
alpha2 = '${fparse 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
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}'
alphas = '${alpha1} ${alpha2}'
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} * ${length1} * sin(${alpha1})
+ ${rho} * ${gravity} * ${length2} * sin(${alpha2})'
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/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
[]
(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/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/IncompressibleVerification/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
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${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/IncompressibleVerification/ADfull.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${pump}) / (f * ${length} / 4 / ${R} / ${rho} / ${area}^2 + ${forms} / 2 / ${rho} / ${area}^2))'
pp_names = 'f'
execute_on = 'TIMESTEP_END'
[]
[relative_error]
type = ParsedPostprocessor
expression = 'abs((analytical_mdot - mdot)/analytical_mdot)'
pp_names = 'analytical_mdot mdot'
execute_on = 'TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
start_time = 0
end_time = 100.0
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.4
dt = 5
[]
solve_type = 'PJFNK'
nl_abs_tol = 1e-09
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]
(test/tests/scalar_kernels/ad_scalar_time_derivative/ad_scalar_time_derivative.i)
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[u]
family = SCALAR
order = FIRST
initial_condition = 0
[]
[]
[ScalarKernels]
inactive = 'coupled_dot'
[time]
type = ADScalarTimeDerivative
variable = u
[]
[coupled_dot]
type = ADCoupledScalarDot
variable = u
v = u
[]
[source]
type = ParsedODEKernel
variable = u
expression = '-5'
[]
[]
[Executioner]
type = Transient
scheme = implicit-euler
dt = 1.0
num_steps = 3
solve_type = NEWTON
nl_abs_tol = 1e-10
[]
[Outputs]
csv = true
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/coupledpressure_reverse.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = 10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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/IncompressibleVerification/fullCP.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = 10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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/IncompressibleVerification/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
alpha1 = 0.0
alpha2 = '${fparse 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 = IncompressibleMomentumSPScalarKernel
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}'
alphas = '${alpha1} ${alpha2}'
forms_losses = '${forms1} ${forms2}'
pump_pressures = '${pump1} ${pump2}'
roughnesses = '${epsilon1} ${epsilon2}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length1} * sin(${alpha1})
+ ${rho} * ${gravity} * ${length2} * sin(${alpha2})
- ${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/IncompressibleVerification/coupledpressure.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = 10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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/IncompressibleVerification/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
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
variable = 'm1'
[]
[temp1]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp1_DT]
type = ODETimeDerivative
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
[]
[]
[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/IncompressibleVerification/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
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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'
[]
[]
(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/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/functors/scalar_variable/test.i)
# Domain on (0,1) with 1 element
#
# du/dt = v, u(0) = 0
# dv/dt = 1, v(0) = 0
#
# Taking 3 time steps of 1 second each. Values should be the following:
#
# t = 0: u = 0, v = 0
# t = 1: u = 1, v = 1
# t = 2: u = 3, v = 2
# t = 3: u = 6, v = 3
u0 = 0
v0 = 0
v_source = 1
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 1
nx = 1
xmin = 0
xmax = 1
[]
[]
[Variables]
[u]
family = LAGRANGE
order = FIRST
initial_condition = ${u0}
[]
[v]
family = SCALAR
order = FIRST
initial_condition = ${v0}
[]
[]
[Kernels]
[time_deriv_u]
type = ADTimeDerivative
variable = u
[]
[source_u]
type = FunctorKernel
variable = u
functor = source_u
functor_on_rhs = true
[]
[]
[FunctorMaterials]
[u_source_mat]
type = ADParsedFunctorMaterial
expression = 'v'
functor_names = 'v'
property_name = source_u
[]
[]
[ScalarKernels]
[time_deriv_v]
type = ADScalarTimeDerivative
variable = v
[]
[source_v]
type = ParsedODEKernel
variable = v
expression = '-${v_source}'
[]
[]
[Postprocessors]
[u_avg]
type = ElementAverageValue
variable = u
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
dt = 1
num_steps = 3
solve_type = NEWTON
[]
[Outputs]
csv = true
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/regular_reverse.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${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
[]
(modules/thermal_hydraulics/test/tests/scalarkernels/IncompressibleVerification/ADfullCP.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = 10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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/IncompressibleVerification/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
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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/IncompressibleVerification/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
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
variable = 'm1'
[]
[temp1]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp1_DT]
type = ODETimeDerivative
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
[]
[]
[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/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/IncompressibleVerification/heatreverse.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
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
variable = 'm1'
[]
[temp1]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp1_DT]
type = ODETimeDerivative
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
[]
[]
[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/IncompressibleVerification/ADpump.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = -10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length} * sin(${alpha}) - ${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/IncompressibleVerification/ADformsCP.i)
length = 1.0
R = 0.025
min = 1.0
Pin = 101300
dP = 10130
Tin = 293.15
rho = 998.2
mu = 0.001002
alpha = 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 = CoupledPressureIncompressibleMomentumSPScalarKernel
variable = 'dPc'
coupled_mass_flow_rate = 'm1'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
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} * ${length} * sin(${alpha})'
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/IncompressibleVerification/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
alpha = 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 = IncompressibleMomentumSPScalarKernel
variable = 'm1'
reference_pressure_drop = 'dPc'
temperatures = 'T1'
reference_pressure = ${Pin}
fp = 'water'
areas = '${area}'
perimeters = '${fparse 2*3.14159* ${R}}'
lengths = '${length}'
alphas = '${alpha}'
forms_losses = '${forms}'
pump_pressures = '${pump}'
roughnesses = '${epsilon}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
variable = 'm1'
[]
[temp1]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp1_DT]
type = ODETimeDerivative
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
[]
[]
[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/IncompressibleVerification/regular_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
alpha1 = 0.0
alpha2 = '${fparse 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 = IncompressibleMomentumSPScalarKernel
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}'
alphas = '${alpha1} ${alpha2}'
forms_losses = '${forms1} ${forms2}'
pump_pressures = '${pump1} ${pump2}'
roughnesses = '${epsilon1} ${epsilon2}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
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} * ${length1} * sin(${alpha1})
+ ${rho} * ${gravity} * ${length2} * sin(${alpha2})
- ${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/IncompressibleVerification/heat_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
alpha1 = 0.0
alpha2 = '${fparse 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 = IncompressibleMomentumSPScalarKernel
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}'
alphas = '${alpha1} ${alpha2} ${alpha2}'
forms_losses = '${forms1} ${forms2} ${forms2}'
pump_pressures = '${pump1} ${pump2} ${pump2}'
roughnesses = '${epsilon1} ${epsilon2} ${epsilon2}'
g = ${gravity}
is_implicit = True
[]
[pipe1_DT]
type = ODETimeDerivative
variable = 'm1'
[]
[temp0]
type = ParsedODEKernel
expression = 'T0 - ${Tin}'
variable = T0
[]
[temp1]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp1_DT]
type = ODETimeDerivative
variable = 'T1'
[]
[temp2]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp2_DT]
type = ODETimeDerivative
variable = 'T2'
[]
[temp3]
type = IncompressibleEnergySPScalarKernel
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
[]
[temp3_DT]
type = ODETimeDerivative
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
[]
[]
[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-08
l_tol = 1e-07
[]
[Outputs]
perf_graph = true
[out]
type = CSV
execute_on = 'FINAL'
[]
[]