Corner-point grid large-scale preprocessing parallel method and system for reservoir simulation
By employing a distributed construction and on-demand exchange approach, the memory and communication issues of large-scale corner grid reservoir numerical models were resolved, enabling an efficient preprocessing workflow and improving the performance and reliability of parallel computing.
Patent Information
- Application Number
- CN202611397584.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-11-27
AI Technical Summary
In a multi-node parallel environment, existing technologies suffer from problems such as excessively high peak memory usage of the main process, large redundancy in corner geometric replication, and complex handling of faults and non-adjacent connections, resulting in low preprocessing efficiency for large-scale corner grid reservoir numerical models.
It adopts a collaborative process of distributed corner geometry construction, local connection generation, parallel partitioning, solution domain reconstruction, local property reconstruction, and on-demand exchange of remote adjacencies. By constructing a local geometry list in a distributed manner and exchanging remote adjacency relationships on demand, it avoids the main process holding all the data centrally.
It reduces the memory footprint of the main process, reduces redundant communication, improves the correctness and scalability of connection processing, and enhances the preprocessing efficiency of large-scale corner grid reservoir numerical models.
Smart Images

Figure CN123179697A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of reservoir numerical simulation technology, and in particular to a parallel method and system for large-scale preprocessing of corner grids for reservoir simulation. Background Technology
[0002] The preprocessing stage of reservoir numerical simulation requires identifying grid validity, constructing corner geometry, establishing inter-grid connectivity, connecting wells to the grid, and reading and assigning physical property parameters such as porosity, permeability, and region numbering. Only after these data processing steps are completed can local grids, ghost grids, connectivity terms, and well terms be established for the subsequent solver, enabling the solution of large-scale linear equations.
[0003] In practical reservoir models, corner grids are a commonly used type of grid. Corner grids describe the grid bars using bar coordinate data and the depths of the eight corner points in each element using corner depth data, enabling them to represent complex geological structures such as dips, faults, shifts, pinch-outs, and non-adjacent connections. Unlike regular orthogonal grids, corner grids cannot rely solely on simple adjacency relationships in three logical coordinate directions to determine connections; they also require consideration of hexahedral geometric faces, opposite projections, and vertical displacement to determine the effective contact area.
[0004] With the increasing sophistication of reservoir models, corner mesh sizes often reach tens of millions or even larger. In such large-scale, multi-node parallel computing scenarios, existing centralized corner mesh preprocessing workflows have significant problems. This workflow typically involves a main process centrally reading the input file, constructing complete corner geometry, complete effective mesh mapping, a complete global adjacency list, and well network connections, and then distributing data to each computing process based on the parallel partitioning results. This approach is usable when the model size is small, but it suffers from the following drawbacks under large-scale corner mesh conditions: 1. High peak memory usage in the main process. The corner mesh needs to simultaneously store column coordinate data, corner depth data, corner hexahedrons, effective mesh mapping, connectivity relationships, well network relationships, and send buffers. If all this data is concentrated in the main process, it can easily exceed the physical memory limit of a single node.
[0005] 2. High redundancy in corner geometry copying. Each process only needs the geometry of its own mesh and its adjacent meshes, as well as the meshes of the same cylinder and the lateral adjacent cylinders to construct a local connection. Copying complete cylinder coordinate data and corner depth data to all processes would result in a large amount of unnecessary memory usage and communication.
[0006] 3. Faults and non-adjacent connections lead to complex cross-process boundaries. The connections of corner meshes may not satisfy the simple symmetric adjacency assumption in orthogonal meshes. If the remote edge processing method of orthogonal meshes is still used, it is easy to misdetermine the target process of remote neighbors.
[0007] 4. Ineffective computation exists in the centralized analysis and distribution of physical properties. The main process centrally analyzes all mesh physical properties before distributing them, but each process ultimately only needs the local physical properties corresponding to the internal mesh and ghost mesh, resulting in a large number of non-local mesh analyses and assignments being of no practical use.
[0008] The common root of these problems lies in the fact that the geometric, connectivity, and physical property data of the corner mesh preprocessing are first constructed centrally, and then divided and distributed. Summary of the Invention
[0009] This application provides a parallel method and system for large-scale preprocessing of corner grids for reservoir simulation. The technical problem to be solved is: in a multi-node parallel environment, how to avoid the main process holding all corner geometry, global adjacency list and all physical property arrays in a large-scale corner grid reservoir numerical model, and how to correctly handle corner grid faults, misalignments and non-adjacent connections; where non-adjacent connections refer to grid connections where the logical layer numbers are not directly adjacent, but may still contact each other in space and form flow channels.
[0010] To address the aforementioned technical issues, this application no longer assigns long-term responsibility for maintaining complete corner mesh geometry and connectivity relationships to a single process. Instead, it employs a collaborative process of "distributed corner geometry construction, local connectivity generation, parallel partitioning, solution domain reconstruction, local property reconstruction, and on-demand exchange of remote adjacencies." On-demand exchange of remote adjacencies means that after the final solution domain is formed, requests are only initiated for remote adjacency relationships missing by the current process. Each process only receives the local cylindrical coordinate data and corner depth data required to construct local corner connections, and only stores its own relevant local connectivity list—that is, the set of connection records stored by the current process. Remote adjacency information is then supplemented as needed after the final solution domain is formed.
[0011] In a first aspect, this application provides a parallel method for large-scale preprocessing of corner grids for reservoir simulation, the method including a preprocessing analysis stage and a distributed construction and reconstruction stage; The preprocessing analysis stage includes: Each process collects its own hostname, the main process counts the number of unique hostnames to determine the running mode, and broadcasts the running mode to all processes; The main process reads the input file, constructs hexahedrons one by one based on the cylindrical coordinate data and corner depth data in the input file, calculates the mesh scale, volume and depth of each hexahedron, and establishes a bidirectional effective mesh mapping based on the validity conditions; the bidirectional effective mesh mapping is used for mutual conversion between the original mesh number and the effective mesh number. Count the total number of effective grids and the total number of well nodes, and distribute the elements of the merged effective grids and well nodes to all processes in an approximately uniform manner to construct an initial allocation boundary; each process is initially responsible for the element numbering interval between two adjacent boundary values. The distributed construction and reconstruction phase includes: Each process determines the assigned valid grid based on the initial allocation boundary; for each assigned valid grid, the assigned valid grid itself, its six-directional direct neighbors, and grids in the same column are added to the neighborhood filtering list; for lateral neighboring columns, only the grid layers that overlap with the vertical enclosing interval of the current assigned valid grid are added to the neighborhood filtering list; a column index list is calculated based on the neighborhood filtering list; The main process packages corner depth data for the neighborhood filtering list of each process, packages bar coordinate data for the bar index list, and sends the packaged data to the corresponding non-main process; each process reconstructs the local geometry list based on the received corner depth data and bar coordinate data; Each process traverses the active grids in the neighborhood filter list and constructs candidate semi-connections for the belonging grid based on the local geometry list. For horizontal connections, it determines whether the current grid face and the adjacent face of the neighboring grid are in effective contact. If there is effective contact, a candidate semi-connection is generated. If a fault or misalignment causes a horizontal connection to span multiple layers, the search for non-adjacent connections continues along the lateral adjacent columns. The non-adjacent connection refers to the connection between the belonging grid and a grid in the lateral adjacent column whose logical layer number is not adjacent but is in spatial contact. For vertical connections, only the upper and lower adjacent layers are processed. A pairwise search method for belonging grids is adopted. After generating a candidate semi-connection on one side, the reverse semi-connection on the other end is immediately searched. If both the forward and reverse semi-connections are valid, a local connection list is generated. The main process iterates through all well perforations, converts the perforation positions into raw global grid numbers, and then converts them into valid grid numbers through the bidirectional valid grid mapping. According to the initial allocation interval in which the valid grid number falls, the grid-to-well node connection is sent to the corresponding process. Each process appends the received connection to the local connection list. Each process organizes the local connection list according to the neighbor number, converts it into a compressed sparse row format graph structure, and calls the parallel graph partitioning function to perform parallel graph partitioning; each process exchanges the redistribution connection table, and the solution domain reconstruction module generates internal grids, ghost grids, well nodes, local grid arrays, global-to-local mappings, and send and receive indices required for communication based on the redistribution connection table. Each process converts the valid grid numbers into the original global grid numbers based on the local grid array, forming an original number list; it rereads the input file, reconstructs the physical properties only for the grids in the original number list, and writes the reconstruction results into the solver's local variable container; The reservoir data loading module checks whether each internal grid falls within the initial allocation range of the current process. If it does not fall within the initial allocation range of the current process, remote completion is performed. The remote completion includes requesting the missing adjacency relationship from the process to which the internal grid belongs. The request and return are exchanged in batches using set communication. After receiving the returned data, the solution connection is generated according to the global number to local number mapping saved by the current process, and the correspondence between well perforation and local grid is established. Release the temporary storage allocated at each stage, and output memory statistics and connectivity quality diagnostic results; wherein, the temporary storage allocated at each stage includes corner depth receiving buffer and cylindrical coordinate receiving buffer, remote adjacency receiving buffer, global to local mapping, and intermediate array for property reconstruction; the memory statistics include the current resident memory and peak resident memory of each process, and summarize the memory usage by computing node; the connectivity quality diagnostic results include connectivity direction statistics, number of invalid area connections, number of illegal numerical area connections, number of grid number out-of-bounds connections, and number of non-unit conductivity multipliers.
[0012] Furthermore, the main process counts the number of unique hostnames to determine the running mode, including: Each process calls the processor name acquisition interface to obtain its own hostname. All hostnames are collected to the main process through aggregate communication. The main process counts the number of unique hostnames. If the number of unique hostnames is greater than 1, then the running mode is set to multi-node mode; otherwise, the running mode is set to single-node mode.
[0013] Further, the main process reads the input file, constructs hexahedrons one by one based on the cylindrical coordinate data and corner depth data in the input file, calculates the mesh scale, volume, and depth of each hexahedron, and establishes a bidirectional effective mesh mapping based on validity conditions, including: The main process reads the input file and identifies the grid type, model type, dual-medium flag, grid dimension, valid grid identifier, and well data; The main process constructs the hexahedron one by one by using the corner depth values of four adjacent columns to form the eight vertices of the hexahedron based on the column coordinate data and the corner depth data. The main process calculates the grid scale in the X, Y, and Z directions based on the vertex coordinates of the constructed hexahedron, calculates the volume of the hexahedron, and calculates the depth value of each grid. The main process determines whether each grid is a valid grid based on the valid grid identifier: for grids whose valid grid identifier indicates inactivity, they are marked as invalid grids; for grids whose valid grid identifier indicates activity, the porosity of the grid is read from the input file, and it is further determined whether the volume of the hexahedron is greater than a preset volume threshold and whether the porosity is greater than a preset porosity threshold. If the volume is greater than the preset volume threshold and the porosity is greater than the preset porosity threshold, it is marked as a valid grid; otherwise, it is marked as an invalid grid. The main process assigns consecutive valid grid numbers to each valid grid, establishes a first mapping relationship from the original global grid number to the valid grid number and a second mapping relationship from the valid grid number to the original global grid number, thus forming the bidirectional valid grid mapping.
[0014] Furthermore, each process determines the assigned valid grid based on the initial allocation boundary and adds the assigned valid grid itself, its six-directional direct neighbors, and co-cylinder grids to the neighborhood filtering list, including: Each process determines its own initial element range based on the initial allocation boundary, and identifies the valid grids that fall within the initial element range as the assigned valid grids. For each of the aforementioned valid grids, the grid itself, its adjacent grids in the positive X direction, negative X direction, positive Y direction, negative Y direction, positive Z direction, and negative Z direction, as well as the grids in the same column but at different levels that are located on the same column line as the valid grid, are added to the neighborhood filtering list. For lateral adjacent columns, calculate the vertical enclosing interval of the assigned valid grid, and select only grid layers whose vertical enclosing interval overlaps with the vertical enclosing interval of the assigned valid grid in the lateral adjacent columns to add to the neighborhood filtering list.
[0015] Furthermore, the main process packages corner depth data for the neighborhood filtering list of each process and packages bar coordinate data for the bar index list, and sends the packaged data to the corresponding non-main process; each process reconstructs a local geometry list based on the received corner depth data and bar coordinate data, including: For each process, the main process extracts the 8 corner depth values of each grid in the neighborhood filtering list in sequence and assembles them into a corner depth data packet for each process. For each process, the main process sequentially extracts the six bar coordinate values of each bar in the bar index list and assembles them into a bar coordinate data packet for each process. The main process sends the corner depth data packet and bar coordinate data packet of each process, along with the corresponding counting information, to the corresponding non-main process; the counting information includes the number of corner depth data packets and bar coordinate data packets that each non-main process should receive; After receiving data according to the counting information, each non-main process associates the received column coordinate data with the corner depth data according to the position of the column in the local column index list. The column coordinates provide the planar position of the hexahedron vertices, and the corner depth provides the depth position of the hexahedron vertices, thus reconstructing the list of local geometries composed of hexahedrons. After completing the local geometry list construction, release the temporary corner depth buffer and cylindrical coordinate buffer.
[0016] Furthermore, the method of constructing candidate semi-connections for the belonging mesh based on the local geometry list, and generating the local connectivity list using a pairwise search method for the belonging mesh, includes: Each process traverses the active grids in the neighborhood filter list and constructs candidate semi-connections for the belonging grid based on the local geometry list; the candidate semi-connection represents a side connection relationship from one grid to another. For horizontal connections, calculate the spatial overlap area between the current mesh face and the neighboring opposite face, and determine whether the area of the overlap area is greater than a preset area threshold. If the area of the overlap area is greater than the preset area threshold, it is determined to be a valid contact. Calculate the effective area parameters of the current end and the opposite end and generate candidate half connections. If the currently traversed class grid has a valid spatial contact with a grid whose logical layer number is not adjacent in the lateral adjacent column, then the connection relationship between the currently traversed class grid and the grid whose logical layer number is not adjacent is identified as a non-adjacent connection and a candidate semi-connection is generated. For vertical connections, only the connections between the currently traversed home grid and its adjacent layer grids in the positive and negative Z directions are processed; After generating a candidate semi-connection on one side, immediately look up the reverse semi-connection that points to the currently traversed home grid from the opposite grid. If the reverse half-connection is valid, the candidate half-connection and the reverse half-connection are merged into a single local connection record and saved to the local connection list. If the reverse semi-connection is invalid, then the candidate semi-connection is discarded; If the input contains a vertical conductance multiplier, the vertical connection is multiplied by the corresponding conductance multiplier during generation.
[0017] Further, the main process iterates through all well perforations, converts the perforation locations into raw global grid numbers, and then converts them into valid grid numbers through the bidirectional valid grid mapping; according to the initial allocation interval where the valid grid number falls, the grid-to-well node connections are sent to the corresponding processes; each process appends the received connections to the local connection list, including: The main process reads all well perforation data and obtains the corresponding original global grid number for each perforation location; The main process converts the original global grid number into a valid grid number through the first mapping relationship from the original global grid number to the valid grid number in the bidirectional valid grid mapping; The main process queries the initial allocation range of each process based on the valid grid number, and determines the target process corresponding to the initial allocation range in which the valid grid number falls; The main process groups and packages the connections from the grid to the well node corresponding to the valid grid number into groups according to the target processes and sends them to each target process; After each target process receives the connection from the grid to the well node, it verifies whether the valid grid number in the connection belongs to the initial allocation range of its own process. If the verification passes, each target process will add the received grid-to-well node connections to the local connection list; Each target process simultaneously receives the reverse connection from the well node to the grid and appends the reverse connection to the local connection list.
[0018] Furthermore, each process organizes the local connection list according to the neighbor number, converts it into a compressed sparse row format graph structure, and calls the parallel graph partitioning function to perform parallel graph partitioning, including: Each process sorts and organizes each connection record in the local connection list according to the neighbor number; Verify that all neighbor numbers in the cleaned connection list are within the range of valid grid numbers. If there are out-of-bounds numbers, mark them as diagnostic anomalies. For corner grid cross-process neighbors, the cross-process neighbor refers to a grid whose neighbor number in the local connection list does not belong to the initial allocation range of this process; the process obtains the actual target process of the cross-process neighbor in the parallel graph partition by requesting the initial owner process of the cross-process neighbor to return the partition label; The organized connection list is converted into a compressed sparse row-format graph structure. The compressed sparse row-format graph structure stores all neighbor numbers of each grid in a neighbor array and records the starting position of each grid's neighbors through a row offset array. The parallel graph partitioning function is called to perform parallel graph partitioning on the compressed sparse row format graph structure, and the partition label of each grid is obtained. Each process exchanges a redistribution connection table, which is used to record the grids that need to be migrated between processes after the graph is partitioned and their connection relationships. Verify that the received quantity is correct to confirm that there are no missed or over-received items in the cross-process exchange; The solution domain reconstruction module generates internal meshes, ghost meshes, well nodes, local mesh arrays, global-to-local mappings, and send and receive indices required for communication based on the redistribution connection table. The internal mesh is the mesh that this process is responsible for solving after the graph is partitioned, while the ghost mesh is a copy of the mesh that needs to be read for boundary calculations but is handled by other processes.
[0019] Further, the missing adjacency relationships are requested from the process that owns the internal mesh; the request and response are exchanged in batches using set communication; upon receiving the returned data, a solution connection is generated according to the global number to local number mapping saved in this process, and the correspondence between the well perforation and the local mesh is established, including: The reservoir data loading module traverses all internal grids and checks whether each internal grid falls within the initial allocation range of this process; If the internal grid does not belong to the initial allocation range of this process, then the internal grid is added to the remote completion list and grouped according to the initial process to which the internal grid belongs; All processes send request counts to other processes and receive request counts from other processes through set communication; Based on the number of requests received, each process sends the grid number of the request to the corresponding requesting process; Upon receiving a request, the owning process retrieves the adjacency record of the corresponding grid from its local connection list and first returns the number of neighbors for each grid. The adjacency record contains the neighbor numbers of all neighbors of the grid, the connection direction with each neighbor, the effective area parameters at both ends, and the conductivity multiplier. Based on the number of neighbors received, the requesting process allocates a receiving buffer, and the owning process then returns the neighbor identifiers, connection directions, and effective area parameters at both ends in batches. The returned fields are transmitted separately according to the neighbor identifier, compact connection direction, and effective area parameters at both ends; the compact connection direction is represented by integer encoding; the conductivity multiplier defaults to 1, and only the offset and value of non-unit values are transmitted in a sparse manner. The receiving process constructs a remote grid index table based on the returned data, and the remote grid index table records the position index of each remote grid in the receiving buffer; For internal grids that do not belong to the initial allocation range of this process, the receiving buffer is located in the remote grid index table by binary search to obtain the adjacency relationship of the internal grid; the adjacency relationship includes the neighbor number of each neighbor of the internal grid, the connection direction between each neighbor, the effective area parameters at both ends, and the conductivity multiplier; If the neighbor number belongs to the well node range, then update the local well perforation mapping; If the neighbor corresponding to the neighbor number is a grid, then the local number of the neighbor is obtained through global-to-local mapping, and a solution connection is generated.
[0020] Secondly, this application provides a parallel system for large-scale preprocessing of corner grids for reservoir simulation, the system comprising a first processing module and a second processing module; The first processing module is configured to perform a preprocessing analysis phase, and the first processing module includes: The running mode determination unit is configured to have each process collect its own hostname, the main process counts the number of unique hostnames to determine the running mode, and broadcasts the running mode to all processes. The effective mesh mapping unit is configured to have the main process read the input file, construct hexahedrons one by one according to the cylindrical coordinate data and corner depth data in the input file, calculate the mesh scale, volume and depth of each hexahedron, and establish a bidirectional effective mesh mapping according to the validity conditions; the bidirectional effective mesh mapping is used for mutual conversion between the original mesh number and the effective mesh number. The allocation boundary construction unit is configured to count the total number of effective grids and the total number of well nodes, and to distribute the elements of the merged effective grids and well nodes to all processes in an approximately uniform manner to construct the initial allocation boundary; each process is initially responsible for the element numbering interval between two adjacent boundary values. The second processing module is configured to perform the distributed build and rebuild phases, and the second processing module includes: The list building unit is configured to have each process determine the assigned valid grid based on the initial allocation boundary; for each assigned valid grid, the assigned valid grid itself, its six-directional direct neighbors, and grids in the same column are added to the neighborhood filtering list; for lateral adjacent columns, only the grid layers that overlap with the vertical enclosing interval of the current assigned valid grid are added to the neighborhood filtering list; and a column index list is calculated based on the neighborhood filtering list. The corner geometry distributed construction unit is configured to have the main process package corner depth data for each process's neighborhood filtering list, package bar coordinate data for the bar index list, and send the packaged data to the corresponding non-main process; each process reconstructs a local geometry list based on the received corner depth data and bar coordinate data. The corner connection construction unit is configured to have each process traverse the active grids in the neighborhood filter list and construct candidate semi-connections for the belonging grid based on the local geometry list. For horizontal connections, it is determined whether the current grid face and the adjacent face of the neighboring grid are in effective contact. If there is effective contact, a candidate semi-connection is generated. If a fault or misalignment causes the horizontal connection to span multiple layers, the search for non-adjacent connections continues along the lateral adjacent columns. The non-adjacent connection refers to the connection between the belonging grid and a grid in the lateral adjacent column whose logical layer number is not adjacent but is in spatial contact. For vertical connections, only the upper and lower adjacent layers are processed. A pairwise search method for belonging grids is adopted. After generating a candidate semi-connection on one side, the reverse semi-connection on the other side is immediately searched. If both the forward and reverse semi-connections are valid, a local connection list is generated. The well network connection unit is configured to have the main process traverse all well perforations, convert the perforation positions into raw global grid numbers, and then convert them into valid grid numbers through the bidirectional valid grid mapping; according to the initial allocation interval in which the valid grid numbers fall, the grid-to-well node connections are sent to the corresponding processes; each process appends the received connections to the local connection list; The graph partitioning and domain reconstruction unit is configured to have each process organize the local connection list by neighbor number, convert it into a compressed sparse row format graph structure, and call the parallel graph partitioning function to perform parallel graph partitioning; each process exchanges the redistribution connection table, and the domain reconstruction module generates internal grids, ghost grids, well nodes, local grid arrays, global-to-local mappings, and send and receive indices required for communication based on the redistribution connection table. The property reconstruction unit is configured to have each process convert the valid grid numbers into the original global grid numbers based on the local grid array, forming an original number list; reread the input file, reconstruct the property only for the grids in the original number list, and write the reconstruction results into the solver's local variable container; The remote adjacency exchange unit is configured to have the reservoir data loading module check whether each of the internal grids falls within the initial allocation range of the current process. If it does not fall within the initial allocation range of the current process, remote completion is performed. The remote completion includes requesting the missing adjacency relationship from the process to which the internal grid belongs. The request and return are exchanged in batches using set communication. After receiving the returned data, a solution connection is generated according to the global number to local number mapping saved by the current process, and the correspondence between well perforation and local grid is established. The memory reclamation and diagnostic unit is configured to release temporary storage allocated at each stage and output memory statistics and connectivity quality diagnostic results. The temporary storage allocated at each stage includes corner depth receiving buffers, cylindrical coordinate receiving buffers, remote adjacency receiving buffers, global-to-local mapping, and intermediate arrays for property reconstruction. The memory statistics include the current resident memory and peak resident memory of each process, and summarize memory usage by compute node. The connectivity quality diagnostic results include connectivity direction statistics, number of invalid area connections, number of illegal numerical area connections, number of grid number out-of-bounds connections, and number of non-unit conductivity multipliers.
[0021] The parallel method and system for large-scale preprocessing of corner grids for reservoir simulation provided in this application have at least the following beneficial effects: 1) In terms of memory, the main process no longer holds complete corner depth data, bar coordinate data, global connectivity list and full property array for a long time. The memory usage of each process is mainly related to the size of its local geometry list, local connectivity list and internal mesh set. The pairwise search method can avoid storing the full candidate semi-connection set for a long time. Temporary storage allocated at each stage, including corner depth receiving buffer, bar coordinate receiving buffer, remote adjacency receiving buffer, global to local mapping and property reconstruction intermediate array, are all released in time, further reducing memory usage.
[0022] 2) In terms of communication, column coordinate data is packaged and transmitted after deduplication of unique columns in the column index list, and corner depth data is packaged and transmitted according to the corner geometric units in the neighborhood filtering list; remote adjacency relationships are requested only as needed when the internal grid does not belong to the initial allocation range of this process, and the receiving process constructs a remote grid index table based on the returned data and locates it through binary search, without the need to copy all remote connections in advance; fields such as connection direction and effective area parameters are transmitted in batches, and the conductivity multiplier adopts a sparse method to transmit only the offset and value of non-unit values, reducing redundant communication.
[0023] 3) In terms of correctness, corner grid connections are generated through paired search matching of belonging grids and fault misalignment contact judgment, while non-adjacent connections are searched along lateral adjacent columns; the neighbor number range verification before graph partitioning, the redistribution connection table reception quantity verification, and the receiving process's verification of whether the valid grid number in the grid-to-well node connection belongs to the initial allocation interval of this process, together improve the reliability of cross-process data exchange.
[0024] 4) In terms of scalability, the determination of the effective grid, the construction of the neighborhood screening list and the column index list, the reconstruction of the local geometry list, the construction of corner connection and the injection of well network connection, the graph partitioning and solution domain reconstruction, the local reconstruction of physical properties according to the original number list, and the remote completion in the final connection reconstruction are all executed in a distributed manner to reduce centralized serial bottlenecks. Attached Figure Description
[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0026] Figure 1 A schematic diagram of the two-stage overall process of a parallel method for large-scale preprocessing of corner grids for reservoir simulation provided in this application embodiment; Figure 2 A flowchart illustrating the preprocessing analysis stage provided in an embodiment of this application; Figure 3 A flowchart illustrating the distributed construction and reconstruction phases provided in this application embodiment; Figure 4 A schematic diagram illustrating parallel graph partitioning, solution domain reconstruction, and on-demand completion of remote adjacencies provided in an embodiment of this application; Figure 5 This is a structural diagram of a parallel system for large-scale preprocessing of corner grids for reservoir simulation, provided in an embodiment of this application.
[0027] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concepts of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0028] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0029] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, they do not mean that the applicant has used or necessarily used the solution.
[0030] The technical solution of this application and how it solves the above-mentioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0031] Example 1: This application provides a parallel method for large-scale preprocessing of corner meshes for reservoir simulation, such as... Figure 1 As shown, the method is generally divided into the S100 preprocessing and analysis stage and the S200 distributed construction and reconstruction stage.
[0032] In reservoir numerical simulation, the corner-point grid is currently the most widely used geological model grid in industry. Its core characteristic is that each grid cell is defined by the top and bottom corner depths of eight pillars. These pillars can tilt and twist in three-dimensional space, thus accurately describing complex geological structures such as faults, pinch-outs, and cross-layers. However, the geometrical specialties of the corner-point grid also bring significant challenges to the preprocessing stage: on the one hand, the spatial adjacency relationships of grid cells cannot be directly determined by logical numbering and must be established through geometric contact judgment; on the other hand, as the scale of reservoir models grows to millions or even tens of millions of grid cells, a single process can no longer handle complete corner geometric data and global connectivity relationships. To address this, this application proposes a complete distributed preprocessing scheme, which achieves efficient preprocessing of large-scale corner-point grid reservoir models through multi-stage neighborhood filtering, on-demand geometric distribution, local connectivity construction, parallel graph partitioning, and remote adjacency completion.
[0033] In various embodiments of this application, some terms may be expressed differently in different descriptive positions, but their meanings are the same. For ease of understanding, they are uniformly explained here: "Neighborhood screening list" and "corner point geometric neighborhood cell list" have the same meaning, both referring to the set of all grids for which each process needs to obtain geometric data in order to construct the connection relationship of its assigned grid; "Assigned valid grid" and "Current process assigned grid" have the same meaning, both referring to the valid grids assigned to the current process to maintain adjacency information according to the initial allocation boundary; candidate semi-connection refers to a unidirectional connection relationship from one grid to another; local connection list refers to the set of inter-grid connection records saved by the current process; "internal grid" and "local internal grid" have the same meaning, both referring to the grids assigned to the current process after graph partitioning. The grid that the current process is responsible for solving; "ghost grid" and "boundary ghost grid" have the same meaning, both referring to a copy of a grid belonging to another process but whose data the current process needs to read when calculating the boundary; "compressed sparse row format" and "CSR format" have the same meaning, both referring to a compact storage method that uses row offset arrays and column index arrays to store the sparse graph structure; "compact connection direction" and "connection direction encoding" have the same meaning, both referring to using small integer encoding to represent the connection orientation; "current resident memory" and "current memory usage" have the same meaning, both referring to the actual amount of physical memory occupied by the process at the current moment; "peak resident memory" and "peak memory" have the same meaning, both referring to the maximum amount of memory usage reached by the process from startup to the current moment.
[0034] S100: Preprocessing and analysis stage.
[0035] like Figure 2 As shown, the purpose of the preprocessing analysis stage is to complete the determination of the operating environment, preparation of basic information of corner grids, effective grid mapping and initial allocation boundary construction, which can be achieved through the following steps S101-S103.
[0036] S101: Running mode determination. Each process collects its own hostname, the main process counts the number of unique hostnames to determine the running mode, and broadcasts the running mode to all processes.
[0037] For example, upon program startup, each process calls the processor name acquisition interface to obtain its own hostname. All hostnames are aggregated to the main process via collective communication, and the main process counts the number of unique hostnames. If the number of unique nodes is greater than 1, the running mode is set to multi-node mode; otherwise, the running mode is set to single-node mode. This flag is then broadcast to all processes.
[0038] It's important to note that the purpose of determining the operating mode is to differentiate between single-node and multi-node operating scenarios. In single-node mode, all processes reside on the same physical node, resulting in lower inter-process communication latency and allowing for simplified communication strategies. However, in multi-node mode, processes are distributed across multiple physical nodes, leading to higher inter-node communication overhead and necessitating more refined data distribution and communication optimization strategies. Determining the operating mode through hostname collection and unique hostname counting is a lightweight implementation that does not rely on external configuration files or manual user specification.
[0039] S102: Preparation of basic information for corner grids and establishment of effective grid mapping.
[0040] The main process reads the input file and identifies the grid type, model type, dual-medium flag, grid dimension, bar coordinate data, corner depth data, valid grid identifier, and well data. For corner grids, in a multi-node path, the main process constructs hexahedrons one by one based on the bar coordinate data and corner depth data, calculates the grid scale, volume, and depth in three directions, and establishes a bidirectional valid grid mapping based on validity conditions. This bidirectional valid grid mapping is used for the mutual conversion between the original grid number and the valid grid number.
[0041] In some embodiments, step S102 can be specifically established by the following steps S1021-S1025 to establish a bidirectional effective mesh mapping.
[0042] S1021: The main process reads the input file and identifies the grid type, model type, dual-medium flag, grid dimension, valid grid identifier, and well data.
[0043] The input file for corner meshes typically follows the industry-standard GRDECL format or a similar format. Pillar coordinate data defines the XY-plane position of each pillar at the top, bottom, and intermediate control points, while corner-point depth data defines the depth values of the eight corner points (four at the top and four at the bottom) of each mesh cell. By providing the planar position through pillar coordinates and the vertical position through corner-point depth, the precise geometry of each mesh cell in three-dimensional space can be determined through their combination.
[0044] S1022: The main process constructs the hexahedron one by one by using the corner depth values of the four adjacent columns to form the eight vertices of the hexahedron based on the column coordinate data and corner depth data.
[0045] A hexahedral mesh element is formed by four adjacent columns, each column contributing two corner points (top and bottom), resulting in a total of eight corner points. The four corner points on the top surface are determined by the top depth values of the four columns, and the four corner points on the bottom surface are determined by the bottom depth values of the four columns. These eight corner points collectively define the geometry of a hexahedral element, which is not necessarily a regular cuboid; its lateral surfaces can be twisted.
[0046] S1023: The main process calculates the grid scale in the X, Y, and Z directions based on the vertex coordinates of the constructed hexahedron, calculates the volume of the hexahedron, and calculates the depth value of each grid.
[0047] The volume of a hexahedron can be calculated by decomposing it into multiple tetrahedrons and then summing their volumes. This is a numerically stable geometric calculation method. The mesh scale represents the characteristic length of the mesh cell in three coordinate directions and is used for subsequent numerical calculations, such as stability condition judgment and time step control.
[0048] S1024: The main process determines whether each mesh is a valid mesh based on the valid mesh identifier: For meshes whose valid mesh identifier indicates that they are inactive, they are marked as invalid meshes; For meshes whose valid mesh identifier indicates that they are active, the porosity of the mesh is read from the input file, and it is further determined whether the volume of the hexahedron is greater than a preset volume threshold and whether the porosity is greater than a preset porosity threshold. If the volume is greater than the preset volume threshold and the porosity is greater than the preset porosity threshold, it is marked as a valid mesh; otherwise, it is marked as an invalid mesh.
[0049] It should be noted that the valid mesh identifier is an active / inactive marker directly given in the input file, but this marker alone is insufficient to accurately determine whether a mesh can participate in the numerical solution. Mesh with negative or near-zero volumes (usually caused by column distortion near faults) can lead to numerical instability, while meshes with porosity below the threshold contribute negligibly to fluid flow. Therefore, this application adopts a strategy of prioritizing valid mesh identifiers and dual verification of volume and porosity, excluding meshes identified as active but with excessively small volumes or low porosity from the valid mesh set, thereby improving the stability of the numerical solution. The preset volume threshold and preset porosity threshold can be configured by the user according to the characteristics of the specific reservoir model; for example, the volume threshold can be set to 1×10⁻⁶. -6 m 3 The porosity threshold can be set to 1×10. -4 .
[0050] S1025: The main process assigns consecutive valid grid numbers to each valid grid, establishes a first mapping relationship from the original global grid number to the valid grid number and a second mapping relationship from the valid grid number to the original global grid number, thus forming a bidirectional valid grid mapping.
[0051] The original global grid number is the number within the complete grid of the entire reservoir model (including invalid grids), typically ranging from 1 to the total number of grids. The valid grid number is the numbering of only the valid grids after invalid grids have been removed, ranging from 1 to the total number of valid grids. The purpose of establishing a bidirectional mapping is that input information such as well perforation data and property assignments typically uses the original global grid number, while connection construction, graph partitioning, and solver operations in parallel computing use the valid grid number. The bidirectional mapping allows the conversion between the two to be completed in a shorter time.
[0052] S103: Construct the initial allocation boundary.
[0053] The total number of effective grid cells and well nodes are counted, and the elements after merging the effective grid cells and well nodes are approximately evenly distributed among all processes. The second-to-last item of the initial allocation boundary table records the total number of elements, and the last item records the total number of well nodes; each process is initially responsible for the element numbering interval between two adjacent boundary values. This initial allocation boundary table describes the element numbering interval that each process is responsible for in the initial stage, and also serves as a unified boundary for subsequent local geometry construction, graph partitioning, and remote adjacency attribution determination.
[0054] For example, an initial allocation boundary table is constructed as follows: Assume the total number of processes is P and the total number of elements is N. total_elements (That is, the sum of the effective grid number and the number of well nodes), then each process is allocated approximately N on average. total_elementsThe allocation boundary table contains P elements. It is an integer array of length P+2, where the first P+1 elements are the starting boundary values for each process, and the P+1th element (the second to last element) records the total number of elements N. total_elements The (P+2)th element (the last item) records the total number of well nodes N. wells For the i-th process (i starting from 0), the element numbering range it is responsible for is [boundary[i], boundary[i+1]), which is a left-closed, right-open interval. Since well nodes are independent of the effective grid and are relatively few in number, they are appended to the effective grid for unified numbering. This ensures that well nodes can also participate in the initial allocation and facilitates independent identification of well nodes and grid nodes in subsequent connection construction.
[0055] S200: Distributed construction and reconstruction phase.
[0056] like Figure 3 As shown, the distributed construction and reconstruction phase completes corner point geometric distribution, connection construction, well network connection, graph partitioning, solution domain reconstruction, property reconstruction, and final connection generation based on step S100; the detailed process of parallel graph partitioning, solution domain reconstruction, and on-demand completion of long-range adjacencies can be found in [reference needed]. Figure 4 Remote adjacency completion refers to requesting only the missing remote adjacency relationships after the final solution domain is determined.
[0057] S201: Corner Geometric Neighborhood Construction. Each process determines its own valid grid based on its initial element interval; that is, the valid grid to which this process is responsible for maintaining adjacency information in the initial stage. For each valid grid, the grid itself, its six-directional direct neighbors, and grids in the same column are added to the neighborhood filtering list; this list represents the set of grid geometry required by the current process to construct corner connections. For lateral adjacent columns, this method uses a vertical interval overlap filtering method, only adding grid layers that overlap with the vertically enclosing interval of the current grid, avoiding adding all segments of lateral adjacent columns to the local geometry set. Then, a column index list is calculated based on the neighborhood filtering list. This list is the only set of columns involved in the neighborhood filtering list, used to avoid duplicate transmission of column coordinates.
[0058] It should be noted that in the construction of the corner geometric neighborhood, each process determines its own valid grid based on its initial allocation boundary. That is, in the initial stage, the process is responsible for maintaining the valid grids with connectivity relationships. In order to construct the connections of these grids, the process needs not only the owning grid itself, but also directly adjacent grids, co-cylinder grids, and laterally adjacent column grids. This embodiment only uses the vertical interval overlap filtering method to construct the corner geometric neighborhood cell list (i.e., the neighborhood filtering list). The cells in this corner geometric neighborhood cell list include the own valid grid itself, six-way direct neighbors, co-cylinder grids, and laterally adjacent column segments that overlap with the vertical range of the current grid, thereby avoiding the indiscriminate addition of all laterally adjacent column segments to the local geometric set.
[0059] It should be further clarified that the six-directional direct neighbors refer to the grids logically adjacent to the currently assigned grid in the positive X, negative X, positive Y, negative Y, positive Z, and negative Z directions. Grids within the same column are all grids located on the same column line (i.e., a vertical column enclosed by the same pair of adjacent columns) but at different layers than the currently assigned grid. For lateral adjacent columns, i.e., all grids located on the X or Y direction adjacent columns of the column line where the current grid is located, adding all layers of the entire adjacent column to the neighborhood filter list without screening would result in a large amount of unnecessary geometric data transmission. The vertical interval overlap filtering method adopted in this application calculates the vertical enclosed interval of the currently assigned grid (i.e., the range between its minimum depth at the top surface and maximum depth at the bottom surface), and only selects grid layers from lateral adjacent columns whose vertical range overlaps with this interval, significantly reducing redundant data.
[0060] Building upon this, since multiple different grids may reference the same bar, for example, multiple grids at different levels on the same bar may reference the same bar coordinates, directly transmitting bar coordinates at the grid granularity would result in a large amount of duplicate transmission. The bar index list removes duplicates from all bars involved in the neighborhood filtering list, resulting in a unique set of bars. Subsequent transmission is only performed on this unique set, significantly compressing the amount of bar coordinate data.
[0061] S202: Local Corner Geometry Reconstruction. The main process packages corner depth data for each process's neighborhood filter list and cylindrical coordinate data for each cylindrical index list, and sends the packaged data to the corresponding non-main process; each process reconstructs the local geometry list based on the received corner depth data and cylindrical coordinate data.
[0062] It should be noted that in step S202, the main process no longer sends complete cylinder coordinate data and corner depth data to each process. Instead, it sends them separately according to a list of corner geometric neighborhood cells and a list of unique cylinders. The list of unique cylinders is a set obtained by deduplicating the cylinders involved in the neighborhood cells. For each grid in the list, the eight corner depth values corresponding to that cell are sent; for each unique cylinder involved in the list, the six cylinder coordinate values corresponding to that cylinder are sent. The receiving process reconstructs the local geometry list based on the local corner depth values and local cylinder coordinate values, that is, a set of hexahedrons formed by the local corner depths and local cylinder coordinates. After reconstruction is completed, the receiving buffer and the cylinder index buffer are immediately released.
[0063] In some embodiments, step S202 specifically involves reconstructing the local geometry list through the following steps S2021-S2025.
[0064] S2021: The main process takes the 8 corner depth values of each grid in the neighborhood filter list for each process and assembles them into a corner depth data packet for each process.
[0065] S2022: The main process takes the six bar coordinate values of each bar in the bar index list for each process and assembles them into a bar coordinate data packet for each process.
[0066] S2023: The main process sends the corner depth data packet and bar coordinate data packet of each process, along with the corresponding counting information, to the corresponding non-main process; the counting information includes the number of corner depth data packets and bar coordinate data packets that each non-main process should receive.
[0067] S2024: After receiving data based on the counting information, each non-master process associates the received column coordinate data with the corner depth data according to the position of the column in the local column index list. The column coordinates provide the planar position of the hexahedron vertices, and the corner depths provide the depth position of the hexahedron vertices, thus reconstructing the list of local geometries composed of hexahedrons.
[0068] S2025: After completing the local geometry list construction, release the temporary corner depth buffer and cylindrical coordinate buffer.
[0069] It should be noted that "packaging" here refers to storing multiple scattered data items consecutively in a contiguous memory buffer according to a predetermined order, so as to facilitate batch transmission through the aggregate communication interface. The arrangement order of the eight corner depth values of each grid can adopt industry standard conventions (e.g., cyclically arranged in the I and J directions). The six column coordinate values of each column include the top X coordinate, top Y coordinate, bottom X coordinate, bottom Y coordinate, and the X and Y coordinates of the control point in the middle of the column. The introduction of counting information allows the non-main process to pre-allocate a buffer of the appropriate size before receiving data, avoiding the performance overhead and memory waste caused by dynamic expansion. The receiving buffer is released immediately after the local geometry list is constructed, reflecting the design principle of phased memory release in this application, that is, the data in each stage is released in a timely manner after use, and redundant data across stages is not retained.
[0070] S203: Corner Connection Construction. Each process traverses the active grids in the neighborhood filter list and constructs candidate semi-connections for its assigned grid based on the local geometry list; a candidate semi-connection represents a side connection relationship from one grid to another. For horizontal connections, it first determines whether the current grid face and its neighboring opposite face are in effective contact; if a fault or misalignment causes the connection to span multiple layers, it continues to search for non-adjacent connections along the lateral adjacent columns, i.e., grid connections whose logical layer numbers are not directly adjacent but may still be in spatial contact. For vertical connections, only adjacent upper and lower layers are processed. Connection construction adopts a paired search method for assigned grids, i.e., after generating a candidate connection on one side, it immediately searches for the opposite reverse connection. Finally, only when both positive and negative semi-connections are valid is a local connection list generated; this local connection list stores the grid connections and well network connection records that the current process is responsible for.
[0071] It should be noted that when constructing the local connection list for corner grids, each process, based on the local geometry list, only constructs candidate semi-connections for the grid to which it belongs. A candidate semi-connection is a side connection relationship from one grid to another. For the horizontal direction, the connection surface of the current grid and the opposite surface of the adjacent grid are first taken to determine whether the two surfaces are truly in contact. If there is a fault or misalignment, the search continues along the lateral adjacent columns upwards or downwards for possible contact non-adjacent grids. For the vertical direction, the effective area is directly calculated based on the upper and lower surfaces. Connection matching adopts a pairwise search method for the belonging grid, that is, for each candidate semi-connection generated, the opposite reverse semi-connection is searched immediately. Only when both the forward and reverse semi-connections exist, and the effective area coefficients in both directions are greater than zero, are they written into the local connection list. Each record in this list contains at least the neighbor identifier, connection weight, connection direction, equivalent area parameters at both ends, and conductivity multiplier; the equivalent area parameter is used to represent the reduced amount of effective contact area at both ends of the connection, and the conductivity multiplier is used to correct the connection conductivity, with a default value of 1.
[0072] It should be further explained that in corner grids, two horizontally adjacent grids may not actually be in spatial contact. For example, although grids on both sides of a fault may be logically adjacent, their common surfaces may be completely misaligned due to fault displacement. In this case, a connection should not be established. This application determines whether there is effective contact by calculating the spatial overlap area between the current grid surface and its neighboring opposite surface. Specifically, if the overlap area of the two surfaces is greater than a preset area threshold, it is considered effective contact; otherwise, it is considered non-contact. For cases where faults or misalignments cause logically adjacent but spatially separated grids, a search is conducted upwards or downwards along the lateral adjacent columns for potentially contacting grid segments. If non-logically adjacent grids that are actually in spatial contact are found, a non-adjacent connection is established, thereby ensuring the correct representation of the fluid flow path near the fault.
[0073] It should also be noted that the core idea of the pairwise search method is that the connection relationship is essentially bidirectional; that is, if mesh A and mesh B are adjacent, then connections from A to B and from B to A should exist simultaneously. In the traditional one-sided construction method, floating-point errors or inconsistencies in geometric calculations may lead to A being judged as contact while B is judged as non-contact, resulting in inconsistent connection records. This application adopts a pairwise search method, that is, after generating candidate connections on one side, it immediately searches for reverse connections on the opposite end, ensuring that any valid connection must exist in pairs in the local connection list. If a reverse connection does not exist, it indicates that the candidate connection is an isolated invalid connection and is directly discarded, avoiding convergence problems caused by inconsistent connections in the subsequent solver.
[0074] S204: Well-Grid Connection Injection. The main process iterates through all well perforations, converting the perforation position into the original global grid number, and then into a valid grid number. Based on the initial allocation interval where the valid grid number falls, the grid-to-well node connection is sent to the corresponding process. If a process contains a well node interval, it also receives the reverse well-to-grid connection. All connections are directly appended to the local connection list.
[0075] It should be noted that during the bidirectional distributed injection of well-grid connections, the main process converts the perforation spatial coordinates into the original global grid number based on the well perforation data, and then converts them into valid grid numbers through valid grid mapping. The process to which the valid grid belongs is determined according to the initial allocation boundary table, and the "grid-to-well node" connection is sent to the corresponding process. Simultaneously, if a process contains a range of well node numbers, a reverse "well node-to-grid" connection is sent to that process. The receiving process directly appends these connections to its local connection list, without needing to centrally construct the global well network topology.
[0076] The difference in data structure between well-mesh connections and ordinary grid-mesh connections lies in the fact that well nodes are not grid cells, lacking geometric volumes and six-directional connection surfaces. Therefore, the construction of well-mesh connections does not involve geometric contact determination; it only requires associating the grid containing the perforation with the corresponding well node. The bidirectional nature of well-mesh connections is reflected in flow calculations. Fluid can flow from the grid into the well (production well) or from the well into the grid (injection well), thus requiring connections in both the grid-to-well and well-to-grid directions. Since the number of well nodes (typically tens to hundreds) is much smaller than the number of effective grids, this application merges well nodes with the effective grids and assigns them uniform numbers. Then, an initial allocation boundary table is used to determine the assignment process of each well node. This allows the distributed injection of well-mesh connections to reuse the same communication framework as grid-mesh connections, eliminating the need for a separate allocation mechanism for well connections.
[0077] S205: Parallel Graph Partitioning and Solution Domain Reconstruction. Each process first organizes its local connection list by neighbor number, then converts it into a compressed sparse row-format graph structure. This involves compressing and storing the neighbor list of each grid in a sparse graph structure, and verifying the neighbor number range before calling the parallel graph partitioning function. For corner grids with cross-process neighbors, the process requests the partition label from the initial owner process of that neighbor to obtain the true target process, avoiding misjudgments of target processes caused by gaps and non-adjacent edges. Subsequently, each process exchanges a redistributed connection table. This table records the connections and grids that need to be exchanged between processes after graph partitioning and verifies the received quantity to ensure that no cross-process exchanges have missed or over-received connections. The solution domain reconstruction module generates internal grids, ghost grids, well nodes, local grid arrays, global-to-local mappings, and send and receive indices required for subsequent communication. Internal grids are those solved by the process after graph partitioning, while ghost grids are copies of grids that need to be read for boundary calculations but are handled by other processes.
[0078] During parallel graph partitioning, each process first organizes a local connection list according to neighbor numbers, and then converts the local connection list into a compressed sparse row-format graph structure. This graph structure uses a row offset array to record the starting position of each grid's neighbors, a column index array to record neighbor numbers, and an edge weight array to record connection weights. Before executing parallel graph partitioning, each process first verifies whether the neighbor numbers fall within the range of globally valid elements. Then, it calls the parallel graph partitioning program in conjunction with the initial allocation boundary table to generate a partition label for each initial vertex; the initial vertex is a valid grid or well node element participating in the partitioning, and the partition label indicates the target process to which the element is partitioned. For cross-process neighbors, this application's method does not directly assume that the boundary connections are symmetric, but instead requests the process holding the remote neighbor to return its partition label, thereby ensuring that the target processes for fault connections and non-adjacent connections on process boundaries are correctly identified.
[0079] After graph partitioning, a solution domain reconstruction is performed. Each process exchanges a redistributed connection table based on the partition labels. This redistributed connection table records the connections and meshes that need to be exchanged between processes after graph partitioning. For corner mesh paths, the redistributed connection table exchange uses a send-receive process with communication tags. These tags distinguish different message types and probe the actual message length before receiving to verify that the actual received quantity matches the expected quantity. The solution domain reconstruction module reads this redistributed connection table, determines the internal meshes, well nodes, and ghost meshes of its current process, and constructs the local mesh set, the number of internal meshes, the number of ghost meshes, the sending process list, and the receiving process list. Internal meshes are the meshes that the current process is responsible for solving after graph partitioning. Ghost meshes are copies of meshes that need to be read for boundary calculations but are handled by other processes. Together, they constitute the mesh set that needs to be saved during the local solution phase.
[0080] It should be noted that Compressed Sparse Row Format (CSR) is a widely used sparse graph storage format, consisting of a row offset array (row_ptr), a column index array (col_ind), and a value array (values). For a graph with N vertices, the length of row_ptr is N+1, where row_ptr[i] represents the starting position of the i-th vertex's neighbors in col_ind, row_ptr[i+1] represents the ending position, and the number of neighbors of the i-th vertex is row_ptr[i+1] - row_ptr[i]. The length of col_ind is the number of edges, and it stores all the neighbor numbers of each vertex contiguously. The core advantage of the CSR format is that the neighbors of each vertex are stored contiguously in memory, resulting in good locality of access, making it suitable for frequent neighbor traversal operations in parallel graph partitioning algorithms.
[0081] It's also important to note that during parallel graph partitioning, each process needs to know the final partition labels of each of its neighbors to determine which connections are internal (neighbors are in the same process) and which are external (neighbors are in other processes). For neighbors within the initial allocation interval of the current process, their partition labels are readily available locally. For cross-process neighbors (i.e., the neighbor's initial home process is not the current process), the current process cannot directly know the neighbor's partition label and must send a request to the neighbor's initial home process, which will then return the partition label. This process is particularly crucial in corner meshes because faults and non-adjacent connections prevent cross-process neighbor relationships from being derived through simple logical adjacency. After obtaining the partition labels of all neighbors, a redistribution connection table can be constructed to determine which meshes need to be migrated to other processes and which meshes need to be received from other processes.
[0082] The communication markers are integer identifiers used in aggregated communication to distinguish different message types. For example, marker 1 represents "grid migration request," marker 2 represents "grid migration response," and marker 3 represents "connection relationship request," etc. When the receiving process receives a message, it first reads the communication marker, determines the message type based on the marker value, and then calls the corresponding parsing logic. Before receiving a message, probing the actual message length using MPI_Probe or a similar mechanism allows for dynamic allocation of a precisely sized receive buffer, avoiding truncation or memory waste that might occur with a fixed-size buffer. This is also a necessary prerequisite for verifying the correctness of the received message count.
[0083] S206: Local Property Reconstruction. Each process converts valid mesh numbers into original global mesh numbers based on the local mesh array generated by the solution domain reconstruction module, forming an original number list. This list represents the set of original global numbers for the internal and ghost meshes that the current process needs to participate in the solution. Then, the input main file and include files are reread, and properties are reconstructed only for the meshes in the original number list. Basic property keywords and range operation keywords are processed in the order of the input files. After completion, the reconstruction results are written to the solver's local variable container.
[0084] For example, during the local property reconstruction process, each process converts the valid grid numbers in the local grid set into original global grid numbers, forming an original number list. This list represents the set of original global grid numbers for which the current process needs to reconstruct properties. Subsequently, each process rereads the input master file and include files, but only reconstructs properties for the grids in the original number list. This process supports keywords such as porosity, net-to-gross ratio, three-directional permeability, initial water saturation, rock region number, and fluid region number, and supports operations such as range assignment, range copying, and range scaling. The reconstructed properties are directly written into the local solver variables.
[0085] It should be noted that physical properties are a set of parameters describing the geological and fluid physical characteristics in reservoir numerical simulations. These typically include porosity, permeability (including X, Y, and Z directions), net-to-gross ratio, initial water saturation, rock type number, and fluid type number. These physical property data are usually given in the input file in the form of key-value pairs. The values can be constants, spatially distributed arrays, or combinations generated through range operations (such as BOX assignment, COPY, MULTIPLY, etc.). In traditional centralized preprocessing, the main process needs to reconstruct physical properties for all grids before redistributing them, resulting in significant memory pressure. In this application, each process only needs to reconstruct physical properties for its local grid set. The size of the physical property data for each process is proportional to the number of local grids, achieving distributed processing in the physical property reconstruction stage.
[0086] S207: Final Connection Reconstruction. Since the final internal grid may originate from other initial assigning processes, the reservoir data loading module checks whether each internal grid falls within the initial allocation range of this process. If it does not belong to the initial range, remote completion is performed, i.e., only the missing adjacency relationships are requested from the assigning process of that grid, without pre-copying all remote connections. Requests and responses are exchanged in batches using set communication. Return fields are transmitted in columns according to neighbor identifier, compact connection direction, and effective area parameters at both ends; where column transmission means sending different fields in batches in consecutive arrays, compact connection direction means using a smaller integer encoding to represent the connection direction, and the effective area parameters at both ends are used for subsequent calculation of inter-grid flow capacity. The conductivity multiplier represents the correction coefficient for connection conductivity, with a default value of 1, and a sparse method is used to transmit only non-unit offsets and values. Upon receipt, the current process generates the solution connection according to the global number to local number mapping saved in this process, and establishes the correspondence between well perforations and local grids.
[0087] It should be noted that the final connections are reconstructed on demand. Since the final internal grid after graph partitioning may not entirely fall within the initial home range of this process, the reservoir data loading module generates a set of remote adjacency requests based on the final internal grid requirements; that is, missing adjacency relationship requests grouped by remote home process. For internal grids that do not belong to the initial home range of this process, the process that belongs to them is requested to return the corresponding adjacency relationship. The returned data is transmitted in batches, including neighbor identifiers, compact connection directions, equivalent area parameters at both ends, and conductivity multipliers. Batch transmission means sending different fields in consecutive arrays, and compact connection directions are represented by small integers. The conductivity multiplier defaults to a unit value; only non-unit values are sparsely transmitted based on offset and value. After receiving the data, the process generates a solution connection based on the global number to local number mapping saved in this process; if the neighbor is a well node, the mapping between well perforation and the local grid is written.
[0088] It's important to further clarify that after graph partitioning, the set of internal grids for each process to solve changes. Some grids that originally belonged to the initial allocation region of process A may be reassigned to process B. In this case, process B needs to obtain all the adjacency relationships of these grids to solve correctly. However, the local connectivity list built by process B in stage S203 only contains the connectivity relationships of its initially assigned grids. For internal grids migrated from other processes, their adjacency relationships (especially the connections with some of their neighbors) may not yet be known to process B. The remote completion mechanism only requests the complete adjacency relationships of these migrated internal grids, rather than blindly copying all connections of all remote grids, significantly reducing cross-process communication.
[0089] It's also important to clarify that split transmission means aggregating data of the same type together for transmission, rather than sending complete fields from multiple records together. For example, suppose you need to return 100 connection records, each containing three fields: neighbor ID, connection direction, and effective area. Split transmission would first send the 100 neighbor IDs in a contiguous array, then send the 100 connection directions in another contiguous array, and finally send the 100 effective area values in a third contiguous array. The advantage of this approach is that contiguous storage of similar data facilitates vectorized processing, and the receiver can directly map the contiguous arrays to its local data structure without parsing each record individually, thus improving communication efficiency and data processing speed.
[0090] Compact connection directions reduce the space overhead of data representation by mapping connection directions to smaller integer codes. For example, the positive X direction can be encoded as 1, the negative X direction as 2, the positive Y direction as 3, the negative Y direction as 4, the positive Z direction as 5, and the negative Z direction as 6, while non-adjacent connections can be encoded as 0 or 7. This encoding method allows each connection direction to be represented with only 1 byte, significantly saving storage and communication overhead compared to representing directions using strings or full enumeration types.
[0091] The conductivity multiplier is a dimensionless coefficient used to correct the conductivity between meshes; its default value is 1, indicating no correction. Since the conductivity multiplier for most connections in actual reservoir models is the default value of 1, storing a floating-point conductivity multiplier for each connection would result in significant redundant storage. This application employs a sparse transmission method, assigning an integer offset index to each connection. The actual multiplier value is only stored at the offset position when the conductivity multiplier for that connection is not equal to 1. For connections with a multiplier of 1, no value needs to be stored; the receiver fills it with 1 by default during parsing. This sparse storage method has extremely high compression efficiency when the proportion of non-unit multiplier values is very low (typically less than 1%).
[0092] S208: Memory Reclamation and Diagnostics. After completing local corner geometry construction, release the corner depth and cylindrical coordinate receiving buffers; after completing connection construction, release the remote adjacency receiving buffer; after completing connection generation, release the global-to-local mapping; after completing property loading, release the property reconstruction intermediate array. If diagnostics and memory monitoring are enabled, it also calculates connection direction, invalid area, illegal numerical area, non-unit conductivity multipliers, current resident memory, and peak resident memory, and summarizes memory usage by compute node; where current resident memory represents the actual memory currently occupied by the process, and peak resident memory represents the maximum memory usage reached during execution.
[0093] In step S208, after the local geometry list is constructed, the corner geometry receiving buffer is released; after the local geometry distribution is completed, the main process releases the complete cylindrical coordinate data and corner depth data; after the connection is constructed, the remote receiving buffer and the global-to-local index mapping are released; after the property loading is completed, the parsing temporary container and the distributed property intermediate array are released. If diagnostics are enabled, the current resident memory, peak resident memory, object capacity, and connection direction distribution are statistically analyzed by process, and the memory usage is summarized by computing node; where current resident memory represents the actual memory currently occupied by the process, peak resident memory represents the maximum memory occupied during operation, and object capacity represents the size of the main data container. After the final connection is generated, the distribution of invalid area, illegal numerical area, and connection direction is also statistically analyzed. This multi-stage memory reclamation and diagnostics avoids the long-term occupation of memory by useless data and facilitates the location of the memory peak source in large-scale corner mesh preprocessing.
[0094] It should be noted that the memory reclamation strategy of this application is phased and on-demand release. That is, the temporary storage dedicated to each processing stage is released immediately after completion, rather than waiting for the entire preprocessing process to finish before reclaiming it all at once. The core consideration of this strategy is that in a parallel environment, the processing progress of each process may be inconsistent. A fast process may have already entered the next stage while a slow process is still stuck in the current stage. If the temporary storage is not released in time, the fast process will hold data from both the completed stage and the current stage, resulting in continuous accumulation of memory usage. Specifically, the corner depth receiving buffer and the cylindrical coordinate receiving buffer are only used in stage S202 and can be released after the connection is built in S203; the remote adjacency receiving buffer is only used in the remote completion process in S207 and can be released after completion; the global-to-local mapping is no longer needed after the solver connection is generated; the intermediate array for property reconstruction is no longer needed after the property is written into the solver variable container. The release timing of each stage is precisely matched with the usage lifecycle of the corresponding data.
[0095] Invalid area connections refer to the number of connections where two meshes are logically adjacent but their effective contact area on their common surface is zero or close to zero during connection construction. Such connections should not physically exist, and their number reflects the accuracy of geometric assessments near faults or pinch-outs. Illegal numerical area connections refer to the number of connections that produce non-numerical (NaN) or infinite (Inf) floating-point results when calculating the effective area. Their occurrence usually indicates anomalies in the input data (such as missing bar coordinates or out-of-bounds corner depth values). Statistics on these diagnostic metrics help users identify potential problem areas in the model data and locate numerical anomalies that may occur during preprocessing. Connection direction distribution statistics are used to analyze connection patterns in complex structures such as fault layers and horizontal wells in the model, providing a reference for subsequent solver optimization.
[0096] In some embodiments, such as Figure 4 The diagram shown is a detailed flowchart of parallel graph partitioning, solution domain reconstruction, and on-demand completion of remote adjacencies provided in an embodiment of this application. This flowchart further refines the specific execution logic of graph partitioning, solution domain reconstruction, property reconstruction, remote adjacency completion, and memory reclamation and diagnosis involved in steps S205 to S208.
[0097] like Figure 4As shown, after the well-mesh connection injection in step S204, each process enters the parallel graph partitioning and solution domain reconstruction stage. First, step S205-2 is executed, where each process sorts and organizes each connection record in the local connection list according to its neighbor number, storing all neighbor connections belonging to the same mesh consecutively for easy compression and fast access later. Then, step S205-3 is executed, where each process converts the organized local connection list into a compressed sparse row-format graph structure. This graph structure uses a row offset array to record the starting position of each mesh's neighbors, a column index array to record the neighbor numbers, and an edge weight array to record the connection weights, forming a standardized sparse graph representation. Next, step S205-4 is executed, where each process verifies whether all neighbor numbers in the compressed sparse row-format graph structure are within the range of globally valid element numbers. If any out-of-bounds numbers exist, they are marked as diagnostic anomalies and recorded to prevent illegal numbers from entering the graph partitioning process. After passing the number range verification, step S205-5 is executed, where each process calls the parallel graph partitioning function to perform parallel graph partitioning on the compressed sparse row-format graph structure. For each neighbor of each grid, a process needs to know the target process to which that neighbor belongs after graph partitioning to determine whether the connection is an internal connection or a cross-process boundary connection. If the neighbor is within the initial allocation range of the current process, its partition label can be directly obtained from the local partitioning result; if the neighbor is a cross-process neighbor, i.e., its initial belonging process is not the current process, the current process cannot directly obtain its partition label and must send a request to the initial belonging process of the neighbor, which will then query its own partitioning result and return the partition label of the neighbor. This process ensures that complex cross-process neighbor relationships caused by faults and non-adjacent connections in corner grids can be correctly handled, avoiding target process judgment errors caused by simply assuming boundary connection symmetry. After each process obtains the partition labels of all its neighbors, it executes steps S205-6, where each process determines which grids need to be migrated out and which grids need to be migrated in from other processes based on the partition labels, and exchanges the redistribution connection table accordingly; this redistribution connection table records the grids that need to be migrated between processes after graph partitioning and their connection relationships. After the exchange is completed, each process verifies whether the actual received quantity matches the expectation to confirm that no missed or over-received items occurred during the cross-process exchange. This verification is achieved by probing the actual message length at the communication receiving end and comparing it with the expected length recorded at the sending end. If an inconsistency is found, it is marked as a serious anomaly and the subsequent process is terminated to avoid erroneous calculation results due to incomplete data. Subsequently, step S205-7 is executed, where the solution domain reconstruction module generates the internal grid, ghost grid, and well nodes of the current process based on the redistribution connection table, and constructs the local grid array, global-to-local mapping, and the send and receive indices required for subsequent communication.The internal grid is the grid that the process is responsible for solving after graph partitioning, while the ghost grid is a copy of the grid that needs to be read for boundary calculations but is handled by other processes. Together, they constitute the set of grids that need to be saved during the local solution phase. The global-to-local mapping is used to quickly convert any global grid number into a location index in local storage. The send index and receive index record the target process and message length information required for cross-process data exchange during subsequent solution processes.
[0098] After completing the solution domain reconstruction, the process proceeds to the local property reconstruction and final connectivity reconstruction stages. For example... Figure 4 As shown, in step S206-1, each process converts the valid grid numbers into original global grid numbers based on the local grid array generated by the solution domain reconstruction module, forming an original number list. This list represents the set of original global numbers for the internal and ghost grids that the current process needs to participate in the solution. Each process then rereads the input master file and include files, reconstructs the properties only for the grids in the original number list, and writes the reconstruction results into the solver's local variable container. It should be noted that property reconstruction and connectivity construction are two independent preprocessing tasks. Property reconstruction depends only on the set of grid numbers and not on the connectivity relationships between grids. Therefore, property reconstruction can be performed before, after, or in parallel with connectivity construction. However, in the process design of this application, property reconstruction is scheduled to be performed after the solution domain reconstruction is completed. The reason is that the solution domain reconstruction determines the set of internal and ghost grids that each process is ultimately responsible for. This set may have changed significantly compared to the initial assignment. If the properties are reconstructed before the solution domain reconstruction, the property data of some grids may be assigned to the wrong process, requiring redistribution after graph partitioning, resulting in additional communication overhead. Therefore, this application places property reconstruction after solution domain reconstruction, ensuring that each process only reconstructs properties for the mesh that ultimately belongs to it, thus avoiding cross-process migration of property data.
[0099] After completing the physical property reconstruction, step S207-1 is executed, where the reservoir data loading module determines whether each internal grid lacks adjacency relationships. For internal grids, if the grid originally belongs to the initial allocation range of this process, then the process has already constructed a complete local connectivity list for it in step S203, and the adjacency relationships of the grid already exist completely, requiring no additional acquisition. If the grid was migrated to this process from another process during the graph partitioning process in step S205, then this process did not construct connectivity relationships for the grid in the initial stage, and the adjacency relationships of the grid are missing for this process. Therefore, the basis for determining whether adjacency relationships are missing is whether the internal grid falls within the initial allocation range of this process. If it falls within the initial allocation range of this process, then the adjacency relationship is already in the local connectivity list; if it does not belong to the initial allocation range of this process, then the adjacency relationship is missing and needs to be remotely completed. If an internal grid does not belong to the initial allocation range of this process (i.e., it lacks adjacency relationships), the remote completion path is entered: Step S207-2 is executed, the reservoir data loading module adds the internal grid to the remote completion list, and groups it according to the initial home process of the grid, requesting the missing adjacency relationships from the corresponding home process. Both requests and returns use batch exchange via set communication. After receiving the request, the home process retrieves the adjacency record of the corresponding grid from its own local connection list, executes step S207-3, and returns fields such as neighbor identifier, compact connection direction, and effective area parameters at both ends; where column transmission means that different fields are placed into continuous arrays and sent in batches, compact connection direction means that the connection direction is represented by a smaller integer encoding, the conductivity multiplier defaults to 1, and a sparse method is used to transmit only the non-unit value offset and value. If the internal grid belongs to the initial allocation range of this process (i.e., the adjacency relationship is complete), there is no need to request remote data, and step S207-4 is executed to directly read the adjacency record corresponding to the grid in the local connection list. After obtaining the adjacency relationship, whether the returned data is obtained through remote completion or the record is read directly from the local connection list, step S207-5 is executed to convert the global number in the connection to the local number according to the global number to local number mapping saved in this process, and generate a solution connection that can be directly used by the solver; if the neighbor number belongs to the well node range, the correspondence between the well perforation and the local grid is established at the same time.
[0100] Finally, step S208-1 is executed to release the temporary storage allocated in each stage and output memory statistics and connectivity quality diagnostic results. Specifically, the released temporary storage includes the corner depth receiving buffer and cylindrical coordinate receiving buffer allocated in step S202, the remote adjacency receiving buffer allocated in step S203, the global-to-local mapping allocated in step S205, and the intermediate array for property reconstruction allocated in step S206. If diagnostics and memory monitoring are enabled, the connection direction, number of invalid area connections, number of illegal numerical area connections, number of non-unit conductivity multipliers, current resident memory, and peak resident memory are also statistically analyzed, and memory usage is summarized by compute node to form a complete connectivity quality diagnostic report.
[0101] Example 2: This embodiment provides a specific application process for corner grid neighborhood construction and connection generation. It should be noted that this embodiment is a more specific implementation example of the corner grid neighborhood construction and connection generation process in steps S201 to S203, based on the overall process framework described in Embodiment 1.
[0102] In multi-node mode, the main process first calculates the corner geometry, volume, depth, and vertical extent of each grid using column coordinate data and corner depth data, and generates valid grid markers. Each process determines its own assigned valid grid based on the initial allocation boundary. For a assigned valid grid, the neighborhood filtering list first adds itself and its direct neighbors in six directions. Since lateral connections between corner grids may span multiple layers due to faults and shifts, it is also necessary to add grids with the same column and lateral adjacent column grids; for lateral adjacent columns, only the layers intersecting the vertical extent of the current grid are added.
[0103] The main process packages corner depth data based on the neighborhood filter list and column coordinate data based on the column index list. The receiving process reconstructs the local geometry list upon receiving the local geometry. Subsequently, in the connection construction phase, the contact between the current face and the opposite face is calculated for each pair of candidate lateral meshes. If the opposite faces are completely misaligned, they are skipped; if valid contact exists, the effective area parameters of the current end and the opposite end are calculated. To ensure consistent connection pairs, this method uses a pairwise search approach, only saving candidate half-connections of the currently belonging mesh and immediately searching for reverse half-connections; connection records in the local connection list are only generated when both the current mesh-to-neighbor and neighbor-to-current mesh half-connections are valid. If a vertical conductance multiplier exists in the input, the vertical connection is multiplied by the corresponding conductance multiplier during generation.
[0104] Example 3: This embodiment describes the on-demand exchange of remote adjacencies after the final solution domain is formed. It should be noted that this embodiment is a specific implementation example of the on-demand exchange process of remote adjacencies after the final solution domain is formed, based on steps S205-S207 described in Embodiment 1.
[0105] After parallel graph partitioning, the internal grids ultimately managed by a process may not all originate from its initial assigned range. For internal grids originating from other initially assigned processes, the current process does not have their complete adjacency relationships. The reservoir data loading module traverses the internal grids, generates a remote completion list, and groups them according to the initial assigned process of the grid. All processes exchange the number of requests and the requested grid number via set communication. Upon receiving a request, the owning process retrieves the adjacency record of the corresponding grid from its local connection list, first returning the number of neighbors for each grid, and then returning the neighbor identifier, connection direction, and effective area parameters at both ends in batches. The conductivity multiplier defaults to a unit value; its relative offset sum is returned only when it is not equal to the unit value.
[0106] The receiving process constructs a remote grid index table based on the returned data. For each internal grid, if it is the local initial home grid, the local connection list is read directly; otherwise, the receive buffer is located in the remote grid index table using a binary search. If the neighbor number belongs to the well node range, the local well perforation mapping is updated; if the neighbor is a grid, the local number is obtained through a global-to-local mapping, and solution connections are generated while avoiding duplication.
[0107] Example 4: This embodiment combines two experimental runs of the method of this application on a domestic supercomputing platform to illustrate the comparative results of the same large-scale corner grid example using "distributed corner geometry construction and pairwise search connection generation" and "centralized construction and distribution by the main process". It should be noted that this embodiment, based on the methods described in Embodiments 1-3, verifies and quantifies the beneficial effects of the technical solution of this application through two comparative runs on an actual domestic supercomputing platform.
[0108] Both runs employed 20 compute nodes and 80 parallel processes, with 4 processes deployed per node. The test case had a total of 5,225,220 grids, of which 881,691 were active and 4,343,529 were inactive, representing 83.126% of the total. It also included 30 well nodes. The current resident memory before construction was essentially the same for both runs: the distributed construction had a total resident memory of 36,568.918 MB, with a maximum single-process memory of 834.984 MB; the centralized control had a total resident memory of 36,584.285 MB, with a maximum single-process memory of 835.277 MB. These data indicate that the two controls had the same scale and similar initial running conditions.
[0109] In the distributed corner geometry construction stage, this method employs a vertical interval overlap filtering approach, constructing corner geometry data only around the connection range required by each process. After neighborhood filtering, the cumulative number of corner units required by each process is 12,478,174, which becomes 2,959,916 after global deduplication; the corresponding cumulative number of unique bars is 1,055,590, which becomes 26,615 after global deduplication. Based on equivalent double-precision values (i.e., converting different fields into 8-byte double-precision numbers), the corner geometry transmission volume is reduced from 399,301,568 to 106,158,932, and the converted transmission volume is reduced from approximately 3,046.429 MB to approximately 809.928 MB, saving approximately 2,236.501 MB, a reduction of 73.414%.
[0110] During the corner connection construction phase, a pairwise search method was used in the distributed operation. The measured number of candidate semi-connections was 4,182,669, and 4,182,626 reverse semi-connections were found, ultimately forming 4,182,556 directed mesh connections. A directed mesh connection is a connection record pointing from one mesh to another. After well-mesh connection injection, the total number of directed connections was 4,184,948, of which 2,392 were well-mesh connections. In the connection quality diagnosis, the number of invalid area connections, illegal numerical area connections, out-of-bounds mesh numbers, and non-unit conductivity multipliers were all 0.
[0111] Compared to centralized construction followed by distribution in the main process, the memory advantage of this method is mainly reflected in the peak memory usage per process and the amount of complete source corner data retained. After construction, the distributed construction no longer retains complete source corner data, with a corresponding retention of 0.000 MB; the centralized control still retains 320.590 MB. The maximum current resident memory of a single process during the construction phase decreased from 2,597.477 MB to 964.746 MB, a reduction of approximately 62.858%; the peak resident memory of a single process during the construction phase decreased from 6,404.508 MB to 1,509.332 MB, a reduction of approximately 76.433%. After the grid intermediate data is released, the maximum resident memory of a single process in the distributed construction is 555.008 MB, compared to 1,945.664 MB in the centralized control, a reduction of approximately 71.475%.
[0112] During the solution domain reconstruction and remote completion phases, the total number of remote grid number requests sent and received in the distributed operation was 770,049, indicating that the cross-process request exchange was globally consistent. In the connection field exchange phase, a total of 3,643,203 connection records were received, ultimately generating 2,121,651 undirected connections used by the solver; these undirected connections are the paired grid connections ultimately used by the solver. The number of local connections generated by each process ranged from 18,107 to 32,307, and the final connection quality diagnostics showed that the number of invalid area connections and illegal numerical area connections were both 0.
[0113] In this test, the total time for mesh construction, well connection, and distribution in distributed architecture was 24.755 s, compared to 12.968 s for centralized architecture. This indicates that distributed architecture increases the overhead of local geometry filtering and communication. Its advantage lies not in the absolute mesh construction time during this run, but in transforming the load of complete corner geometry and global connection construction, which is concentrated on the main process, into local geometry reconstruction and local connection generation distributed across processes. This significantly reduces the peak memory usage per process and the data residency pressure on the main process.
[0114] In summary, two practical runs verified the feasibility of this method on 20 nodes, 80 processes, approximately 5.22 million original grids, and approximately 880,000 effective grid examples. Compared with the control path that centrally builds and distributes data after the main process, this method can reduce the amount of corner geometry transfer and peak memory usage per process, avoid the main process retaining complete source corner data for a long time, and maintain normal results for remote completion exchange and final connection quality diagnosis.
[0115] Example 5: This application also provides a parallel system for large-scale preprocessing of corner meshes for reservoir simulation, used to implement the method described above. Figure 5 As shown, the system includes a first processing module 510 and a second processing module 520; The first processing module 510 is configured to perform a preprocessing analysis phase, and the first processing module 510 includes: The running mode determination unit 511 is configured to have each process collect its own hostname, the main process counts the number of unique hostnames to determine the running mode, and broadcasts the running mode to all processes. The effective mesh mapping unit 512 is configured to have the main process read the input file, construct hexahedrons one by one according to the cylindrical coordinate data and corner depth data in the input file, calculate the mesh scale, volume and depth of each hexahedron, and establish a bidirectional effective mesh mapping according to the validity conditions; the bidirectional effective mesh mapping is used for mutual conversion between the original mesh number and the effective mesh number. The allocation boundary construction unit 513 is configured to count the total number of effective grids and the total number of well nodes, and to distribute the elements of the merged effective grids and well nodes to all processes in an approximately uniform manner to construct the initial allocation boundary; each process is initially responsible for the element numbering interval between two adjacent boundary values. The second processing module 520 is configured to perform a distributed build and rebuild phase, and the second processing module 520 includes: List building unit 521 is configured to have each process determine the assigned valid grid based on the initial allocation boundary; for each assigned valid grid, add the assigned valid grid itself, its six-directional direct neighbors, and grids in the same column to the neighborhood filtering list; for lateral adjacent columns, only add the grid layers that overlap with the vertical enclosing interval of the current assigned valid grid to the neighborhood filtering list; and calculate the column index list based on the neighborhood filtering list. The corner geometry distributed construction unit 522 is configured to have the main process package corner depth data for the neighborhood filtering list of each process, package column coordinate data for the column index list, and send the packaged data to the corresponding non-main process; each process reconstructs the local geometry list based on the received corner depth data and column coordinate data; Corner connection construction unit 523 is configured to have each process traverse the active grids in the neighborhood filter list and construct candidate semi-connections for the belonging grid based on the local geometry list. For horizontal connections, it is determined whether the current grid face and the neighboring opposite face are in effective contact. If there is effective contact, a candidate semi-connection is generated. If a fault or misalignment causes the horizontal connection to span multiple layers, the search for non-adjacent connections continues along the lateral adjacent columns. The non-adjacent connection refers to the connection between the belonging grid and a grid in the lateral adjacent column whose logical layer number is not adjacent but is in spatial contact. For vertical connections, only the upper and lower adjacent layers are processed. A pairwise search method for belonging grids is adopted. After generating a candidate semi-connection on one side, the reverse semi-connection on the other end is immediately searched. If both the forward and reverse semi-connections are valid, a local connection list is generated. Well network connection unit 524 is configured to have the main process traverse all well perforations, convert the perforation positions into original global grid numbers, and then convert them into valid grid numbers through the bidirectional valid grid mapping; according to the initial allocation interval in which the valid grid number falls, the grid-to-well node connection is sent to the corresponding process; each process appends the received connection to the local connection list; The graph partitioning and domain reconstruction unit 525 is configured to have each process organize the local connection list according to the neighbor number, convert it into a compressed sparse row format graph structure, and call the parallel graph partitioning function to perform parallel graph partitioning; each process exchanges the redistribution connection table, and the domain reconstruction module generates internal grids, ghost grids, well nodes, local grid arrays, global to local mappings, and send and receive indices required for communication based on the redistribution connection table. The property reconstruction unit 526 is configured to have each process convert the valid grid numbers into the original global grid numbers according to the local grid array, forming an original number list; reread the input file, reconstruct the property only for the grids in the original number list, and write the reconstruction results into the solver's local variable container; The remote adjacency exchange unit 527 is configured to have the reservoir data loading module check whether each of the internal grids falls within the initial allocation range of the current process. If it does not fall within the initial allocation range of the current process, remote completion is performed. The remote completion includes requesting the missing adjacency relationship from the process to which the internal grid belongs. The request and return are exchanged in batches using set communication. After receiving the returned data, a solution connection is generated according to the global number to local number mapping saved by the current process, and the correspondence between well perforation and local grid is established. The memory reclamation and diagnostic unit 528 is configured to release temporary storage allocated at each stage and output memory statistics and connectivity quality diagnostic results. The temporary storage allocated at each stage includes corner depth receiving buffers, cylindrical coordinate receiving buffers, remote adjacency receiving buffers, global-to-local mapping, and intermediate arrays for property reconstruction. The memory statistics include the current resident memory and peak resident memory of each process, and summarize memory usage by compute node. The connectivity quality diagnostic results include connectivity direction statistics, number of invalid area connections, number of illegal numerical area connections, number of grid number out-of-bounds connections, and number of non-unit conductivity multipliers.
[0116] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A parallel method for large-scale preprocessing of corner meshes for reservoir simulation, characterized in that, The method includes a preprocessing analysis stage and a distributed construction and reconstruction stage; The preprocessing analysis stage includes: Each process collects its own hostname, the main process counts the number of unique hostnames to determine the running mode, and broadcasts the running mode to all processes; The main process reads the input file, constructs hexahedrons one by one based on the cylindrical coordinate data and corner depth data in the input file, calculates the mesh scale, volume and depth of each hexahedron, and establishes a bidirectional effective mesh mapping based on the validity conditions; the bidirectional effective mesh mapping is used for mutual conversion between the original mesh number and the effective mesh number. Count the total number of effective grids and the total number of well nodes, and distribute the elements of the merged effective grids and well nodes to all processes in an approximately uniform manner to construct an initial allocation boundary; each process is initially responsible for the element numbering interval between two adjacent boundary values. The distributed construction and reconstruction phase includes: Each process determines the assigned valid grid based on the initial allocation boundary; for each assigned valid grid, the assigned valid grid itself, its six-directional direct neighbors, and grids in the same column are added to the neighborhood filtering list; for lateral neighboring columns, only the grid layers that overlap with the vertical enclosing interval of the current assigned valid grid are added to the neighborhood filtering list; a column index list is calculated based on the neighborhood filtering list; The main process packages corner depth data for the neighborhood filtering list of each process, packages bar coordinate data for the bar index list, and sends the packaged data to the corresponding non-main process; each process reconstructs the local geometry list based on the received corner depth data and bar coordinate data; Each process traverses the active grids in the neighborhood filter list and constructs candidate semi-connections for the belonging grid based on the local geometry list. For horizontal connections, it determines whether the current grid face and the adjacent face of the neighboring grid are in effective contact. If there is effective contact, a candidate semi-connection is generated. If a fault or misalignment causes a horizontal connection to span multiple layers, the search for non-adjacent connections continues along the lateral adjacent columns. The non-adjacent connection refers to the connection between the belonging grid and a grid in the lateral adjacent column whose logical layer number is not adjacent but is in spatial contact. For vertical connections, only the upper and lower adjacent layers are processed. A pairwise search method for belonging grids is adopted. After generating a candidate semi-connection on one side, the reverse semi-connection on the other end is immediately searched. If both the forward and reverse semi-connections are valid, a local connection list is generated. The main process iterates through all well perforations, converts the perforation positions into raw global grid numbers, and then converts them into valid grid numbers through the bidirectional valid grid mapping. According to the initial allocation interval in which the valid grid number falls, the grid-to-well node connection is sent to the corresponding process. Each process appends the received connection to the local connection list. Each process organizes the local connection list according to the neighbor number, converts it into a compressed sparse row format graph structure, and calls the parallel graph partitioning function to perform parallel graph partitioning; each process exchanges the redistribution connection table, and the solution domain reconstruction module generates internal grids, ghost grids, well nodes, local grid arrays, global to local mappings, and send and receive indices required for communication based on the redistribution connection table. Each process converts the valid grid numbers into the original global grid numbers based on the local grid array, forming an original number list; it rereads the input file, reconstructs the physical properties only for the grids in the original number list, and writes the reconstruction results into the solver's local variable container; The reservoir data loading module checks whether each internal grid falls within the initial allocation range of the current process. If it does not fall within the initial allocation range of the current process, remote completion is performed. The remote completion includes requesting the missing adjacency relationship from the process to which the internal grid belongs. The request and return are exchanged in batches using set communication. After receiving the returned data, the solution connection is generated according to the global number to local number mapping saved by the current process, and the correspondence between well perforation and local grid is established. Release the temporary storage allocated at each stage, and output memory statistics and connectivity quality diagnostic results; wherein, the temporary storage allocated at each stage includes corner depth receiving buffer and cylindrical coordinate receiving buffer, remote adjacency receiving buffer, global to local mapping, and intermediate array for property reconstruction; the memory statistics include the current resident memory and peak resident memory of each process, and summarize the memory usage by computing node; the connectivity quality diagnostic results include connectivity direction statistics, number of invalid area connections, number of illegal numerical area connections, number of grid number out-of-bounds connections, and number of non-unit conductivity multipliers.
2. The method according to claim 1, characterized in that, The main process counts the number of unique hostnames to determine the running mode, including: Each process calls the processor name acquisition interface to obtain its own hostname. All hostnames are collected to the main process through aggregate communication. The main process counts the number of unique hostnames. If the number of unique hostnames is greater than 1, then the running mode is set to multi-node mode; otherwise, the running mode is set to single-node mode.
3. The method according to claim 1, characterized in that, The main process reads the input file, constructs hexahedrons one by one based on the cylindrical coordinate data and corner depth data in the input file, calculates the mesh scale, volume, and depth of each hexahedron, and establishes a bidirectional effective mesh mapping based on validity conditions, including: The main process reads the input file and identifies the grid type, model type, dual-medium flag, grid dimension, valid grid identifier, and well data; The main process constructs the hexahedron one by one by using the corner depth values of four adjacent columns to form the eight vertices of the hexahedron based on the column coordinate data and the corner depth data. The main process calculates the grid scale in the X, Y, and Z directions based on the vertex coordinates of the constructed hexahedron, calculates the volume of the hexahedron, and calculates the depth value of each grid. The main process determines whether each grid is a valid grid based on the valid grid identifier: for grids whose valid grid identifier indicates inactivity, they are marked as invalid grids; for grids whose valid grid identifier indicates activity, the porosity of the grid is read from the input file, and it is further determined whether the volume of the hexahedron is greater than a preset volume threshold and whether the porosity is greater than a preset porosity threshold. If the volume is greater than the preset volume threshold and the porosity is greater than the preset porosity threshold, it is marked as a valid grid; otherwise, it is marked as an invalid grid. The main process assigns consecutive valid grid numbers to each valid grid, establishes a first mapping relationship from the original global grid number to the valid grid number and a second mapping relationship from the valid grid number to the original global grid number, thus forming the bidirectional valid grid mapping.
4. The method according to claim 1, characterized in that, Each process determines the assigned valid grid based on the initial allocation boundary and adds the assigned valid grid itself, its six-directional direct neighbors, and co-pillar grids to the neighborhood filtering list, including: Each process determines its own initial element range based on the initial allocation boundary, and identifies the valid grids that fall within the initial element range as the assigned valid grids. For each of the aforementioned valid grids, the grid itself, the adjacent grids in the positive X direction, negative X direction, positive Y direction, negative Y direction, positive Z direction, and negative Z direction, as well as the grids in the same column but at different levels that are located on the same column line as the valid grid, are added to the neighborhood filtering list. For lateral adjacent columns, calculate the vertical enclosing interval of the assigned valid grid, and select only grid layers whose vertical enclosing interval overlaps with the vertical enclosing interval of the assigned valid grid in the lateral adjacent columns to add to the neighborhood filtering list.
5. The method according to claim 1, characterized in that, The main process packages corner depth data for the neighborhood filtering list of each process, packages bar coordinate data for the bar index list, and sends the packaged data to the corresponding non-main process. Each process reconstructs a list of local geometries based on the received corner depth data and cylindrical coordinate data, including: For each process, the main process extracts the 8 corner depth values of each grid in the neighborhood filtering list in sequence and assembles them into a corner depth data packet for each process. For each process, the main process sequentially extracts the six bar coordinate values of each bar in the bar index list and assembles them into a bar coordinate data packet for each process. The main process sends the corner depth data packet and bar coordinate data packet of each process, along with the corresponding counting information, to the corresponding non-main process; the counting information includes the number of corner depth data packets and bar coordinate data packets that each non-main process should receive; After receiving data according to the counting information, each non-main process associates the received column coordinate data with the corner depth data according to the position of the column in the local column index list. The column coordinates provide the planar position of the hexahedron vertices, and the corner depth provides the depth position of the hexahedron vertices, thus reconstructing the list of local geometries composed of hexahedrons. After completing the local geometry list construction, release the temporary corner depth buffer and cylindrical coordinate buffer.
6. The method according to claim 1, characterized in that, Based on the local geometry list, candidate semi-connections are constructed for the belonging mesh. The method of generating the local connection list using the belonging mesh pairwise search method includes: Each process traverses the active grids in the neighborhood filter list and constructs candidate semi-connections for the belonging grid based on the local geometry list; the candidate semi-connection represents a side connection relationship from one grid to another. For horizontal connections, calculate the spatial overlap area between the current mesh face and the neighboring opposite face, and determine whether the area of the overlap area is greater than a preset area threshold. If the area of the overlap area is greater than the preset area threshold, it is determined to be a valid contact. Calculate the effective area parameters of the current end and the opposite end and generate candidate half connections. If the currently traversed class grid has a valid spatial contact with a grid whose logical layer number is not adjacent in the lateral adjacent column, then the connection relationship between the currently traversed class grid and the grid whose logical layer number is not adjacent is identified as a non-adjacent connection and a candidate semi-connection is generated. For vertical connections, only the connections between the currently traversed home grid and its adjacent layer grids in the positive and negative Z directions are processed; After generating a candidate semi-connection on one side, immediately look up the reverse semi-connection that points to the currently traversed home grid from the opposite grid. If the reverse half-connection is valid, the candidate half-connection and the reverse half-connection are merged into a single local connection record and saved to the local connection list. If the reverse semi-connection is invalid, then the candidate semi-connection is discarded; If the input contains a vertical conductance multiplier, the vertical connection is multiplied by the corresponding conductance multiplier during generation.
7. The method according to claim 1, characterized in that, The main process iterates through all well perforations, converts the perforation positions into raw global grid numbers, and then converts them into valid grid numbers through the bidirectional valid grid mapping; according to the initial allocation interval in which the valid grid number falls, the connection from the grid to the well node is sent to the corresponding process; Each process appends the received connections to the local connection list, including: The main process reads all well perforation data and obtains the corresponding original global grid number for each perforation location; The main process converts the original global grid number into a valid grid number through the first mapping relationship from the original global grid number to the valid grid number in the bidirectional valid grid mapping; The main process queries the initial allocation range of each process based on the valid grid number, and determines the target process corresponding to the initial allocation range in which the valid grid number falls; The main process groups and packages the connections from the grid to the well node corresponding to the valid grid number into groups according to the target processes and sends them to each target process; After each target process receives the connection from the grid to the well node, it verifies whether the valid grid number in the connection belongs to the initial allocation range of its own process. If the verification passes, each target process will add the received grid-to-well node connections to the local connection list; Each target process simultaneously receives the reverse connection from the well node to the grid and appends the reverse connection to the local connection list.
8. The method according to claim 1, characterized in that, Each process organizes the local connection list according to the neighbor number, converts it into a compressed sparse line graph structure, and calls the parallel graph partitioning function to perform parallel graph partitioning, including: Each process sorts and organizes each connection record in the local connection list according to the neighbor number; Verify that all neighbor numbers in the cleaned connection list are within the range of valid grid numbers. If there are out-of-bounds numbers, mark them as diagnostic anomalies. For corner grid cross-process neighbors, the cross-process neighbor refers to a grid whose neighbor number in the local connection list does not belong to the initial allocation range of this process; the process obtains the actual target process of the cross-process neighbor in the parallel graph partition by requesting the initial owner process of the cross-process neighbor to return the partition label; The organized connection list is converted into a compressed sparse row-format graph structure. The compressed sparse row-format graph structure stores all neighbor numbers of each grid in a neighbor array and records the starting position of each grid's neighbors through a row offset array. The parallel graph partitioning function is called to perform parallel graph partitioning on the compressed sparse row format graph structure, and the partition label of each grid is obtained. Each process exchanges a redistribution connection table, which is used to record the grids that need to be migrated between processes after the graph is partitioned and their connection relationships. Verify that the received quantity is correct to confirm that there are no missed or over-received items in the cross-process exchange; The solution domain reconstruction module generates internal meshes, ghost meshes, well nodes, local mesh arrays, global-to-local mappings, and send and receive indices required for communication based on the redistribution connection table. The internal mesh is the mesh that this process is responsible for solving after the graph is partitioned, while the ghost mesh is a copy of the mesh that needs to be read for boundary calculations but is handled by other processes.
9. The method according to claim 1, characterized in that, Request missing adjacency relationships from the process that owns the internal mesh; the request and response are exchanged in batches using set communication; upon receiving the returned data, generate a solution connection according to the global number to local number mapping saved in this process, and establish the correspondence between well perforations and the local mesh, including: The reservoir data loading module traverses all internal grids and checks whether each internal grid falls within the initial allocation range of this process; If the internal grid does not belong to the initial allocation range of this process, then the internal grid is added to the remote completion list and grouped according to the initial process to which the internal grid belongs; All processes send request counts to other processes and receive request counts from other processes through set communication; Based on the number of requests received, each process sends the grid number of the request to the corresponding requesting process; Upon receiving a request, the owning process retrieves the adjacency record of the corresponding grid from its local connection list and first returns the number of neighbors for each grid. The adjacency record contains the neighbor numbers of all neighbors of the grid, the connection direction with each neighbor, the effective area parameters at both ends, and the conductivity multiplier. Based on the number of neighbors received, the requesting process allocates a receiving buffer, and the owning process then returns the neighbor identifiers, connection directions, and effective area parameters at both ends in batches. The returned fields are transmitted separately according to the neighbor identifier, compact connection direction, and effective area parameters at both ends; the compact connection direction is represented by integer encoding; the conductivity multiplier defaults to 1, and only the offset and value of non-unit values are transmitted in a sparse manner. The receiving process constructs a remote grid index table based on the returned data, and the remote grid index table records the position index of each remote grid in the receiving buffer; For internal grids that do not belong to the initial allocation range of this process, the receiving buffer is located in the remote grid index table by binary search to obtain the adjacency relationship of the internal grid; the adjacency relationship includes the neighbor number of each neighbor of the internal grid, the connection direction between each neighbor, the effective area parameters at both ends, and the conductivity multiplier; If the neighbor number belongs to the well node range, then update the local well perforation mapping; If the neighbor corresponding to the neighbor number is a grid, then the local number of the neighbor is obtained through global-to-local mapping, and a solution connection is generated.
10. A parallel system for large-scale preprocessing of corner grids for reservoir simulation, characterized in that, The system includes a first processing module and a second processing module; The first processing module is configured to perform a preprocessing analysis phase, and the first processing module includes: The running mode determination unit is configured to have each process collect its own hostname, the main process counts the number of unique hostnames to determine the running mode, and broadcasts the running mode to all processes. The effective mesh mapping unit is configured to have the main process read the input file, construct hexahedrons one by one according to the cylindrical coordinate data and corner depth data in the input file, calculate the mesh scale, volume and depth of each hexahedron, and establish a bidirectional effective mesh mapping according to the validity conditions; the bidirectional effective mesh mapping is used for mutual conversion between the original mesh number and the effective mesh number. The allocation boundary construction unit is configured to count the total number of effective grids and the total number of well nodes, and to distribute the elements of the merged effective grids and well nodes to all processes in an approximately uniform manner to construct the initial allocation boundary; each process is initially responsible for the element numbering interval between two adjacent boundary values. The second processing module is configured to perform the distributed build and rebuild phases, and the second processing module includes: The list building unit is configured to have each process determine the assigned valid grid based on the initial allocation boundary; for each assigned valid grid, the assigned valid grid itself, its six-directional direct neighbors, and grids in the same column are added to the neighborhood filtering list; for lateral adjacent columns, only the grid layers that overlap with the vertical enclosing interval of the current assigned valid grid are added to the neighborhood filtering list; and a column index list is calculated based on the neighborhood filtering list. The corner geometry distributed construction unit is configured to have the main process package corner depth data for each process's neighborhood filtering list, package bar coordinate data for the bar index list, and send the packaged data to the corresponding non-main process; each process reconstructs a local geometry list based on the received corner depth data and bar coordinate data. The corner connection construction unit is configured to have each process traverse the active grids in the neighborhood filter list and construct candidate semi-connections for the belonging grid based on the local geometry list. For horizontal connections, it is determined whether the current grid face and the adjacent face of the neighboring grid are in effective contact. If there is effective contact, a candidate semi-connection is generated. If a fault or misalignment causes the horizontal connection to span multiple layers, the search for non-adjacent connections continues along the lateral adjacent columns. The non-adjacent connection refers to the connection between the belonging grid and a grid in the lateral adjacent column whose logical layer number is not adjacent but is in spatial contact. For vertical connections, only the upper and lower adjacent layers are processed. A pairwise search method for belonging grids is adopted. After generating a candidate semi-connection on one side, the reverse semi-connection on the other side is immediately searched. If both the forward and reverse semi-connections are valid, a local connection list is generated. The well network connection unit is configured to have the main process traverse all well perforations, convert the perforation positions into raw global grid numbers, and then convert them into valid grid numbers through the bidirectional valid grid mapping; according to the initial allocation interval in which the valid grid numbers fall, the grid-to-well node connections are sent to the corresponding processes; each process appends the received connections to the local connection list; The graph partitioning and domain reconstruction unit is configured to have each process organize the local connection list by neighbor number, convert it into a compressed sparse row format graph structure, and call the parallel graph partitioning function to perform parallel graph partitioning; each process exchanges the redistribution connection table, and the domain reconstruction module generates internal grids, ghost grids, well nodes, local grid arrays, global-to-local mappings, and send and receive indices required for communication based on the redistribution connection table. The property reconstruction unit is configured to have each process convert the valid grid numbers into the original global grid numbers based on the local grid array, forming an original number list; reread the input file, reconstruct the property only for the grids in the original number list, and write the reconstruction results into the solver's local variable container; The remote adjacency exchange unit is configured to have the reservoir data loading module check whether each of the internal grids falls within the initial allocation range of the current process. If it does not fall within the initial allocation range of the current process, remote completion is performed. The remote completion includes requesting the missing adjacency relationship from the process to which the internal grid belongs. The request and return are exchanged in batches using set communication. After receiving the returned data, a solution connection is generated according to the global number to local number mapping saved by the current process, and the correspondence between well perforation and local grid is established. The memory reclamation and diagnostic unit is configured to release temporary storage allocated at each stage and output memory statistics and connectivity quality diagnostic results. The temporary storage allocated at each stage includes corner depth receiving buffers, cylindrical coordinate receiving buffers, remote adjacency receiving buffers, global-to-local mapping, and intermediate arrays for property reconstruction. The memory statistics include the current resident memory and peak resident memory of each process, and summarize memory usage by compute node. The connectivity quality diagnostic results include connectivity direction statistics, number of invalid area connections, number of illegal numerical area connections, number of grid number out-of-bounds connections, and number of non-unit conductivity multipliers.
