cfdpre 0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cfdpre/__init__.py +3 -0
- cfdpre/main.py +99 -0
- cfdpre-0.1.dist-info/METADATA +28 -0
- cfdpre-0.1.dist-info/RECORD +6 -0
- cfdpre-0.1.dist-info/WHEEL +5 -0
- cfdpre-0.1.dist-info/top_level.txt +1 -0
cfdpre/__init__.py
ADDED
cfdpre/main.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# main.py
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
import CoolProp.CoolProp as CP
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def calculate_f(r, N, delta99, yH):
|
|
10
|
+
|
|
11
|
+
"""Calculates the function f(r) for root finding."""
|
|
12
|
+
|
|
13
|
+
return r**N - r * (delta99 / yH) + (delta99 / yH - 1)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def calculate_df_dr(r, N, delta99, yH):
|
|
18
|
+
|
|
19
|
+
"""Calculates the derivative of f(r) with respect to r."""
|
|
20
|
+
|
|
21
|
+
return N * r**(N-1) - (delta99 / yH)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def newton_raphson(N, delta99, yH, initial_guess=5, tolerance=1e-12, max_iterations=1000):
|
|
26
|
+
|
|
27
|
+
"""Finds the growth ratio using the Newton-Raphson method."""
|
|
28
|
+
|
|
29
|
+
r = initial_guess
|
|
30
|
+
|
|
31
|
+
for _ in range(max_iterations):
|
|
32
|
+
|
|
33
|
+
f_r = calculate_f(r, N, delta99, yH)
|
|
34
|
+
|
|
35
|
+
df_dr = calculate_df_dr(r, N, delta99, yH)
|
|
36
|
+
|
|
37
|
+
r_new = r - f_r / df_dr
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if np.abs(r_new - r) < tolerance:
|
|
41
|
+
|
|
42
|
+
return r_new
|
|
43
|
+
|
|
44
|
+
r = r_new
|
|
45
|
+
|
|
46
|
+
return r
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def yhgrcalc(fluid, temperature_c, pressure_bar, massflow_kgpersec, hydraulicdia_mm, target_yplus, num_layers):
|
|
52
|
+
|
|
53
|
+
pressure_pa = pressure_bar * 1e5
|
|
54
|
+
hydraulicdia_m = hydraulicdia_mm/1000
|
|
55
|
+
temperature_k = temperature_c + 273.15
|
|
56
|
+
|
|
57
|
+
dynvisc_pas = CP.PropsSI('V', 'T', temperature_k, 'P', pressure_pa, fluid)
|
|
58
|
+
dynvisc_nsm2 = dynvisc_pas
|
|
59
|
+
|
|
60
|
+
thermal_conductivity_wpermk = CP.PropsSI('L', 'T', temperature_k, 'P', pressure_pa, fluid)
|
|
61
|
+
specific_heat_cp_jperkgk = CP.PropsSI('C', 'T', temperature_k, 'P', pressure_pa, fluid)
|
|
62
|
+
density_kgperm3 = CP.PropsSI('D', 'T', temperature_k, 'P', pressure_pa, fluid)
|
|
63
|
+
kinevisc_m2s = dynvisc_nsm2 / density_kgperm3
|
|
64
|
+
volflowrate_m3persec = massflow_kgpersec / density_kgperm3
|
|
65
|
+
flowvelocity_mpersec = volflowrate_m3persec / ((np.pi/4) * np.power(hydraulicdia_m, 2))
|
|
66
|
+
reynolds = flowvelocity_mpersec * hydraulicdia_m / kinevisc_m2s
|
|
67
|
+
prandtl = specific_heat_cp_jperkgk * dynvisc_nsm2 / thermal_conductivity_wpermk
|
|
68
|
+
cf = np.power(((2 * np.log10(reynolds)- 0.65)), (-2.3)) # skin friction coefficient
|
|
69
|
+
tau_wall = 0.5 * density_kgperm3 * np.square(flowvelocity_mpersec) * cf # wall shear stress
|
|
70
|
+
u_tau = np.sqrt(tau_wall/density_kgperm3) #friction velocity
|
|
71
|
+
yp_m = (target_yplus * dynvisc_nsm2) /(u_tau * density_kgperm3)
|
|
72
|
+
yh_m = yp_m * 2
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if reynolds < 5e5:
|
|
78
|
+
|
|
79
|
+
delta99 = 4.91 * hydraulicdia_m / np.sqrt(reynolds)
|
|
80
|
+
|
|
81
|
+
else:
|
|
82
|
+
|
|
83
|
+
delta99 = 0.38 * hydraulicdia_m * reynolds**(-1/5)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
growth_ratio = newton_raphson(num_layers, delta99, yh_m)
|
|
87
|
+
final_layer_thickness_m = yh_m * growth_ratio**(num_layers - 1)
|
|
88
|
+
propdict = [density_kgperm3, specific_heat_cp_jperkgk, thermal_conductivity_wpermk, dynvisc_nsm2]
|
|
89
|
+
|
|
90
|
+
return yh_m, growth_ratio, final_layer_thickness_m, reynolds, propdict
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: cfdpre
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: CFD PreProcessing Library
|
|
5
|
+
Author: Pushkar Sheth
|
|
6
|
+
Author-email: siglyserdev@gmail.com
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: CoolProp
|
|
10
|
+
|
|
11
|
+
# CFD-Pre
|
|
12
|
+
CFD PreProcessing Library.
|
|
13
|
+
|
|
14
|
+
Provides the following functionality:
|
|
15
|
+
1. Calculate Boundary Layer Mesh dimensions.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Project Log
|
|
21
|
+
January 2025:
|
|
22
|
+
1. Created Library
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Project Road Map:
|
|
26
|
+
|
|
27
|
+
1. Documentation for existing functionality.
|
|
28
|
+
2. Include example data within library.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
cfdpre/__init__.py,sha256=kMXOwXEXmkNP2IXpfR3H9RoTL2hCYhFi-7aZvqR1A9g,41
|
|
2
|
+
cfdpre/main.py,sha256=Ml9AWENuCoNarpx5tdrEARHmWYGICcxX203W_1UbiFE,2758
|
|
3
|
+
cfdpre-0.1.dist-info/METADATA,sha256=sFrHbBFfdXaT5sOd0fP37_49WYVXLpSPHZ4bSQcBn3Q,538
|
|
4
|
+
cfdpre-0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
5
|
+
cfdpre-0.1.dist-info/top_level.txt,sha256=z61rr-JLldcK6fkxASUG-u6oUgwcuX3rVp8S1U2737s,7
|
|
6
|
+
cfdpre-0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cfdpre
|