- postprocessorThe name of the postprocessor
C++ Type:PostprocessorName
Controllable:No
Description:The name of the postprocessor
ChangeOverTimePostprocessor
Description
This post-processor computes the change or relative change in a post-processor value over a time step or over the entire transient. The change is computed as where is the relative change at time index , is the value of post-processor at time index , and is the reference value for the change (either the previous time value, , or the initial value, ). The relative change, which may be requested instead using the "compute_relative_change" parameter is computed as
Optionally, the user may specify to return the absolute value of the change.
Example Syntax
The following example demonstrates how this post-processor is used:
# This test tests the ChangeOverTimePostprocessor, which computes the change
# in a postprocessor value with respect to the previous value or with respect to
# the initial value. This test creates a time-dependent function postprocessor
# and then computes its change over a timestep. The FE problem used here is a
# dummy problem and has no effect on the test.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 5
[]
[Variables]
[./u]
[../]
[]
[Kernels]
[./time_derivative]
type = TimeDerivative
variable = u
[../]
[./diff]
type = Diffusion
variable = u
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]
[Executioner]
type = Transient
start_time = 0.0
dt = 1.0
num_steps = 2
[]
[Functions]
[./my_function]
type = ParsedFunction
value = '1 + t * t'
[../]
[]
[Postprocessors]
[./my_postprocessor]
type = FunctionValuePostprocessor
function = my_function
execute_on = 'initial timestep_end'
[../]
[./change_over_time]
type = ChangeOverTimePostprocessor
postprocessor = my_postprocessor
change_with_respect_to_initial = false
execute_on = 'initial timestep_end'
[../]
[]
[Outputs]
file_base = 'change_over_time_previous'
csv = true
[]
(test/tests/postprocessors/change_over_time/change_over_time.i)Input Parameters
- change_with_respect_to_initialFalseCompute change with respect to initial value instead of previous value
Default:False
C++ Type:bool
Controllable:No
Description:Compute change with respect to initial value instead of previous value
- compute_relative_changeFalseCompute magnitude of relative change instead of change
Default:False
C++ Type:bool
Controllable:No
Description:Compute magnitude of relative change instead of change
- execute_onTIMESTEP_ENDThe list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, FINAL, CUSTOM, ALWAYS.
Default:TIMESTEP_END
C++ Type:ExecFlagEnum
Options:NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, FINAL, CUSTOM, TRANSFER, ALWAYS
Controllable:No
Description:The list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, FINAL, CUSTOM, ALWAYS.
- prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
C++ Type:MaterialPropertyName
Controllable:No
Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
- take_absolute_valueFalseOption to take absolute value of change
Default:False
C++ Type:bool
Controllable:No
Description:Option to take absolute value of change
Optional Parameters
- allow_duplicate_execution_on_initialFalseIn the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).
Default:False
C++ Type:bool
Controllable:No
Description:In the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
- enableTrueSet the enabled status of the MooseObject.
Default:True
C++ Type:bool
Controllable:Yes
Description:Set the enabled status of the MooseObject.
- force_postauxFalseForces the UserObject to be executed in POSTAUX
Default:False
C++ Type:bool
Controllable:No
Description:Forces the UserObject to be executed in POSTAUX
- force_preauxFalseForces the UserObject to be executed in PREAUX
Default:False
C++ Type:bool
Controllable:No
Description:Forces the UserObject to be executed in PREAUX
- force_preicFalseForces the UserObject to be executed in PREIC during initial setup
Default:False
C++ Type:bool
Controllable:No
Description:Forces the UserObject to be executed in PREIC during initial setup
- outputsVector of output names were you would like to restrict the output of variables(s) associated with this object
C++ Type:std::vector<OutputName>
Controllable:No
Description:Vector of output names were you would like to restrict the output of variables(s) associated with this object
- use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Default:False
C++ Type:bool
Controllable:No
Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Advanced Parameters
Input Files
- (modules/thermal_hydraulics/test/tests/components/shaft_connected_compressor_1phase/shaft_motor_compressor.i)
- (modules/thermal_hydraulics/test/tests/components/junction_parallel_channels_1phase/conservation.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/from_file_3d.i)
- (modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_flux_1phase/phy.energy_heatflux_ss_1phase.i)
- (modules/porous_flow/examples/lava_lamp/1phase_convection.i)
- (modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_3d/jac.1phase.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/cylindrical.i)
- (modules/thermal_hydraulics/test/tests/components/shaft_connected_turbine_1phase/shaft_motor_turbine.i)
- (modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_3d/err.not_a_3d_hs.i)
- (modules/porous_flow/examples/lava_lamp/2phase_convection.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/cylindrical.i)
- (modules/thermal_hydraulics/test/tests/components/shaft_connected_pump_1phase/pump_coastdown.i)
- (modules/thermal_hydraulics/test/tests/components/heat_source_from_power_density/phy.conservation_from_file_3d.i)
- (modules/thermal_hydraulics/test/tests/components/heat_transfer_from_specified_temperature_1phase/phy.energy_walltemperature_ss_1phase.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/cylindrical.i)
- (modules/stochastic_tools/examples/paper/full_solve.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/plate.i)
- (modules/thermal_hydraulics/test/tests/components/volume_junction_1phase/t_junction_1phase.i)
- (modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_3d/phy.conservation.i)
- (modules/thermal_hydraulics/test/tests/components/heat_source_from_total_power/phy.conservation.i)
- (modules/thermal_hydraulics/test/tests/components/free_boundary_1phase/phy.conservation_free_boundary_1phase.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/from_file_3d.i)
- (modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_1phase/phy.conservation_1phase.i)
- (modules/thermal_hydraulics/test/tests/components/deprecated/heat_source_volumetric.i)
- (modules/thermal_hydraulics/test/tests/components/heat_source_volumetric_1phase/phy.conservation.1phase.i)
- (modules/thermal_hydraulics/test/tests/components/shaft_connected_pump_1phase/shaft_motor_pump.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/from_file_3d.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/plate.i)
- (modules/thermal_hydraulics/test/tests/components/heat_source_from_total_power/phy.conservation_from_file_3d.i)
- (test/tests/postprocessors/change_over_time/change_over_time.i)
- (modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/plate.i)
- (modules/thermal_hydraulics/test/tests/components/pump_1phase/pump_mass_energy_conservation.i)
Child Objects
compute_relative_change
Default:False
C++ Type:bool
Controllable:No
Description:Compute magnitude of relative change instead of change
(test/tests/postprocessors/change_over_time/change_over_time.i)
# This test tests the ChangeOverTimePostprocessor, which computes the change
# in a postprocessor value with respect to the previous value or with respect to
# the initial value. This test creates a time-dependent function postprocessor
# and then computes its change over a timestep. The FE problem used here is a
# dummy problem and has no effect on the test.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 5
[]
[Variables]
[./u]
[../]
[]
[Kernels]
[./time_derivative]
type = TimeDerivative
variable = u
[../]
[./diff]
type = Diffusion
variable = u
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]
[Executioner]
type = Transient
start_time = 0.0
dt = 1.0
num_steps = 2
[]
[Functions]
[./my_function]
type = ParsedFunction
value = '1 + t * t'
[../]
[]
[Postprocessors]
[./my_postprocessor]
type = FunctionValuePostprocessor
function = my_function
execute_on = 'initial timestep_end'
[../]
[./change_over_time]
type = ChangeOverTimePostprocessor
postprocessor = my_postprocessor
change_with_respect_to_initial = false
execute_on = 'initial timestep_end'
[../]
[]
[Outputs]
file_base = 'change_over_time_previous'
csv = true
[]
(modules/thermal_hydraulics/test/tests/components/shaft_connected_compressor_1phase/shaft_motor_compressor.i)
area = 0.2359
dt = 1.e-3
[GlobalParams]
initial_p = 1e5
initial_T = 288
initial_vel = 60
initial_vel_x = 60
initial_vel_y = 0
initial_vel_z = 0
A = ${area}
A_ref = ${area}
f = 100
scaling_factor_1phase = '0.04 0.04 0.04e-5'
closures = simple_closures
fp = fp
[]
[Modules/FluidProperties]
[fp]
type = IdealGasFluidProperties
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[compressor]
type = ShaftConnectedCompressor1Phase
inlet = 'pipe:out'
outlet = 'pipe:in'
position = '0 0 0'
scaling_factor_rhoEV = 1e-5
volume = ${fparse area*0.45}
inertia_coeff = '1 1 1 1'
inertia_const = 1.61397
speed_cr_I = 1e12
speed_cr_fr = 0
tau_fr_coeff = '0 0 0 0'
tau_fr_const = 0
omega_rated = 200
mdot_rated = 21.74
rho0_rated = 1.1812
c0_rated = 340
speeds = '0.0 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 2'
Rp_functions = 'Rp00 Rp04 Rp05 Rp06 Rp07 Rp08 Rp09 Rp10 Rp11 Rp11'
eff_functions = 'eff00 eff04 eff05 eff06 eff07 eff08 eff09 eff10 eff11 eff11'
[]
[pipe]
type = FlowChannel1Phase
position = '0.1 0 0'
orientation = '1 0 0'
length = 10
n_elems = 20
[]
[motor]
type = ShaftConnectedMotor
inertia = 1e2
torque = 100
[]
[shaft]
type = Shaft
connected_components = 'motor compressor'
initial_speed = 100
[]
[]
[Functions]
[Rp00]
type = PiecewiseLinear
x = '0 0.3736 0.4216'
y = '1 0.9701 0.9619'
[]
[eff00]
type = PiecewiseLinear
x = '0 0.3736 0.4216'
y = '0.001 0.8941 0.6641'
[]
[Rp04]
type = PiecewiseLinear
x = '0.3736 0.3745 0.3753 0.3762 0.3770 0.3919 0.4067 0.4216 0.4826'
y = '1.0789 1.0779 1.0771 1.0759 1.0749 1.0570 1.0388 1.0204 0.9450'
[]
[eff04]
type = PiecewiseLinear
x = '0.3736 0.3745 0.3753 0.3762 0.3770 0.3919 0.4067 0.4216 0.4826'
y = '0.8941 0.8929 0.8925 0.8915 0.8901 0.8601 0.7986 0.6641 0.1115'
[]
[Rp05]
type = PiecewiseLinear
x = '0.3736 0.4026 0.4106 0.4186 0.4266 0.4346 0.4426 0.4506 0.4586 0.4666 0.4746 0.4826 0.5941'
y = '1.2898 1.2442 1.2316 1.2189 1.2066 1.1930 1.1804 1.1677 1.1542 1.1413 1.1279 1.1150 0.9357'
[]
[eff05]
type = PiecewiseLinear
x = '0.3736 0.4026 0.4106 0.4186 0.4266 0.4346 0.4426 0.4506 0.4586 0.4666 0.4746 0.4826 0.5941'
y = '0.9281 0.9263 0.9258 0.9244 0.9226 0.9211 0.9195 0.9162 0.9116 0.9062 0.8995 0.8914 0.7793'
[]
[Rp06]
type = PiecewiseLinear
x = '0.4026 0.4613 0.4723 0.4834 0.4945 0.5055 0.5166 0.5277 0.5387 0.5609 0.5719 0.583 0.5941 0.7124'
y = '1.5533 1.4438 1.4232 1.4011 1.3793 1.3589 1.3354 1.3100 1.2867 1.2376 1.2131 1.1887 1.1636 0.896'
[]
[eff06]
type = PiecewiseLinear
x = '0.4026 0.4613 0.4723 0.4834 0.4945 0.5055 0.5166 0.5277 0.5387 0.5609 0.5719 0.583 0.5941 0.7124'
y = '0.9148 0.9255 0.9275 0.9277 0.9282 0.9295 0.9290 0.9269 0.9242 0.9146 0.9080 0.900 0.8920 0.8061'
[]
[Rp07]
type = PiecewiseLinear
x = '0.4613 0.5447 0.5587 0.5726 0.5866 0.6006 0.6145 0.6285 0.6425 0.6565 0.6704 0.6844 0.6984 0.7124 0.8358'
y = '1.8740 1.6857 1.6541 1.6168 1.5811 1.5430 1.5067 1.4684 1.4292 1.3891 1.3479 1.3061 1.2628 1.2208 0.8498'
[]
[eff07]
type = PiecewiseLinear
x = '0.4613 0.5447 0.5587 0.5726 0.5866 0.6006 0.6145 0.6285 0.6425 0.6565 0.6704 0.6844 0.6984 0.7124 0.8358'
y = '0.9004 0.9232 0.9270 0.9294 0.9298 0.9312 0.9310 0.9290 0.9264 0.9225 0.9191 0.9128 0.9030 0.8904 0.7789'
[]
[Rp08]
type = PiecewiseLinear
x = '0.5447 0.6638 0.6810 0.6982 0.7154 0.7326 0.7498 0.7670 0.7842 0.8014 0.8186 0.8358 0.9702'
y = '2.3005 1.9270 1.8732 1.8195 1.7600 1.7010 1.6357 1.5697 1.5019 1.4327 1.3638 1.2925 0.7347'
[]
[eff08]
type = PiecewiseLinear
x = '0.5447 0.6638 0.6810 0.6982 0.7154 0.7326 0.7498 0.7670 0.7842 0.8014 0.8186 0.8358 0.9702'
y = '0.9102 0.9276 0.9301 0.9313 0.9319 0.9318 0.9293 0.9256 0.9231 0.9153 0.9040 0.8933 0.8098'
[]
[Rp09]
type = PiecewiseLinear
x = '0.6638 0.7762 0.7938 0.8115 0.8291 0.8467 0.8644 0.8820 0.8997 0.9173 0.9349 0.9526 0.9702 1.1107 1.25120'
y = '2.6895 2.2892 2.2263 2.1611 2.0887 2.0061 1.9211 1.8302 1.7409 1.6482 1.5593 1.4612 1.3586 0.5422 -0.2742'
[]
[eff09]
type = PiecewiseLinear
x = '0.6638 0.7762 0.7938 0.8115 0.8291 0.8467 0.8644 0.8820 0.8997 0.9173 0.9349 0.9526 0.9702 1.1107 1.2512'
y = '0.8961 0.9243 0.9288 0.9323 0.9330 0.9325 0.9319 0.9284 0.9254 0.9215 0.9134 0.9051 0.8864 0.7380 0.5896'
[]
[Rp10]
type = PiecewiseLinear
x = '0.7762 0.9255 0.9284 0.9461 0.9546 0.9816 0.9968 1.0170 1.039 1.0525 1.0812 1.0880 1.1056 1.1107 1.2511'
y = '3.3162 2.6391 2.6261 2.5425 2.5000 2.3469 2.2521 2.1211 1.974 1.8806 1.6701 1.6169 1.4710 1.4257 0.1817'
[]
[eff10]
type = PiecewiseLinear
x = '0.7762 0.9255 0.9284 0.9461 0.9546 0.9816 0.9968 1.0170 1.0390 1.0525 1.0812 1.0880 1.1056 1.1107 1.2511'
y = '0.8991 0.9276 0.9281 0.9308 0.9317 0.9329 0.9318 0.9291 0.9252 0.9223 0.9116 0.9072 0.8913 0.8844 0.6937'
[]
[Rp11]
type = PiecewiseLinear
x = '0.9255 1.0749 1.134 1.2511'
y = '3.9586 2.9889 2.605 1.4928'
[]
[eff11]
type = PiecewiseLinear
x = '0.9255 1.0749 1.1340 1.2511'
y = '0.9257 0.9308 0.9328 0.8823'
[]
[S_energy_fcn]
type = ParsedFunction
value = '-(tau_isen+tau_diss)*omega'
vars = 'tau_isen tau_diss omega'
vals = 'compressor:isentropic_torque compressor:dissipation_torque shaft:omega'
[]
[energy_conservation_fcn]
type = ParsedFunction
value = '(E_change - S_energy * dt) / E_tot'
vars = 'E_change S_energy dt E_tot'
vals = 'E_change S_energy ${dt} E_tot'
[]
[]
[Postprocessors]
# mass conservation
[mass_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoA
block = 'pipe'
execute_on = 'initial timestep_end'
[]
[mass_compressor]
type = ScalarVariable
variable = compressor:rhoV
execute_on = 'initial timestep_end'
[]
[mass_tot]
type = SumPostprocessor
values = 'mass_pipes mass_compressor'
execute_on = 'initial timestep_end'
[]
[mass_conservation]
type = ChangeOverTimePostprocessor
postprocessor = mass_tot
change_with_respect_to_initial = true
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
# energy conservation
[E_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
block = 'pipe'
execute_on = 'initial timestep_end'
[]
[E_compressor]
type = ScalarVariable
variable = compressor:rhoEV
execute_on = 'initial timestep_end'
[]
[E_tot]
type = LinearCombinationPostprocessor
pp_coefs = '1 1'
pp_names = 'E_pipes E_compressor'
execute_on = 'initial timestep_end'
[]
[S_energy]
type = FunctionValuePostprocessor
function = S_energy_fcn
execute_on = 'initial timestep_end'
[]
[E_change]
type = ChangeOverTimePostprocessor
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
# This should also execute on initial. This value is
# lagged by one timestep as a workaround to moose issue #13262.
[energy_conservation]
type = FunctionValuePostprocessor
function = energy_conservation_fcn
execute_on = 'timestep_end'
[]
[]
[Preconditioning]
[SMP_PJFNK]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'implicit-euler'
dt = ${dt}
num_steps = 6
solve_type = 'NEWTON'
line_search = 'basic'
petsc_options_iname = '-pc_type'
petsc_options_value = ' lu'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-4
l_max_its = 10
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Outputs]
velocity_as_vector = false
[]
(modules/thermal_hydraulics/test/tests/components/junction_parallel_channels_1phase/conservation.i)
# Junction between 2 pipes where the second has half the area of the first.
# The momentum density of the second should be twice that of the first.
[GlobalParams]
gravity_vector = '0 0 0'
initial_T = 300
initial_p = 1e5
initial_vel = 20
initial_vel_x = 20
initial_vel_y = 0
initial_vel_z = 0
f = 0
fp = eos
scaling_factor_1phase = '1 1e-2 1e-5'
closures = simple_closures
[]
[Modules/FluidProperties]
[eos]
type = StiffenedGasFluidProperties
gamma = 1.4
cv = 725
p_inf = 0
q = 0
q_prime = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[pipe1]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
length = 1
A = 1
n_elems = 20
[]
[junction1]
type = JunctionParallelChannels1Phase
connections = 'pipe1:out pipe2:in'
scaling_factor_rhouV = 1e-4
scaling_factor_rhoEV = 1e-5
position = '1 0 0'
volume = 1e-2
[]
[pipe2]
type = FlowChannel1Phase
position = '1 0 0'
orientation = '1 0 0'
length = 1
A = 0.5
n_elems = 20
[]
[junction2]
type = JunctionParallelChannels1Phase
connections = 'pipe2:out pipe1:in'
scaling_factor_rhouV = 1e-4
scaling_factor_rhoEV = 1e-5
position = '1 0 0'
volume = 1e-2
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
start_time = 0
dt = 0.05
num_steps = 5
abort_on_solve_fail = true
solve_type = 'NEWTON'
line_search = basic
petsc_options_iname = '-pc_type'
petsc_options_value = ' lu'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 20
l_tol = 1e-3
l_max_its = 20
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Postprocessors]
# mass conservation
[mass_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoA
block = 'pipe1 pipe2'
execute_on = 'initial timestep_end'
[]
[mass_junction1]
type = ScalarVariable
variable = junction1:rhoV
execute_on = 'initial timestep_end'
[]
[mass_junction2]
type = ScalarVariable
variable = junction2:rhoV
execute_on = 'initial timestep_end'
[]
[mass_tot]
type = SumPostprocessor
values = 'mass_pipes mass_junction1 mass_junction2'
execute_on = 'initial timestep_end'
[]
[mass_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = mass_tot
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
# energy conservation
[E_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
block = 'pipe1 pipe2'
execute_on = 'initial timestep_end'
[]
[E_junction1]
type = ScalarVariable
variable = junction1:rhoEV
execute_on = 'initial timestep_end'
[]
[E_junction2]
type = ScalarVariable
variable = junction2:rhoEV
execute_on = 'initial timestep_end'
[]
[E_tot]
type = SumPostprocessor
values = 'E_pipes E_junction1 E_junction2'
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
[]
[Outputs]
[out]
type = CSV
show = 'mass_tot_change E_tot_change'
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/from_file_3d.i)
T_hs = 300
T_ambient1 = 500
htc1 = 100
T_ambient2 = 400
htc2 = 300
t = 0.001
# dimensions of the side 'left'
height = 5
depth = 2
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
A = ${fparse height * depth}
heat_flux_avg = ${fparse 0.5 * (htc1 * (T_ambient1 - T_hs) + htc2 * (T_ambient2 - T_hs))}
heat_flux_integral = ${fparse heat_flux_avg * A}
scale = 0.8
E_change = ${fparse scale * heat_flux_integral * t}
[Functions]
[T_ambient_fn]
type = PiecewiseConstant
axis = z
x = '-2.5 0'
y = '${T_ambient1} ${T_ambient2}'
[]
[htc_ambient_fn]
type = PiecewiseConstant
axis = z
x = '-2.5 0'
y = '${htc1} ${htc2}'
[]
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'hs:brick'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '${density} ${specific_heat_capacity} ${conductivity}'
[]
[]
[Components]
[hs]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = ${T_hs}
[]
[ambient_convection]
type = HSBoundaryAmbientConvection
boundary = 'hs:left'
hs = hs
T_ambient = T_ambient_fn
htc_ambient = htc_ambient_fn
scale_pp = bc_scale_pp
[]
[]
[Postprocessors]
[bc_scale_pp]
type = FunctionValuePostprocessor
function = ${scale}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs]
type = ADHeatStructureEnergy3D
block = 'hs:brick'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
exodus = true
[]
(modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_flux_1phase/phy.energy_heatflux_ss_1phase.i)
# This test tests conservation of energy at steady state for 1-phase flow when a
# heat flux is specified. Conservation is checked by comparing the integral of
# the heat flux against the difference of the boundary fluxes.
[GlobalParams]
initial_p = 7.0e6
initial_vel = 0
initial_T = 513
gravity_vector = '0.0 0.0 0.0'
closures = simple_closures
[]
[Modules/FluidProperties]
[eos]
type = StiffenedGasFluidProperties
gamma = 2.35
q = -1167e3
q_prime = 0
p_inf = 1.e9
cv = 1816
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[pipe]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '0 0 1'
length = 3.66
n_elems = 10
A = 1.907720E-04
D_h = 1.698566E-02
f = 0.0
fp = eos
[]
[ht_pipe]
type = HeatTransferFromHeatFlux1Phase
flow_channel = pipe
q_wall = 1.0e5
Hw = 1.0e4
P_hf = 4.4925e-2
[]
[inlet]
type = SolidWall1Phase
input = 'pipe:in'
[]
[outlet]
type = SolidWall1Phase
input = 'pipe:out'
[]
[]
[Postprocessors]
[E]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
execute_on = 'initial timestep_end'
[]
[E_change]
type = ChangeOverTimePostprocessor
postprocessor = E
execute_on = 'initial timestep_end'
[]
[]
[Preconditioning]
[SMP_PJFNK]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
abort_on_solve_fail = true
dt = 1
solve_type = 'NEWTON'
line_search = 'basic'
nl_rel_tol = 1e-10
nl_abs_tol = 1e-7
nl_max_its = 50
l_tol = 1e-3
l_max_its = 60
start_time = 0
num_steps = 10
[]
[Outputs]
[out]
type = CSV
show = 'E_change'
[]
[console]
type = Console
show = 'E_change'
[]
[]
(modules/porous_flow/examples/lava_lamp/1phase_convection.i)
# Two phase density-driven convection of dissolved CO2 in brine
#
# The model starts with CO2 in the liquid phase only. The CO2 diffuses into the brine.
# As the density of the CO2-saturated brine is greater
# than the unsaturated brine, a gravitational instability arises and density-driven
# convection of CO2-rich fingers descend into the unsaturated brine.
#
# The instability is seeded by a random perturbation to the porosity field.
# Mesh adaptivity is used to refine the mesh as the fingers form.
#
# Note: this model is computationally expensive, so should be run with multiple cores.
[GlobalParams]
PorousFlowDictator = 'dictator'
gravity = '0 -9.81 0'
[]
[Adaptivity]
max_h_level = 2
marker = marker
initial_marker = initial
initial_steps = 2
[Indicators]
[indicator]
type = GradientJumpIndicator
variable = zi
[]
[]
[Markers]
[marker]
type = ErrorFractionMarker
indicator = indicator
refine = 0.8
[]
[initial]
type = BoxMarker
bottom_left = '0 1.95 0'
top_right = '2 2 0'
inside = REFINE
outside = DO_NOTHING
[]
[]
[]
[Mesh]
type = GeneratedMesh
dim = 2
ymin = 1.5
ymax = 2
xmax = 2
ny = 20
nx = 40
bias_y = 0.95
[]
[AuxVariables]
[xnacl]
initial_condition = 0.01
[]
[saturation_gas]
order = FIRST
family = MONOMIAL
[]
[xco2l]
order = FIRST
family = MONOMIAL
[]
[density_liquid]
order = FIRST
family = MONOMIAL
[]
[porosity]
order = CONSTANT
family = MONOMIAL
[]
[]
[AuxKernels]
[saturation_gas]
type = PorousFlowPropertyAux
variable = saturation_gas
property = saturation
phase = 1
execute_on = 'timestep_end'
[]
[xco2l]
type = PorousFlowPropertyAux
variable = xco2l
property = mass_fraction
phase = 0
fluid_component = 1
execute_on = 'timestep_end'
[]
[density_liquid]
type = PorousFlowPropertyAux
variable = density_liquid
property = density
phase = 0
execute_on = 'timestep_end'
[]
[]
[Variables]
[pgas]
[]
[zi]
scaling = 1e4
[]
[]
[ICs]
[pressure]
type = FunctionIC
function = 10e6-9.81*1000*y
variable = pgas
[]
[zi]
type = ConstantIC
value = 0
variable = zi
[]
[porosity]
type = RandomIC
variable = porosity
min = 0.25
max = 0.275
seed = 0
[]
[]
[BCs]
[top]
type = DirichletBC
value = 0.04
variable = zi
boundary = top
[]
[]
[Kernels]
[mass0]
type = PorousFlowMassTimeDerivative
fluid_component = 0
variable = pgas
[]
[flux0]
type = PorousFlowAdvectiveFlux
fluid_component = 0
variable = pgas
[]
[diff0]
type = PorousFlowDispersiveFlux
fluid_component = 0
variable = pgas
disp_long = '0 0'
disp_trans = '0 0'
[]
[mass1]
type = PorousFlowMassTimeDerivative
fluid_component = 1
variable = zi
[]
[flux1]
type = PorousFlowAdvectiveFlux
fluid_component = 1
variable = zi
[]
[diff1]
type = PorousFlowDispersiveFlux
fluid_component = 1
variable = zi
disp_long = '0 0'
disp_trans = '0 0'
[]
[]
[UserObjects]
[dictator]
type = PorousFlowDictator
porous_flow_vars = 'pgas zi'
number_fluid_phases = 2
number_fluid_components = 2
[]
[pc]
type = PorousFlowCapillaryPressureConst
pc = 0
[]
[fs]
type = PorousFlowBrineCO2
brine_fp = brine
co2_fp = co2
capillary_pressure = pc
[]
[]
[Modules]
[FluidProperties]
[co2sw]
type = CO2FluidProperties
[]
[co2]
type = TabulatedFluidProperties
fp = co2sw
[]
[brine]
type = BrineFluidProperties
[]
[]
[]
[Materials]
[temperature]
type = PorousFlowTemperature
temperature = '45'
[]
[brineco2]
type = PorousFlowFluidState
gas_porepressure = 'pgas'
z = 'zi'
temperature_unit = Celsius
xnacl = 'xnacl'
capillary_pressure = pc
fluid_state = fs
[]
[porosity]
type = PorousFlowPorosityConst
porosity = porosity
[]
[permeability]
type = PorousFlowPermeabilityConst
permeability = '1e-11 0 0 0 1e-11 0 0 0 1e-11'
[]
[relperm_water]
type = PorousFlowRelativePermeabilityCorey
phase = 0
n = 2
s_res = 0.1
sum_s_res = 0.2
[]
[relperm_gas]
type = PorousFlowRelativePermeabilityCorey
phase = 1
n = 2
s_res = 0.1
sum_s_res = 0.2
[]
[diffusivity]
type = PorousFlowDiffusivityConst
diffusion_coeff = '2e-9 2e-9 2e-9 2e-9'
tortuosity = '1 1'
[]
[]
[Preconditioning]
active = basic
[mumps_is_best_for_parallel_jobs]
type = SMP
full = true
petsc_options_iname = '-pc_type -pc_factor_mat_solver_package'
petsc_options_value = ' lu mumps'
[]
[basic]
type = SMP
full = true
petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -sub_pc_factor_shift_type -pc_asm_overlap'
petsc_options_value = 'gmres asm lu NONZERO 2 '
[]
[]
[Executioner]
type = Transient
solve_type = NEWTON
end_time = 1e6
nl_max_its = 25
l_max_its = 100
dtmax = 1e4
nl_abs_tol = 1e-6
[TimeStepper]
type = IterationAdaptiveDT
dt = 100
growth_factor = 2
cutback_factor = 0.5
[]
[]
[Functions]
[flux]
type = ParsedFunction
vals = 'delta_xco2 dt'
vars = 'dx dt'
value = 'dx/dt'
[]
[]
[Postprocessors]
[total_co2_in_gas]
type = PorousFlowFluidMass
phase = 1
fluid_component = 1
[]
[total_co2_in_liquid]
type = PorousFlowFluidMass
phase = 0
fluid_component = 1
[]
[numdofs]
type = NumDOFs
[]
[delta_xco2]
type = ChangeOverTimePostprocessor
postprocessor = total_co2_in_liquid
[]
[dt]
type = TimestepSize
[]
[flux]
type = FunctionValuePostprocessor
function = flux
[]
[]
[Outputs]
print_linear_residuals = false
perf_graph = true
exodus = true
csv = true
[]
(modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_3d/jac.1phase.i)
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'blk:0'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '1000 100 30'
[]
[]
[Modules/FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 2.35
cv = 1816.0
q = -1.167e6
p_inf = 1.0e9
q_prime = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Functions]
[T_init]
type = ParsedFunction
value = '1000*y+300+30*z'
[]
[]
[GlobalParams]
scaling_factor_1phase = '1 1 1e-3'
gravity_vector = '0 0 0'
[]
[Components]
[fch]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '0 0 1'
fp = fp
n_elems = 6
length = 1
initial_T = T_init
initial_p = 1.01e5
initial_vel = 0
closures = simple_closures
A = 0.00314159
D_h = 0.2
f = 0.01
[]
[in]
type = InletVelocityTemperature1Phase
input = 'fch:in'
vel = 1
T = 300
[]
[out]
type = Outlet1Phase
input = 'fch:out'
p = 1.01e5
[]
[blk]
type = HeatStructureFromFile3D
file = mesh.e
position = '0 0 0'
initial_T = T_init
[]
[ht]
type = HeatTransferFromHeatStructure3D1Phase
flow_channels = 'fch'
hs = blk
boundary = blk:rmin
Hw = 10000
P_hf = 0.1564344650402309
[]
[]
[Postprocessors]
[energy_hs]
type = ADHeatStructureEnergy3D
block = blk:0
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_fch]
type = ElementIntegralVariablePostprocessor
block = fch
variable = rhoEA
execute_on = 'INITIAL TIMESTEP_END'
[]
[total_energy]
type = SumPostprocessor
values = 'energy_fch energy_hs'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = total_energy
compute_relative_change = true
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
petsc_options_iname = '-snes_test_err'
petsc_options_value = ' 1e-9'
[]
[]
[Executioner]
type = Transient
scheme = bdf2
dt = 0.1
num_steps = 1
solve_type = PJFNK
line_search = basic
abort_on_solve_fail = true
nl_abs_tol = 1e-8
[]
[Outputs]
file_base = 'phy.conservation'
csv = true
show = 'energy_change'
execute_on = 'final'
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/cylindrical.i)
T_hs = 300
T_ambient1 = 500
htc1 = 100
T_ambient2 = 400
htc2 = 300
t = 0.001
L = 2
D_i = 0.2
thickness = 0.5
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
R_i = ${fparse 0.5 * D_i}
D_o = ${fparse D_i + 2 * thickness}
A = ${fparse pi * D_o * L}
heat_flux_avg = ${fparse 0.5 * (htc1 * (T_ambient1 - T_hs) + htc2 * (T_ambient2 - T_hs))}
heat_flux_integral = ${fparse heat_flux_avg * A}
scale = 0.8
E_change = ${fparse scale * heat_flux_integral * t}
[Functions]
[T_ambient_fn]
type = PiecewiseConstant
axis = z
x = '0 1'
y = '${T_ambient1} ${T_ambient2}'
[]
[htc_ambient_fn]
type = PiecewiseConstant
axis = z
x = '0 1'
y = '${htc1} ${htc2}'
[]
[]
[HeatStructureMaterials]
[hs_mat]
type = SolidMaterialProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructureCylindrical
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
inner_radius = ${R_i}
widths = '${thickness}'
n_part_elems = '10'
materials = 'hs_mat'
names = 'region'
initial_T = ${T_hs}
[]
[ambient_convection]
type = HSBoundaryAmbientConvection
boundary = 'hs:outer'
hs = hs
T_ambient = T_ambient_fn
htc_ambient = htc_ambient_fn
scale_pp = bc_scale_pp
[]
[]
[Postprocessors]
[bc_scale_pp]
type = FunctionValuePostprocessor
function = ${scale}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs]
type = ADHeatStructureEnergyRZ
block = 'hs:region'
axis_dir = '0 0 1'
axis_point = '0 0 0'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/shaft_connected_turbine_1phase/shaft_motor_turbine.i)
area = 0.2359
dt = 1.e-3
[GlobalParams]
initial_p = 2e5
initial_T = 600
initial_vel = 100
initial_vel_x = 100
initial_vel_y = 0
initial_vel_z = 0
A = ${area}
A_ref = ${area}
f = 100
scaling_factor_1phase = '0.04 0.04 0.04e-5'
closures = simple_closures
fp = fp
[]
[Modules/FluidProperties]
[fp]
type = IdealGasFluidProperties
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[turbine]
type = ShaftConnectedTurbine1Phase
inlet = 'pipe:out'
outlet = 'pipe:in'
position = '0 0 0'
volume = 0.2
inertia_coeff = '1 1 1 1'
inertia_const = 1.61397
speed_cr_I = 1e12
speed_cr_fr = 0
tau_fr_coeff = '0 0 0 0'
tau_fr_const = 0
omega_rated = 100
D_wheel = 0.4
head_coefficient = head
power_coefficient = power
[]
[pipe]
type = FlowChannel1Phase
position = '0.1 0 0'
orientation = '1 0 0'
length = 10
n_elems = 20
initial_p = 2e6
[]
[dyno]
type = ShaftConnectedMotor
inertia = 1e2
torque = -1e3
[]
[shaft]
type = Shaft
connected_components = 'dyno turbine'
initial_speed = 300
[]
[]
[Functions]
[head]
type = PiecewiseLinear
x = '0 7e-3 1e-2'
y = '0 15 20'
[]
[power]
type = PiecewiseLinear
x = '0 6e-3 1e-2'
y = '0 0.05 0.18'
[]
[S_energy_fcn]
type = ParsedFunction
value = '-(tau_driving+tau_fr)*omega'
vars = 'tau_driving tau_fr omega'
vals = 'turbine:driving_torque turbine:friction_torque shaft:omega'
[]
[energy_conservation_fcn]
type = ParsedFunction
value = '(E_change - S_energy * dt) / E_tot'
vars = 'E_change S_energy dt E_tot'
vals = 'E_change S_energy ${dt} E_tot'
[]
[]
[Postprocessors]
# mass conservation
[mass_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoA
block = 'pipe'
execute_on = 'initial timestep_end'
[]
[mass_turbine]
type = ScalarVariable
variable = turbine:rhoV
execute_on = 'initial timestep_end'
[]
[mass_tot]
type = SumPostprocessor
values = 'mass_pipes mass_turbine'
execute_on = 'initial timestep_end'
[]
[mass_conservation]
type = ChangeOverTimePostprocessor
postprocessor = mass_tot
change_with_respect_to_initial = true
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
# energy conservation
[E_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
block = 'pipe'
execute_on = 'initial timestep_end'
[]
[E_turbine]
type = ScalarVariable
variable = turbine:rhoEV
execute_on = 'initial timestep_end'
[]
[E_tot]
type = LinearCombinationPostprocessor
pp_coefs = '1 1'
pp_names = 'E_pipes E_turbine'
execute_on = 'initial timestep_end'
[]
[S_energy]
type = FunctionValuePostprocessor
function = S_energy_fcn
execute_on = 'initial timestep_end'
[]
[E_change]
type = ChangeOverTimePostprocessor
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
# This should also execute on initial. This value is
# lagged by one timestep as a workaround to moose issue #13262.
[energy_conservation]
type = FunctionValuePostprocessor
function = energy_conservation_fcn
execute_on = 'timestep_end'
[]
[]
[Preconditioning]
[SMP]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'implicit-euler'
dt = ${dt}
num_steps = 6
solve_type = 'PJFNK'
line_search = 'basic'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-4
l_max_its = 10
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Outputs]
velocity_as_vector = false
[]
(modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_3d/err.not_a_3d_hs.i)
[GlobalParams]
scaling_factor_1phase = '1 1 1e-3'
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'blk:0'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '1000 100 30'
[]
[]
[Modules/FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 2.35
cv = 1816.0
q = -1.167e6
p_inf = 1.0e9
q_prime = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Functions]
[T_init]
type = ParsedFunction
value = '1000*y+300+30*z'
[]
[]
[Components]
[fch]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '0 0 1'
fp = fp
n_elems = 6
length = 1
initial_T = 300
initial_p = 1.01e5
initial_vel = 1
closures = simple_closures
A = 0.00314159
D_h = 0.2
f = 0.01
[]
[in]
type = InletVelocityTemperature1Phase
input = 'fch:in'
vel = 1
T = 300
[]
[out]
type = Outlet1Phase
input = 'fch:out'
p = 1.01e5
[]
[blk]
type = HeatStructureCylindrical
position = '0 0 0'
orientation = '0 0 1'
widths = 0.1
inner_radius = 0.1
length = 1
n_elems = 6
n_part_elems = 1
initial_T = T_init
materials = 'mat'
names = blk
[]
[ht]
type = HeatTransferFromHeatStructure3D1Phase
flow_channels = 'fch'
hs = blk
boundary = blk:inner
Hw = 10000
P_hf = 0.156434465
[]
[]
[Postprocessors]
[energy_hs]
type = HeatStructureEnergy3D
block = blk:0
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_fch]
type = ElementIntegralVariablePostprocessor
block = fch
variable = rhoEA
execute_on = 'INITIAL TIMESTEP_END'
[]
[total_energy]
type = SumPostprocessor
values = 'energy_fch energy_hs'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = total_energy
compute_relative_change = false
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
dt = 1
solve_type = PJFNK
line_search = basic
num_steps = 1000
steady_state_detection = true
steady_state_tolerance = 1e-08
nl_abs_tol = 1e-8
[]
[Outputs]
exodus = true
[]
(modules/porous_flow/examples/lava_lamp/2phase_convection.i)
# Two phase density-driven convection of dissolved CO2 in brine
#
# Initially, the model has a gas phase at the top with a saturation of 0.29
# (which corresponds to an initial value of zi = 0.2).
# Diffusion of the dissolved CO2
# component from the saturated liquid to the unsaturated liquid below reduces the
# amount of CO2 in the gas phase. As the density of the CO2-saturated brine is greater
# than the unsaturated brine, a gravitational instability arises and density-driven
# convection of CO2-rich fingers descend into the unsaturated brine.
#
# The instability is seeded by a random perturbation to the porosity field.
# Mesh adaptivity is used to refine the mesh as the fingers form.
#
# Note: this model is computationally expensive, so should be run with multiple cores,
# preferably on a cluster.
[GlobalParams]
PorousFlowDictator = 'dictator'
gravity = '0 -9.81 0'
[]
[Adaptivity]
max_h_level = 2
marker = marker
initial_marker = initial
initial_steps = 2
[Indicators]
[indicator]
type = GradientJumpIndicator
variable = zi
[]
[]
[Markers]
[marker]
type = ErrorFractionMarker
indicator = indicator
refine = 0.8
[]
[initial]
type = BoxMarker
bottom_left = '0 1.95 0'
top_right = '2 2 0'
inside = REFINE
outside = DO_NOTHING
[]
[]
[]
[Mesh]
type = GeneratedMesh
dim = 2
ymax = 2
xmax = 2
ny = 40
nx = 40
bias_y = 0.95
[]
[Kernels]
[mass0]
type = PorousFlowMassTimeDerivative
fluid_component = 0
variable = pgas
[]
[flux0]
type = PorousFlowAdvectiveFlux
fluid_component = 0
variable = pgas
[]
[diff0]
type = PorousFlowDispersiveFlux
fluid_component = 0
variable = pgas
disp_long = '0 0'
disp_trans = '0 0'
[]
[mass1]
type = PorousFlowMassTimeDerivative
fluid_component = 1
variable = zi
[]
[flux1]
type = PorousFlowAdvectiveFlux
fluid_component = 1
variable = zi
[]
[diff1]
type = PorousFlowDispersiveFlux
fluid_component = 1
variable = zi
disp_long = '0 0'
disp_trans = '0 0'
[]
[]
[AuxVariables]
[xnacl]
initial_condition = 0.01
[]
[saturation_gas]
order = FIRST
family = MONOMIAL
[]
[xco2l]
order = FIRST
family = MONOMIAL
[]
[density_liquid]
order = FIRST
family = MONOMIAL
[]
[porosity]
order = CONSTANT
family = MONOMIAL
[]
[]
[AuxKernels]
[saturation_gas]
type = PorousFlowPropertyAux
variable = saturation_gas
property = saturation
phase = 1
execute_on = 'timestep_end'
[]
[xco2l]
type = PorousFlowPropertyAux
variable = xco2l
property = mass_fraction
phase = 0
fluid_component = 1
execute_on = 'timestep_end'
[]
[density_liquid]
type = PorousFlowPropertyAux
variable = density_liquid
property = density
phase = 0
execute_on = 'timestep_end'
[]
[]
[Variables]
[pgas]
[]
[zi]
scaling = 1e4
[]
[]
[ICs]
[pressure]
type = FunctionIC
function = 10e6-9.81*1000*y
variable = pgas
[]
[zi]
type = BoundingBoxIC
variable = zi
x1 = 0
x2 = 2
y1 = 1.95
y2 = 2
inside = 0.2
outside = 0
[]
[porosity]
type = RandomIC
variable = porosity
min = 0.25
max = 0.275
seed = 0
[]
[]
[UserObjects]
[dictator]
type = PorousFlowDictator
porous_flow_vars = 'pgas zi'
number_fluid_phases = 2
number_fluid_components = 2
[]
[pc]
type = PorousFlowCapillaryPressureConst
pc = 0
[]
[fs]
type = PorousFlowBrineCO2
brine_fp = brine
co2_fp = co2
capillary_pressure = pc
[]
[]
[Modules]
[FluidProperties]
[co2sw]
type = CO2FluidProperties
[]
[co2]
type = TabulatedFluidProperties
fp = co2sw
[]
[brine]
type = BrineFluidProperties
[]
[]
[]
[Materials]
[temperature]
type = PorousFlowTemperature
temperature = '45'
[]
[brineco2]
type = PorousFlowFluidState
gas_porepressure = 'pgas'
z = 'zi'
temperature_unit = Celsius
xnacl = 'xnacl'
capillary_pressure = pc
fluid_state = fs
[]
[porosity]
type = PorousFlowPorosityConst
porosity = porosity
[]
[permeability]
type = PorousFlowPermeabilityConst
permeability = '1e-11 0 0 0 1e-11 0 0 0 1e-11'
[]
[relperm_water]
type = PorousFlowRelativePermeabilityCorey
phase = 0
n = 2
s_res = 0.1
sum_s_res = 0.2
[]
[relperm_gas]
type = PorousFlowRelativePermeabilityCorey
phase = 1
n = 2
s_res = 0.1
sum_s_res = 0.2
[]
[diffusivity]
type = PorousFlowDiffusivityConst
diffusion_coeff = '2e-9 2e-9 2e-9 2e-9'
tortuosity = '1 1'
[]
[]
[Preconditioning]
active = basic
[mumps_is_best_for_parallel_jobs]
type = SMP
full = true
petsc_options_iname = '-pc_type -pc_factor_mat_solver_package'
petsc_options_value = ' lu mumps'
[]
[basic]
type = SMP
full = true
petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -sub_pc_factor_shift_type -pc_asm_overlap'
petsc_options_value = 'gmres asm lu NONZERO 2 '
[]
[]
[Executioner]
type = Transient
solve_type = NEWTON
end_time = 1e6
nl_max_its = 25
l_max_its = 100
dtmax = 1e4
nl_abs_tol = 1e-6
[TimeStepper]
type = IterationAdaptiveDT
dt = 10
growth_factor = 2
cutback_factor = 0.5
[]
[]
[Functions]
[flux]
type = ParsedFunction
vals = 'delta_xco2 dt'
vars = 'dx dt'
value = 'dx/dt'
[]
[]
[Postprocessors]
[total_co2_in_gas]
type = PorousFlowFluidMass
phase = 1
fluid_component = 1
[]
[total_co2_in_liquid]
type = PorousFlowFluidMass
phase = 0
fluid_component = 1
[]
[numdofs]
type = NumDOFs
[]
[delta_xco2]
type = ChangeOverTimePostprocessor
postprocessor = total_co2_in_liquid
[]
[dt]
type = TimestepSize
[]
[flux]
type = FunctionValuePostprocessor
function = flux
[]
[]
[Outputs]
print_linear_residuals = false
perf_graph = true
exodus = true
csv = true
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/cylindrical.i)
T_hs = 300
heat_flux = 1000
t = 0.001
L = 2
D_i = 0.2
thickness = 0.5
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
R_i = ${fparse 0.5 * D_i}
D_o = ${fparse D_i + 2 * thickness}
A = ${fparse pi * D_o * L}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[Functions]
[q_fn]
type = ConstantFunction
value = ${heat_flux}
[]
[]
[HeatStructureMaterials]
[hs_mat]
type = SolidMaterialProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructureCylindrical
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
inner_radius = ${R_i}
widths = '${thickness}'
n_part_elems = '10'
materials = 'hs_mat'
names = 'region'
initial_T = ${T_hs}
[]
[heat_flux_boundary]
type = HSBoundaryHeatFlux
boundary = 'hs:outer'
hs = hs
q = q_fn
scale_pp = bc_scale_pp
[]
[]
[Postprocessors]
[bc_scale_pp]
type = FunctionValuePostprocessor
function = ${scale}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs]
type = ADHeatStructureEnergyRZ
block = 'hs:region'
axis_dir = '0 0 1'
axis_point = '0 0 0'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/shaft_connected_pump_1phase/pump_coastdown.i)
# Pump data used in this test comes from the Semiscale Program, summarized in NUREG/CR-4945
initial_T = 393.15
area = 1e-2
dt = 0.005
[GlobalParams]
initial_p = 1.4E+07
initial_T = ${initial_T}
initial_vel = 0.01
initial_vel_x = 0.01
initial_vel_y = 0
initial_vel_z = 0
A = ${area}
A_ref = ${area}
f = 100
scaling_factor_1phase = '1 1 1e-3'
closures = simple_closures
rdg_slope_reconstruction = minmod
fp = fp
[]
[Modules/FluidProperties]
[fp]
type = IdealGasFluidProperties
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[pump]
type = ShaftConnectedPump1Phase
inlet = 'pipe:out'
outlet = 'pipe:in'
position = '0 0 0'
scaling_factor_rhoEV = 1e-5
volume = 0.3
inertia_coeff = '1 1 1 1'
inertia_const = 0.5
omega_rated = 314
speed_cr_I = 1e12
speed_cr_fr = 0.001
torque_rated = 47.1825
volumetric_rated = 1
head_rated = 58.52
tau_fr_coeff = '4 0 80 0'
tau_fr_const = 8
head = head_fcn
torque_hydraulic = torque_fcn
density_rated = 124.2046
[]
[pipe]
type = FlowChannel1Phase
position = '0.6096 0 0'
orientation = '1 0 0'
length = 10
n_elems = 20
[]
[shaft]
type = Shaft
connected_components = 'pump'
initial_speed = 1
[]
[]
[Functions]
[head_fcn]
type = PiecewiseLinear
data_file = semiscale_head_data.csv
format = columns
[]
[torque_fcn]
type = PiecewiseLinear
data_file = semiscale_torque_data.csv
format = columns
[]
[S_energy_fcn]
type = ParsedFunction
value = '-tau_hyd * omega'
vars = 'tau_hyd omega'
vals = 'pump:hydraulic_torque shaft:omega'
[]
[energy_conservation_fcn]
type = ParsedFunction
value = '(E_change - S_energy * dt) / E_tot'
vars = 'E_change S_energy dt E_tot'
vals = 'E_change S_energy ${dt} E_tot'
[]
[]
[Postprocessors]
# mass conservation
[mass_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoA
block = 'pipe'
execute_on = 'initial timestep_end'
[]
[mass_pump]
type = ScalarVariable
variable = pump:rhoV
execute_on = 'initial timestep_end'
[]
[mass_tot]
type = SumPostprocessor
values = 'mass_pipes mass_pump'
execute_on = 'initial timestep_end'
[]
[mass_conservation]
type = ChangeOverTimePostprocessor
postprocessor = mass_tot
change_with_respect_to_initial = true
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
# energy conservation
[E_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
block = 'pipe'
execute_on = 'initial timestep_end'
[]
[E_pump]
type = ScalarVariable
variable = pump:rhoEV
execute_on = 'initial timestep_end'
[]
[E_tot]
type = LinearCombinationPostprocessor
pp_coefs = '1 1'
pp_names = 'E_pipes E_pump'
execute_on = 'initial timestep_end'
[]
[S_energy]
type = FunctionValuePostprocessor
function = S_energy_fcn
execute_on = 'initial timestep_end'
[]
[E_change]
type = ChangeOverTimePostprocessor
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
# This should also execute on initial. This value is
# lagged by one timestep as a workaround to moose issue #13262.
[energy_conservation]
type = FunctionValuePostprocessor
function = energy_conservation_fcn
execute_on = 'timestep_end'
[]
[]
[Preconditioning]
[SMP]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
dt = ${dt}
num_steps = 40
solve_type = 'NEWTON'
line_search = 'basic'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-8
nl_max_its = 15
l_tol = 1e-4
l_max_its = 10
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Outputs]
velocity_as_vector = false
exodus = true
[]
(modules/thermal_hydraulics/test/tests/components/heat_source_from_power_density/phy.conservation_from_file_3d.i)
t = 0.5
# these are the dimensions of rgn1 from box.e
width = 1.5
height = 5
depth = 2
density = 3
specific_heat_capacity = 1
conductivity = 5
power_density = 20
E_change = ${fparse power_density * width * height * depth * t}
[Functions]
[power_density_fn]
type = ConstantFunction
value = ${power_density}
[]
[]
[AuxVariables]
[power_density]
family = MONOMIAL
order = CONSTANT
block = 'heat_structure:rgn1'
[]
[]
[AuxKernels]
[mock_power_aux]
type = FunctionAux
variable = power_density
function = power_density_fn
[]
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'heat_structure:rgn1 heat_structure:rgn2'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '${density} ${specific_heat_capacity} ${conductivity}'
[]
[]
[Components]
[heat_structure]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = 300
[]
[heat_generation]
type = HeatSourceFromPowerDensity
hs = heat_structure
regions = 'rgn1'
power_density = power_density
[]
[]
[Postprocessors]
[E_tot]
type = ADHeatStructureEnergy3D
block = 'heat_structure:rgn1 heat_structure:rgn2'
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
[E_tot_change_rel_err]
type = RelativeDifferencePostprocessor
value1 = E_tot_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'newton'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-3
l_max_its = 10
start_time = 0.0
dt = 0.5
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
csv = true
show = 'E_tot_change_rel_err'
execute_on = 'final'
[]
(modules/thermal_hydraulics/test/tests/components/heat_transfer_from_specified_temperature_1phase/phy.energy_walltemperature_ss_1phase.i)
# This test tests conservation of energy at steady state for 1-phase flow when
# wall temperature is specified. Conservation is checked by comparing the
# integral of the heat flux against the difference of the boundary fluxes.
[GlobalParams]
initial_p = 7.0e6
initial_vel = 0
initial_T = 513
gravity_vector = '0.0 0.0 0.0'
closures = simple_closures
[]
[Modules/FluidProperties]
[eos]
type = StiffenedGasFluidProperties
gamma = 2.35
cv = 1816.0
q = -1.167e6
p_inf = 1.0e9
q_prime = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[pipe]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '0 0 1'
length = 3.66
n_elems = 10
A = 1.907720E-04
D_h = 1.698566E-02
f = 0.0
fp = eos
[]
[ht_pipe]
type = HeatTransferFromSpecifiedTemperature1Phase
flow_channel = pipe
T_wall = 550
Hw = 1.0e3
P_hf = 4.4925e-2
[]
[inlet]
type = SolidWall1Phase
input = 'pipe:in'
[]
[outlet]
type = SolidWall1Phase
input = 'pipe:out'
[]
[]
[Postprocessors]
[hf_pipe]
type = ADHeatRateConvection1Phase
block = pipe
T_wall = T_wall
T = T
Hw = Hw
P_hf = P_hf
execute_on = 'initial timestep_end'
[]
[heat_added]
type = TimeIntegratedPostprocessor
value = hf_pipe
execute_on = 'initial timestep_end'
[]
[E]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
execute_on = 'initial timestep_end'
[]
[E_change]
type = ChangeOverTimePostprocessor
postprocessor = E
change_with_respect_to_initial = true
execute_on = 'initial timestep_end'
[]
[E_conservation]
type = DifferencePostprocessor
value1 = heat_added
value2 = E_change
execute_on = 'initial timestep_end'
[]
[]
[Preconditioning]
[SMP_PJFNK]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = crank-nicolson
abort_on_solve_fail = true
dt = 1e-1
solve_type = 'NEWTON'
line_search = 'basic'
petsc_options_iname = '-pc_type'
petsc_options_value = ' lu'
nl_rel_tol = 1e-9
nl_abs_tol = 1e-8
nl_max_its = 50
l_tol = 1e-3
l_max_its = 60
start_time = 0
num_steps = 10
[]
[Outputs]
[out]
type = CSV
show = 'E_conservation'
[]
[console]
type = Console
show = 'E_conservation'
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/cylindrical.i)
T_hs = 1200
T_ambient = 1500
emissivity = 0.3
view_factor = 0.6
t = 5.0
L = 2
D_i = 0.2
thickness = 0.5
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
stefan_boltzmann = 5.670367e-8
R_i = ${fparse 0.5 * D_i}
D_o = ${fparse D_i + 2 * thickness}
A = ${fparse pi * D_o * L}
heat_flux = ${fparse stefan_boltzmann * emissivity * view_factor * (T_ambient^4 - T_hs^4)}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[HeatStructureMaterials]
[hs_mat]
type = SolidMaterialProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructureCylindrical
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
inner_radius = ${R_i}
widths = '${thickness}'
n_part_elems = '10'
materials = 'hs_mat'
names = 'region'
initial_T = ${T_hs}
[]
[hs_boundary]
type = HSBoundaryRadiation
boundary = 'hs:outer'
hs = hs
T_ambient = ${T_ambient}
emissivity = ${emissivity}
view_factor = ${view_factor}
scale_pp = bc_scale_pp
[]
[]
[Postprocessors]
[bc_scale_pp]
type = FunctionValuePostprocessor
function = ${scale}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs]
type = ADHeatStructureEnergyRZ
block = 'hs:region'
axis_dir = '0 0 1'
axis_point = '0 0 0'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/stochastic_tools/examples/paper/full_solve.i)
[StochasticTools]
[]
[Distributions]
[uniform]
type = Uniform
lower_bound = 1
upper_bound = 9
[]
[]
[Samplers]
[mc]
type = MonteCarlo
num_rows = 10
distributions = 'uniform uniform'
execute_on = 'initial timestep_end'
[]
[]
[MultiApps]
[runner]
type = SamplerFullSolveMultiApp
sampler = mc
input_files = 'sub.i'
mode = batch-restore
[]
[]
[Transfers]
[runner]
type = SamplerParameterTransfer
to_multi_app = runner
parameters = 'BCs/left/value BCs/right/value'
to_control = receiver
sampler = mc
[]
[data]
type = SamplerPostprocessorTransfer
from_multi_app = runner
to_vector_postprocessor = storage
from_postprocessor = average
sampler = mc
[]
[]
[VectorPostprocessors]
[storage]
type = StochasticResults
[]
[]
[Executioner]
type = Transient
num_steps = 1
[]
[Postprocessors]
[total]
type = MemoryUsage
execute_on = 'INITIAL TIMESTEP_END'
[]
[per_proc]
type = MemoryUsage
value_type = "average"
execute_on = 'INITIAL TIMESTEP_END'
[]
[max_proc]
type = MemoryUsage
value_type = "max_process"
execute_on = 'INITIAL TIMESTEP_END'
[]
[total_time]
type = PerfGraphData
execute_on = 'INITIAL TIMESTEP_END'
data_type = 'TOTAL'
section_name = 'Root'
[]
[run_time]
type = ChangeOverTimePostprocessor
postprocessor = total_time
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Outputs]
csv = true
perf_graph = true
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/plate.i)
T_hs = 300
heat_flux = 1000
t = 0.001
L = 2
thickness = 0.5
depth = 0.6
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
A = ${fparse L * depth}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[Functions]
[q_fn]
type = ConstantFunction
value = ${heat_flux}
[]
[]
[HeatStructureMaterials]
[hs_mat]
type = SolidMaterialProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructurePlate
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
depth = ${depth}
widths = '${thickness}'
n_part_elems = '10'
materials = 'hs_mat'
names = 'region'
initial_T = ${T_hs}
[]
[heat_flux_boundary]
type = HSBoundaryHeatFlux
boundary = 'hs:outer'
hs = hs
q = q_fn
scale_pp = bc_scale_pp
[]
[]
[Postprocessors]
[bc_scale_pp]
type = FunctionValuePostprocessor
function = ${scale}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs]
type = ADHeatStructureEnergy
block = 'hs:region'
plate_depth = ${depth}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/volume_junction_1phase/t_junction_1phase.i)
# Junction between 3 pipes, 1 of which goes to a dead-end. All ends are walls,
# and 1 of the pipes is pressurized higher than the others.
A_big = 1
A_small = 0.5
[GlobalParams]
gravity_vector = '0 0 0'
scaling_factor_1phase = '1 1 1e-5'
scaling_factor_rhoV = 1
scaling_factor_rhouV = 1
scaling_factor_rhovV = 1
scaling_factor_rhowV = 1
scaling_factor_rhoEV = 1e-5
initial_T = 300
initial_vel = 0
n_elems = 20
length = 1
f = 0
fp = fp
rdg_slope_reconstruction = minmod
closures = simple_closures
[]
[Modules/FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 1.4
cv = 725
q = 0
q_prime = 0
p_inf = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[pipe1]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
A = ${A_big}
# This pipe is pressurized higher than the others.
initial_p = 1.05e5
[]
[pipe2]
type = FlowChannel1Phase
position = '1 0 0'
orientation = '1 0 0'
A = ${A_big}
initial_p = 1e5
[]
[pipe3]
type = FlowChannel1Phase
position = '1 0 0'
orientation = '0 1 0'
# This pipe is smaller than the others.
A = ${A_small}
initial_p = 1e5
[]
[junction]
type = VolumeJunction1Phase
connections = 'pipe1:out pipe2:in pipe3:in'
position = '1 0 0'
volume = 0.37
initial_p = 1e5
initial_vel_x = 0
initial_vel_y = 0
initial_vel_z = 0
[]
[pipe1_wall]
type = SolidWall1Phase
input = 'pipe1:in'
[]
[pipe2_wall]
type = SolidWall1Phase
input = 'pipe2:out'
[]
[pipe3_wall]
type = SolidWall1Phase
input = 'pipe3:out'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
start_time = 0
end_time = 5
dt = 0.05
num_steps = 5
abort_on_solve_fail = true
solve_type = 'PJFNK'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 10
l_tol = 1e-3
l_max_its = 10
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Postprocessors]
# mass conservation
[mass_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoA
block = 'pipe1 pipe2 pipe3'
execute_on = 'initial timestep_end'
[]
[mass_junction]
type = ScalarVariable
variable = junction:rhoV
execute_on = 'initial timestep_end'
[]
[mass_tot]
type = SumPostprocessor
values = 'mass_pipes mass_junction'
execute_on = 'initial timestep_end'
[]
[mass_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = mass_tot
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
# energy conservation
[E_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
block = 'pipe1 pipe2 pipe3'
execute_on = 'initial timestep_end'
[]
[E_junction]
type = ScalarVariable
variable = junction:rhoEV
execute_on = 'initial timestep_end'
[]
[E_tot]
type = SumPostprocessor
values = 'E_pipes E_junction'
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
[]
[Outputs]
[out]
type = CSV
show = 'mass_tot_change E_tot_change'
[]
[]
(modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_3d/phy.conservation.i)
# Testing energy conservation with fluid at rest
P_hf = ${fparse 0.6 * sin (pi/24)}
[GlobalParams]
gravity_vector = '0 0 0'
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'blk:0'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '1000 100 30'
[]
[]
[Modules/FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 2.35
cv = 1816.0
q = -1.167e6
p_inf = 1.0e9
q_prime = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Functions]
[T_init]
type = ParsedFunction
value = '1000*y+300+30*z'
[]
[]
[Components]
[in1]
type = SolidWall1Phase
input = 'fch1:in'
[]
[fch1]
type = FlowChannel1Phase
position = '0.15 0 0'
orientation = '0 0 1'
fp = fp
n_elems = 10
length = 1
initial_T = 300
initial_p = 1.01e5
initial_vel = 0
closures = simple_closures
A = 0.00314159
f = 0.0
[]
[out1]
type = SolidWall1Phase
input = 'fch1:out'
[]
[in2]
type = SolidWall1Phase
input = 'fch2:in'
[]
[fch2]
type = FlowChannel1Phase
position = '0 0.15 0'
orientation = '0 0 1'
fp = fp
n_elems = 10
length = 1
initial_T = 350
initial_p = 1.01e5
initial_vel = 0
closures = simple_closures
A = 0.00314159
f = 0.0
[]
[out2]
type = SolidWall1Phase
input = 'fch2:out'
[]
[blk]
type = HeatStructureFromFile3D
file = mesh.e
position = '0 0 0'
initial_T = T_init
[]
[ht]
type = HeatTransferFromHeatStructure3D1Phase
flow_channels = 'fch1 fch2'
hs = blk
boundary = blk:rmin
Hw = 10000
P_hf = ${P_hf}
[]
[]
[Postprocessors]
[energy_hs]
type = ADHeatStructureEnergy3D
block = blk:0
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_fch1]
type = ElementIntegralVariablePostprocessor
block = fch1
variable = rhoEA
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_fch2]
type = ElementIntegralVariablePostprocessor
block = fch2
variable = rhoEA
execute_on = 'INITIAL TIMESTEP_END'
[]
[total_energy]
type = SumPostprocessor
values = 'energy_fch1 energy_fch2 energy_hs'
execute_on = 'INITIAL TIMESTEP_END'
[]
[energy_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = total_energy
compute_relative_change = true
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = bdf2
dt = 0.1
num_steps = 10
solve_type = NEWTON
line_search = basic
abort_on_solve_fail = true
nl_abs_tol = 1e-8
[]
[Outputs]
file_base = 'phy.conservation'
[csv]
type = CSV
show = 'energy_change'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/heat_source_from_total_power/phy.conservation.i)
# Tests energy conservation for HeatGeneration component when a power component is used
n_units = 5
power = 1e5
power_fraction = 0.3
t = 1
energy_change = ${fparse power_fraction * power * t}
[GlobalParams]
scaling_factor_temperature = 1e-3
[]
[Functions]
[power_shape]
type = ConstantFunction
value = 0.4
[]
[]
[HeatStructureMaterials]
[main-material]
type = SolidMaterialProperties
k = 1e4
cp = 500.0
rho = 100.0
[]
[]
[Components]
[heat_structure]
type = HeatStructureCylindrical
num_rods = ${n_units}
position = '0 1 0'
orientation = '1 0 0'
length = 0.8
n_elems = 100
names = 'rgn1 rgn2 rgn3'
materials = 'main-material main-material main-material'
widths = '0.4 0.1 0.5'
n_part_elems = '2 2 2'
initial_T = 300
[]
[heat_generation]
type = HeatSourceFromTotalPower
hs = heat_structure
regions = 'rgn1 rgn2'
power = total_power
power_fraction = ${power_fraction}
[]
[total_power]
type = TotalPower
power = ${power}
[]
[]
[Postprocessors]
[E_tot]
type = ADHeatStructureEnergyRZ
block = 'heat_structure:rgn1 heat_structure:rgn2 heat_structure:rgn3'
n_units = ${n_units}
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
[E_tot_change_rel_err]
type = RelativeDifferencePostprocessor
value1 = E_tot_change
value2 = ${energy_change}
execute_on = 'initial timestep_end'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'NEWTON'
line_search = 'basic'
petsc_options_iname = '-pc_type'
petsc_options_value = ' lu'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-3
l_max_its = 10
start_time = 0.0
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Outputs]
csv = true
show = 'E_tot_change_rel_err'
execute_on = 'final'
[]
(modules/thermal_hydraulics/test/tests/components/free_boundary_1phase/phy.conservation_free_boundary_1phase.i)
# This test tests conservation of mass, momentum, and energy on a transient
# problem with an inlet and outlet (using free boundaries for each). This test
# takes 1 time step with Crank-Nicolson and some boundary flux integral
# post-processors needed for the full conservation statement. Lastly, the
# conservation quantities are shown on the console, which should ideally be zero
# for full conservation.
[GlobalParams]
gravity_vector = '0 0 0'
scaling_factor_1phase = '1 1 1e-6'
closures = simple_closures
[]
[Functions]
[T_fn]
type = ParsedFunction
value = '300 + 10 * (cos(2*pi*x + pi))'
[]
[]
[Modules/FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 2.35
cv = 1816.0
q = -1.167e6
p_inf = 1.0e9
q_prime = 0
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[inlet]
type = FreeBoundary1Phase
input = pipe:in
[]
[pipe]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
length = 1.0
n_elems = 10
A = 1.0
initial_T = T_fn
initial_p = 1e5
initial_vel = 1
f = 0
fp = fp
[]
[outlet]
type = FreeBoundary1Phase
input = pipe:out
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = crank-nicolson
start_time = 0.0
end_time = 0.01
dt = 0.01
abort_on_solve_fail = true
solve_type = 'PJFNK'
line_search = 'basic'
nl_rel_tol = 1e-6
nl_abs_tol = 1e-4
nl_max_its = 10
l_tol = 1e-2
l_max_its = 20
[]
[Postprocessors]
# MASS
[massflux_left]
type = MassFluxIntegral
boundary = inlet
arhouA = rhouA
[]
[massflux_right]
type = MassFluxIntegral
boundary = outlet
arhouA = rhouA
[]
[massflux_difference]
type = DifferencePostprocessor
value1 = massflux_right
value2 = massflux_left
[]
[massflux_integral]
type = TimeIntegratedPostprocessor
value = massflux_difference
[]
[mass]
type = ElementIntegralVariablePostprocessor
variable = rhoA
execute_on = 'initial timestep_end'
[]
[mass_change]
type = ChangeOverTimePostprocessor
postprocessor = mass
change_with_respect_to_initial = true
execute_on = 'initial timestep_end'
[]
[mass_conservation]
type = SumPostprocessor
values = 'mass_change massflux_integral'
[]
# MOMENTUM
[momentumflux_left]
type = MomentumFluxIntegral
boundary = inlet
arhouA = rhouA
vel = vel
p = p
A = A
[]
[momentumflux_right]
type = MomentumFluxIntegral
boundary = outlet
arhouA = rhouA
vel = vel
p = p
A = A
[]
[momentumflux_difference]
type = DifferencePostprocessor
value1 = momentumflux_right
value2 = momentumflux_left
[]
[momentumflux_integral]
type = TimeIntegratedPostprocessor
value = momentumflux_difference
[]
[momentum]
type = ElementIntegralVariablePostprocessor
variable = rhouA
execute_on = 'initial timestep_end'
[]
[momentum_change]
type = ChangeOverTimePostprocessor
postprocessor = momentum
change_with_respect_to_initial = true
execute_on = 'initial timestep_end'
[]
[momentum_conservation]
type = SumPostprocessor
values = 'momentum_change momentumflux_integral'
[]
# ENERGY
[energyflux_left]
type = EnergyFluxIntegral
boundary = inlet
arhouA = rhouA
H = H
[]
[energyflux_right]
type = EnergyFluxIntegral
boundary = outlet
arhouA = rhouA
H = H
[]
[energyflux_difference]
type = DifferencePostprocessor
value1 = energyflux_right
value2 = energyflux_left
[]
[energyflux_integral]
type = TimeIntegratedPostprocessor
value = energyflux_difference
[]
[energy]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
execute_on = 'initial timestep_end'
[]
[energy_change]
type = ChangeOverTimePostprocessor
postprocessor = energy
change_with_respect_to_initial = true
execute_on = 'initial timestep_end'
[]
[energy_conservation]
type = SumPostprocessor
values = 'energy_change energyflux_integral'
[]
[]
[Outputs]
[console]
type = Console
show = 'mass_conservation momentum_conservation energy_conservation'
[]
velocity_as_vector = false
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/from_file_3d.i)
T_hs = 1200
T_ambient = 1500
emissivity = 0.3
view_factor = 0.6
t = 5.0
# dimensions of the side 'left'
height = 5
depth = 2
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
stefan_boltzmann = 5.670367e-8
A = ${fparse height * depth}
heat_flux = ${fparse stefan_boltzmann * emissivity * view_factor * (T_ambient^4 - T_hs^4)}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'hs:brick'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '${density} ${specific_heat_capacity} ${conductivity}'
[]
[]
[Components]
[hs]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = ${T_hs}
[]
[hs_boundary]
type = HSBoundaryRadiation
boundary = 'hs:left'
hs = hs
T_ambient = ${T_ambient}
emissivity = ${emissivity}
view_factor = ${view_factor}
scale_pp = bc_scale_pp
[]
[]
[Postprocessors]
[bc_scale_pp]
type = FunctionValuePostprocessor
function = ${scale}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs]
type = ADHeatStructureEnergy3D
block = 'hs:brick'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/heat_transfer_from_heat_structure_1phase/phy.conservation_1phase.i)
# Tests conservation for heat transfer between a cylindrical heat structure and
# a 1-phase flow channel
[GlobalParams]
gravity_vector = '0 0 0'
scaling_factor_1phase = '1e-3 1e-3 1e-8'
scaling_factor_temperature = 1e-3
closures = simple_closures
[]
[Modules/FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 2.35
q = -1167e3
q_prime = 0
p_inf = 1.e9
cv = 1816
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[HeatStructureMaterials]
[main-material]
type = SolidMaterialProperties
k = 1e4
cp = 500.0
rho = 100.0
[]
[]
[Functions]
[T0_fn]
type = ParsedFunction
value = '290 + 20 * (y - 1)'
[]
[]
[Components]
[left_wall]
type = SolidWall1Phase
input = 'pipe:in'
[]
[pipe]
type = FlowChannel1Phase
fp = fp
position = '0 2 0'
orientation = '1 0 0'
length = 1.0
n_elems = 5
A = 1.0
initial_T = 300
initial_p = 1e5
initial_vel = 0
f = 0
[]
[right_wall]
type = SolidWall1Phase
input = 'pipe:out'
[]
[heat_transfer]
type = HeatTransferFromHeatStructure1Phase
flow_channel = pipe
hs = heat_structure
hs_side = inner
Hw = 1e3
[]
[heat_structure]
#type = set externally
num_rods = 5
position = '0 2 0'
orientation = '1 0 0'
length = 1.0
n_elems = 5
names = 'main'
materials = 'main-material'
widths = '1.0'
n_part_elems = '5'
initial_T = T0_fn
[]
[]
[Postprocessors]
[E_pipe]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
block = pipe
execute_on = 'initial timestep_end'
[]
[E_heat_structure]
block = 'heat_structure:main'
n_units = 5
execute_on = 'initial timestep_end'
[]
[E_tot]
type = SumPostprocessor
values = 'E_pipe E_heat_structure'
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'PJFNK'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-3
l_max_its = 10
start_time = 0.0
dt = 0.01
num_steps = 5
abort_on_solve_fail = true
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Outputs]
file_base = 'phy.conservation_1phase_cylinder'
csv = true
show = 'E_tot_change'
execute_on = 'final'
[]
(modules/thermal_hydraulics/test/tests/components/deprecated/heat_source_volumetric.i)
[GlobalParams]
scaling_factor_1phase = '1 1e-2 1e-4'
[]
[Modules/FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 2.35
q = -1167e3
q_prime = 0
p_inf = 1.e9
cv = 1816
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[flow_channel]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
length = 1
n_elems = 10
A = 1
f = 0
fp = fp
closures = simple_closures
initial_T = 310
initial_p = 1e5
initial_vel = 0
[]
[wall1]
type = SolidWall1Phase
input = flow_channel:in
[]
[wall2]
type = SolidWall1Phase
input = flow_channel:out
[]
[heat_source]
type = HeatSourceVolumetric
flow_channel = flow_channel
q = 1e3
[]
[]
[Postprocessors]
[E_tot]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'NEWTON'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-3
l_max_its = 10
start_time = 0.0
dt = 0.1
end_time = 1
abort_on_solve_fail = true
[]
(modules/thermal_hydraulics/test/tests/components/heat_source_volumetric_1phase/phy.conservation.1phase.i)
# Tests energy conservation for HeatSourceVolumetric component with 1-phase flow
[GlobalParams]
scaling_factor_1phase = '1 1e-2 1e-4'
[]
[Modules/FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 2.35
q = -1167e3
q_prime = 0
p_inf = 1.e9
cv = 1816
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[flow_channel]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
length = 1
n_elems = 10
A = 1
f = 0
fp = fp
closures = simple_closures
initial_T = 310
initial_p = 1e5
initial_vel = 0
[]
[wall1]
type = SolidWall1Phase
input = flow_channel:in
[]
[wall2]
type = SolidWall1Phase
input = flow_channel:out
[]
[heat_source]
type = HeatSourceVolumetric1Phase
flow_channel = flow_channel
q = 1e3
[]
[]
[Postprocessors]
[E_tot]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'NEWTON'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-3
l_max_its = 10
start_time = 0.0
dt = 0.1
end_time = 1
abort_on_solve_fail = true
[]
[Outputs]
csv = true
show = 'E_tot_change'
execute_on = 'final'
[]
(modules/thermal_hydraulics/test/tests/components/shaft_connected_pump_1phase/shaft_motor_pump.i)
# Pump data used in this test comes from the Semiscale Program, summarized in NUREG/CR-4945
initial_T = 393.15
area = 1e-2
dt = 1.e-2
[GlobalParams]
initial_p = 1.4E+07
initial_T = ${initial_T}
initial_vel = 10
initial_vel_x = 10
initial_vel_y = 0
initial_vel_z = 0
A = ${area}
A_ref = ${area}
f = 100
scaling_factor_1phase = '0.04 0.04 0.04e-5'
closures = simple_closures
fp = fp
[]
[Modules/FluidProperties]
[fp]
type = IdealGasFluidProperties
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[pump]
type = ShaftConnectedPump1Phase
inlet = 'pipe:out'
outlet = 'pipe:in'
position = '0 0 0'
scaling_factor_rhoEV = 1e-5
volume = 0.3
inertia_coeff = '1 1 1 1'
inertia_const = 1.61397
omega_rated = 314
speed_cr_I = 1e12
speed_cr_fr = 0
torque_rated = 47.1825
volumetric_rated = 1
head_rated = 58.52
tau_fr_coeff = '0 0 9.084 0'
tau_fr_const = 0
head = head_fcn
torque_hydraulic = torque_fcn
density_rated = 124.2046
[]
[pipe]
type = FlowChannel1Phase
position = '0.6096 0 0'
orientation = '1 0 0'
length = 10
n_elems = 20
[]
[motor]
type = ShaftConnectedMotor
inertia = 2
torque = 47
[]
[shaft]
type = Shaft
connected_components = 'motor pump'
initial_speed = 30
[]
[]
[Functions]
[head_fcn]
type = PiecewiseLinear
data_file = semiscale_head_data.csv
format = columns
[]
[torque_fcn]
type = PiecewiseLinear
data_file = semiscale_torque_data.csv
format = columns
[]
[S_energy_fcn]
type = ParsedFunction
value = '-tau_hyd * omega'
vars = 'tau_hyd omega'
vals = 'pump:hydraulic_torque shaft:omega'
[]
[energy_conservation_fcn]
type = ParsedFunction
value = '(E_change - S_energy * dt) / E_tot'
vars = 'E_change S_energy dt E_tot'
vals = 'E_change S_energy ${dt} E_tot'
[]
[]
[Postprocessors]
# mass conservation
[mass_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoA
block = 'pipe'
execute_on = 'initial timestep_end'
[]
[mass_pump]
type = ScalarVariable
variable = pump:rhoV
execute_on = 'initial timestep_end'
[]
[mass_tot]
type = SumPostprocessor
values = 'mass_pipes mass_pump'
execute_on = 'initial timestep_end'
[]
[mass_conservation]
type = ChangeOverTimePostprocessor
postprocessor = mass_tot
change_with_respect_to_initial = true
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
# energy conservation
[E_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
block = 'pipe'
execute_on = 'initial timestep_end'
[]
[E_pump]
type = ScalarVariable
variable = pump:rhoEV
execute_on = 'initial timestep_end'
[]
[E_tot]
type = LinearCombinationPostprocessor
pp_coefs = '1 1'
pp_names = 'E_pipes E_pump'
execute_on = 'initial timestep_end'
[]
[S_energy]
type = FunctionValuePostprocessor
function = S_energy_fcn
execute_on = 'initial timestep_end'
[]
[E_change]
type = ChangeOverTimePostprocessor
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
# This should also execute on initial. This value is
# lagged by one timestep as a workaround to moose issue #13262.
[energy_conservation]
type = FunctionValuePostprocessor
function = energy_conservation_fcn
execute_on = 'timestep_end'
[]
[]
[Preconditioning]
[SMP_PJFNK]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'implicit-euler'
dt = ${dt}
num_steps = 6
solve_type = 'NEWTON'
line_search = 'basic'
petsc_options_iname = '-pc_type'
petsc_options_value = ' lu'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-4
l_max_its = 10
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Outputs]
velocity_as_vector = false
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_heat_flux/from_file_3d.i)
T_hs = 300
heat_flux = 1000
t = 0.001
# dimensions of the side 'left'
height = 5
depth = 2
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
A = ${fparse height * depth}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[Functions]
[q_fn]
type = ConstantFunction
value = ${heat_flux}
[]
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'hs:brick'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '${density} ${specific_heat_capacity} ${conductivity}'
[]
[]
[Components]
[hs]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = ${T_hs}
[]
[heat_flux_boundary]
type = HSBoundaryHeatFlux
boundary = 'hs:left'
hs = hs
q = q_fn
scale_pp = bc_scale_pp
[]
[]
[Postprocessors]
[bc_scale_pp]
type = FunctionValuePostprocessor
function = ${scale}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs]
type = ADHeatStructureEnergy3D
block = 'hs:brick'
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_ambient_convection/plate.i)
T_hs = 300
T_ambient1 = 500
htc1 = 100
T_ambient2 = 400
htc2 = 300
t = 0.001
L = 2
thickness = 0.5
depth = 0.6
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
A = ${fparse L * depth}
heat_flux_avg = ${fparse 0.5 * (htc1 * (T_ambient1 - T_hs) + htc2 * (T_ambient2 - T_hs))}
heat_flux_integral = ${fparse heat_flux_avg * A}
scale = 0.8
E_change = ${fparse scale * heat_flux_integral * t}
[Functions]
[T_ambient_fn]
type = PiecewiseConstant
axis = z
x = '0 1'
y = '${T_ambient1} ${T_ambient2}'
[]
[htc_ambient_fn]
type = PiecewiseConstant
axis = z
x = '0 1'
y = '${htc1} ${htc2}'
[]
[]
[HeatStructureMaterials]
[hs_mat]
type = SolidMaterialProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructurePlate
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
depth = ${depth}
widths = '${thickness}'
n_part_elems = '10'
materials = 'hs_mat'
names = 'region'
initial_T = ${T_hs}
[]
[ambient_convection]
type = HSBoundaryAmbientConvection
boundary = 'hs:outer'
hs = hs
T_ambient = T_ambient_fn
htc_ambient = htc_ambient_fn
scale_pp = bc_scale_pp
[]
[]
[Postprocessors]
[bc_scale_pp]
type = FunctionValuePostprocessor
function = ${scale}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs]
type = ADHeatStructureEnergy
block = 'hs:region'
plate_depth = ${depth}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
solve_type = lumped
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/heat_source_from_total_power/phy.conservation_from_file_3d.i)
# Tests energy conservation for HeatStructureFromFile3D in combination with HeatSourceFromTotalPower
power = 1e5
power_fraction = 0.3
t = 1
energy_change = ${fparse power_fraction * power * t}
[Functions]
[power_shape]
type = ConstantFunction
value = 0.4
[]
[]
[Materials]
[mat]
type = ADGenericConstantMaterial
block = 'heat_structure:rgn1 heat_structure:rgn2'
prop_names = 'density specific_heat thermal_conductivity'
prop_values = '100 500 1e4'
[]
[]
[Components]
[heat_structure]
type = HeatStructureFromFile3D
file = box.e
position = '0 0 0'
initial_T = 300
[]
[heat_generation]
type = HeatSourceFromTotalPower
hs = heat_structure
regions = 'rgn1'
power = total_power
power_fraction = ${power_fraction}
[]
[total_power]
type = TotalPower
power = ${power}
[]
[]
[Postprocessors]
[E_tot]
type = ADHeatStructureEnergy3D
block = 'heat_structure:rgn1 heat_structure:rgn2'
execute_on = 'initial timestep_end'
[]
[E_tot_change]
type = ChangeOverTimePostprocessor
change_with_respect_to_initial = true
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
[E_tot_change_rel_err]
type = RelativeDifferencePostprocessor
value1 = E_tot_change
value2 = ${energy_change}
execute_on = 'initial timestep_end'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'bdf2'
solve_type = 'PJFNK'
line_search = 'basic'
nl_rel_tol = 0
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-3
l_max_its = 10
start_time = 0.0
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
csv = true
show = 'E_tot_change_rel_err'
execute_on = 'final'
[]
(test/tests/postprocessors/change_over_time/change_over_time.i)
# This test tests the ChangeOverTimePostprocessor, which computes the change
# in a postprocessor value with respect to the previous value or with respect to
# the initial value. This test creates a time-dependent function postprocessor
# and then computes its change over a timestep. The FE problem used here is a
# dummy problem and has no effect on the test.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 5
[]
[Variables]
[./u]
[../]
[]
[Kernels]
[./time_derivative]
type = TimeDerivative
variable = u
[../]
[./diff]
type = Diffusion
variable = u
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]
[Executioner]
type = Transient
start_time = 0.0
dt = 1.0
num_steps = 2
[]
[Functions]
[./my_function]
type = ParsedFunction
value = '1 + t * t'
[../]
[]
[Postprocessors]
[./my_postprocessor]
type = FunctionValuePostprocessor
function = my_function
execute_on = 'initial timestep_end'
[../]
[./change_over_time]
type = ChangeOverTimePostprocessor
postprocessor = my_postprocessor
change_with_respect_to_initial = false
execute_on = 'initial timestep_end'
[../]
[]
[Outputs]
file_base = 'change_over_time_previous'
csv = true
[]
(modules/thermal_hydraulics/test/tests/components/hs_boundary_radiation/plate.i)
T_hs = 1200
T_ambient = 1500
emissivity = 0.3
view_factor = 0.6
t = 5.0
L = 2
thickness = 0.5
depth = 0.6
# SS 316
density = 8.0272e3
specific_heat_capacity = 502.1
conductivity = 16.26
stefan_boltzmann = 5.670367e-8
A = ${fparse L * depth}
heat_flux = ${fparse stefan_boltzmann * emissivity * view_factor * (T_ambient^4 - T_hs^4)}
scale = 0.8
E_change = ${fparse scale * heat_flux * A * t}
[HeatStructureMaterials]
[hs_mat]
type = SolidMaterialProperties
rho = ${density}
cp = ${specific_heat_capacity}
k = ${conductivity}
[]
[]
[Components]
[hs]
type = HeatStructurePlate
orientation = '0 0 1'
position = '0 0 0'
length = ${L}
n_elems = 10
depth = ${depth}
widths = '${thickness}'
n_part_elems = '10'
materials = 'hs_mat'
names = 'region'
initial_T = ${T_hs}
[]
[hs_boundary]
type = HSBoundaryRadiation
boundary = 'hs:outer'
hs = hs
T_ambient = ${T_ambient}
emissivity = ${emissivity}
view_factor = ${view_factor}
scale_pp = bc_scale_pp
[]
[]
[Postprocessors]
[bc_scale_pp]
type = FunctionValuePostprocessor
function = ${scale}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs]
type = ADHeatStructureEnergy
block = 'hs:region'
plate_depth = ${depth}
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_hs_change]
type = ChangeOverTimePostprocessor
postprocessor = E_hs
execute_on = 'INITIAL TIMESTEP_END'
[]
[E_change_relerr]
type = RelativeDifferencePostprocessor
value1 = E_hs_change
value2 = ${E_change}
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Executioner]
type = Transient
[TimeIntegrator]
type = ActuallyExplicitEuler
[]
dt = ${t}
num_steps = 1
abort_on_solve_fail = true
[]
[Outputs]
[out]
type = CSV
show = 'E_change_relerr'
execute_on = 'FINAL'
[]
[]
(modules/thermal_hydraulics/test/tests/components/pump_1phase/pump_mass_energy_conservation.i)
# This test tests that mass and energy are conserved.
dt = 1.e-2
head = 95.
volume = 1.
A = 1.
g = 9.81
[GlobalParams]
initial_T = 393.15
initial_vel = 0
f = 0
fp = fp
scaling_factor_1phase = '0.04 0.04 0.04e-5'
closures = simple_closures
A = ${A}
[]
[Modules/FluidProperties]
[fp]
type = StiffenedGasFluidProperties
gamma = 2.35
q = -1167e3
q_prime = 0
p_inf = 1.e9
cv = 1816
[]
[]
[Closures]
[simple_closures]
type = Closures1PhaseSimple
[]
[]
[Components]
[wall_in]
type = SolidWall1Phase
input = 'pipe1:in'
[]
[pipe1]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '1 0 0'
length = 1
initial_p = 1.7E+07
n_elems = 10
gravity_vector = '0 0 0'
[]
[pump]
type = Pump1Phase
connections = 'pipe1:out pipe2:in'
position = '1.02 0 0'
initial_p = 1.3e+07
scaling_factor_rhoEV = 1e-5
head = ${head}
A_ref = ${A}
volume = ${volume}
initial_vel_x = 0
initial_vel_y = 0
initial_vel_z = 0
[]
[pipe2]
type = FlowChannel1Phase
position = '1.04 0 0'
orientation = '1 0 0'
length = 1
initial_p = 1.3e+07
n_elems = 10
gravity_vector = '0 0 0'
[]
[wall_out]
type = SolidWall1Phase
input = 'pipe2:out'
[]
[]
[Preconditioning]
[pc]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = 'implicit-euler'
start_time = 0
dt = ${dt}
num_steps = 6
abort_on_solve_fail = true
solve_type = 'PJFNK'
line_search = 'basic'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-6
nl_max_its = 15
l_tol = 1e-4
l_max_its = 10
[Quadrature]
type = GAUSS
order = SECOND
[]
[]
[Postprocessors]
# mass conservation
[mass_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoA
block = 'pipe1 pipe2'
execute_on = 'initial timestep_end'
[]
[mass_pump]
type = ScalarVariable
variable = pump:rhoV
execute_on = 'initial timestep_end'
[]
[mass_tot]
type = SumPostprocessor
values = 'mass_pipes mass_pump'
execute_on = 'initial timestep_end'
[]
[mass_tot_change]
type = ChangeOverTimePostprocessor
postprocessor = mass_tot
change_with_respect_to_initial = true
compute_relative_change = true
execute_on = 'initial timestep_end'
[]
# energy conservation
[E_pipes]
type = ElementIntegralVariablePostprocessor
variable = rhoEA
block = 'pipe1 pipe2'
execute_on = 'initial timestep_end'
[]
[E_pump]
type = ScalarVariable
variable = pump:rhoEV
execute_on = 'initial timestep_end'
[]
[E_tot]
type = LinearCombinationPostprocessor
pp_coefs = '1 1'
pp_names = 'E_pipes E_pump'
execute_on = 'initial timestep_end'
[]
[S_energy]
type = FunctionValuePostprocessor
function = S_energy_fcn
execute_on = 'initial timestep_end'
[]
[E_change]
type = ChangeOverTimePostprocessor
postprocessor = E_tot
execute_on = 'initial timestep_end'
[]
# this should also execute on initial, this value is
# lagged by one timestep as a workaround to moose issue #13262
[E_conservation]
type = FunctionValuePostprocessor
function = E_conservation_fcn
execute_on = 'timestep_end'
[]
[]
[Functions]
[S_energy_fcn]
type = ParsedFunction
value = 'rhouV * g * head * A / volume'
vars = 'rhouV g head A volume'
vals = 'pump:rhouV ${g} ${head} ${A} ${volume}'
[]
[E_conservation_fcn]
type = ParsedFunction
value = '(E_change - S_energy * dt) / E_tot'
vars = 'E_change S_energy dt E_tot'
vals = 'E_change S_energy ${dt} E_tot'
[]
[]
[Outputs]
[out]
type = CSV
execute_on = 'FINAL'
show = 'mass_tot_change E_conservation'
[]
[]
(framework/include/postprocessors/ChangeOverTimestepPostprocessor.h)
// This file is part of the MOOSE framework
// https://www.mooseframework.org
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "ChangeOverTimePostprocessor.h"
/**
* Computes the change in a post-processor value, or the magnitude of its
* relative change, over a time step or over the entire transient.
*/
class ChangeOverTimestepPostprocessor : public ChangeOverTimePostprocessor
{
public:
static InputParameters validParams();
ChangeOverTimestepPostprocessor(const InputParameters & parameters);
};