Skip to content

Commit

Permalink
Fix a_in
Browse files Browse the repository at this point in the history
  • Loading branch information
MassimoCimmino committed Jun 13, 2024
1 parent 428678f commit 43799d6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions pygfunction/pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,20 +1099,18 @@ def coefficients_temperature(
# Coefficient [a_in] for inlet temperature
a_in = np.zeros((nz, 2, 1))
# Intermediate thermal parameters
A = 1 - delta + beta12 / gamma
B = 1 + delta - beta12 / gamma
A = 1 - 0.5 * (beta1 + beta2) / gamma
B = 1 + 0.5 * (beta1 + beta2) / gamma
C = (A + B * np.exp(-2 * gamma * H)) / (B + A * np.exp(-2 * gamma * H))
# Downward pipe
a_in[:, 0, 0] = (
(0.5 * (A * beta12 / gamma + B * (1 - delta)) / (B + A * np.exp(-2 * gamma * H)) * np.exp((beta + gamma) * z) if H < z_crit else 0.)
+ (0.5 * (B * beta12 / gamma + A * (1 - delta)) / (B + A * np.exp(-2 * gamma * H)) * np.exp((beta + gamma) * z - 2 * gamma * H))
+ 0.5 * (1 + delta - beta12 / gamma * C) * np.exp((beta - gamma) * z)
a_in[:, 0, 0] = 0.5 * (
((1 - delta) * A + beta12 / gamma * B) / (B + A * np.exp(-2 * gamma * H)) * np.exp((beta + gamma) * z - 2 * gamma * H)
+ ((1 + delta) * B - beta12 / gamma * A) / (B + A * np.exp(-2 * gamma * H)) * np.exp((beta - gamma) * z)
)
# Upward pipe
a_in[:, 1, 0] = (
(0.5 * (A * (1 + delta) - B * beta12 / gamma) / (B + A * np.exp(-2 * gamma * H)) * np.exp((beta + gamma) * z) if H < z_crit else 0.)
+ (0.5 * (B * (1 + delta) - A * beta12 / gamma) / (B + A * np.exp(-2 * gamma * H)) * np.exp((beta + gamma) * z - 2 * gamma * H))
+ 0.5 * (beta12 / gamma + (1 - delta) * C) * np.exp((beta - gamma) * z)
a_in[:, 1, 0] = 0.5 * (
((1 + delta) * B - beta12 / gamma * A) / (B + A * np.exp(-2 * gamma * H)) * np.exp((beta + gamma) * z - 2 * gamma * H)
+ ((1 - delta) * A + beta12 / gamma * B) / (B + A * np.exp(-2 * gamma * H)) * np.exp((beta - gamma) * z)
)

# Coefficient [a_in] for inlet temperature
Expand Down

0 comments on commit 43799d6

Please sign in to comment.