A method for outputting characteristic fronts of flow fields in OpenFOAM unsteady simulations

CN122549256APending Publication Date: 2026-08-11SHANGHAI JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-09
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

现有技术缺乏批量处理大量时间序列数据的能力,限制了针对特征锋面时空演化过程和规律的分析

Benefits of technology

(1)本发明针对OpenFOAM非稳态数值模拟中任意数量的中间时刻结果,可自动、批量识别与提取指定特征锋面位置及其携带的物理量信息,显著提升关键数据的后处理效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122549256A_ABST
    Figure CN122549256A_ABST
Patent Text Reader

Abstract

This invention discloses a method for outputting characteristic fronts of OpenFOAM unsteady-state simulated flow fields, comprising the following steps: first, setting the working path and time selector, reading the mesh file, and entering a dual time and mesh loop; then, based on user-defined physical criteria or threshold conditions, automatically identifying and extracting the location of the characteristic fronts and the physical quantity information they carry, saving the results in a format easily readable by mainstream data processing software to each time folder, and finally completing the batch extraction of characteristic fronts at all times and indicating that the operation is complete. This invention employs the above-mentioned method for outputting characteristic fronts of OpenFOAM unsteady-state simulated flow fields, which can flexibly adapt to different types of meshes and characteristic fronts, significantly improving the automation, accuracy, and efficiency of characteristic front extraction. Furthermore, the output data can directly support flow field characteristic analysis, combustion characteristic research, and engineering optimization design, and is applicable to CFD simulation post-processing scenarios in multiple fields such as aerospace and energy power.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computational fluid dynamics data post-processing technology, and in particular to a method for outputting characteristic fronts of unsteady flow fields in OpenFOAM simulations. Background Technology

[0002] With the rapid development of computer hardware and software technologies, Computational Fluid Dynamics (CFD) has been widely applied in various fields such as aerospace, weaponry, shipbuilding, energy and power, vehicle transportation, heavy machinery, and electronics. OpenFOAM, as an object-oriented open-source CFD software package, features convenient modular design, powerful multiphysics coupling, flexible code customization, and efficient parallel computing capabilities, and has received widespread attention from academia and industry in recent years. Compared to commonly used commercial CFD software such as ANSYS Fluent, STAR-CD, STAR-CCM+, and CFX, which have closed algorithms and expensive copyrights, OpenFOAM's source code is completely open, requiring no additional software fees. It also supports polyhedral meshes, can handle complex geometric configurations, and possesses powerful simulation and analysis capabilities for flow, combustion, heat transfer, and other multiphysics coupling problems.

[0003] In the flow field of chemical reaction flows, there are usually a variety of characteristic structures with clear physical meanings, which are collections of spatial regions that meet specific conditions. These are key parameters for revealing flow / combustion mechanisms, evaluating engineering performance, and guiding structural design, and are implicit in the rich flow field information. However, in practice, it is difficult to accurately identify these characteristic structures with clear physical meanings but no fixed shape. For example, the flame front is the interface between the combustion reaction zone and the unburned mixture or combustion products, characterizing drastic changes in parameters such as temperature, heat release rate, and chemical reaction rate. Its thickness under normal pressure is usually only on the order of tens to hundreds of micrometers, and it has highly unsteady characteristics, making it difficult to track in real time and dynamically. The shock front is an extremely thin discontinuity formed by the drastic compression of the flow area of ​​supersonic airflow, where gas parameters such as pressure, temperature, and density undergo abrupt changes. Its thickness is usually a few tenths to a few micrometers, and it cannot be directly captured in either experiments or numerical calculations.

[0004] For numerical calculations, after performing unsteady-state chemical reaction flow simulations using OpenFOAM, the characteristic fronts mentioned above are typically extracted by setting isosurfaces in post-processing software. This method relies on manual experience, is cumbersome, and inefficient. When dealing with complex three-dimensional flow fields or involving a large number of intermediate time-series results from unsteady-state simulations, it is difficult to achieve rapid, batch, and efficient extraction of characteristic fronts. For example, if an unsteady-state calculation outputs 1000 time-series data points, the characteristic fronts at each of these 1000 independent time-series data points must be manually identified and extracted. Current technology lacks the ability to process large amounts of time-series data in batches, limiting the analysis of the spatiotemporal evolution and patterns of characteristic fronts.

[0005] Therefore, it is necessary to establish a method for outputting characteristic fronts of unsteady flow fields in OpenFOAM simulations, which can automatically identify and extract the set characteristic fronts in the flow field, improve the accuracy, automation and engineering applicability of characteristic front extraction, and support the visualization and in-depth analysis of flow and combustion problems. Summary of the Invention

[0006] The purpose of this invention is to provide a method for outputting characteristic fronts of flow fields in OpenFOAM unsteady-state simulations. For the large amount of time-series flow field data generated by OpenFOAM unsteady-state numerical simulations, this method can automatically identify and extract characteristic fronts of interest to the user and the physical quantity information they carry. Based on set physical criteria or threshold conditions, it automatically searches, locates, and extracts characteristic structures in the flow field across the entire spatial domain, without relying on manual operation of external visualization software. Furthermore, the results are saved to files in easily readable formats such as CSV and DAT, which are readily readable by commonly used data processing software like Origin, Tecplot, and MATLAB, effectively supporting further flow structure analysis, combustion characteristic studies, and engineering optimization design.

[0007] To achieve the above objectives, this invention provides a method for outputting characteristic fronts of an unsteady flow field in OpenFOAM simulation, comprising the following steps: S1. Set the current working path of OpenFOAM, i.e., the root directory of the instance, connect to the standard time control function of OpenFOAM, add a time selector, and allow users to specify specific time steps; S2. Read the normalized grid file stored discretely in OpenFOAM and create the simulation grid; S3. Enter the time loop and create a local blank file in the current time folder to store the location of the feature front and the physical quantity information it carries at the current moment. S4. Write the time variable name, the location variable name of the feature front to be extracted, and the variable names of other physical quantities of interest on the feature front in the first line of the local blank file. S5. Read the calculation result file stored independently in the current time folder in the form of OpenFOAM standard output file, which contains the calculation results required to extract the location of the characteristic front and the physical quantity information it carries; S6. Enter the grid loop, set physical criteria or threshold conditions through the if function in OpenFOAM, and define local variables that dynamically store the position and physical quantity information of the characteristic front. S7. In the if function, iterate through all grids and determine whether each grid conforms to the definition of a characteristic front. If it does, assign its position and the physical quantity it carries to the local variable. S8. Write the local variables that have been assigned values ​​to the local file in the current time folder, and repeat the process of assigning values ​​to local variables and writing them to the local file until the grid loop is broken. S9. Loop through all time points until exiting the time loop, complete the identification, extraction and output of the characteristic fronts at each time point, print information on the screen, prompt that the operation is complete, and terminate.

[0008] Preferably, S1 is as follows: The time object runTime is constructed by accessing the createTime.H header file. This time object runTime is initialized by parsing the controlDict control dictionary, which controls the simulation time step and determines the various times when the simulation results are output. Adding specific options allows you to specify a particular time. These options include the -constant option, the -latestTime option, the -noZero option, and the -time option. The -constant option includes the constant / directory under the root directory, the -latestTime option is used to specify the final time, the -noZero option is used to exclude time 0, and the -time option, along with a list of times, allows for flexible selection of any specific time.

[0009] Preferably, S2 is as follows: In OpenFOAM, the information carried by the discretely stored normalized mesh file includes node coordinates, mesh cell owner, adjacent mesh cells, mesh face and boundary condition definitions; The created computational grid can be a one-dimensional, two-dimensional, or three-dimensional grid. The one-dimensional grid is a structured grid, while the two-dimensional or three-dimensional grid can be either a structured or unstructured grid. The created computational grid can be either a static grid or a dynamic grid. If the computation uses a static grid, a unique grid is read in at the initial time. If the computation uses a dynamic grid, the grid for the current time is read in each time folder.

[0010] Preferably, in S3, the format of the partially blank file is .dat data format or any other file format can be customized according to user needs; The order of the physical quantities to be extracted on the feature front is not restricted in any way, and different variables can be arbitrarily ordered according to user preferences; There is no limit to the number of time folders used to store intermediate results. The OpenFOAM standard forAll loop is used to read the results sequentially from the initial time to the final time, in ascending order of time. If you are interested in the location of multiple feature fronts and the physical quantity information they carry, the number of local blank files that need to be created is the same as the number of feature fronts of interest, in order to store the extraction results of different feature fronts.

[0011] Preferably, in S4, the characteristic fronts and their variable names of interest in the unsteady supersonic combustion simulation include the three-dimensional coordinates of the flame front x-FS, y-FS, z-FS, and the temperature T-FS, pressure p-FS, and Mach number Ma-FS on the flame front. Define any other characteristic fronts according to user needs and extract any other physical quantity information they carry, or define new variables based on existing output quantities, with variable names separated by spaces; The physical quantities carried by a characteristic front include scalars, vectors, and tensors. Scalars include temperature, pressure, and composition; vectors include velocity and vorticity; and tensors include viscous stress and shear stress. If it is a vector or tensor, then the variable names of its various components are defined.

[0012] Preferably, in S5, the OpenFOAM standard file read / write mechanism IOdictionary class is used for file read and write; for field quantity data already stored in the current time folder, the file is read-only and not written; for new physical field quantities that need to be calculated, the file is written only and not read. According to the order of variables to be extracted on the characteristic front written by S4, read the physical field quantity data in the current time folder or use the field quantity calculation of the OpenFOAM standard to define and calculate new physical field quantities in the current time folder; The number of stored physical field quantities read and the number of intermediate or final field quantities calculated at the current moment are unlimited, and the stored physical field quantities read and the intermediate or final field quantities calculated correspond to the physical quantities on the characteristic fronts of interest to S4. Assuming common read Each moment, every moment If there are equivalent physical scalars, then the total number of files read is × The equivalent physical scalar is denoted as the number of scalar fields plus the number of vector fields multiplied by the number of effective vector field components, plus the number of tensor fields multiplied by the number of effective tensor field components.

[0013] Preferably, in S6, the OpenFOAM standard forAll loop is used to traverse all grid cells according to their unique grid numbers; The if function can have a single condition or multiple conditions. A single condition means that only one physical criterion or threshold condition is set, while multiple conditions mean that multiple independent physical criterions or threshold conditions coexist, and the criterions are related by OR, OR and AND. Create local variables corresponding to S4 to dynamically store the location of the characteristic front and the physical quantity information it carries. The type of local variables is scalar. When the physical quantity of interest is a vector or tensor, define local variables to store each component of the physical quantity of interest respectively.

[0014] Preferably, in S7, the location of a specified feature front and its physical quantity information carried are extracted from the normalized mesh file of OpenFOAM discrete storage according to the set physical criteria or threshold conditions. The physical quantity information to be extracted corresponds to the physical quantity information of interest in S4. At the current moment, all grid cells are traversed using the OpenFOAM standard forAll function; based on the set physical criteria or threshold conditions, the if function is used to determine whether the current grid cell meets the definition of a characteristic front; when the set criteria are met, the values ​​of the local variables defined in S6 are updated to the values ​​corresponding to the current grid cell, including spatial coordinates and the physical quantities of interest. If different types of feature fronts are extracted, physical criteria or threshold conditions need to be defined separately; when extracting each type of feature front, separate if statements should be set, and the position and physical quantity information carried by each feature front should be updated separately. Write the location of the feature front of interest and its physical quantity information in the local file at the current moment; the order of the feature front location and physical quantity written at different times is the same as the order of the variable names to be extracted written in the first line of the local file in S4.

[0015] Preferably, in S8, each time a grid cell that matches the definition of a characteristic front is found, the result is output once in the local blank file at the current moment, and a new blank line is inserted at the same time; the value of the current local variable is released and used to store the relevant information on the next grid cell that matches the definition of a characteristic front; The rule for grid looping is to start from the first grid cell, increment sequentially according to the unique number of each grid cell to the last grid cell, until all grids are traversed, and then exit the current grid loop; at the same time, the identification and extraction of feature fronts in the current time folder ends, and the time loop is used to enter the next moment.

[0016] Preferably, in S9, starting from the initial time, the time is incremented sequentially to the final time until all times are traversed, and the time loop is exited; after printing a prompt message on the screen, the program ends. After the program finishes running, a local data file containing the location of the characteristic front defined in S7 and the physical quantity information it carries is obtained in each time folder.

[0017] Therefore, the present invention employs the above-mentioned method for outputting characteristic fronts of unsteady-state simulated flow fields in OpenFOAM, and the beneficial effects are as follows: (1) This invention can automatically and in batches identify and extract the location of a specified characteristic front and the physical quantity information it carries for any number of intermediate time results in OpenFOAM unsteady numerical simulation, which significantly improves the post-processing efficiency of key data.

[0018] (2) The present invention can flexibly, accurately and efficiently identify and extract the location of any specified characteristic front and the physical quantity information it carries, according to the actual needs of users, and support the dynamic monitoring and real-time analysis of key characteristic fronts.

[0019] (3) The characteristic frontal position and the physical quantity information it carries extracted by the present invention are output in common formats supported by mainstream data processing software such as CSV and DAT, which provides reliable data support for subsequent performance analysis or configuration optimization.

[0020] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0021] Figure 1 This is an overall flowchart of an embodiment of a method for outputting characteristic fronts of an unsteady flow field in OpenFOAM according to the present invention; Figure 2 This is a schematic diagram of the configuration of a model scramjet engine combustion chamber, representing an embodiment of the method for outputting characteristic fronts of an unsteady flow field in OpenFOAM simulation according to the present invention. Figure 3 This is an embodiment of the method for outputting characteristic fronts of unsteady flow field simulation in OpenFOAM, which is a model of the flame front evolution of a scramjet engine combustion chamber colored by temperature. Figure 4 This invention provides a method for outputting characteristic fronts of unsteady flow fields in OpenFOAM simulations, which is an example of the evolution of flame fronts in a model scramjet engine combustion chamber colored with Mach number. Detailed Implementation

[0022] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0023] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0024] This invention addresses the challenges of identifying and extracting arbitrary, custom-defined characteristic fronts and their associated physical quantities from complex three-dimensional flow fields or numerous intermediate time-series results in OpenFOAM simulations of unsteady states. The data is saved in easily readable formats (such as CSV and DAT) within various time-series folders, supporting post-processing of OpenFOAM unsteady numerical simulation results, particularly for monitoring the temporal evolution of characteristic fronts.

[0025] This invention provides a method for outputting characteristic fronts of unsteady flow fields simulated in OpenFOAM. The method is written and compiled into an executable file using the C++ programming language, maintaining consistency with the organizational structure of existing OpenFOAM solvers. Taking an unsteady scramjet engine combustion chamber simulated in OpenFOAM as an example, the method aims to extract flame fronts at different times, including the following steps: S1. Set the current working path of OpenFOAM, i.e., the root directory of the computational instance, connect to the OpenFOAM standard time control functions, add a time selector, and allow users to specify specific time steps. Specifically: By accessing the createTime.H header file, a time object runTime is constructed. This time object runTime is initialized by parsing the controlDict control dictionary, thereby enabling control of the simulation time step (progressing from the initial time to the final time) and determining the various times at which the simulation results are output. Adding specific options allows you to specify a particular time. These options include -constant, -latestTime, -noZero, and -time. The -constant option can include the constant / directory under the root directory, the -latestTime option can be used to specify the final time, the -noZero option can be used to exclude time 0, and the -time option with a list of times can be used to flexibly select any specific time.

[0026] S2. Read the normalized grid file stored discretely in OpenFOAM and create the simulation grid, specifically: In OpenFOAM, the information carried by the discretely stored normalized mesh file includes node coordinates, mesh cell owner, adjacent mesh cells, mesh faces, and boundary condition definitions. It can be generated by the built-in blockMesh tool of OpenFOAM, or it can be imported by third-party software and converted into the OpenFOAM local mesh file format.

[0027] The created computational mesh can be a one-dimensional mesh, a two-dimensional mesh, or a three-dimensional mesh. The one-dimensional mesh is a structured mesh, while the two-dimensional or three-dimensional mesh can be a structured mesh or an unstructured mesh.

[0028] The created computational grid can be a static grid or a dynamic grid. If the computation uses a static grid, that is, the same grid is used at all times, then a unique set of grids is read in at the initial time. If the computation uses a dynamic grid, then the grid for the current time is read in each time folder.

[0029] S3. Enter the time loop and create a local blank file in the current time folder to store the location of the characteristic front extracted at the current moment and the physical quantity information it carries.

[0030] The format of partially blank files is unrestricted; they can be in .dat format for easy reading by common data post-processing software such as Origin and Tecplot; or users can customize the output to any other file format according to their needs.

[0031] The order of the physical quantities to be extracted on the characteristic front is not restricted in any way, and different variables can be arbitrarily ordered according to user preferences; for example, the physical quantity X on the characteristic front can be placed in the first position, or in the second, third, etc.

[0032] There is no limit to the number of time folders used to store intermediate results. The OpenFOAM standard forAll loop is used to read the results sequentially from the initial time to the final time, and the time folders are not required to be distributed at equal intervals.

[0033] If you are interested in the location of multiple feature fronts and the physical quantities they carry, such as flame fronts and shock wave fronts, the number of local blank files that need to be created is the same as the number of feature fronts of interest, in order to store the extraction results of different feature fronts.

[0034] S4. Write the time variable name, the location variable name of the feature front to be extracted, and the variable names of other physical quantities of interest on the feature front in the first line of the local blank file.

[0035] The characteristic fronts and their variable names of interest in unsteady supersonic combustion simulation include the three-dimensional coordinates of the flame front (x-FS, y-FS, z-FS), and the temperature (T-FS), pressure (p-FS), and Mach number (Ma-FS) on the flame front.

[0036] Users can also define any other characteristic fronts according to their needs and extract any other physical quantity information they carry, or define new variables based on existing output quantities, with variable names separated by spaces so that the data post-processing software can accurately identify the different variable names.

[0037] The physical quantities carried by a characteristic front can be scalars, vectors, and tensors. Scalars include temperature, pressure, and composition; vectors include velocity and vorticity; and tensors include viscous stress and shear stress. If it is a vector or tensor, then the variable names of its various components are defined.

[0038] S5. Read the calculation result file stored independently in the current time folder in the form of OpenFOAM standard output file, which is required to extract the location of the characteristic front and carry physical quantity information.

[0039] File reading and writing are performed using the IOdictionary class, the standard file reading and writing mechanism of OpenFOAM. For field quantity data already stored in the current time folder, the file is read-only; for new physical field quantities that need to be calculated, the file is written without reading.

[0040] Following the order of variables to be extracted from the characteristic front written by S4, read the physical field quantity data in the current time folder or use the OpenFOAM standard field quantity calculation to define and calculate new physical field quantities in the current time folder.

[0041] The number of stored physical field quantities read and the number of intermediate or final field quantities calculated at the current moment are unlimited, and the stored physical field quantities read and the intermediate or final field quantities calculated correspond to the physical quantities on the characteristic fronts of interest in S4.

[0042] Assuming common read Each moment, every moment If there are equivalent physical scalars, then the total number of files read is × The equivalent physical scalar is denoted as the number of scalar fields plus the number of vector fields multiplied by the number of effective vector field components (1 for one dimension, 2 for two dimensions, and 3 for three dimensions), plus the number of tensor fields multiplied by the number of effective tensor field components (1 for one dimension, 4 for two dimensions, and 9 for three dimensions).

[0043] S6. Enter the grid loop, set physical criteria or threshold conditions through the if function in OpenFOAM, and define local variables that dynamically store the position and physical quantity information of the characteristic front.

[0044] The number of grid cells is unlimited, and all grid cells are traversed according to their unique grid numbers using the OpenFOAM standard forAll loop. Corresponding to S2, the grid cells can be one-dimensional, two-dimensional, or three-dimensional, structured or unstructured, and static or dynamic. The number and topology of the grid cells can vary at different times.

[0045] The `if` function can have a single condition or multiple conditions. A single condition means setting only one physical criterion or threshold condition, while multiple conditions mean that multiple independent physical criterions or threshold conditions coexist, and the criterions are related by "OR" or "AND". There is no limit to the number of `if` conditions, as long as the logic is consistent.

[0046] Create local variables corresponding to S4 to dynamically store the location of the characteristic front and the physical quantity information it carries. The type of local variables is scalar. When the physical quantity of interest is a vector or tensor, define local variables to store each component of the physical quantity of interest respectively.

[0047] S7. In the if function, iterate through all grids and determine whether each grid conforms to the definition of a characteristic front. If it does, assign its position and the physical quantities it carries to local variables.

[0048] Based on the set physical criteria or threshold conditions, the location of the specified feature front and the physical quantity information it carries are extracted from the normalized mesh file of OpenFOAM discrete storage. The physical quantity information to be extracted corresponds to the physical quantity information of interest in S4.

[0049] At the current moment, all grid cells are traversed using the OpenFOAM standard forAll function; based on the set physical criteria or threshold conditions, the if function is used to determine whether the current grid conforms to the definition of a characteristic front; when the set criteria are met, the values ​​of the local variables defined in S6 are updated to the values ​​corresponding to the current grid cell, including spatial coordinates and the physical quantities of interest.

[0050] If different types of feature fronts are extracted, physical criteria or threshold conditions need to be defined separately; each feature front should be extracted with its own if statement, and the criteria should be independent of each other and not affect each other; and the position and physical quantity information carried by each feature front should be updated separately.

[0051] Write the location of the characteristic front of interest and its associated physical quantity information into the local file at the current moment. To ensure data structure consistency, the order of the characteristic front locations and physical quantities written at different times is the same as the order of the variable names to be extracted written in the first line of the local file in S4.

[0052] S8. Write the assigned local variables to the local file in the current time folder, and repeat the process of assigning local variables and writing them to the local file until the grid loop is exited.

[0053] Each time a grid cell matching the characteristic front definition is found, the result is output once in the local blank file at the current moment, and a new blank line is inserted. The value of the current local variable can be released to store relevant information on the next grid cell matching the characteristic front definition.

[0054] The rule for grid looping is to start from the first grid cell, increment sequentially according to the unique number of each grid cell to the last grid cell, until all grids are traversed, and then exit the current grid loop; at the same time, the identification and extraction of feature fronts in the current time folder ends, and the time loop is used to enter the next moment.

[0055] S9. Loop through all time points until exiting the time loop, complete the identification, extraction and output of the characteristic fronts at each time point, print information on the screen, prompt that the operation is complete, and terminate.

[0056] Starting from the initial moment, the time increments sequentially to the final moment until all moments are traversed, at which point the time loop is exited; after printing a prompt message on the screen, the program terminates; alternatively, specific moments can be identified and extracted based on the steps described in the first step.

[0057] After the program finishes running, a local data file containing the location of the characteristic front defined in S7 and the physical quantities it carries at the current moment is obtained in each time folder. This allows for further analysis of the evolution of various variables over time, monitoring the working status of the actual calculation configuration, or supporting its optimization design.

[0058] After completing unsteady-state numerical simulations using OpenFOAM, users can extract the characteristic fronts of interest and their carried physical quantity information using the method of this invention. Taking the extraction of flame fronts as an example, the flowchart of a method for outputting characteristic fronts of the unsteady-state simulation flow field in an OpenFOAM-simulated scramjet engine combustion chamber with a support plate configuration is as follows: Figure 1 As shown.

[0059] First, switch to the current root directory of the simulation example and read the necessary time control parameters from the system / controlDict file, including the start time (startTime), end time (endTime), time step (timeStep), and the output of the numerical simulation results. Based on these parameters, determine the time step and the list of extraction times for the characteristic fronts, progressing from the initial time to the final time in ascending order.

[0060] Secondly, the discretely stored mesh files conforming to the OpenFOAM specification are read from the root directory of the simulation example. These mainly include the points file containing the coordinate information of all mesh nodes, the owner file containing the owner information of the mesh cells, the neighbor file containing the information of adjacent mesh cells, the faces file containing the information of the mesh facets, and the boundary file containing the information of the mesh boundaries. These files together form the OpenFOAM structured or unstructured mesh, and the spatial association between mesh cells is realized through strict topology sorting rules.

[0061] Next, determine whether the computational grid is static (i.e., the grid does not change over time throughout the entire computation process, and a fixed grid is used at all times) or dynamic (the grid topology or resolution changes at different times). If it is a static grid, it is read in once at the initial time and used at all other times; if it is a dynamic grid, the grid file for the current time is read in before reading the result file for each time.

[0062] Then, enter the time loop. Create a local blank file named FS.dat in the current time folder to store the position and physical quantity information of the flame front extracted from the simulation results at the current moment; write the following variable names in sequence on the first line of the file: time, x-FS, y-FS, T-FS, Ma-FS, which represent time, the three-dimensional x / y / z coordinates of the flame front, and the temperature / pressure / Mach number of the flame front, respectively.

[0063] Next, the physical field quantities used to identify the flame front in the current time folder are read, including scalar, vector, or tensor fields. File reading and writing are accomplished through the OpenFOAM standard file reading and writing mechanism (IOdictionary class).

[0064] Further, the process enters a grid loop, using the standard if function in OpenFOAM to set a threshold for the hydrogen chemical reaction rate as a criterion for flame front identification. When the absolute value of the hydrogen chemical reaction rate on a grid cell is greater than the absolute value of this threshold, the condition for a flame front is considered met. Local variables are defined to dynamically store characteristic front information, including x-FS, y-FS, T-FS, and Ma-FS.

[0065] Within the current time folder, all grid cells are traversed using the standard `forAll` function in OpenFOAM. A threshold for the hydrogen chemical reaction rate, set using an `if` function, is used to determine if each grid cell meets the conditions for a characteristic front. If it does, the current grid cell's position coordinates and the physical quantity information it carries are assigned to previously defined local variables, and these assigned local variables are then written to a blank local file within the current time folder. This process is repeated for all grid cells, assigning values ​​to local variables and writing them to the local file.

[0066] Finally, the standard `forAll` function in OpenFOAM is used to iterate through all time points. During time stepping, all steps—from creating local blank files to iterating through all grids and assigning values, and writing local variables—are repeated continuously in each time folder until the final time point and the program terminates. Note that if a dynamic grid is used, the above steps are repeated starting from reading the grid files in each time folder.

[0067] Example 1: A schematic diagram of the physical problems of the scramjet engine combustion chamber in the support plate configuration model is shown below. Figure 2 The height of the combustion chamber inlet ( Direction) is 50mm, total length ( (Direction) is 340mm. Downstream of the combustion chamber inlet, along... A wedge-shaped support plate, 32mm long and 6mm high, is fixedly placed along the central axis with a diameter of 25mm. The back of the support plate (located at...) =109mm) has a 1mm diameter circular hole for fuel injection. The upper wall of the combustion chamber is self- =100mm and up, with a 3° tilt angle.

[0068] The Mach number of the airflow at the combustion chamber inlet is =2.0, static temperature is =340K, static pressure is =0.1 MPa. Based on mass fraction, the polluted air consists of 73.6% nitrogen, 23.2% oxygen, and 3.2% water vapor. A mixture of hydrogen and ammonia fuel is injected into the combustion chamber at a constant velocity of 1200 m / s, with a fixed static temperature. =250K, static pressure is =0.1MPa. After the fuel is mixed with air, it is forced to ignite, and combustion in a composite mode such as supersonic / subsonic and premixed / diffusion is organized downstream of the support plate.

[0069] The mass fractions of hydrogen and ammonia change linearly with time, and their transient mass fractions at the fuel inlet are as follows: (1); (2); in, For time, This represents the instantaneous hydrogen mass fraction. =0 It is 1.0. Let be the instantaneous ammonia mass fraction, with an initial time of 0.0. Equations (1)–(2) show that within a calculation time of 0 to 10 ms, the hydrogen mass fraction decreases linearly from 1.0 to 0.0, and the ammonia mass fraction increases linearly from 0.0 to 1.0.

[0070] This is a typical dynamic combustion system under complex shock-flame-turbulence interactions, and unsteady-state numerical simulations were conducted using OpenFOAM. The total computation time was 10 ms, and the calculation results were saved every 10 µs, resulting in a total of 1000 time points. A method for outputting characteristic fronts of the OpenFOAM unsteady-state simulated flow field, established in this invention, was used to identify and extract the spatiotemporal evolution data of the hydrogen flame front's position, temperature, and Mach number at different time points in this embodiment.

[0071] Figure 3 In this embodiment, the evolution curves of the hydrogen flame front in the combustion chamber of the model scramjet engine at different times are colored with the temperature at the corresponding time. Figure 4 In this embodiment, the evolution curves of the hydrogen flame front in the combustion chamber of the model scramjet engine at different times are colored with the corresponding Mach number. They clearly demonstrate the complete spatiotemporal evolution of the hydrogen flame front and the physical quantities it carries during this process.

[0072] Therefore, the present invention adopts the above-mentioned method for outputting characteristic fronts of unsteady flow fields in OpenFOAM simulation. For the simulation results of unsteady OpenFOAM, it can automatically, accurately, efficiently and conveniently identify and extract the position of any intermediate time, any characteristic front and the physical quantity information it carries, and save it to a file in a way that is easy to read by commonly used data post-processing software, so as to carry out further visualization and analysis.

[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. A method of outputting a characteristic front of a non-stationary simulated flow field in OpenFOAM, characterized in that, Includes the following steps: S1. Set the current working path of OpenFOAM, i.e., the root directory of the instance, connect to the standard time control function of OpenFOAM, add a time selector, and allow users to specify specific time steps; S2. Read the normalized grid file stored discretely in OpenFOAM and create the simulation grid; S3. Enter the time loop and create a local blank file in the current time folder to store the location of the feature front and the physical quantity information it carries at the current moment. S4. Write the time variable name, the location variable name of the feature front to be extracted, and the variable names of other physical quantities of interest on the feature front in the first line of the local blank file. S5. Read the calculation result file stored independently in the current time folder in the form of OpenFOAM standard output file, which contains the calculation results required to extract the location of the characteristic front and the physical quantity information it carries; S6. Enter the grid loop, set physical criteria or threshold conditions through the if function in OpenFOAM, and define local variables that dynamically store the position and physical quantity information of the characteristic front. S7. In the if function, iterate through all grids and determine whether each grid conforms to the definition of a characteristic front. If it does, assign its position and the physical quantity it carries to the local variable. S8. Write the local variables that have been assigned values ​​to the local file in the current time folder, and repeat the process of assigning values ​​to local variables and writing them to the local file until the grid loop is broken. S9. Loop through all time points until exiting the time loop, complete the identification, extraction and output of the characteristic fronts at each time point, print information on the screen, prompt that the operation is complete, and terminate.

2. The method of outputting a characteristic frontal surface of a non-steady simulation flow field of OpenFOAM according to claim 1, characterized in that, S1 specifically refers to: The time object runTime is constructed by accessing the createTime.H header file. This time object runTime is initialized by parsing the controlDict control dictionary, which controls the simulation time step and determines the various times when the simulation results are output. Adding specific options allows you to specify a particular time. These options include the -constant option, the -latestTime option, the -noZero option, and the -time option. The -constant option includes the constant / directory under the root directory, the -latestTime option is used to specify the final time, the -noZero option is used to exclude time 0, and the -time option, along with a list of times, allows for flexible selection of any specific time.

3. The method of outputting a characteristic frontal surface of a non-steady simulation flow field of OpenFOAM according to claim 2, characterized in that, S2 specifically refers to: In OpenFOAM, the information carried by the discretely stored normalized mesh file includes node coordinates, mesh cell owner, adjacent mesh cells, mesh face and boundary condition definitions; The created computational grid can be a one-dimensional, two-dimensional, or three-dimensional grid. The one-dimensional grid is a structured grid, while the two-dimensional or three-dimensional grid can be either a structured or unstructured grid. The created computational grid can be either a static grid or a dynamic grid. If the computation uses a static grid, a unique grid is read in at the initial time. If the computation uses a dynamic grid, the grid for the current time is read in each time folder.

4. The method for outputting characteristic fronts of an unsteady flow field in OpenFOAM simulation according to claim 3, characterized in that, In S3, partially blank files are in .dat data format or can be output in any other file format according to user needs. The order of the physical quantities to be extracted on the feature front is not restricted in any way, and different variables can be arbitrarily ordered according to user preferences; There is no limit to the number of time folders used to store intermediate results. The OpenFOAM standard forAll loop is used to read the results sequentially from the initial time to the final time, in ascending order of time. If you are interested in the location of multiple feature fronts and the physical quantity information they carry, the number of local blank files that need to be created is the same as the number of feature fronts of interest, in order to store the extraction results of different feature fronts.

5. The method for outputting characteristic fronts of an unsteady flow field in OpenFOAM simulation according to claim 4, characterized in that, In S4, the characteristic fronts and their variable names of interest in the unsteady supersonic combustion simulation include the three-dimensional coordinates of the flame front x-FS, y-FS, z-FS, and the temperature T-FS, pressure p-FS, and Mach number Ma-FS on the flame front. Define any other characteristic fronts according to user needs and extract any other physical quantity information they carry, or define new variables based on existing output quantities, with variable names separated by spaces; The physical quantities carried by a characteristic front include scalars, vectors, and tensors. Scalars include temperature, pressure, and composition; vectors include velocity and vorticity; and tensors include viscous stress and shear stress. If it is a vector or tensor, then the variable names of its various components are defined.

6. The method of outputting a characteristic frontal surface of a non-steady simulation flow field of OpenFOAM according to claim 5, characterized in that, In S5, the IOdictionary class, a standard file read / write mechanism of OpenFOAM, is used for file reading and writing. For field quantity data already stored in the current time folder, the file is read-only and not written. For new physical field quantities that need to be calculated, the file is written but not read. According to the order of variables to be extracted on the characteristic front written by S4, read the physical field quantity data in the current time folder or use the field quantity calculation of the OpenFOAM standard to define and calculate new physical field quantities in the current time folder; The number of stored physical field quantities read and the number of intermediate or final field quantities calculated at the current moment are unlimited, and the stored physical field quantities read and the intermediate or final field quantities calculated correspond to the physical quantities on the characteristic fronts of interest to S4. Assuming common read Each moment, every moment If there are equivalent physical scalars, then the total number of files read is × The equivalent physical scalar is denoted as the number of scalar fields plus the number of vector fields multiplied by the number of effective vector field components, plus the number of tensor fields multiplied by the number of effective tensor field components.

7. The method of outputting a characteristic frontal surface of a non-steady simulation flow field of OpenFOAM according to claim 6, characterized in that, In S6, the OpenFOAM standard forAll loop is used to traverse all grid cells according to their unique grid numbers. The if function can have a single condition or multiple conditions. A single condition means that only one physical criterion or threshold condition is set, while multiple conditions mean that multiple independent physical criterions or threshold conditions coexist, and the criterions are related by OR, OR and AND. Create local variables corresponding to S4 to dynamically store the location of the characteristic front and the physical quantity information it carries. The type of local variables is scalar. When the physical quantity of interest is a vector or tensor, define local variables to store each component of the physical quantity of interest respectively.

8. The method of outputting a characteristic frontal surface of a non-steady simulation flow field of OpenFOAM according to claim 7, characterized in that, In S7, based on the set physical criteria or threshold conditions, the location of the specified feature front and the physical quantity information it carries are extracted from the normalized mesh file of OpenFOAM discrete storage. The physical quantity information to be extracted corresponds to the physical quantity information of interest in S4. At the current moment, all grid cells are traversed using the OpenFOAM standard forAll function; based on the set physical criteria or threshold conditions, the if function is used to determine whether the current grid cell meets the definition of a characteristic front; when the set criteria are met, the values ​​of the local variables defined in S6 are updated to the values ​​corresponding to the current grid cell, including spatial coordinates and the physical quantities of interest. If different types of feature fronts are extracted, physical criteria or threshold conditions need to be defined separately; when extracting each type of feature front, separate if statements should be set, and the position and physical quantity information carried by each feature front should be updated separately. Write the location of the feature front of interest and its physical quantity information in the local file at the current moment; the order of the feature front location and physical quantity written at different times is the same as the order of the variable names to be extracted written in the first line of the local file in S4.

9. A method for outputting characteristic fronts of an unsteady flow field in OpenFOAM simulation according to claim 8, characterized in that, In S8, each time a grid cell that matches the definition of a characteristic front is found, the result is output once in the local blank file at the current moment, and a new blank line is inserted at the same time; the value of the current local variable is released and used to store the relevant information of the next grid cell that matches the definition of a characteristic front; The rule for grid looping is to start from the first grid cell, increment sequentially according to the unique number of each grid cell to the last grid cell, until all grids are traversed, and then exit the current grid loop; at the same time, the identification and extraction of feature fronts in the current time folder ends, and the time loop is used to enter the next moment.

10. The method of outputting a characteristic frontal surface of a non-steady simulation flow field of OpenFOAM according to claim 9, wherein, In S9, starting from the initial time, the time increments sequentially to the final time until all times are traversed, at which point the time loop is exited; after printing a prompt message on the screen, the program terminates. After the program finishes running, a local data file containing the location of the characteristic front defined in S7 and the physical quantity information it carries is obtained in each time folder.