From 62fb1f17efba9e4d96224d85cdd2bc5ba6c9d7ad Mon Sep 17 00:00:00 2001 From: Rahil Doshi <rahil.doshi@fau.de> Date: Mon, 12 Aug 2024 13:12:16 +0200 Subject: [PATCH] File formatting --- src/materials/alloys/Alloy.py | 3 +-- src/materials/alloys/SS316L/SS316L.py | 2 +- src/materials/interpolators.py | 12 ++++++------ src/materials/models.py | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/materials/alloys/Alloy.py b/src/materials/alloys/Alloy.py index 23726c14e..8b638106d 100644 --- a/src/materials/alloys/Alloy.py +++ b/src/materials/alloys/Alloy.py @@ -1,5 +1,5 @@ import numpy as np -from typing import List, Tuple, Union +from typing import List, Tuple from dataclasses import dataclass, field from src.materials.elements import Element, Ti, Al, V from src.materials.elements import interpolate_atomic_number, interpolate_atomic_mass, interpolate_temperature_boil @@ -123,4 +123,3 @@ if __name__ == '__main__': except Exception as e: print(f"An unexpected error occurred: {e}") - diff --git a/src/materials/alloys/SS316L/SS316L.py b/src/materials/alloys/SS316L/SS316L.py index df963b135..c79a42559 100644 --- a/src/materials/alloys/SS316L/SS316L.py +++ b/src/materials/alloys/SS316L/SS316L.py @@ -116,4 +116,4 @@ if __name__ == '__main__': heat_capacity = 600 # Example value for testing thermal_diffusivity = thermal_diffusivity_by_heat_conductivity( heat_conductivity, density, heat_capacity) - print(f"Calculated thermal diffusivity: {thermal_diffusivity}") \ No newline at end of file + print(f"Calculated thermal diffusivity: {thermal_diffusivity}") diff --git a/src/materials/interpolators.py b/src/materials/interpolators.py index 1a8b7341e..21b977881 100644 --- a/src/materials/interpolators.py +++ b/src/materials/interpolators.py @@ -226,18 +226,18 @@ if __name__ == '__main__': # Consistency Test print("\nConsistency Test between interpolate_lookup and interpolate_equidistant:") test_temps = [150.0, 200.0, 350.0, 450.0, 550.0, 650.0] - for T in test_temps: - lookup_result = interpolate_lookup(T, np.flip(np.array([600.0, 500.0, 400.0, 300.0, 200.0])), + for TT in test_temps: + lookup_result = interpolate_lookup(TT, np.flip(np.array([600.0, 500.0, 400.0, 300.0, 200.0])), np.array([10.0, 20.0, 30.0, 40.0, 50.0])) - equidistant_result = interpolate_equidistant(T, 200.0, 100.0, np.array([10.0, 20.0, 30.0, 40.0, 50.0])) - print(f"Temperature {T}:") + equidistant_result = interpolate_equidistant(TT, 200.0, 100.0, np.array([10.0, 20.0, 30.0, 40.0, 50.0])) + print(f"Temperature {TT}:") print(f"interpolate_lookup result: {lookup_result}") print(f"interpolate_equidistant result: {equidistant_result}") if isinstance(lookup_result, (int, float)) and isinstance(equidistant_result, (int, float)): - assert np.isclose(lookup_result, equidistant_result), f"Inconsistent results for T = {T}" + assert np.isclose(lookup_result, equidistant_result), f"Inconsistent results for T = {TT}" else: - print(f"Skipping comparison for symbolic or non-numeric result at T = {T}") + print(f"Skipping comparison for symbolic or non-numeric result at T = {TT}") symbolic_lookup_result = interpolate_lookup(Temp, density_temp_array1, density_v_array1) symbolic_equidistant_result = interpolate_equidistant(Temp, Temp_base, Temp_incr, density_v_array1) diff --git a/src/materials/models.py b/src/materials/models.py index 8a453662e..cc1f1f088 100644 --- a/src/materials/models.py +++ b/src/materials/models.py @@ -83,12 +83,12 @@ if __name__ == '__main__': # Test 5: Thermal diffusivity calculation with array values for heat conductivity k_a = np.linspace(30, 40, 3) print(f"Test 4a - Thermal diffusivity with array of heat conductivity: {thermal_diffusivity_by_heat_conductivity(k_a, rho, c_p)}") - # Expected output: Array of thermal diffusivities + # Expected output: Array of thermal diffusivity # Test 6: Thermal diffusivity with density calculated by thermal expansion calculated_densities = density_by_thermal_expansion(T_a, T_0, rho, tec) print(f"Test 4b - Thermal diffusivity with calculated densities: {thermal_diffusivity_by_heat_conductivity(k_a, calculated_densities, c_p)}") - # Expected output: Array of thermal diffusivities considering temperature-dependent density + # Expected output: Array of thermal diffusivity considering temperature-dependent density # Test 7: Symbolic computation for density with sympy Symbol temperature T_symbolic = sp.Symbol('T') -- GitLab