Determination of the Thermodynamic Properties of Water and Steam in the p-T and p-S Planes via Different Grid Search Computer Algorithms

: The role of different grid search computer algorithms for the determination of the thermodynamic properties of water and steam in the p-T and P-S planes has been investigated via experimental and analytical methods. The results show that the spline interpolation grid search algorithm and the power grid search algorithm are more efficient, stable and clear than other algorithms.

Therefore, only by improving the continuity of lines in the saturated-line region [Sendek, Cubuk, Antoniuk et al. (2018)] can prevent the accuracy from being reduced and maintain the high standards on calculation speed simultaneously [Baltrusaitis, Valter, Hellman et al. (2016)]. Based on the application conditions of the spline interpolation algorithm, instead of the real surfaces of thermal properties, this study uses the virtual surfaces [Tymińska, Wu and Dupuis (2017)] to separately calculate the values of the thermal surfaces on both sides of the saturation lines [Kitabata, Taddese and Okazaki (2018)]. In other words, the point of thermal state maintains the same data as the curved surface of the saturation line [Ammal and Heyden (2016)]. Therefore, the virtual surface represents the other side of the thermal surface, thereby ensuring that the entire thermal surface is intact without breaking [Ha, Baxter, Cass et al. (2017)]. In summary, the thermodynamic properties of water and steam in p-T and p-S planes are studied by experimental and analytical methods. The results show that the search algorithms based on spline interpolation and power grid have greater advantages in researching the thermodynamic properties of water and steam in the p-T and p-S planes. The proposed algorithms are significant for the subsequent research on the thermodynamic properties of water and steam in the p-T and p-S planes.

Optimization of the spline interpolation algorithm
Combined with the previous algorithms, an inclusive innovation was made to the speed calculation algorithm of the thermodynamic properties of steam and water in the p-T plane. The method based on the virtual surface extension was used for all the applications on both sides of the saturation lines. Then, coefficients of the two sets of spline algorithms were formed separately, and the coefficients of the spline algorithm on the real data side were stored. Besides, three different numerical-based surface extension algorithms were applied to the thermodynamic surfaces of density, enthalpy, and entropy, which were respectively the quadratic curve extension, the straight-line extension, and the cubic spline curve extension. The line extension method for point fitting was mostly a kind of interpolation algorithm. The key was that it perfectly integrated the extension point of the image with the baseline. By using such methods, the perfect extension of the thermodynamic surfaces on the saturation lines of the curve could be achieved, which not only made the calculation accuracy of the algorithm greatly improved but also reduced the time consumption of the computer grid search. Therefore, the operation rate of the spline interpolation algorithm was improved. Also, the reduction in accuracy and the overlength of operating time that caused by boundary specification of coordinate transformation were correctly solved. The experiments confirmed that the three methods could meet the accuracy requirements of the algorithm near the saturation lines. Besides, the accuracy of the quadratic curve algorithm was the highest, and the accuracy of the algorithm near the saturation lines was reduced by 2-3 orders of magnitude.

Study on thermodynamic properties of water and steam in the p-T thermodynamic plane by the spline interpolation algorithm
The accuracy of the spline interpolation algorithm is affected by the unsustainability of the saturated on-the-line thermal properties. Therefore, the spline interpolation algorithm used the saturation line as the center point to improve its accuracy by dividing its surrounding area into non-square areas for calculations. However, in turn, the algorithm of spline interpolation would have strict requirements on the shape of the area, which must be a square. In other words, the position of each element point was correspondingly converted to the boundary to change the surrounding area into a square. Calculation confirmed that the accuracy of the spline interpolation algorithm in most regions was 3-4 orders of magnitude better than other algorithms, which was progress from quantity to quality. Only by improving the continuity of lines in the saturated-line region could prevent the accuracy from being reduced and maintain the high standards on calculation speed simultaneously. Based on the application conditions of the spline interpolation algorithm, instead of the real surfaces of thermal properties, the study used the virtual surfaces ( Fig.  1) to separately calculate the values of the thermal surfaces on both sides of the saturation lines. In other words, the point of thermal state maintained the same data as the curved surface of the saturation line. Therefore, the virtual surface represented the other side of the thermal surface, thereby ensuring that the entire thermal surface is intact without breaking. Also, specific requirements were given for the spline interpolation algorithm. First, based on the requirements of thermodynamic properties, the algorithm should calculate and find the interpolation grid to meet the accuracy requirements of different regions. Second, based on the spline interpolation method, the algorithm should calculate the coefficients included in the grid and store these coefficients in the computer database. Third, the algorithm should write the coefficients included in all grid splines into the computer memory to ensure that the computer CPU could be called at any time.
According to the position of a given thermal state point, the saturation line was used as the center point to divide the surrounding area into many non-square areas for successive operations. However, in turn, the spline interpolation algorithm would have stricter requirements on the shape of the surrounding area, i.e., the area must be square. Therefore, the position of each element point was correspondingly converted to a boundary to change the area into a square. In other words, the irregular shape with the boundary region was transformed into a regular square, which settled the overlength of time caused by partition and coordinate changes.

Optimization of the surface extension algorithm
The results showed that based on the uniform grid of the whole region, the calculation accuracy of the spline interpolation algorithm would be reduced by the decrease of p.
The reduction in accuracy was mainly caused by the primary method of piecewise polynomials used by spline interpolation algorithm for the infinite proximity to the more delicate surfaces. The infinite proximity of the algorithm was inversely proportional to the surface rate. Thus, a smaller p-value indicated more violent changes in the thermodynamic properties in the p-S plane. The general spline interpolation algorithm could only be satisfied by a square grid. Therefore, in this study, the uniform grid was used to increase the density at the beginning, thereby reducing the calculation error in the low-pressure region. As the density of the grid continued to increase, the algorithmic error in the low-pressure region continued to decrease; however, it would bring two problems at the same time: First, as the density of the grid continued to increase, the error of the algorithm would continue to become weak. In other words, as the density of the grid continued to increase, the accuracy of the algorithm was also steadily increasing. However, as the grid density continued to increase, the CPU space of the computer would continue to decrease. As the grid density increased, the computational search time consumed by the algorithm would continue to increase, and the rate of computation would gradually decrease. Second, the experimental data showed that the calculation accuracy of the algorithm was the lowest in the low-pressure region, and the accuracy of the calculation could be improved by increasing the grid density. However, it cannot meet the purpose of this study.
Since the computational accuracy required in the high-pressure region would far exceed the accuracy of industrial computing, the computational accuracy of the algorithm in the low-pressure region cannot meet the industrial requirements.
In order to solve these problems, it was necessary to increase the grid density in the lowpressure region continuously. At the same time, it was necessary to reduce the grid density in the high-pressure region continuously. Therefore, a non-uniform grid was used to satisfy the requirements on the computational accuracy of the algorithm in the low-pressure region. Meanwhile, a stable state within a specific pressure range was guaranteed. This study used a non-uniform grid approach, in which the gradual transition started from the low-pressure region to the high-pressure region. Also, the basic non-uniform grid algorithms of equal difference, equal ratio, and power-law were verified respectively (Tab. 1). For the accurate and fair results, the grid densities were all 300 (p)×300 (s). The results showed that the three types of non-uniform grid algorithms significantly improved the computational accuracy in the low-pressure region. The equal-ratio grid algorithm reduced the computational error in the low-pressure region; however, it also increased the operation error in the high-pressure region. For the equal difference grid and the power-law grid, in the direction of the overall pressure, the operation errors under the spline interpolation algorithm were closed. However, in the low-pressure region, the operation error of the power-law grid was smaller than that of the equal difference grid. Thus, the power rate grid method was adopted in this study. Equal difference i o dp dp i Δp = + × dpi is the grid length in the pressure direction, dpo is the length of the first grid (starts from the low pressure), p ∆ is the increment of the grid length Equal ratio i i o dp dp k , i 1.0 = + > dpi and dpo are the same as above; k is the ratio of the lengths of adjacent grids.

Power law
[ ] x n 1 u n n 1, 2, 3..N N 1 N is the total number of grids for the entire calculation range, n is the grid point number, u[n] is the nth grid point position (the total length is set to 1), and x is the index.

Study on thermodynamic properties of water and steam in the p-S thermodynamic plane by the surface extension algorithm
In order to avoid the partitioning and reduce the occupation of computer memory resources, this study used a spline interpolation model of the non-uniform grid. If the conventional equation search method was used, the complexity of grid would inevitably lead to the complexity of the search algorithm and reduce the calculation speed of the spline interpolation model. Therefore, it was necessary to develop a more efficient grid search algorithm. The spline interpolation algorithm used the saturation line as the center point to improve its accuracy by dividing its surrounding area into non-square areas for calculations. However, in turn, the algorithm of spline interpolation would have strict requirements on the shape of the area, which must be a square. In other words, the position of each element point was correspondingly converted to the boundary to change the surrounding area into a square, thereby achieving the goal of the algorithm. For the uniform grid and the three partitioning methods of non-uniform grid discussed above, if the searching was based on the grid calculation equation, the following equations would be obtained: min p p j floor dp The calculation equations listed above were respectively the search equations of the uniform grid, the arithmetic grid, the equal-ratio grid, and the power-law grid. In the present study, the calculation amount of the above search equations was calculated, and 120 thermal element state points were randomly selected for speed detection from the whole p-T thermodynamic surface. In addition, the search algorithm of the uniform grid had the smallest computational quantity and the fastest calculation speed; the search algorithms of the arithmetic grid, the equal-ratio grid, and the power-law grid had greater computational quantity but slower calculation speed because of the square root, logarithm, and power operations. The equation search method cannot be used as the grid search algorithm. Based on the research of the computational quantity of the non-uniform grid search algorithm, this study used the binary search algorithm to perform grid work. Assuming the grid number in the direction of the pressure was 300, the binary search algorithm was used for searching, and the computer would judge according to the following steps: First, the grid was roughly divided into two parts (1-150 and 151-300), in which the part that was geared to the given p-value was judged, and the search range was narrowed down to 150 grids in further. Second, the above step was repeated, and the search range was reduced to 75 grids in further. Third, the above step was repeated, the search range was reduced to within 2 grids in further. Consequently, the position j of the grid in the pressure direction was determined. The search process with a grid number of 300 used only 10 logical operations for numerical value judgment. Only 10 if-statements were necessary for programming. The calculation amount was 28.9 flops, which was much smaller than the calculation amount of the equation methods listed in Tab. 1. It thoroughly explained the search efficiency of the binary search method. Millions of grids with different density were searched with a grid number of 300 in the pressure direction, and the calculation time was calculated. The results illustrated that the search time of the binary search method was about 0.855 s, which had more significant advantages than the equation search method.
The utilization of complex non-uniform grids improved the calculation accuracy of spline interpolation function in the low-pressure region, reduced the total number of grids, and occupied less computer memory resources. If the equation methods were used to search the grids, the search efficiency would be lower, while the search efficiency of the powerlaw grid was only related to the total number of grids. It was related to the complexity of the grid, and the power grid search algorithm had a considerable advantage for the sophisticated non-uniform grid search algorithm, which made it unnecessary to consider the impact on the computational speed when the optimization scheme of the grid was used.
For the grid search of thermodynamic properties on other thermodynamic surfaces, the power grid search algorithm was more efficient.

Results and discussion
As shown in Fig. 2, under the condition of constant pressure, the grid search algorithm of spline interpolation based on surface extension showed that the actual thermodynamic property curve on the right side had a considerable improvement in accuracy, stability, and clarity of data results. The improvement was 2-3 orders of magnitude, which fully validated the clarity and accuracy of the data of the grid search algorithm of spline interpolation based on the surface extension. As shown in Fig. 3, under the condition of constant pressure, the grid search algorithm of spline interpolation based on surface extension showed that the real thermodynamic property curve on the right side had a massive improvement in accuracy, stability, and clarity of data result. The improvement was 3-4 orders of magnitude, which fully validated the efficiency of the grid search algorithm of spline interpolation based on the surface extension. Power-law grid 360.2 6.015 As shown in Tab. 2, it was concluded that among the uniform grid, the arithmetic grid, the equal-ratio grid, and the power-law grid, the calculation of the power-law grid was the largest among the four grid schemes. In addition, the search time of the uniform grid for 10 9 was the least. Different grid schemes had different characteristics and advantages in the grid search algorithm of spline interpolation based on the surface extension. In the actual applications, the grid scheme needed to be selected according to the actual situations, but the algorithm used in this study was still the most efficient. As shown in Tab. 3, it was clear that among the four work districts, i.e., work district 1, work district 2, work district 3, and work district 4, the work district 4 had the least calculation time t1 of spline interpolation algorithm (ρ SPL (p, T)), which was 0.063; also, the work district 3 had the least calculation time t2 of the general calculation model of general thermodynamics (ρIF97 (p, T)), which was 3.271. It could be observed from the ratio of t2 and t1 that in the calculation of 10 8 , the efficiency of the work district 4 was the highest. It was evident that different work districts had different characteristics and advantages in the grid search algorithm of spline interpolation based on the surface extension. In the actual applications, the work district needed to be selected according to the actual situation, but the algorithm used in this study was still the most efficient.  Fig. 4, as the grid density continued to increase in the low-pressure region, the error of the algorithm would fluctuate at the beginning; then, it would become weaker. In other words, as the grid density continued to increase, the accuracy of the calculation was also steadily increasing. At the same time, in the calculation of thermodynamic properties, the square that the determined state point (p, s) belonged to should be figured at first, i.e., as the grid density increased, the search time consumed by the algorithm would continue to increase, and the rate of calculation would gradually decrease. As shown in Fig. 5, as the density of the grid increased, the error of the algorithm was reduced. In the high-pressure region, since the required calculation accuracy was not high, the grid density could be increased continuously. The accuracy required in the low-pressure region was relatively high, by improving the grid density, the accuracy of the calculation could be improved. The computational accuracy required in the high-pressure region would far exceed the accuracy of mechanical calculations, but the computational accuracy requirements of the algorithm in the low-pressure region were the highest.

Conclusion
In this study, the effects of different grid search computer algorithms on the thermodynamic properties of water and steam in p-T and p-S planes were analyzed. The thermodynamic properties of water and steam in p-T and p-S planes were studied by experimental and analytical methods. The results showed that the grid search algorithm of spline interpolation and the power grid search algorithm were more efficient, stable, and precise than other algorithms in researching the thermodynamic properties of water and steam in p-T and p-S planes, respectively. The overall improvement was 3-4 orders of magnitude. In summary, the search algorithms based on spline interpolation and power grid have greater advantages in researching the thermodynamic properties of water and steam in the p-T and p-S planes. The proposed algorithms are significant for the subsequent research on the thermodynamic properties of water and steam in the p-T and p-S planes. However, in this study, improvements could be made in further. For example, all the grid algorithms had not been studied in detail. Moreover, due to the limitations of time, the research in this study could be more in-depth. Despite these deficiencies, the results of this study could be used as reference for the follow-up researches.