Adaptive phase space thermodynamic table construction, storage and retrieval method with phase boundary perception

CN122616414APending Publication Date: 2026-08-21SECOND INST OF OCEANOGRAPHY MNR
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610864146.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-16
Publication Date
2026-08-21

AI Technical Summary

Technical Problem

该类方法在热力学性质平滑区域可以获得较高效率,但在相边界、临界区和高梯度区域容易出现较大插值误差,甚至产生错误相态判定

Benefits of technology

(1)更好地平衡了精度与效率:通过基于局部热力学复杂度指标(如梯度、曲率、相态变化)进行递归剖分,仅在复杂区域细分辨率,平滑区域保持粗网格,从而以更少的存储开销获得更高的整体热力学精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122616414A_ABST
    Figure CN122616414A_ABST
Patent Text Reader

Abstract

The present application belongs to the field of thermodynamic property calculation, scientific calculation and high-performance numerical simulation, and relates to a self-adaptive phase space thermodynamic table construction, storage and retrieval method with phase boundary awareness, comprising: determining the range and dimension of the thermodynamic state space, establishing an initial partition and sampling to obtain thermodynamic properties and phase states; calculating the local complexity index (interpolation error, gradient, curvature, phase state change) of each unit; recursively subdividing the units that meet the refinement conditions to form a non-uniform hierarchical grid; identifying and marking the phase boundary, high gradient and critical region units; storing the leaf unit information (space range, level, property, risk label, etc.) in a data structure supporting fast indexing. When querying, interpolation calculation is performed on the single-phase smooth units, and the state equation is directly called for the high-risk or phase boundary units. The method is high in precision, robust in phase boundary, and efficient in storage and retrieval.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of thermodynamic property calculation, scientific computing and high-performance numerical simulation technology, and in particular to a method for constructing, storing and retrieving phase space thermodynamic tables with phase boundary awareness. Background Technology

[0002] In scientific calculations and engineering simulations involving water, salt water, carbon dioxide, hydrocarbon fluids, refrigerants, and other complex fluid systems, it is often necessary to frequently invoke complex thermodynamic equations of state to obtain fluid density, enthalpy, specific heat, viscosity, thermal conductivity, phase state, and other thermodynamic properties.

[0003] Existing thermodynamic equations of state are typically characterized by complex mathematical expressions, strong nonlinearity, numerous phase regions, dramatic changes in properties within the critical region, and the need for iterative inversion for some variable combinations. In large-scale numerical simulations, thermodynamic property queries may occur millions to billions of times, and directly calling the equations of state would significantly increase computational time.

[0004] To improve computational efficiency, existing techniques often employ regular grid lookup table methods, which involve pre-storing thermodynamic properties using a uniform grid in the thermodynamic state space and then performing interpolation lookups at runtime. While this type of method achieves high efficiency in regions with smooth thermodynamic properties, it is prone to significant interpolation errors at phase boundaries, critical regions, and high gradient regions, and may even lead to incorrect phase state determinations.

[0005] Improving accuracy by increasing the resolution of regular grids leads to a sharp increase in storage requirements with the dimensionality of the state space. For example, in a three-dimensional state space of pressure-temperature-composition, the number of uniform grids increases cubically with the resolution in each direction; for more components or more thermodynamic variables, the storage cost becomes even more unacceptable.

[0006] Therefore, existing technologies struggle to balance computational speed, storage efficiency, phase boundary robustness, and thermodynamic accuracy, and are particularly inadequate to meet the high-frequency call requirements of complex state equations in large-scale multiphysics numerical simulations. Summary of the Invention

[0007] To address the aforementioned technical problems, this invention provides a method for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness, employing the following technical solution, including the following steps: The range and dimensions of the thermodynamic state space are determined, initial partitioning units are established, and the equation of state is invoked at the sampling points to obtain thermodynamic properties and phase information; Based on the thermodynamic properties and the phase information, the local thermodynamic complexity index of each partition unit is calculated. The index includes at least one of interpolation error, property gradient, property curvature and phase change. Based on the local thermodynamic complexity index, the partitioned units that meet the refinement conditions are recursively subdivided to form a non-uniform hierarchical mesh structure. After the refinement is terminated, leaf units are obtained. The leaf units are defined as the final mesh units that are no longer further subdivided. In the leaf unit, phase boundary crossing units, high gradient units, and critical region units are identified and marked; The spatial range, hierarchical information, thermodynamic properties, risk markers, and interpolation data of the marked leaf units are stored in a data structure that supports queries, and a fast index and spatial positioning structure are established. Upon receiving a query request, the leaf unit to which the given state point belongs is located, and the thermodynamic properties are obtained in the single-phase smooth unit by interpolation based on the risk label of the leaf unit. In the unit marked as high risk or phase boundary crossing, the state equation is invoked to perform calculations and the results are returned.

[0008] To address the aforementioned technical problems, this invention also provides a phase boundary-aware adaptive phase space thermodynamic table construction, storage, and retrieval device, which employs the following technical solution, including: The initialization module is used to determine the range and dimensions of the thermodynamic state space, establish initial partitioning units, and call the equation of state at the sampling points to obtain thermodynamic properties and phase information; The calculation module is used to calculate the local thermodynamic complexity index of each partition unit based on the thermodynamic properties and the phase information. The index includes at least one of interpolation error, property gradient, property curvature and phase change. The subdivision module is used to recursively subdivide the partitioned units that meet the refinement conditions according to the local thermodynamic complexity index, forming a non-uniform hierarchical mesh structure. After the refinement is terminated, the leaf unit is obtained. The leaf unit is defined as the final mesh unit that will not be further subdivided. The identification module is used to identify and mark phase boundary crossing units, high gradient units, and critical region units in the leaf units; A module is established to store the spatial range, hierarchical information, thermodynamic properties, risk markers, and interpolation data of the marked leaf units in a data structure that supports queries, and to establish a fast index and spatial positioning structure. The calling module is used to locate the leaf unit to which the given state point belongs when a query request is received, and to obtain the thermodynamic properties in the single-phase smooth unit by interpolation method according to the risk label of the leaf unit. In the unit marked as high risk or phase boundary crossing, the state equation is called to perform calculation and return the result.

[0009] To address the aforementioned technical problems, the present invention also provides a computer device that employs the technical solution described below, comprising a memory and a processor. The memory stores computer-readable instructions, and the processor, when executing the computer-readable instructions, implements the steps of the aforementioned method for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness.

[0010] To address the aforementioned technical problems, the present invention also provides a computer-readable storage medium, which employs the technical solution described below. The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the aforementioned method for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness.

[0011] Compared with the prior art, the present invention has the following main advantages: (1) Better balance between accuracy and efficiency: By recursively partitioning based on local thermodynamic complexity indicators (such as gradient, curvature, phase change), fine resolution is only applied to complex regions and coarse mesh is maintained in smooth regions, thereby achieving higher overall thermodynamic accuracy with less storage overhead.

[0012] (2) Robust handling of phase boundaries: By explicitly identifying and marking phase boundary crossing units, high gradient units and critical region units, the state equation is directly called for these high-risk units to avoid phase state errors caused by interpolation and ensure thermodynamic consistency. This is particularly suitable for multiphysics simulation involving phase transitions.

[0013] (3) High efficiency in storage and retrieval: By adopting a hierarchical non-uniform grid structure, combined with fast indexing and spatial positioning, memory usage is significantly reduced. At the same time, during querying, only leaf cells need to be located and interpolation or direct calculation is selected according to the risk marker. High-speed interpolation is maintained in most smooth areas, and time-consuming state equations are called only in necessary areas, thus achieving coordinated optimization of computational speed and robustness. Attached Figure Description

[0014] To more clearly illustrate the solutions in this invention, the accompanying drawings used in the description of the embodiments of this invention will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0015] Figure 1 This is a flowchart of an embodiment of the phase boundary sensing adaptive phase space thermodynamic table construction, storage and retrieval method of the present invention; Figure 2 This is a schematic diagram of the adaptive partitioning of the two-dimensional thermodynamic state space quadtree used in the method of the present invention; Figure 3 This is a schematic diagram of the adaptive partitioning of the three-dimensional thermodynamic state space octree used in the method of the present invention; Figure 4 This is a schematic diagram of phase boundary crossing unit identification and marking used in the method of the present invention; Figure 5 A comparison chart showing the computational speed of the direct state equation, the rule lookup table, and the method of this invention; Figure 6 This is a schematic diagram of the coupling framework between the method of the present invention and the numerical simulator and the back-end of the state equation; Figure 7 This is a schematic diagram of an embodiment of the phase boundary sensing adaptive phase space thermodynamic table construction, storage and retrieval device of the present invention; Figure 8 This is a schematic diagram of the structure of one embodiment of the computer device of the present invention. Detailed Implementation

[0016] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains; the terminology used herein in the specification is for the purpose of describing particular embodiments only and is not intended to limit the invention; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings are used to distinguish different objects and not to describe a particular order.

[0017] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0018] To enable those skilled in the art to better understand the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.

[0019] It should be noted that the phase boundary-aware adaptive phase space thermodynamic table construction, storage and retrieval method provided in the embodiments of the present invention is generally executed by a server / terminal device, and correspondingly, the phase boundary-aware adaptive phase space thermodynamic table construction, storage and retrieval device is generally set in the server / terminal device.

[0020] It should be understood that the number of terminal devices, networks, and servers is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be used. Example 1

[0021] Please refer to Figure 1 The flowchart illustrates an embodiment of the phase boundary-aware adaptive phase space thermodynamic table construction, storage, and retrieval method of the present invention. The phase boundary-aware adaptive phase space thermodynamic table construction, storage, and retrieval method includes the following steps: Step S1: Determine the range and dimensions of the thermodynamic state space, establish initial partitioning units, and call the state equation at the sampling point to obtain thermodynamic properties and phase information.

[0022] In this embodiment, the electronic device (e.g., a server / terminal device) on which the phase boundary-aware adaptive phase space thermodynamic table construction, storage, and retrieval method runs can receive phase boundary-aware adaptive phase space thermodynamic table construction, storage, and retrieval requests via wired or wireless connections. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra wideband) connections, and other currently known or future-developed wireless connection methods.

[0023] In this embodiment, step S1 may specifically include the following steps: S11, determine the independent variables of the thermodynamic state space and their physical range.

[0024] Based on the target fluid system (e.g., pure water, CO2, brine H2O-NaCl, hydrocarbon mixtures, refrigerant R134a, etc.) and its applicable exact equation of state (e.g., IAPWS-IF97, Span-Wagner, Peng-Robinson, SAFT, etc.), a set of thermodynamically independent variables is selected to construct the state space. Typical combinations include, but are not limited to: Two-dimensional: Pressure -temperature ; Two-dimensional: Pressure enthalpy ; Three dimensions: pressure -temperature – Component mole fraction (or quality fraction); Three dimensions: pressure enthalpy – Component mole fraction ; High Dimension: Pressure -temperature –Multi-component .

[0025] For each independent variable, set minimum and maximum values ​​based on the target application scenario. For example, for geothermal system simulation: , ; , .

[0026] For salinity (mass fraction): , .

[0027] Defining the dimensions and range of the state space is a prerequisite for constructing the query table, avoiding subsequent interpolation and extrapolation to physically invalid regions, and also controlling the upper limit of storage size.

[0028] The purpose of step S11 is to lock the input coordinate system (dimension and physical range) of the lookup table, ensuring that all subsequent operations are performed only within the valid thermodynamic domain, and avoiding invalid regions from occupying storage and computing resources.

[0029] S12 establishes initial partitioning units in the thermodynamic state space, forming an initial coarse grid structure.

[0030] The state space is uniformly divided into initial partition units. Let the dimension of the state space be . , Divide in each dimension Segment (e.g.) If =2 or 4), then the initial total number of units is .

[0031] For a two-dimensional state space (e.g.) ): Divided into A rectangular unit.

[0032] For three-dimensional state space (e.g.) ): Divided into A cube unit.

[0033] Each initial unit stores: spatial extent (upper and lower bounds for each dimension), and current level. A pointer to the subarray (initially NULL), and optional cell center coordinates.

[0034] The specific data structure, described in C style, is exemplified below: struct Unit { double bounds[2][d]; / / Lower and upper bounds for each dimension int level; / / Level, root level is 0 int isLeaf; / / Whether it is a leaf node union { struct Unit* children; / / Pointer to an array of child units (2^d elements) LeafData leaf; / / Thermodynamic data stored in leaf nodes }; }; The coarse mesh avoids over-refinement starting from a single cell, while ensuring that all regions have at least one initial representation, providing a seed for adaptive refinement.

[0035] The purpose of step S12 is to cover the entire state space with a small number of coarse grid cells as the starting point for adaptive hierarchical refinement, balancing initial overhead and refinement flexibility.

[0036] S13 invokes the state equation at the corner, center, or sampling point of the initial partition unit to calculate and store thermodynamic properties and phase information as reference data for subsequent error assessment.

[0037] For each initial element, call the exact state equation backend at its corners (4 corners in 2D, 8 corners in 3D) and the element center (optional). The calling format is: .

[0038] For each sampling point, calculate and store the following set of thermodynamic properties. : density (Unit: kg / m³) enthalpy (Unit: J / kg); Internal energy (Unit: J / kg); Specific entropy (Unit: J / (kg·K)); Isobaric specific heat (Unit: J / (kg·K)); Dynamic viscosity (Unit: Pa·s); thermal conductivity (Unit: W / (m·K)); Speed ​​of sound (Unit: m / s); Compression coefficient ,in For volume, For pressure, For temperature; coefficient of thermal expansion ; Phase: Encoded by integers, for example 0 = liquid phase, 1 = vapor phase, 2 = two phases, 3 = supercritical, 4 = solid phase, etc.

[0039] If the equation of state cannot directly output a certain property (such as viscosity), the corresponding transport model is called through a unified backend interface.

[0040] The precise values ​​provide a reference standard for subsequent error assessment, while ensuring that there is at least some accuracy of data available for the initial interpolation on the initial coarse grid.

[0041] The purpose of step S13 is to provide high-precision thermodynamic properties and true phase values ​​for each node, center, or designated sampling point of the initial unit, as a reference for error calculation in step S2.

[0042] The purpose of step S1 is to: clarify the range of independent variables in the thermodynamic problem, establish the initial coarse resolution lookup table structure, and calculate the precise thermodynamic properties and phase states at all initial sampling points, providing a baseline true value for subsequent error assessment.

[0043] Step S2: Based on thermodynamic properties and phase information, calculate the local thermodynamic complexity index of each partition unit. The index includes at least one of interpolation error, property gradient, property curvature, and phase change.

[0044] In this embodiment, step S2 may specifically include the following steps: S21, calculate the relative error between the interpolated predicted value and the accurate state equation value in each partition unit to form an error complexity index.

[0045] For the current unit Assume the precise values ​​of its corner points (or existing sampling points) are known. We select a set of test points within the unit. (For example, the center of a cell, the midpoint of each edge, or a random point). For each test point: The predicted value is obtained by local interpolation based on the precise value of the current cell corner point. .

[0046] By applying the exact state equation, the true value can be obtained. .

[0047] Calculate the relative error.

[0048] Then, the maximum value among all test points and all thermodynamic properties is taken as the unit. Complexity metrics: .

[0049] in: :unit The local thermodynamic complexity index (dimensionless, representing the maximum relative interpolation error).

[0050] : The set of all thermodynamic properties that need to be calculated, for example .

[0051] :gather Any specific thermodynamic property, such as density or specific enthalpy .

[0052] The set of test points selected within the unit.

[0053] : No. The state vector of each test point, for example .

[0054] At the test point The true value of a thermodynamic property calculated from the exact equation of state.

[0055] : The predicted value obtained by interpolation of the current cell corner point at the same test point.

[0056] : Absolute value symbol, representing the absolute value of the difference.

[0057] A very small positive number, typically valued at... This is used to avoid the denominator being zero (for example, when the density approaches zero near absolute zero).

[0058] The maximum value operation first takes the maximum value of each property across all test points, and then takes the maximum value of different properties.

[0059] This formula directly reflects how much precision is lost when using interpolation at the current resolution. When Exceeding the preset error tolerance In such cases, the unit must be refined or specially processed.

[0060] The purpose of step S21 is to directly measure the maximum relative error caused by replacing the exact state equation with interpolation at the current cell resolution, which is the most important indicator driving refinement.

[0061] S22, calculate the gradient and curvature of the thermodynamic properties within each partition unit relative to the state variables, and form gradient and curvature complexity indices.

[0062] Using precise values ​​at sampling points (including corners and the center) within a unit cell, the partial derivatives of each thermodynamic property with respect to the state variables are calculated using the finite difference method. This is done in a two-dimensional state space. For example: ; .

[0063] The magnitude of the gradient (i.e., the rate of change) is: .

[0064] in: Scalar field The gradient magnitude in the state space represents the degree to which the property changes drastically with the state variables.

[0065] : Gradient operator (Nabla symbol).

[0066] : stress The partial derivatives of reflect the sensitivity of a property to pressure under isothermal conditions.

[0067] : Temperature The partial derivatives of reflect the sensitivity of the property to temperature under isobaric conditions.

[0068] , : Small changes in pressure and temperature, used for finite difference approximations.

[0069] Square root operation, used to calculate the Euclidean modulus of the gradient.

[0070] For curvature, calculate the maximum modulus of the eigenvalues ​​of the Hessian matrix: .

[0071] Curvature index ,in , for eigenvalues.

[0072] in: Thermodynamic properties Regarding state variables The Hessian matrix (second-order partial derivative matrix).

[0073] : stress The second-order partial derivatives of .

[0074] : Temperature The second-order partial derivatives of .

[0075] and : The mixed partial derivatives with respect to pressure and temperature (equal under continuously differentiable conditions).

[0076] , : The two eigenvalues ​​of the Hessian matrix.

[0077] : The absolute value of the eigenvalue.

[0078] Curvature index: Takes the absolute value of the largest eigenvalue, used to quantify the degree of curvature of a function.

[0079] High gradients or high curvatures mean that even small state perturbations can cause drastic changes in properties, even if the current error is small. Refining these regions in advance can improve the robustness of the simulation, especially for implicit solvers (which require thermodynamic derivatives).

[0080] The purpose of step S22 is to identify regions where thermodynamic properties change drastically in space. Even if the current interpolation error has not exceeded the limit, these regions may lead to insufficient refinement in the future due to high gradient / curvature, or cause derivative-related instabilities in numerical simulation.

[0081] S23, detect the phase consistency between different sampling points within each partition unit, and identify whether there is a phase boundary crossing or phase change.

[0082] For all sampling points within the cell (including at least all corner points, center points, and midpoints of each side), obtain their phase labels. .

[0083] Condition 1: If there exist any two sampling points , making If so, the element is marked as a phase boundary crossing element. Figure 4 This is a schematic diagram of phase boundary crossing unit identification and marking used in the method of the present invention.

[0084] Condition 2 (pure substance-assisted judgment): if the pressure range of the unit Includes the average temperature of the unit Saturation pressure below If both liquid and vapor points exist within a unit, then it is marked.

[0085] Condition 3 (mixtures): For systems containing solid precipitation (such as NaCl precipitated from brine), check the Gibbs free energy or solubility product.

[0086] In implementation, a phase mask (bitmask) can be pre-stored for each cell. Each phase corresponds to one bit. All phases that have appeared in the cell are bitwise ORed. If more than one bit in the result is 1, then there are multiple phases.

[0087] in: At the state point The phase code (integer) returned by the exact state equation.

[0088] : Any two different sampling points within a cell.

[0089] : Minimum and maximum pressure within the unit.

[0090] : The average temperature within the unit.

[0091] At a given temperature The saturation pressure function.

[0092] Interphase interpolation can produce completely non-physical interpretations; for example, it can yield meaningless intermediate densities for the specific volume of a liquid mixture and the specific volume of a gas mixture in a two-phase region, and it can also disrupt thermodynamic consistency. Accurate labeling of these units is crucial to ensuring the overall reliability of the algorithm.

[0093] The purpose of step S23 is to identify whether different phase states exist within the unit, or whether the unit is crossed by thermodynamic phase boundaries (saturation lines, solid precipitation lines, etc.). Such units cannot be interpolated using conventional methods and must be marked as high-risk, requiring subsequent rollback for accurate calculations.

[0094] The purpose of step S2 is to calculate multiple quantitative indicators for each current partition unit (initial or refined unit) to determine whether the unit needs further refinement or is marked as high risk.

[0095] Step S3: Based on the local thermodynamic complexity index, recursively subdivide the partitioned units that meet the refinement conditions to form a non-uniform hierarchical mesh structure. After the refinement is terminated, leaf units are obtained. Leaf units are defined as the final mesh units that are no longer further subdivided.

[0096] In this embodiment, step S3 may specifically include the following steps: S31. Based on the complexity index, determine whether the current partition unit meets the refinement conditions. The refinement conditions include error exceeding the limit, gradient exceeding the limit, curvature exceeding the limit, existence of multiphase state, or being located in the neighborhood of the critical region.

[0097] For each current leaf unit The following conditions are checked in sequence; refinement is triggered if any one of them is met: Error conditions: .

[0098] The complexity metric defined for step S21.

[0099] To preset a global error tolerance threshold, for example, commonly used in CFD simulations. High-precision database construction is available. .

[0100] Gradient condition: .

[0101] It represents the maximum gradient modulus of a certain thermodynamic property within the unit.

[0102] The gradient threshold can be set according to the normalization of the state variable range.

[0103] Curvature condition: .

[0104] This represents the maximum value of the curvature index.

[0105] This is the curvature threshold.

[0106] Multiphase condition: There are two or more different phase states in the cell (as shown in the detection result of step S23).

[0107] Critical region condition: The cell center point is located within the neighborhood of the critical point, i.e.: .

[0108] in: These are, respectively, critical pressure, critical temperature, and the first Critical mole fraction of each component.

[0109] Current state point The dimensionless Euclidean distance to the critical point.

[0110] : Critical neighborhood radius, usually taken as 0.05 or 0.1.

[0111] Subscripts for all components Sum.

[0112] If the critical point is unknown beforehand, it can be automatically detected by changes in the density derivative.

[0113] The refinement criteria cover three dimensions: accuracy, smoothness, and physical consistency, ensuring that the adaptive mesh can automatically capture all critical areas that require high resolution.

[0114] The purpose of step S31 is to determine whether the current leaf unit needs to be further subdivided based on a defined mathematical threshold.

[0115] S32, the element that meets the refinement condition, is uniformly divided according to the state space dimension to generate multiple sub-elements.

[0116] Let the dimension of the current unit be If the partitioning method is uniform bisection (i.e., each dimension is divided into two segments), then the number of sub-units is... .

[0117] Figure 2 This is a schematic diagram of the adaptive partitioning of the two-dimensional thermodynamic state space quadtree used in the method of this invention. Figure 2 As shown, two-dimensional Quadtree decomposition: The parent unit is divided into 4 small rectangles.

[0118] Figure 3 This is a schematic diagram of the adaptive partitioning of the three-dimensional thermodynamic state space octree used in the method of this invention. Figure 3 As shown, three-dimensional Octree partitioning: The parent unit is divided into 8 small cubes.

[0119] Higher dimensions: Correspondence Forked tree.

[0120] Specific operations (in two dimensions) For example): The parent unit's spatial range is , Sub-units after partitioning The scope is: ; .

[0121] in: : The total width of the parent cell in the pressure direction.

[0122] : The total width of the parent cell in the temperature direction.

[0123] : The index of the sub-unit in the pressure and temperature dimensions, with a value of 0 or 1.

[0124] The hierarchy of new sub-units For each new sub-unit, the exact equation of state is immediately invoked at all its corner points (some corner points may be inherited from the parent unit, and some may be newly added points) to calculate the thermodynamic properties and phase state, avoiding subsequent redundant calculations.

[0125] Hierarchical partitioning ensures the consistency and recursion of the grid, making it easy for subsequent queries to locate the target location by coordinate comparison.

[0126] The function of step S32 is to divide the parent unit into several sub-units evenly according to the dimension of the state space, and to initialize the new sub-units.

[0127] S33, update the tree structure, mark the parent element as a non-leaf node, calculate the accurate thermodynamic properties for the child elements, and recursively perform refinement judgments until the termination condition is met.

[0128] Set the parent cell's isLeaf flag to false.

[0129] Allocate a length of to the parent unit The array of child pointers.

[0130] Insert the newly generated sub-units into the array one by one.

[0131] For each new sub-unit, step S2 (local thermodynamic complexity assessment) is called again to calculate its... Indicators such as gradient, curvature, and phase consistency.

[0132] If the new subunit still meets the refinement conditions and the current level If the maximum depth is set by the user, such as 10, then add it to the refinement queue (stack or queue) and recursively execute steps S31–S33.

[0133] If a sub-unit does not meet the refinement conditions, it is retained as a leaf node, storing all its corner point data and the interpolation information required.

[0134] The correct updating of the tree structure is the core of the adaptive thinning algorithm, ensuring that the entire lookup table can represent arbitrarily complex non-uniform resolutions, while avoiding dangling nodes that could cause query failures.

[0135] The purpose of step S33 is to maintain the integrity of the adaptive data structure, convert the parent unit into a non-leaf node, establish parent-child links, and prepare for the next round of refinement loop.

[0136] The purpose of step S3 is to recursively subdivide the elements that meet the refinement conditions based on the local thermodynamic complexity index calculated in step S2, and concentrate computational and storage resources in the region where thermodynamic properties change drastically, forming a non-uniform high-resolution mesh.

[0137] Step S4: In the leaf element, identify and mark the phase boundary crossing element, high gradient element, and critical region element.

[0138] In this embodiment, step S4 may specifically include the following steps: S41, Identify and mark the leaf element that is crossed by the liquid-vapor boundary, liquid-solid boundary, vapor-solid boundary or multiphase coexistence boundary as the phase boundary crossing element.

[0139] Based on the phase state detection results of step S23, for the final leaf element: If the phase mask (bitmask) of a sampling point within a cell contains more than one phase, it is marked as CROSSING type.

[0140] To enhance robustness, for pure materials, additional verification can be performed: assuming the temperature range within the unit cell is... Pressure range is If a certain temperature exists This results in saturation pressure If both liquid and vapor phase sampling points exist within the unit, then mark it.

[0141] For solid-phase precipitation (such as hydrates or salt crystals in salt water), the salinity versus solubility curves are compared.

[0142] In implementation, a risk_flag bit field can be set for a single unit: enum RiskType { SMOOTH = 0x00, / / Smoothing unit, allowing safe interpolation CROSSING = 0x01, / / Phase boundary crossing unit HIGH_GRAD = 0x02, / / High gradient unit CRITICAL = 0x04 / / Critical section cell }; Phase boundary crossings are a high-risk area for interpolation methods, and must be calculated back to be accurate; otherwise, completely unphysical results will be produced.

[0143] The purpose of step S41 is to identify the units that are crossed by liquid-vapor phase, liquid-solid phase, vapor-solid phase, saturation curve, and multiphase coexistence boundary.

[0144] S42 identifies and marks leaf elements whose thermodynamic property gradients exceed the high gradient threshold as high gradient elements.

[0145] Take the maximum gradient magnitude within the cell calculated in step S22. Define the high gradient threshold. ,in Typically, a value of 5–10 is used. If: It is then marked as HIGH_GRAD. Typical scenarios include: Near the pseudo-critical line in the supercritical region peak.

[0146] The density near the critical point changes drastically with pressure or temperature.

[0147] The properties change abruptly near the isothermal line at the edge of the two-phase region.

[0148] in: In the unit Internal thermodynamic properties The maximum value of the gradient magnitude.

[0149] High gradient threshold, typically more refined than a standard threshold. Several times larger.

[0150] : Scale factor, used to calculate the high gradient threshold from the basic threshold.

[0151] : For sets The maximum value is taken for all properties.

[0152] Even in a single phase, using low-order interpolation in high-gradient regions can produce significant errors. Backtracking for accurate calculations can ensure the numerical stability of the simulation.

[0153] The purpose of step S42 is to mark units that, even without phase boundary crossings, have thermodynamic property gradients far exceeding normal levels. The interpolation errors of these units may still be large, and the derivative information is unreliable.

[0154] S43, identify and label leaf units located in the neighborhood of the critical point as critical region units.

[0155] Given the critical point of a fluid Define a dimensionless critical distance: .

[0156] If any sampling point within the cell (For example If ), then the unit is labeled CRITICAL.

[0157] in: State point The dimensionless Euclidean distance to the critical point.

[0158] Pressure at the current state point.

[0159] : Temperature at the current state point.

[0160] : No. The mole fraction (or mass fraction) of each component.

[0161] Critical pressure.

[0162] Critical temperature.

[0163] : No. Critical mole fraction of each component.

[0164] : From 1 to The components are summed by their subscripts (the last component is obtained by normalization and is not independent).

[0165] Square root, used to calculate Euclidean distance.

[0166] If no clear critical point data is available, automatic detection can be performed through thermodynamic property fluctuations: density within the calculation unit. If the coefficient of variation (standard deviation / mean) exceeds 0.1 and the pressure and temperature are close to the estimated critical values, then it is determined to be in the critical zone.

[0167] Critical region elements require the highest level of attention, not only requiring back-to-precision calculations but also potentially necessitating the use of specialized critical region state equation correction models.

[0168] The purpose of step S43 is to separately mark the critical point and the cells in its neighborhood. Because the critical region has singularities, density fluctuations and scaling behavior, conventional state equation interpolation or even direct evaluation may be inaccurate and requires special handling (such as calling the renormalization group to correct the state equation).

[0169] The purpose of step S4 is to identify those cells that cannot be safely used for interpolation calculations from the final set of all refined leaf cells, and to clearly mark them for use in subsequent query steps.

[0170] Step S5: Store the spatial range, hierarchical information, thermodynamic properties, risk markings, and interpolation data of the marked leaf units in a data structure that supports queries, and establish a fast index and spatial positioning structure.

[0171] In this embodiment, step S5 may specifically include the following steps: S51, select a storage data structure, including one or more combinations of tree structure, Morton encoding, Z-order sorting, hierarchical array, hash index, or compressed sparse storage.

[0172] Based on state space dimension Choose one or more of the following combinations with your expected query pattern: Tree structure (quadritree / octree): Advantages: Intuitive and easy to implement recursive positioning.

[0173] Disadvantages: High pointer overhead and poor cache-friendliness.

[0174] Suitable for: small to medium scale, with ≤3 dimensions.

[0175] Morton encoding (Z-order curve): Will Morton codes that map 3D space coordinates to alternating binary bits to a one-dimensional integer. .

[0176] The leaf units are sorted by Morton code and stored in a contiguous array.

[0177] During the query, the Morton code of the state point is calculated, and a binary search is used to locate it.

[0178] Advantages: Good spatial proximity, GPU friendly.

[0179] Level-based dense array: Each layer uses a dense grid array, and non-leaf layers store indices pointing to blocks in the next layer.

[0180] Suitable for scenarios with uniform and deep refinement but strong localization.

[0181] Hash index: Use the cell center coordinates or Morton code as the key and the leaf cell data as the value to store in a hash table.

[0182] The query time is O(1) on average, but hash collisions and memory overhead are significant.

[0183] This invention recommends Morton encoding and ordered arrays as the default implementation, balancing query speed and memory efficiency.

[0184] The purpose of step S51 is to balance storage space, cache locality, and query speed to adapt to different computing environments (CPU serial, multi-core, GPU).

[0185] S52 stores the spatial extent, hierarchy, risk marker, corner thermodynamic properties, and derivative or coefficient data required for interpolation for each leaf unit.

[0186] Create a data structure for each leaf unit, containing the following fields (taking a two-dimensional pressure-temperature space as an example): struct LeafCell { double p_low, p_high; / / Pressure range double T_low, T_high; / / Temperature range int level; / / Refine the hierarchy uint8_t risk_flags; / / Risk flags (SMOOTH / CROSSING / HIGH_GRAD / CRITICAL) / / Thermodynamic properties of the four corner points (0: bottom left, 1: bottom right, 2: top left, 3: top right) double rho[4]; / / density double h[4]; / / enthalpy double cp[4]; / / Specific heat at constant pressure double mu[4]; / / Viscosity double k[4]; / / Thermal conductivity uint8_t phase[4]; / / Phase encoding / / Optional: Derivatives used for higher-order interpolation double drho_dp[4], drho_dT[4]; / / Partial derivatives of density with respect to pressure and temperature }; For higher dimensions, storage requirements increase with the number of corner points. Exponential growth necessitates compressed storage in high-dimensional cases (e.g., storing only the center value and gradient).

[0187] Sufficient data ensures flexibility in choosing interpolation methods (linear, bilinear, Hermite, etc.), while risk labeling directly guides query strategies.

[0188] The purpose of step S52 is to save all the information needed to support interpolation calculations and risk decisions.

[0189] S53 establishes a fast index and spatial positioning structure, supporting the rapid positioning of the leaf unit to which it belongs based on a given state point.

[0190] Implemented using Morton code and binary search: Construction phase: Iterate through all leaf cells and calculate the Morton code for the representative point (such as the center point) of each cell. .

[0191] Press all leaf units Store the data in ascending order into the array leaf_array, and construct an auxiliary array to store the starting index corresponding to each Morton code.

[0192] Query phase: Given a state point Calculate its Morton code. .

[0193] In leaf_array Perform a binary search and find The interval in which it is located.

[0194] Since multiple units may have similar Morton codes, it is necessary to check the spatial range of each candidate unit (bounds check) until a unique containing Morton code is found. Leaf unit.

[0195] optimization: Use std::lower_bound or write a binary search by hand.

[0196] Create a first-level index for Morton codes (e.g., a skip list every 64 units) to speed up localization.

[0197] Location speed directly impacts overall query throughput. At a query frequency of millions of queries per second, O(log N) location is faster than recursive tree descent and is more suitable for SIMD / GPU.

[0198] The data structure output in this step includes: (1) an array of thermodynamic data for all leaf units; and (2) a fast indexing and spatial positioning structure based on Morton codes. This positioning structure will be used as input to step six for state point positioning in step S61.

[0199] The purpose of step S53 is to: provide any query state point It can locate the leaf unit to which it belongs within microseconds.

[0200] The purpose of step S5 is to store the final non-uniform mesh structure, the thermodynamic properties of each leaf element, the parameters required for interpolation, and the labeling information in a format that supports efficient querying.

[0201] Step S6: Upon receiving a query request, locate the leaf unit to which the given state point belongs, and obtain the thermodynamic properties in the single-phase smooth unit using an interpolation method based on the risk label of the leaf unit. In the unit marked as high risk or phase boundary crossing, call the state equation to perform calculations and return the results.

[0202] In this embodiment, step S6 may specifically include the following steps: S61, based on the fast index and spatial positioning structure, locate the leaf unit to which the input state point belongs.

[0203] Input state vector .

[0204] Based on the fast index and spatial positioning structure established in step S5: If Morton code index is used: calculate Morton code A binary search is performed in the leaf_array to obtain the range of candidate indices.

[0205] Traverse the candidate leaf units (usually ≤ 3), and check each leaf unit: and and

[0206] in: The lower and upper limits of pressure for the blade unit.

[0207] : The lower and upper limits of the leaf unit.

[0208] Leaf unit in the first Lower and upper bounds for each component dimension.

[0209] For all component dimensions Established.

[0210] Returns the pointer to the first leaf cell that meets the condition. If not found (in rare cases, possibly due to floating-point rounding), a global fallback is used: recursively descent the quadtree / octree.

[0211] Accurate and rapid positioning is the foundation for all subsequent calculations, with an error of less than [missing information]. Relative magnitude.

[0212] The purpose of step S61 is to determine which leaf cell in the adaptive table the input state point falls into.

[0213] S62, read the risk marker of the leaf element. If it is marked as a single-phase smooth element, select the interpolation path. If it is marked as a phase boundary crossing element, high gradient element, or critical region element, select the accurate state equation backoff path.

[0214] Read the risk_flags field of the leaf cell: If risk_flags == SMOOTH: Call the interpolation function in step S63.

[0215] Otherwise (risk_flags include CROSSING, HIGH_GRAD, or CRITICAL): Call the precise state equation backend and pass in the state points. .

[0216] Optional optimization: If multiple queries are made within the same cell (e.g., within the same grid cell in a numerical simulation), the most recent accurate calculation result can be cached in a temporary buffer attached to the cell to avoid repeated calls.

[0217] The hybrid strategy enables more than 90% of queries (located in the single-phase smooth region) to be executed at interpolation speed, while high-risk regions retain accuracy, resulting in an overall speedup of 10–100 times.

[0218] The purpose of step S62 is to determine whether to use interpolation or the exact state equation for the current query based on the risk marker.

[0219] S63 calculates thermodynamic properties using linear interpolation, bilinear interpolation, trilinear interpolation, higher-order polynomial interpolation, or Hermite interpolation in the interpolation path, calls the backend of the state equation in the fallback path to perform the calculation, and returns the results to the caller.

[0220] Interpolation calculation (for single-phase smoothing units): Density calculation using two-dimensional bilinear interpolation For example, let the state point be... Located within the leaf unit, the four corner points of the unit are denoted as... The corresponding pressure is The temperature is First, calculate the normalized coordinates: .

[0221] in The density interpolation formula is then: .

[0222] in: Normalized coordinates (interpolation weights) in the direction of pressure.

[0223] : Normalized coordinates (interpolation weights) in the temperature direction.

[0224] The pressure at the current query point.

[0225] : The lower bound of the blade element in the pressure direction.

[0226] : The upper limit of the blade element in the pressure direction.

[0227] : Temperature at the current query point.

[0228] : The lower bound of the blade unit in the temperature direction.

[0229] : The upper bound of the blade unit in the temperature direction.

[0230] In normalized coordinates The density value obtained by interpolation.

[0231] : Lower left corner point The density.

[0232] bottom right corner The density.

[0233] Top left corner The density.

[0234] Top right corner The density.

[0235] Equal to: interpolation basis functions, corresponding to the weights of the four corner points respectively.

[0236] For other properties Similarly, if the first derivative (used in the Jacobian matrix of the implicit solver) is needed, the interpolation formula can be analytically differentiated.

[0237] Precise calculation: Call the precise state equation library through a unified function pointer or virtual function interface: void eos_compute(double p, double T, double x[], double *rho, double*h, double *cp, ...); This function may contain iterative solutions (e.g.) (Inverse temperature calculation is required when inputting), but for high-risk units, the query frequency is usually low, and the additional overhead is acceptable.

[0238] Result return: Pack all the calculated properties into a structure or tuple and return it to the upper-level simulator.

[0239] The purpose of step S63 is to actually calculate the thermodynamic properties and return them to the caller (such as a CFD solver) in a uniform format.

[0240] The purpose of step S6 is to provide a unified interface for querying thermodynamic properties, automatically select fast interpolation or precise equation of state calculation based on the risk marker of the leaf unit, and return the results.

[0241] Figure 5 This is a comparison chart showing the computational speed of the direct state equation, the rule lookup table, and the method of this invention. (See attached image.) Figure 5 As shown, the speedup is more than 10 times, and the more complex the CFD calculation, the more significant the speedup.

[0242] Figure 6 This is a schematic diagram illustrating the coupling framework between the method of this invention and the numerical simulator and the state equation backend. Figure 6As shown, the tasks involved in the table construction and offline preparation stages include: state space definition, adaptive refinement, phase boundary identification and marking, and table generation and storage. The adaptive spatial thermodynamic table with phase boundary awareness in this invention involves the following processes: a unified query interface and a hybrid evaluation scheduler. The hybrid evaluation scheduler is connected to A. ordinary elements: fast interpolation module and B. phase boundary / dangerous elements: precise evaluation module. Both A. ordinary elements: fast interpolation module and B. phase boundary / dangerous elements: precise evaluation module are connected to the hierarchical retrieval and element location module. A. ordinary elements: fast interpolation module is connected to the element attribute database, and B. phase boundary / dangerous elements: precise evaluation module is connected to the phase boundary marking / error index database. The adaptive spatial thermodynamic table with phase boundary awareness in this invention interacts with the numerical simulator / upper-level application and the state equation backend / property model. The numerical simulator / upper-level application involves CFD solvers, porous media seepage-heat transfer simulators, geothermal / submarine hydrothermal simulators, and oil and gas reservoir / reaction transport simulators, etc. The numerical simulator / upper-level application sends a state lookup request to the phase boundary-aware adaptive spatial thermodynamic table of the present invention, and the phase boundary-aware adaptive spatial thermodynamic table of the present invention returns property results to the numerical simulator / upper-level application. The phase boundary-aware adaptive spatial thermodynamic table of the present invention performs an exact EOS call from the backend of the equation of state / property model. The output and coupling results of the phase boundary-aware adaptive spatial thermodynamic table of the present invention, including thermodynamic property output, phase state output, etc., are returned to the upper-level solver.

[0243] This invention can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This invention can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This invention can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0244] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).

[0245] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps. Example 2

[0246] This embodiment uses the hydrothermal equation of state as an example to construct a two-dimensional adaptive thermodynamic table in the pressure-temperature state space. First, an initial coarse grid is established within a set pressure and temperature range, and then the exact equation of state is called at the grid nodes to calculate density, enthalpy, specific heat, viscosity, thermal conductivity, and phase state.

[0247] For each cell, the interpolation error and the phase consistency of the sampling points within the cell are calculated. When the properties within a cell change smoothly and the phase is consistent, the cell is retained as a leaf cell; when the error within a cell exceeds a threshold or the phase changes, the cell is refined using a quadtree. Cells crossed by saturation curves or liquid-vapor phase boundaries are marked as phase boundary crossing cells.

[0248] During the query, if the input state point is located in a single-phase smooth blade element, bilinear interpolation is used to return the thermodynamic properties; if it is located in a phase boundary crossing element, the exact equation of state is invoked. This method avoids the cross-phase interpolation problem near phase boundaries encountered by traditional rule lookup tables. Example 3

[0249] This embodiment uses the H2O-NaCl thermodynamic system as an example to construct a three-dimensional adaptive thermodynamic table in the pressure-temperature-composition state space. The component variables can represent salinity, mass fraction, mole fraction, or other compositional parameters.

[0250] Within this three-dimensional state space, the back end of the H2O-NaCl equation of state is invoked for each initial unit to obtain information on density, enthalpy, viscosity, thermal conductivity, phase state, phase saturation, and component distribution. If a unit crosses a liquid-vapor phase boundary, salting-out boundary, or multiphase coexistence region, it is marked as a high-risk unit; if the properties change drastically but do not cross a phase boundary, local octree refinement is performed.

[0251] This embodiment can be used for high-frequency thermodynamic property lookup in simulations of submarine hydrothermal circulation, geothermal systems, and brine multiphase flow. Example 4

[0252] In some numerical simulations involving energy conservation, state variables may be pressure and enthalpy. In such cases, directly calling the equations of state usually requires inverting temperature or phase from pressure and enthalpy, which is computationally expensive. This embodiment constructs an adaptive table in the pressure-enthalpy state space, pre-calculating and adaptively storing the mapping from pressure-enthalpy to temperature, density, phase, and other properties.

[0253] For single-phase smooth regions, temperature and other thermodynamic properties can be directly obtained through interpolation during querying; for multiphase regions or phase boundary crossing units, an accurate inversion solver is invoked. This embodiment can significantly reduce the thermodynamic inversion cost in non-isothermal flow simulations using enthalpy variables. Example 5

[0254] This invention can be embedded as a thermodynamic query layer in a numerical simulator. In each time step or nonlinear iteration of the numerical simulation, the simulator provides the invention with state variables such as pressure, temperature, enthalpy, and composition. Based on the state point location and element label, the invention determines whether to use interpolation or an exact equation of state and returns density, enthalpy, viscosity, thermal conductivity, phase state, and the required derivative.

[0255] In simulations of porous media flow, geothermal systems, subsea hydrothermal systems, oil and gas reservoirs, and reactive transport, this invention can significantly reduce the number of thermodynamic equations of state calls, thereby improving overall simulation efficiency. Example 6

[0256] This invention can also achieve parallel construction and parallel querying in multi-threaded, MPI, or GPU environments. The adaptive table construction phase can be divided into multiple tasks for parallel computation according to the state space sub-regions; the query phase can adopt a read-only shared table structure, enabling multiple simulated grid cells or particles to perform thermodynamic queries in parallel.

[0257] For GPU implementations, leaf unit data can be stored in Morton encoding or Z-order order to enhance memory access locality and query efficiency. Example 7

[0258] Further reference Figure 7As a response to the above Figure 1 The present invention provides an embodiment of a phase boundary-aware adaptive phase space thermodynamic table construction, storage, and retrieval device, which is similar to the method shown. Figure 1 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.

[0259] like Figure 7 As shown, the phase boundary-aware adaptive phase space thermodynamic table construction, storage, and retrieval device 70 described in this embodiment includes: an initialization module 71, a calculation module 72, a subdivision module 73, an identification module 74, a creation module 75, and a calling module 76. Wherein: Initialization module 71 is used to determine the range and dimensions of the thermodynamic state space, establish initial partitioning units, and call the state equation at the sampling point to obtain thermodynamic properties and phase information; The calculation module 72 is used to calculate the local thermodynamic complexity index of each partition unit based on the thermodynamic properties and the phase information. The index includes at least one of interpolation error, property gradient, property curvature and phase change. The subdivision module 73 is used to recursively subdivide the partitioned units that meet the refinement conditions according to the local thermodynamic complexity index, forming a non-uniform hierarchical mesh structure. After the refinement is terminated, the leaf unit is obtained. The leaf unit is defined as the final mesh unit that is no longer further subdivided. The identification module 74 is used to identify and mark phase boundary crossing units, high gradient units, and critical region units in the leaf unit; Module 75 is used to store the spatial range, hierarchical information, thermodynamic properties, risk markers and interpolation data of the marked leaf units in a data structure that supports querying, and to establish a fast index and spatial positioning structure. The calling module 76 is used to locate the leaf unit to which the given state point belongs when a query request is received, and to obtain the thermodynamic properties in the single-phase smooth unit by interpolation method according to the risk label of the leaf unit. In the unit marked as high risk or phase boundary crossing, the state equation is called to perform calculation and return the result. Example 8

[0260] To address the aforementioned technical problems, embodiments of the present invention also provide a computer device. Please refer to [link / reference needed]. Figure 8 , Figure 8 This is a basic structural block diagram of the computer device in this embodiment.

[0261] The aforementioned computer device 8 includes a memory 81, a processor 82, and a network interface 83 that are interconnected via a system bus. It should be noted that only the computer device 8 with components 81, 82, and 83 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described herein is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0262] The aforementioned computer devices can be desktop computers, laptops, handheld computers, and cloud servers, among other computing devices. These devices can facilitate human-computer interaction with users through keyboards, mice, remote controls, touchpads, or voice-activated devices.

[0263] The aforementioned memory 81 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the aforementioned memory 81 may be an internal storage unit of the aforementioned computer device 8, such as the hard disk or memory of the computer device 8. In other embodiments, the aforementioned memory 81 may also be an external storage device of the aforementioned computer device 8, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 8. Of course, the aforementioned memory 81 may also include both internal storage units and external storage devices of the aforementioned computer device 8. In this embodiment, the aforementioned memory 81 is typically used to store the operating system and various application software installed on the aforementioned computer device 8, such as computer-readable instructions for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness. In addition, the aforementioned memory 81 can also be used to temporarily store various types of data that have been output or will be output.

[0264] In some embodiments, the processor 82 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 82 is typically used to control the overall operation of the computer device 8. In this embodiment, the processor 82 is used to execute computer-readable instructions stored in the memory 81 or to process data, such as executing computer-readable instructions for the phase boundary-aware adaptive phase space thermodynamic table construction, storage, and retrieval method.

[0265] The network interface 83 may include a wireless network interface or a wired network interface, which is typically used to establish a communication connection between the computer device 8 and other electronic devices. Example 9

[0266] The present invention also provides another embodiment, namely, a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the phase boundary-aware adaptive phase space thermodynamic table construction, storage and retrieval method as described above.

[0267] The beneficial effects of implementing the above embodiments are as follows: (1) Better balance between accuracy and efficiency: By recursively partitioning based on local thermodynamic complexity indicators (such as gradient, curvature, phase change), fine resolution is only applied to complex regions and coarse mesh is maintained in smooth regions, thereby achieving higher overall thermodynamic accuracy with less storage overhead.

[0268] (2) Robust handling of phase boundaries: By explicitly identifying and marking phase boundary crossing units, high gradient units and critical region units, the state equation is directly called for these high-risk units to avoid phase state errors caused by interpolation and ensure thermodynamic consistency. This is particularly suitable for multiphysics simulation involving phase transitions.

[0269] (3) High efficiency in storage and retrieval: By adopting a hierarchical non-uniform grid structure, combined with fast indexing and spatial positioning, memory usage is significantly reduced. At the same time, during querying, only leaf cells need to be located and interpolation or direct calculation is selected according to the risk marker. High-speed interpolation is maintained in most smooth areas, and time-consuming state equations are called only in necessary areas, thus achieving coordinated optimization of computational speed and robustness.

[0270] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0271] Obviously, the embodiments described above are merely some embodiments of the present invention, not all embodiments. The accompanying drawings show preferred embodiments of the present invention, but do not limit the patent scope of the present invention. The present invention can be implemented in many different forms; rather, these embodiments are provided to provide a more thorough and complete understanding of the disclosure of the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the patent protection scope of this invention.

Claims

1. A method for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness, characterized in that, Includes the following steps: The range and dimensions of the thermodynamic state space are determined, initial partitioning units are established, and the equation of state is invoked at the sampling points to obtain thermodynamic properties and phase information; Based on the thermodynamic properties and the phase information, the local thermodynamic complexity index of each partition unit is calculated. The index includes at least one of interpolation error, property gradient, property curvature and phase change. Based on the local thermodynamic complexity index, the partitioned units that meet the refinement conditions are recursively subdivided to form a non-uniform hierarchical mesh structure. After the refinement is terminated, leaf units are obtained. The leaf units are defined as the final mesh units that are no longer further subdivided. In the leaf unit, phase boundary crossing units, high gradient units, and critical region units are identified and marked; The spatial range, hierarchical information, thermodynamic properties, risk markers, and interpolation data of the marked leaf units are stored in a data structure that supports queries, and a fast index and spatial positioning structure are established. Upon receiving a query request, the leaf unit to which the given state point belongs is located, and the thermodynamic properties are obtained in the single-phase smooth unit by interpolation based on the risk label of the leaf unit. In the unit marked as high risk or phase boundary crossing, the state equation is invoked to perform calculations and the results are returned.

2. The method for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness according to claim 1, characterized in that, The steps of determining the range and dimensions of the thermodynamic state space, establishing initial partitioning units, and calling the equation of state at sampling points to obtain thermodynamic properties and phase information specifically include: Determine the independent variables of the thermodynamic state space and their physical extent; Initial partitioning units are established in the thermodynamic state space to form an initial coarse grid structure; The state equation is invoked at the corner, center, or sampling point of the initial partition unit to calculate and store thermodynamic properties and phase information as benchmark data for subsequent error assessment.

3. The method for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness according to claim 1, characterized in that, The step of calculating the local thermodynamic complexity index of each partition unit based on the thermodynamic properties and the phase information, wherein the index includes at least one of interpolation error, property gradient, property curvature, and phase change, specifically includes: Calculate the relative error between the interpolated predicted value and the exact state equation value within each partition unit to form an error complexity index; Calculate the gradient and curvature of the thermodynamic properties relative to the state variables within each partition unit to form gradient and curvature complexity indices; The phase consistency between different sampling points within each partition unit is detected to identify whether there is a phase boundary crossing or phase change.

4. The method for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness according to claim 1, characterized in that, The step of recursively subdividing the partitioned units that meet the refinement conditions according to the local thermodynamic complexity index to form a non-uniform hierarchical mesh structure, and obtaining leaf elements after refinement termination, wherein the leaf elements are defined as the final mesh elements that are no longer further subdivided, specifically includes: Based on the complexity index, determine whether the current partition unit meets the refinement conditions, which include error exceeding the limit, gradient exceeding the limit, curvature exceeding the limit, the existence of multiphase states, or being located in the neighborhood of the critical region. For elements that meet the refinement conditions, they are uniformly partitioned according to the state space dimension to generate multiple sub-elements; Update the tree structure, mark the parent element as a non-leaf node, calculate the precise thermodynamic properties for the child elements, and recursively perform refinement checks until the termination condition is met.

5. The method for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness according to claim 1, characterized in that, The step of identifying and marking phase boundary crossing units, high gradient units, and critical region units in the leaf unit specifically includes: Identify and mark the leaf elements that are crossed by liquid-vapor boundary, liquid-solid boundary, vapor-solid boundary or multiphase coexistence boundary as phase boundary crossing elements; Identify and label leaf elements whose thermodynamic property gradients exceed the high gradient threshold as high gradient elements; Identify and label leaf units located in the neighborhood of the critical point as critical region units.

6. The method for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness according to claim 1, characterized in that, The steps of storing the spatial extent, hierarchical information, thermodynamic properties, risk markers, and interpolation data of the marked leaf units in a data structure that supports queries, and establishing a fast index and spatial positioning structure, specifically include: Choose a storage data structure, including one or more combinations of tree structure, Morton encoding, Z-order sorting, hierarchical array, hash index or compressed sparse storage; Store for each leaf unit its spatial extent, level, risk marker, corner thermodynamic properties, and derivative or coefficient data required for interpolation; Establish a fast index and spatial positioning structure to support the rapid location of the leaf unit to which it belongs based on a given state point.

7. The method for constructing, storing, and retrieving phase-space thermodynamic tables with phase boundary awareness according to any one of claims 1 to 6, characterized in that, The steps of locating the leaf unit to which the given state point belongs upon receiving a query request, obtaining thermodynamic properties in a single-phase smoothing unit using interpolation based on the risk label of the leaf unit, and calling the state equation to perform calculations and return the results in units marked as high-risk or phase boundary crossings, specifically include: Based on the fast index and spatial positioning structure, locate the leaf unit to which the input state point belongs; Read the risk marker of the leaf element. If it is marked as a single-phase smooth element, select the interpolation path. If it is marked as a phase boundary crossing element, high gradient element, or critical region element, select the accurate state equation backoff path. Thermodynamic properties are calculated using linear interpolation, bilinear interpolation, trilinear interpolation, higher-order polynomial interpolation, or Hermite interpolation in the interpolation path. In the fallback path, the backend of the equation of state is called to perform the calculation and the results are returned to the caller.

8. A device for constructing, storing, and retrieving phase space thermodynamic tables with phase boundary awareness, characterized in that, include: The initialization module is used to determine the range and dimensions of the thermodynamic state space, establish initial partitioning units, and call the equation of state at the sampling points to obtain thermodynamic properties and phase information; The calculation module is used to calculate the local thermodynamic complexity index of each partition unit based on the thermodynamic properties and the phase information. The index includes at least one of interpolation error, property gradient, property curvature and phase change. The subdivision module is used to recursively subdivide the partitioned units that meet the refinement conditions according to the local thermodynamic complexity index, forming a non-uniform hierarchical mesh structure. After the refinement is terminated, the leaf unit is obtained. The leaf unit is defined as the final mesh unit that will not be further subdivided. The identification module is used to identify and mark phase boundary crossing units, high gradient units, and critical region units in the leaf units; A module is established to store the spatial range, hierarchical information, thermodynamic properties, risk markers, and interpolation data of the marked leaf units in a data structure that supports queries, and to establish a fast index and spatial positioning structure. The calling module is used to locate the leaf unit to which the given state point belongs when a query request is received, and to obtain the thermodynamic properties in the single-phase smooth unit by interpolation method according to the risk label of the leaf unit. In the unit marked as high risk or phase boundary crossing, the state equation is called to perform calculation and return the result.

9. A computer device, characterized in that, The method includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the phase boundary-aware adaptive phase space thermodynamic table construction, storage and retrieval method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the phase boundary-aware adaptive phase space thermodynamic table construction, storage, and retrieval method as described in any one of claims 1 to 7.