Calculations Tests

Channel Tests

test_channel_w_no_heat_flux_maintains_temperature_profile

With no heat flux, temperatures should flow through the channel without changing.

test_specific_initialized_Channel_for_precalculated_values

Channel instance is created, its variables, mass vector are correct

test_specific_initialized_ChannelAndContacts_for_precalculated_values

ChannelAndContacts instance is created, its variables, mass vector are correct

test_first_order_upwind_dTdt_is_zero_for_zero_heat_flux

If all temperatures are constant, then we should be in stable state

test_first_order_upwind_is_constant_for_linear_temperature_no_heat_flux

If the temperature is rising linearly, dT/dt should be constant if nothing else changes

test_channel_with_zero_flow_constant_h_reaches_wall_temperature

The channel is subjected to constant wall temperatures.

test_first_order_upwind_inverts_correctly_on_flow_reversal_no_heat_flux

For an isolated system, inlet temperature determines channel profile.

test_no_exceptions_raised_through_external_flow_inversion_on_Channel

Inverting current in channel raises no error

Tests for the Channel class.

test_channel_w_no_heat_flux_maintains_temperature_profile()[source]

With no heat flux, temperatures should flow through the channel without changing. Special consideration is given to the Courant (CFL) condition.

Return type:

None

test_channel_with_zero_flow_constant_h_reaches_wall_temperature()[source]

The channel is subjected to constant wall temperatures. Flow is constantly zero, so the system should gradually adjust to the wall temperature. The heat transfer coefficient is set to a constant value.

Return type:

None

test_first_order_upwind_dTdt_is_zero_for_zero_heat_flux()[source]

If all temperatures are constant, then we should be in stable state

Return type:

None

test_first_order_upwind_inverts_correctly_on_flow_reversal_no_heat_flux()[source]

For an isolated system, inlet temperature determines channel profile. If the flow is reversed, the profile should move in the other direction.

Return type:

None

test_first_order_upwind_is_constant_for_linear_temperature_no_heat_flux()[source]

If the temperature is rising linearly, dT/dt should be constant if nothing else changes

Return type:

None

test_no_exceptions_raised_through_external_flow_inversion_on_Channel()[source]

Inverting current in channel raises no error

test_specific_initialized_ChannelAndContacts_for_precalculated_values()[source]

ChannelAndContacts instance is created, its variables, mass vector are correct

test_specific_initialized_Channel_for_precalculated_values()[source]

Channel instance is created, its variables, mass vector are correct

Heat Diffusion Test

test_Fuel_at_constant_temperature_has_derivative_0

test_derivative_of_one_cell_follows_the_x_diffusion_kernel

test_not_equispaced

test_specific_multi_cell_has_the_right_dimensions

test_specific_multi_cell_has_the_right_meat

test_specific_multi_cell_has_the_right_contacts

test_specific_multi_cell_has_the_right_dTdt

test_steady_state_with_zero_power

test_steady_state_for_a_configuration_with_uniform_power

test_initialization_of_Fuel_with_one_known_example

test_diffusion_gives_0_for_uniform_temperatures

If all temperatures are uniform (with zero power), no heat flux should be generated, and the system should be at steady-state.

test_derivative_of_one_cell_follows_the_r_diffusion_kernel

test_annulus_given_wall_temperatures

For an axially symmetric annulus of radii \(r_1, r_2\), given inner and outer boundary temperatures \(T_{1}, T_{2}\), the radial temperature dependence is[1]:

test_cylinder_given_heat_production_and_wall_temperature

Temperature distribution calculated analytically matches the numeric result, in a polar system with heat production per volume \(\dot{q}\), radius \(r_{0}\) and fixed outer temperature \(T_{s}\).

test_annulus_given_heat_production_and_wall_temperatures

For an axially symmetric annulus of radii \(r_1, r_2\), given inner and outer boundary temperatures \(T_{1}, T_{2}\), and heat production of \(\dot{q}\) the radial temperature dependence is:

test_derivative_of_one_cell_follows_the_rz_diffusion_kernel

multiple_regions()[source]
test_Fuel_at_constant_temperature_has_derivative_0()[source]
test_annulus_given_heat_production_and_wall_temperatures(temps=(45, 75), edges=(1, 3.123))[source]

For an axially symmetric annulus of radii \(r_1, r_2\), given inner and outer boundary temperatures \(T_{1}, T_{2}\), and heat production of \(\dot{q}\) the radial temperature dependence is:

\[T(r) = \frac{\dot{q}}{4k}\left[r_1^2 - r^2 + (r_2^2 - r_1^2)\frac{\ln(r / r_1)}{\ln(r_2 / r_1)}\right] + (T_2 - T_1)\frac{\ln(r / r_1)}{\ln(r_2 / r_1)} + T_1\]
test_annulus_given_wall_temperatures(temps=(45, 75), edges=(1, 3))[source]

For an axially symmetric annulus of radii \(r_1, r_2\), given inner and outer boundary temperatures \(T_{1}, T_{2}\), the radial temperature dependence is[1]:

\[T(r) = (T_{1} - T_{2})\frac{\ln(r / r_2)}{\ln(r_1 / r_2)} + T_{2}\]

References

test_cylinder_given_heat_production_and_wall_temperature(Twall=45, r0=3)[source]

Temperature distribution calculated analytically matches the numeric result, in a polar system with heat production per volume \(\dot{q}\), radius \(r_{0}\) and fixed outer temperature \(T_{s}\). The analytic solution is[1]:

\[T(r) = T_s + \dot{q} (r_0 ^2 - r^2)/4k\]
test_derivative_of_one_cell_follows_the_r_diffusion_kernel()[source]
Return type:

None

test_derivative_of_one_cell_follows_the_rz_diffusion_kernel()[source]
Return type:

None

test_derivative_of_one_cell_follows_the_x_diffusion_kernel()[source]
Return type:

None

test_diffusion_gives_0_for_uniform_temperatures()[source]

If all temperatures are uniform (with zero power), no heat flux should be generated, and the system should be at steady-state. This property is tested over all available kernels.

Return type:

None

test_initialization_of_Fuel_with_one_known_example()[source]
test_not_equispaced()[source]
Return type:

None

test_specific_multi_cell_has_the_right_contacts(multiple_regions)[source]
test_specific_multi_cell_has_the_right_dTdt(multiple_regions)[source]
test_specific_multi_cell_has_the_right_dimensions(multiple_regions)[source]
test_specific_multi_cell_has_the_right_meat(multiple_regions)[source]
test_specific_multi_cell_has_the_right_power_shape(multiple_regions)[source]
test_steady_state_for_a_configuration_with_uniform_power(_some_config)[source]
test_steady_state_with_zero_power(_some_config)[source]

Ideal Calculations Tests

test_pump_as_ideal_dp_source

test_pump_as_ideal_current_source

test_pump_errors_on_impossibly_imposed_dp_and_mdot

One cannot impose both dp and mdot as ideal sources

test_pump_errors_on_when_no_source_type_was_imposed

The pump source type (and value) must be set

test_resistor

test_hx

test_local_pressure_drop_is_always_non_positive

test_resistor_sum_calculates_additions_of_different_resistors

test_resistor_sum_from_a_sum_of_resistor_sums

test_arbitrary_resistors_in_resistor_sum

test_arbitrary_resistors_in_resistor_sum()[source]
Return type:

None

test_hx()[source]
Return type:

None

test_local_pressure_drop_for_expansion_to_infinity()[source]
Return type:

None

test_local_pressure_drop_is_always_non_positive()[source]
Return type:

None

test_pump_as_ideal_current_source()[source]
Return type:

None

test_pump_as_ideal_dp_source()[source]
Return type:

None

test_pump_errors_on_impossibly_imposed_dp_and_mdot()[source]

One cannot impose both dp and mdot as ideal sources

test_pump_errors_on_when_no_source_type_was_imposed()[source]

The pump source type (and value) must be set

test_resistor()[source]
Return type:

None

test_resistor_factor_just_multiplies()[source]
Return type:

None

test_resistor_mul_can_be_deepcopied()[source]
Return type:

None

test_resistor_multiplication_is_symmetric()[source]
Return type:

None

test_resistor_sum_calculates_additions_of_different_resistors()[source]
Return type:

None

test_resistor_sum_from_a_sum_of_resistor_sums()[source]
Return type:

None

test_zero_bend_angle_returns_zero_pressure_drop()[source]
Return type:

None

Flapper Tests

test_fully_open_flapper_acts_as_resistor

test_closed_flapper_zero_flow_residue_is_zero

test_flapper_should_not_continue_at_opening_condition

test_closed_flapper_zero_flow_residue_is_zero()[source]
Return type:

None

test_flapper_should_not_continue_at_opening_condition()[source]
test_fully_open_flapper_acts_as_resistor()[source]
Return type:

None

Kirchhoff Tests

test_a_multigraph_to_graph_for_cycles

test_build_kvl_matrix_from_a_multigraph

test_junction_mixing_a_given_set_of_currents

The temperature a Junction defines is just the weighted sum of all incoming temperatures with the corresponding mass current.

test_kvl_matrix_works_on_mock_graph

test_kcl_matrix_works_on_mock_graph

test_kirchhoff_indexing_works_on_mock_graph

test_kirchhoff_calculate_works_for_mock_graph

test_kirchoff_w_mdot2_accepts_a_graph_and_has_correct_length

test_Kirchoff_kcl_matrix_fits_known_example_with_weights

test_Kirchoff_supplies_correct_absolute_pressures_for_one_example

Oh, how the turns have tabled…

J()[source]
K(mock_graph)[source]
mock_graph(J)[source]
Return type:

MultiDiGraph

test_Kirchoff_kcl_matrix_fits_known_example_with_weights()[source]
test_Kirchoff_supplies_correct_absolute_pressures_for_one_example(mock_graph, J)[source]
test_a_multigraph_to_graph_for_cycles()[source]
test_agr_of_kirchhoff_load_reverses_save_by_example(K)[source]
Return type:

None

test_build_kvl_matrix_from_a_multigraph()[source]
test_junction_mixing_a_given_set_of_currents()[source]

The temperature a Junction defines is just the weighted sum of all incoming temperatures with the corresponding mass current.

test_kcl_matrix_works_on_mock_graph(K, J)[source]
test_kirchhoff_calculate_works_for_mock_graph(K)[source]
test_kirchhoff_indexing_works_on_mock_graph(K, J)[source]
test_kirchhoff_variable_names_are_strings()[source]
Return type:

None

test_kirchoff_save_fits_known_value_for_one_example(K)[source]
test_kirchoff_w_mdot2_accepts_a_graph_and_has_correct_length()[source]
test_kvl_matrix_works_on_mock_graph(K)[source]

Point Kinetics Tests

test_pkc

test_precursor_death

Having only precursors in a critical system with beta=0 should yield an exponentially dependent power (like capacitor charging)

test_pk_save_follows_known_pattern_for_mock

test_pk_load

test_reactivity_for_linear_temperature_in_relation_to_reference

test_pk_with_decay

test_pk_change_state_sets_SCRAM_time

test_pk_should_continue_stops_at_SCRAM_time

mock_point_kinetics()[source]
test_pk_change_state_sets_SCRAM_time()[source]
Return type:

None

test_pk_load()[source]
Return type:

None

test_pk_save_follows_known_pattern_for_mock()[source]
Return type:

None

test_pk_should_continue_stops_at_SCRAM_time()[source]
Return type:

None

test_pk_with_decay()[source]
test_pkc()[source]
test_precursor_death()[source]

Having only precursors in a critical system with beta=0 should yield an exponentially dependent power (like capacitor charging)

Return type:

None

test_reactivity_for_linear_temperature_in_relation_to_reference(w, result)[source]