A Finite Element-Based Analysis Method for Core Subchannels of a Fully Coupled Nuclear Reactor
By using a finite element-based analysis method for the core subchannels of a fully coupled nuclear reactor, the problems of high computational resources and inaccurate parameter distribution in existing technologies are solved, enabling more accurate simulation of core physical parameters and improving the ability to perform reactor safety analysis.
Patent Information
- Application Number
- CN202310363995.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-06
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-04-06
AI Technical Summary
Existing subchannel analysis methods have high computational resource requirements and inaccurate physical parameter distribution when simulating transient conditions in nuclear reactor cores, making it difficult to meet the needs of reactor safety analysis.
A finite element method-based analysis method for the core subchannels of a fully coupled nuclear reactor was adopted. By establishing a one-dimensional mesh and a four-equation model for a single-phase subchannel, the model was discretized using the discontinuous Galerkin method and the finite element method. Iterative solutions were obtained by combining automatic difference and preprocessing JFNK methods to obtain the transient distribution of parameters such as temperature and pressure within the reactor core.
It improves the calculation accuracy when simulating transient operating conditions, reduces numerical oscillations, obtains more accurate physical parameter distributions, and provides technical guidance for safe reactor operation and design.
Smart Images

Figure CN116432493B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of method invention technology, specifically relating to a finite element-based method for analyzing the core channels of a fully coupled nuclear reactor, enabling fully coupled analysis of the nuclear reactor core and providing assistance for the safe operation and design of nuclear reactors by obtaining more accurate core physical parameter distributions. Background Technology
[0002] Since the advent of nuclear power technology, reactor thermal-hydraulic safety has been a major concern. Reactor systems are large and complex, and traditional scale-up experimental studies are prohibitively expensive. Therefore, thermal-hydraulic analysis programs have become an irreplaceable tool for nuclear reactor design and optimization. Reactor thermal-hydraulic safety analysis methods typically consider simulations of the entire system at different scales, and are categorized into system analysis, subchannel analysis, and CFD analysis. System analysis considers the entire reactor system but can only perform coarse calculations; CFD analysis can perform detailed simulations but requires significant computational resources; while subchannel analysis, building upon system analysis, considers lateral flow and turbulent mixing between channels, enabling more detailed simulations of the reactor core with relatively lower computational resource requirements, and remains an important method today.
[0003] Currently, numerical reactors have become the most fiercely competitive research field in cutting-edge science among developed nuclear energy nations, and establishing high-fidelity numerical reactor platforms is a consensus among these leading nuclear power countries. While Europe and the United States have taken the lead in numerical reactor projects such as CASL and NEAMS, my country's research on numerical reactors is still in its early stages. Further optimization and expansion of subchannel procedures are crucial for improving nuclear reactor safety analysis and advancing my country's research in numerical reactor technology.
[0004] In conclusion, there is an urgent need for a more advanced subchannel analysis method to better calculate the conditions of nuclear reactor cores under various transient operating conditions and obtain a more accurate distribution of various physical parameters within the reactor, thereby promoting the development of numerical reactor technology in my country. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides a finite element method-based analysis method for sub-channels in a fully coupled nuclear reactor core. The method first establishes a one-dimensional mesh for core sub-channel analysis, with the length and number of axial elements being consistent. Second, it establishes a four-equation model for a single-phase sub-channel, including mass conservation equations, energy conservation equations, axial momentum conservation equations, and transverse momentum conservation equations. Then, it discretizes the four-equation model using the discontinuous Galerkin method and the finite element method, forming a weak form that facilitates iterative solution. Finally, it obtains the Jacobian matrix using an automatic difference method and iteratively solves the four-equation model using a preprocessed JFNK method, yielding the transient distribution of parameters such as temperature, pressure, and flow velocity within the nuclear reactor core. This method enables better calculation of the nuclear reactor core under various transient operating conditions, obtaining a more accurate distribution of various physical parameters within the reactor, thereby providing technical guidance for reactor safe operation and design.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] A method for analyzing core channels of a fully coupled nuclear reactor based on the finite element method, comprising the following steps:
[0008] Step 1: Establish a one-dimensional mesh for core subchannel analysis. For a square assembly with a rod bundle size of n*n, the number of subchannels is (n+1). 2 Correspondingly, (n+1) are established. 2 A one-dimensional mesh with the same length and axial element number;
[0009] Step 2: Establish a four-equation model for a single-phase sub-channel, including the mass conservation equation, energy conservation equation, axial momentum conservation equation, and transverse momentum conservation equation. The four-equation model for a single-phase sub-channel is as follows:
[0010]
[0011] In the formula:
[0012] ρ — Coolant density, kg / m³ 3 ;
[0013] A – Flow area, m 2 ;
[0014] U—Axial velocity, m / s;
[0015] t — time, s;
[0016] z—Axial height, m;
[0017] w—lateral mass velocity, kg / (m·s);
[0018] h—enthalpy value, J / kg;
[0019] q — the amount of heat transferred per unit area of the fuel rod to the coolant, in J / m² 2 w'——turbulent mass flow rate, kg / (m·s);
[0020] h'——Turbulent enthalpy, J / kg;
[0021] G D — Thermal conductivity;
[0022] λ—thermal conductivity, W / (m·K);
[0023] s — gap width, m;
[0024] l — turbulent length, m;
[0025] T – Subchannel coolant temperature, K;
[0026] T n —Coolant temperature of adjacent sub-channels, K;
[0027] p – Pressure, Pa;
[0028] g — acceleration due to gravity;
[0029] θ—Angle between the coolant flow direction and the vertical direction, in rad;
[0030] f—Darcy-Weisbach coefficient of frictional resistance;
[0031] D e —Hydraulic diameter of the sub-channel, in meters;
[0032] f T —Turbulent Motion Factor;
[0033] U' – Lateral flow transmitted by turbulent mixing, m / s;
[0034] —The average flow velocity of the current sub-channel and adjacent sub-channels, in m / s;
[0035] p n —Pressure of adjacent sub-channels, Pa;
[0036] —Average density of the current subchannel and adjacent subchannels, kg / m³ 3 ;
[0037] K G — Crossflow drag coefficient;
[0038] Step 3: Apply the discontinuous Galerkin method to the convection term in the single-phase sub-channel four-equation model, i.e., in equation (1). and Discretize the remaining part of the single-phase sub-channel four-equation model using the finite element method to form a weak form that facilitates iterative solution:
[0039]
[0040] In the formula:
[0041] ψ — Shape function;
[0042] (f,ψ)——The volume integral of function f at the current integration point;
[0043] Step 4: Obtain the Jacobian matrix of the single-phase sub-channel four-equation model using the automatic difference method, and perform a global iterative solution of the single-phase sub-channel four-equation model using the preprocessing PJFNK method to obtain the transient distribution of flow velocity, density, pressure, temperature and enthalpy for each sub-channel.
[0044] The convection terms in the single-phase subchannel four-equation model are discretized using the discontinuous Galerkin method. The discretization method is as follows:
[0045] Step 1: Discretize the one-dimensional mesh into non-overlapping elements. For each element, replace the differentiated physical quantity in the convection term with the numerical flux function, multiply by the basis function, and then calculate its volume integral in the integration domain, as shown in Equation (3):
[0046]
[0047] In the formula:
[0048] f(q) — Numerical flux function;
[0049] φ — basis function on the current cell;
[0050] Ω—the integration domain;
[0051] Step 2: Transform the above volume integral using the integration by parts method, as shown in formula (4):
[0052]
[0053] In the formula:
[0054] x R —The right endpoint of the current cell;
[0055] x L —The left endpoint of the current unit;
[0056] Step 3: In each cell, substitute the numerical flux function of the upwind scheme into the right side of formula (4) to obtain the discrete scheme of the convection term in each cell:
[0057]
[0058] In the formula:
[0059] k — Unit number;
[0060] f k (q) — Numerical flux function on cell k;
[0061] f k-1 (q)——Numerical flux function on cell k-1;
[0062] φ k (x R — The value of the basis function on element k at the right endpoint of the element;
[0063] φ k (x L — The value of the basis function on element k at the left endpoint of the element;
[0064] — Gradient of the basis functions on unit k.
[0065] The specific methods for obtaining the flow velocity, density, and pressure of adjacent sub-channels in the transverse momentum conservation equation are as follows:
[0066] Step 1: Define dynamic arrays `_master_elem_ids` and `_slave_elem_ids` to store the cell IDs of the current sub-channel and adjacent sub-channels, and define dynamic arrays `_master_points` and `_slave_points` to store the center coordinates of the cells of the current sub-channel and adjacent sub-channels. Insert the center coordinates of each cell in the sub-channel sequentially to the end of the dynamic arrays `_master_points` and `_slave_points` using the `push_back` function, thus arranging the center coordinates of the sub-channel cells in `_master_points` and `_slave_points` in order. Define an associative array `_nearest_elem_ids`, and search using the KDtree function. Find the nearest neighboring sub-channel cell center coordinates to the current sub-channel cell center coordinates. That is, search for the nearest element pair in _master_points and _slave_points. After the search is completed, insert the cell IDs corresponding to the two nearest coordinates as key-value pairs into the associative array. Define the getNearestElemID function, which searches for and returns the value corresponding to the key using the find function of the associative array. That is, it returns the nearest neighboring sub-channel cell ID by searching for the current sub-channel cell ID. When the axial cell division method of the current sub-channel and the neighboring sub-channel are completely consistent, the returned value is the neighboring sub-channel cell ID at the same height as the current sub-channel cell. In this way, a one-to-one mapping between the current and neighboring sub-channel cells is established.
[0067] Step 2: Define the variable values to be passed: _vel, _rho, and _p. Define three associative arrays: _adj_vel, _adj_rho, and _adj_p. Use the getElementalValue function and the _current_elem pointer to obtain the values of the three variables in the current sub-channel cell and assign them to _vel, _rho, and _p. Use the getNearestElemID function to obtain the ID of the nearest neighboring sub-channel cell to the current sub-channel cell. Insert the key-value pair consisting of the cell ID of the current sub-channel and the variable value _vel into the associative array _adj_vel. Repeat the same process for the other two associative arrays. Define the getAdjacentX function, which searches for and returns the value corresponding to the key using the find function of the associative array. That is, by inputting the current sub-channel cell ID, it returns the variable value of the cell at the same height in the adjacent sub-channel.
[0068] Step 3: Apply the getAdjacentX function to the transverse momentum conservation equation of the current sub-channel. Obtain the cell ID of the current sub-channel through the _current_elem pointer, and directly call the getAdjacentX function to obtain the flow velocity, density and pressure in the cells at the same height of the adjacent sub-channels. Couple them to the transverse momentum conservation equation to complete the discretization of the equation.
[0069] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0070] 1. The method of this invention discretizes the governing equations using discontinuous Galerkin and finite element methods. Compared with the finite difference method used in common commercial subchannel analysis programs, it can better simulate continuously changing physical fields and effectively reduce numerical oscillations when simulating transient conditions.
[0071] 2. The method of this invention uses the preprocessing PJFNK method to solve the four-equation model in a fully coupled manner. Compared with the pressure gradient method or SIMPLE algorithm used in common commercial subchannel analysis programs, the coupling between the equations is tighter, so the distribution of physical parameters obtained by the solution is more accurate. Attached Figure Description
[0072] Figure 1 This is a flowchart of the finite element method for analyzing the core channels of a fully coupled nuclear reactor, as described in this invention.
[0073] Figure 2 A schematic diagram for establishing the unit mapping between two flow channels.
[0074] Figure 3 This is a diagram illustrating how the passed variable value is bound to the cell ID. Detailed Implementation
[0075] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0076] This invention provides a finite element method for analyzing core channels of a fully coupled nuclear reactor. The specific method is as follows:
[0077] This method first establishes a one-dimensional mesh for core subchannel analysis, with the same length and number of axial elements. Second, it establishes a four-equation model for a single-phase subchannel, including mass conservation equations, energy conservation equations, axial momentum conservation equations, and transverse momentum conservation equations. Then, it discretizes the four-equation model using the discontinuous Galerkin method and the finite element method, forming a weak form that facilitates iterative solution. Finally, it obtains the Jacobian matrix using an automatic difference method and iteratively solves the single-phase subchannel four-equation model using the preprocessed JFNK method, obtaining the transient distribution of parameters such as temperature, pressure, and velocity within the nuclear reactor core.
[0078] like Figure 1 As shown, the finite element method-based analysis method for the core subchannels of a fully coupled nuclear reactor includes the following four steps:
[0079] Step 1: Establish a one-dimensional mesh for core subchannel analysis. For a square assembly with a rod bundle size of n*n, the number of subchannels is (n+1). 2 (n+1) should be established accordingly. 2 A one-dimensional mesh with the same length and axial element number;
[0080] Step 2: Establish a four-equation model for a single-phase sub-channel, including the mass conservation equation, energy conservation equation, axial momentum conservation equation, and transverse momentum conservation equation. The four-equation model for a single-phase sub-channel is as follows:
[0081]
[0082] In the formula:
[0083] ρ — Coolant density, kg / m³ 3 ;
[0084] A – Flow area, m 2 ;
[0085] U—Axial velocity, m / s;
[0086] t — time, s;
[0087] z—Axial height, m;
[0088] w—lateral mass velocity, kg / (m·s);
[0089] h—enthalpy value, J / kg;
[0090] q — the amount of heat transferred per unit area of the fuel rod to the coolant, in J / m² 2 w'——turbulent mass flow rate, kg / (m·s);
[0091] h'——Turbulent enthalpy, J / kg;
[0092] G D — Thermal conductivity;
[0093] λ—thermal conductivity, W / (m·K);
[0094] s — gap width, m;
[0095] l — turbulent length, m;
[0096] T – Subchannel coolant temperature, K;
[0097] Tn —Coolant temperature of adjacent channels, K;
[0098] p – Pressure, Pa;
[0099] g — acceleration due to gravity;
[0100] θ—Angle between the coolant flow direction and the vertical direction, in rad;
[0101] f—Darcy-Weisbach coefficient of frictional resistance;
[0102] D e —Hydraulic diameter of the sub-channel, in meters;
[0103] f T —Turbulent Motion Factor;
[0104] U' – Lateral flow transmitted by turbulent mixing, m / s;
[0105] —The average flow velocity of the current sub-channel and adjacent sub-channels, in m / s;
[0106] p n —Pressure of adjacent channels, Pa;
[0107] —Average density of the current subchannel and adjacent subchannels, kg / m³ 3 ;
[0108] K G — Crossflow drag coefficient;
[0109] Step 3: Discretize the convection terms in the single-phase subchannel four-equation model using the Discontinuous Galerkin Method (DG) and discretize the remaining parts of the single-phase subchannel four-equation model using the Finite Element Method (FEM), forming a weak form that facilitates iterative solution.
[0110]
[0111] In the formula:
[0112] ψ — Shape function;
[0113] (f,ψ)——The volume integral of function f at the current integration point;
[0114] Step 4: Obtain the Jacobian matrix of the four-equation model using the AD (Automatic Differentiation) method. Then, perform an overall iterative solution of the single-phase sub-channel four-equation model using the PJFNK (Preconditioning Jacobian-Free Newton-Krylov) method to obtain the transient distribution of the flow velocity, density, pressure, temperature, and enthalpy parameters of each sub-channel.
[0115] The specific process of discretizing the convection term in the single-phase subchannel four-equation model using the DG method is as follows:
[0116] Step 1: Discretize the one-dimensional mesh into non-overlapping elements. For each element, replace the differentiated physical quantity in the convection term with the numerical flux function, multiply by the basis function, and then calculate its volume integral in the integration domain, as shown in Equation (3):
[0117]
[0118] In the formula:
[0119] f(q) — Numerical flux function;
[0120] φ — basis function on the current cell;
[0121] Ω—the integration domain;
[0122] Step 2: Transform the above volume integral using the integration by parts method, as shown in formula (4):
[0123]
[0124] In the formula:
[0125] x R —The right endpoint of the current cell;
[0126] x L —The left endpoint of the current unit;
[0127] Step 3: In each cell, substitute the numerical flux function of the upwind scheme into the right side of formula (4) to obtain the discrete scheme of the convection term in each cell:
[0128]
[0129] In the formula:
[0130] k — Unit number;
[0131] f k (q) — Numerical flux function on cell k;
[0132] fk-1 (q)——Numerical flux function on cell k-1;
[0133] φ k (x R — The value of the basis function on element k at the right endpoint of the element;
[0134] φ k (x L — The value of the basis function on element k at the left endpoint of the element;
[0135] —The gradient of the basis functions on unit k;
[0136] Considering the simplest two-channel model, the specific methods for obtaining the velocity, density, and pressure of the phase channel in the transverse momentum conservation equation are as follows:
[0137] Step 1: As Figure 2 As shown, dynamic arrays `_master_elem_ids` and `_slave_elem_ids` are defined to store the cell IDs of sub-channel 1 and sub-channel 2, and dynamic arrays `_master_points` and `_slave_points` are defined to store the center coordinates of the cells of sub-channel 1 and sub-channel 2. The center coordinates of each cell in the sub-channel are then sequentially inserted into the end of the dynamic arrays `_master_points` and `_slave_points` using the `push_back` function, thus arranging the center coordinates of the two sub-channel cells sequentially in `_master_points` and `_slave_points`. An associative array `_nearest_elem_ids` is defined, and KDtre is used to... The `e` function searches for the cell center coordinates in sub-channel 2 that are closest to the cell center coordinates in sub-channel 1. Specifically, it searches for the closest element pairs in `_master_points` and `_slave_points`. After the search, the cell IDs corresponding to the two closest coordinates are inserted as key-value pairs into the associative array. The `getNearestElemID` function is defined, which uses the `find` function of the associative array to find and return the value corresponding to the key. Specifically, it searches for the cell ID in sub-channel 1 and returns the cell ID in the nearest sub-channel 2. When the axial cell division methods of the two sub-channels are completely identical, the returned value is the cell ID in sub-channel 2 at the same height as the cell in sub-channel 1. This establishes a one-to-one mapping between the cells of the two sub-channels.
[0138] Step 2: As Figure 3As shown, the variable values to be passed are defined as _vel, _rho, and _p, and three associative arrays _adj_vel, _adj_rho, and _adj_p are defined. The values of the three variables in the cell of subchannel 1 are obtained through the getElementalValue function and the _current_elem pointer, and then assigned to _vel, _rho, and _p. The cell ID in subchannel 2 that is closest to the cell in subchannel 1 is obtained through the getNearestElemID function, and the key-value pair composed of the cell ID in subchannel 1 and the variable value _vel is inserted into the associative array _adj_vel (the other two associative arrays are similar). The getAdjacentX function is defined, which searches for and returns the value corresponding to the key through the find function of the associative array, that is, by inputting the cell ID of subchannel 1, the variable value of the cell at the same height in subchannel 2 is returned.
[0139] Step 3: Apply the getAdjacentX function to the transverse momentum conservation equation of subchannel 1, obtain the cell ID of the current subchannel through the _current_elem pointer, and directly call the getAdjacentX function to obtain the flow velocity, density and pressure in the cell at the same height in subchannel 2, and couple them to the transverse momentum conservation equation to complete the discretization of the equation.
[0140] The above description is a further detailed explanation of the present invention in conjunction with specific preferred embodiments. It should not be considered that the specific embodiments of the present invention are limited to this. For those skilled in the art, several simple deductions or substitutions can be made without departing from the concept of the present invention, and all such deductions or substitutions should be considered to fall within the scope of patent protection determined by the submitted claims.
Claims
1. A method for analyzing core channels of a fully coupled nuclear reactor based on the finite element method, characterized in that: The steps are as follows: Step 1: Establish one-dimensional grid for core sub-channel analysis, the number of sub-channels for a square assembly of n*n rod bundle size is (n+1) 2 (n+1) 2 corresponding to establish (n+1) one-dimensional grid of the same length and axial cell number; Step 2: Establish a four-equation model for a single-phase sub-channel, including the mass conservation equation, energy conservation equation, axial momentum conservation equation, and transverse momentum conservation equation. The four-equation model for a single-phase sub-channel is as follows: Official (1) In the formula: —Coolant density, kg / m³ 3 ; —Flow area, m 2 ; —Axial velocity, m / s; —Time, s; —Axial height, m; — Lateral mass flow rate, kg / (m s); —Enthalpy value, J / kg; —The amount of heat transferred per unit area of the fuel rod to the coolant, in J / m² 2 ; —Turbulent mass flow rate, kg / (m s); —Turbulent enthalpy, J / kg; — Thermal conductivity; Thermal conductivity, W / (m K); — Gap width, in meters; — Turbulent length, m; —Subchannel coolant temperature, K; —Coolant temperature of adjacent sub-channels, K; —Pressure, Pa; —Acceleration due to gravity; —Angle between the coolant flow direction and the vertical direction, in rad; —Darcy-Weisbach coefficient of frictional resistance; —Hydraulic diameter of the sub-channel, in meters; —Turbulent Motion Factor; — Lateral flow transmitted by turbulent mixing, m / s; —The average flow velocity of the current sub-channel and adjacent sub-channels, in m / s; —Pressure of adjacent sub-channels, Pa; —Average density of the current subchannel and adjacent subchannels, kg / m³ 3 ; — Crossflow drag coefficient; Step 3: Apply the discontinuous Galerkin method to the convection term in the single-phase sub-channel four-equation model, i.e., in equation (1). , , and Discretize the remaining part of the single-phase sub-channel four-equation model using the finite element method to form a weak form that facilitates iterative solution: Official (2) In the formula: — Shape function; --function Volume integral at the current integration point; Step 4: Obtain the Jacobian matrix of the single-phase sub-channel four-equation model using the automatic difference method, and perform a global iterative solution of the single-phase sub-channel four-equation model using the preprocessing PJFNK method to obtain the transient distribution of flow velocity, density, pressure, temperature and enthalpy for each sub-channel.
2. The method for analyzing core sub-channels of a fully coupled nuclear reactor based on the finite element method according to claim 1, characterized in that: The convection terms in the single-phase subchannel four-equation model are discretized using the discontinuous Galerkin method. The discretization method is as follows: Step 1: Discretize the one-dimensional mesh into non-overlapping elements. For each element, replace the differentiated physical quantity in the convection term with the numerical flux function, multiply it by the basis function, and then calculate its volume integral in the integration domain, as shown in Equation (3): Official (3) In the formula: —Numerical flux function; —Basis functions on the current cell; —Integral domain; Step 2: Transform the above volume integral using the integration by parts method, as shown in formula (4): Official (4) In the formula: —The right endpoint of the current cell; —The left endpoint of the current unit; Step 3: In each cell, substitute the numerical flux function of the upwind scheme into the right side of formula (4) to obtain the discrete scheme of the convection term in each cell: Official (5) In the formula: —Unit number; —Numerical flux function on cell k; —Numerical flux function on cell k-1; —The value of the basis function on cell k at the right endpoint of the cell; —The value of the basis function on cell k at the left end of the cell; — Gradient of the basis functions on unit k.
3. The method for analyzing core sub-channels of a fully coupled nuclear reactor based on the finite element method according to claim 1, characterized in that: The specific methods for obtaining the flow velocity, density, and pressure of adjacent sub-channels in the transverse momentum conservation equation are as follows: Step 1: Define dynamic arrays `_master_elem_ids` and `_slave_elem_ids` to store the cell IDs of the current sub-channel and adjacent sub-channels, and define dynamic arrays `_master_points` and `_slave_points` to store the center coordinates of the cells of the current sub-channel and adjacent sub-channels. Insert the center coordinates of each cell in the sub-channel sequentially to the end of the dynamic arrays `_master_points` and `_slave_points` using the `push_back` function, thus arranging the center coordinates of the sub-channel cells in `_master_points` and `_slave_points` in order. Define an associative array `_nearest_elem_ids`, and search using the KDtree function. Find the nearest neighboring sub-channel cell center coordinates to the current sub-channel cell center coordinates. That is, search for the nearest element pair in _master_points and _slave_points. After the search is completed, insert the cell IDs corresponding to the two nearest coordinates as key-value pairs into the associative array. Define the getNearestElemID function, which searches for and returns the value corresponding to the key using the find function of the associative array. That is, it returns the nearest neighboring sub-channel cell ID by searching for the current sub-channel cell ID. When the axial cell division method of the current sub-channel and the neighboring sub-channel are completely consistent, the returned value is the neighboring sub-channel cell ID at the same height as the current sub-channel cell. In this way, a one-to-one mapping between the current and neighboring sub-channel cells is established. Step 2: Define the variable values to be passed: _vel, _rho, and _p. Define three associative arrays: _adj_vel, _adj_rho, and _adj_p. Use the getElementalValue function and the _current_elem pointer to obtain the values of the three variables in the current sub-channel cell and assign them to _vel, _rho, and _p. Use the getNearestElemID function to obtain the ID of the nearest neighboring sub-channel cell. Insert the key-value pair consisting of the cell ID of the current sub-channel and the variable value _vel of the neighboring sub-channel into the associative array _adj_vel. Repeat the same process for the other two associative arrays. Define the getAdjacentX function, which searches for and returns the value corresponding to the key using the find function of the associative array. That is, by inputting the current sub-channel cell ID, it returns the variable value of the cell at the same height in the neighboring sub-channel. Step 3: Apply the getAdjacentX function to the transverse momentum conservation equation of the current sub-channel. Obtain the cell ID of the current sub-channel through the _current_elem pointer, and directly call the getAdjacentX function to obtain the flow velocity, density and pressure in the cells at the same height of the adjacent sub-channels. Couple them to the transverse momentum conservation equation to complete the discretization of the equation.
