@@ -380,6 +380,8 @@ def Calculate_Coaxial(self, model):
380
380
"""
381
381
model .logger .info (f'Init { str (__class__ )} : { sys ._getframe ().f_code .co_name } ' )
382
382
383
+ raise NotImplementedError ('SBT with coaxial configuration is not implemented at this time.' )
384
+
383
385
# Clear all equivalent: Initialize variables and import necessary libraries
384
386
385
387
# SBT v2 for co-axial heat exchanger with high-temperature capability
@@ -649,8 +651,8 @@ def Calculate_Coaxial(self, model):
649
651
# MIR N = len(x) - 1
650
652
N = len (x ) - 1
651
653
Nboiler = len (boilerelements )
652
- # MIR Nreg = N - Nboiler
653
- Nreg = 1 + N - Nboiler
654
+ Nreg = N - Nboiler
655
+ # Nreg = 1 + N - Nboiler
654
656
self .krock .value_vector = np .full (N , self .krock .value )
655
657
k_m_vector = np .zeros (N )
656
658
k_m_vector [Nreg :] = k_m_boiler
@@ -667,24 +669,26 @@ def Calculate_Coaxial(self, model):
667
669
SoverLSorted = SMatrixSorted / (np .ones ((N , 1 )) * Deltaz )
668
670
mindexNPCP = np .argmax (np .min (SoverLSorted , axis = 1 ) < LimitSoverL )
669
671
670
- # MIR midpointsx = 0.5 * x[1:] + 0.5 * x[:-1]
671
- # MIR midpointsy = 0.5 * y[1:] + 0.5 * y[:-1]
672
- # MIR midpointsz = 0.5 * z[1:] + 0.5 * z[:-1]
673
- midpointsx = 0.5 * x + 0.5 * x
674
- midpointsy = 0.5 * y + 0.5 * y
675
- midpointsz = 0.5 * z + 0.5 * z
672
+ midpointsx = 0.5 * x [1 :] + 0.5 * x [:- 1 ]
673
+ midpointsy = 0.5 * y [1 :] + 0.5 * y [:- 1 ]
674
+ midpointsz = 0.5 * z [1 :] + 0.5 * z [:- 1 ]
675
+ # midpointsx = 0.5 * x + 0.5 * x
676
+ # midpointsy = 0.5 * y + 0.5 * y
677
+ # midpointsz = 0.5 * z + 0.5 * z
676
678
verticalchange = np .diff (z )
677
679
# MIR
678
- verticalchange = np .append (verticalchange , verticalchange [- 1 ])
680
+ # verticalchange = np.append(verticalchange, verticalchange[-1])
679
681
680
682
if initialtemperatureprofile == 0 :
681
683
BBinitial = Tsurf - GeoGradient * midpointsz
682
684
Tfluidupnodes = Tsurf - GeoGradient * z
683
685
Tfluiddownnodes = Tsurf - GeoGradient * z
684
686
elif initialtemperatureprofile == 1 :
685
687
BBinitial = np .interp (midpointsz , initialtemperaturedata [:, 0 ], initialtemperaturedata [:, 1 ])
686
- Tfluidupnodes = np .interp (z , initialtemperaturedata [:, 0 ], initialtemperaturedata [:, 1 ])
687
- Tfluiddownnodes = np .interp (z , initialtemperaturedata [:, 0 ], initialtemperaturedata [:, 1 ])
688
+ #Tfluidupnodes = np.interp(z, initialtemperaturedata[:, 0], initialtemperaturedata[:, 1])
689
+ #Tfluiddownnodes = np.interp(z, initialtemperaturedata[:, 0], initialtemperaturedata[:, 1])
690
+ Tfluidupnodes = np .interp (z [:- 1 ], initialtemperaturedata [:, 0 ], initialtemperaturedata [:, 1 ])
691
+ Tfluiddownnodes = np .interp (z [:- 1 ], initialtemperaturedata [:, 0 ], initialtemperaturedata [:, 1 ])
688
692
689
693
# MIR Tfluiddownmidpoints = 0.5 * Tfluiddownnodes[1:] + 0.5 * Tfluiddownnodes[:-1]
690
694
# MIR Tfluidupmidpoints = 0.5 * Tfluidupnodes[1:] + 0.5 * Tfluidupnodes[:-1]
@@ -811,26 +815,38 @@ def Calculate_Coaxial(self, model):
811
815
self .Tresoutput .value [0 ] = Tsurf
812
816
Poutput [0 ] = Pin * 1e5
813
817
814
- Tfluidupnodesstore = np .zeros ((N + 1 , len (times )))
815
- Tfluiddownnodesstore = np .zeros ((N + 1 , len (times )))
816
- # MIR Tfluidupmidpointsstore = np.zeros((N, len(times)))
817
- Tfluidupmidpointsstore = np .zeros ((N + 1 , len (times )))
818
- # MIR Tfluiddownmidpointsstore = np.zeros((N, len(times)))
819
- Tfluiddownmidpointsstore = np .zeros ((N + 1 , len (times )))
820
- Pfluidupnodesstore = np .zeros ((N + 1 , len (times )))
821
- Pfluiddownnodesstore = np .zeros ((N + 1 , len (times )))
822
- # MIR Pfluidupmidpointsstore = np.zeros((N, len(times)))
823
- # MIR Pfluiddownmidpointsstore = np.zeros((N, len(times)))
824
- Pfluidupmidpointsstore = np .zeros ((N + 1 , len (times )))
825
- Pfluiddownmidpointsstore = np .zeros ((N + 1 , len (times )))
826
- Qfluidupnodesstore = np .zeros ((N + 1 , len (times )))
827
- Qfluiddownnodesstore = np .zeros ((N + 1 , len (times )))
828
- Phasefluidupnodesstore = np .zeros ((N + 1 , len (times )))
829
- Phasefluiddownnodesstore = np .zeros ((N + 1 , len (times )))
830
- Hfluidupnodesstore = np .zeros ((N + 1 , len (times )))
831
- Hfluiddownnodesstore = np .zeros ((N + 1 , len (times )))
818
+ #Tfluidupnodesstore = np.zeros((N + 1, len(times)))
819
+ #Tfluiddownnodesstore = np.zeros((N + 1, len(times)))
820
+ Tfluidupnodesstore = np .zeros ((N , len (times )))
821
+ Tfluiddownnodesstore = np .zeros ((N , len (times )))
822
+ Tfluidupmidpointsstore = np .zeros ((N , len (times )))
823
+ #Tfluidupmidpointsstore = np.zeros((N + 1, len(times)))
824
+ Tfluiddownmidpointsstore = np .zeros ((N , len (times )))
825
+ #Tfluiddownmidpointsstore = np.zeros((N + 1, len(times)))
826
+ #Pfluidupnodesstore = np.zeros((N + 1, len(times)))
827
+ #Pfluiddownnodesstore = np.zeros((N + 1, len(times)))
828
+ Pfluidupnodesstore = np .zeros ((N , len (times )))
829
+ Pfluiddownnodesstore = np .zeros ((N , len (times )))
830
+ Pfluidupmidpointsstore = np .zeros ((N , len (times )))
831
+ Pfluiddownmidpointsstore = np .zeros ((N , len (times )))
832
+ #Pfluidupmidpointsstore = np.zeros((N + 1, len(times)))
833
+ #Pfluiddownmidpointsstore = np.zeros((N + 1, len(times)))
834
+ #Qfluidupnodesstore = np.zeros((N + 1, len(times)))
835
+ #Qfluiddownnodesstore = np.zeros((N + 1, len(times)))
836
+ #Phasefluidupnodesstore = np.zeros((N + 1, len(times)))
837
+ #Phasefluiddownnodesstore = np.zeros((N + 1, len(times)))
838
+ #Hfluidupnodesstore = np.zeros((N + 1, len(times)))
839
+ #Hfluiddownnodesstore = np.zeros((N + 1, len(times)))
840
+ Qfluidupnodesstore = np .zeros ((N , len (times )))
841
+ Qfluiddownnodesstore = np .zeros ((N , len (times )))
842
+ Phasefluidupnodesstore = np .zeros ((N , len (times )))
843
+ Phasefluiddownnodesstore = np .zeros ((N , len (times )))
844
+ Hfluidupnodesstore = np .zeros ((N , len (times )))
845
+ Hfluiddownnodesstore = np .zeros ((N , len (times )))
832
846
Qinterexchangestore = np .zeros ((N , len (times )))
833
847
QinterexchangeUp = np .zeros (N )
848
+ velocityfluiddownmidpointsstore = np .zeros ((N , len (times )))
849
+ heatcapacityfluidupmidpointsstore = np .zeros ((N , len (times )))
834
850
835
851
# Store initial values
836
852
Tfluidupnodesstore [:, 0 ] = Tfluidupnodes
@@ -846,6 +862,8 @@ def Calculate_Coaxial(self, model):
846
862
Phasefluidupnodesstore [:, 0 ] = Phasefluidupnodes
847
863
Phasefluiddownnodesstore [:, 0 ] = Phasefluiddownnodes
848
864
Qinterexchangestore [:, 0 ] = np .zeros (N )
865
+ velocityfluiddownmidpointsstore [:, 0 ] = velocityfluiddownmidpoints
866
+ heatcapacityfluidupmidpointsstore [:, 0 ] = heatcapacityfluidupmidpoints
849
867
850
868
print ('Pre-processing completed successfully. Starting simulation ...' )
851
869
@@ -942,7 +960,8 @@ def Calculate_Coaxial(self, model):
942
960
else :
943
961
maxindextoconsider = np .where (maxspacingtest > 1 )[0 ][- 1 ]
944
962
945
- if mindexNPCP < maxindextoconsider + 1 :
963
+ #if mindexNPCP < maxindextoconsider + 1:
964
+ if mindexNPCP < maxindextoconsider :
946
965
indicestocalculate = SortedIndices [:, mindexNPCP + 1 :maxindextoconsider + 1 ]
947
966
NPCP [range (N ), indicestocalculate ] = Deltaz [indicestocalculate ] / (
948
967
4 * np .pi * k_m_vector [indicestocalculate ] * SMatrix [range (N ), indicestocalculate ]) * erfc (
@@ -1027,40 +1046,53 @@ def Calculate_Coaxial(self, model):
1027
1046
1028
1047
Q [:, i ] = BB
1029
1048
1030
- R [0 :N ] = Vvector * Tfluiddownmidpointsstore [:, i - 1 ] / Deltat
1031
- R [0 :N ] += Q [:, i ]
1032
- R [N :2 * N ] = Vvector * Tfluidupmidpointsstore [:, i - 1 ] / Deltat
1033
- R [N :2 * N ] += Q [:, i ]
1034
-
1035
- R [2 * N :3 * N ] = Pfluidupmidpointsstore [:, i - 1 ] - Pfluiddownmidpointsstore [:,
1049
+ #R[0:N] = Vvector * Tfluiddownmidpointsstore[:, i - 1] / Deltat
1050
+ #R[0:N] += Q[:, i]
1051
+ #R[N:2 * N] = Vvector * Tfluidupmidpointsstore[:, i - 1] / Deltat
1052
+ #R[N:2 * N] += Q[:, i]
1053
+ R [0 :N , 0 ] = Vvector * Tfluiddownmidpointsstore [:, i - 1 ] / Deltat
1054
+ R [0 :N , 0 ] += Q [:, i ]
1055
+ R [N :2 * N , 0 ] = Vvector * Tfluidupmidpointsstore [:, i - 1 ] / Deltat
1056
+ R [N :2 * N , 0 ] += Q [:, i ]
1057
+
1058
+ #R[2 * N:3 * N] = Pfluidupmidpointsstore[:, i - 1] - Pfluiddownmidpointsstore[:,
1059
+ # i - 1] + velocityfluiddownmidpointsstore[:,
1060
+ # i - 1] * Pfluiddownmidpointsstore[:,
1061
+ # i - 1] * Deltat
1062
+ R [2 * N :3 * N , 0 ] = Pfluidupmidpointsstore [:, i - 1 ] - Pfluiddownmidpointsstore [:,
1036
1063
i - 1 ] + velocityfluiddownmidpointsstore [:,
1037
1064
i - 1 ] * Pfluiddownmidpointsstore [:,
1038
1065
i - 1 ] * Deltat
1039
1066
1040
- R [3 * N :4 * N ] = heatcapacityfluidupmidpointsstore [:, i - 1 ] * Tfluidupmidpointsstore [:, i - 1 ]
1067
+ #R[3 * N:4 * N] = heatcapacityfluidupmidpointsstore[:, i - 1] * Tfluidupmidpointsstore[:, i - 1]
1068
+ R [3 * N :4 * N , 0 ] = heatcapacityfluidupmidpointsstore [:, i - 1 ] * Tfluidupmidpointsstore [:, i - 1 ]
1041
1069
1042
1070
try :
1043
1071
solutions = np .linalg .solve (L , R )
1044
1072
except np .linalg .LinAlgError :
1045
1073
print (f'Simulation terminated prematurely due to linear algebra error at time step { i } .' )
1046
1074
break
1047
1075
1048
- BB = solutions [0 :N ]
1076
+ #BB = solutions[0:N]
1077
+ BB = solutions [0 :N , 0 ]
1049
1078
Tfluidupmidpointsstore [:, i ] = BB
1050
1079
Tfluidupmidpoints = BB
1051
1080
Tfluidupmidpoints = Tfluidupmidpoints
1052
1081
1053
- BB = solutions [N :2 * N ]
1082
+ #BB = solutions[N:2 * N]
1083
+ BB = solutions [N :2 * N , 0 ]
1054
1084
Tfluiddownmidpointsstore [:, i ] = BB
1055
1085
Tfluiddownmidpoints = BB
1056
1086
Tfluiddownmidpoints = Tfluiddownmidpoints
1057
1087
1058
- BB = solutions [2 * N :3 * N ]
1088
+ #BB = solutions[2 * N:3 * N]
1089
+ BB = solutions [2 * N :3 * N , 0 ]
1059
1090
Pfluidupmidpointsstore [:, i ] = BB
1060
1091
Pfluidupmidpoints = BB
1061
1092
Pfluidupmidpoints = Pfluidupmidpoints
1062
1093
1063
- BB = solutions [3 * N :4 * N ]
1094
+ #BB = solutions[3 * N:4 * N]
1095
+ BB = solutions [3 * N :4 * N , 0 ]
1064
1096
Pfluiddownmidpointsstore [:, i ] = BB
1065
1097
Pfluiddownmidpoints = BB
1066
1098
Pfluiddownmidpoints = Pfluiddownmidpoints
0 commit comments