Method for fusing Lagrange particle data in OpenFOAM two-phase flow simulation

Through an automated method, the Lagrangian particle data in OpenFOAM two-phase flow simulation is solved, and the data processing efficiency and analysis capabilities are improved.

CN120217959APending Publication Date: 2025-06-27SHANGHAI JIAOTONG UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510380541.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

After the simulation of two-phase flow or multi-phase flow, the results of the post-processing faces the problems of large data volume, high data discretism and difficulty in data visualization, which affects the analysis of the evolution process of Lagrangian particles and the in-depth study of the problems of two-phase flow or multi-phase flow.

Method used

It provides a method of fusing Lagrangian particle data in OpenFOAM two-phase flow simulation. Through automated steps, it reads and fuses Lagrangian particle variables at multiple intermediate moments to generate a format that is easy to read by common data post-processing software and stores it in a single file.

Benefits of technology

It greatly improves data processing efficiency, supports visualization and in-depth analysis and research of results of two-phase flow or multi-phase flow problems, and simplifies the data post-processing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120217959A_ABST
    Figure CN120217959A_ABST
Patent Text Reader

Abstract

The invention discloses a method for fusing Lagrange particle data in OpenFOAM two-phase flow simulation. The method comprises the following steps: reading an OpenFOAM discrete Euler grid file and creating an example grid; creating a global blank file under the work root directory; a variable name corresponding to the Lagrange particle data to be read by the program is written into the first line of the global blank file; sequentially reading a plurality of Lagrangian variables oriented to particles by OpenFOAM in the time folder; variable names and all Lagrange particle data at the current moment are written into an AllPars.dat file and an InstPars.csv file according to particle index numbers; and traversing all lagrangian particles at all moments, completing data reading, fusion and output, printing information on a screen, prompting that the operation is completed, and ending the operation of the program. According to the method for fusing the Lagrangian particle data in OpenFOAM two-phase flow simulation, the Lagrangian particle variables of all moments in OpenFOAM two-phase flow or multiphase flow simulation results can be efficiently fused and output in a general format, and data visualization and deep analysis are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computational fluid dynamics data post-processing, and more particularly to a method for integrating Lagrangian particle data in OpenFOAM two-phase flow simulation. Background Art

[0002] With the rapid development of computer hardware and software technologies, Computational Fluid Dynamics (CFD) has been widely applied in many fields such as aerospace, ordnance industry, shipbuilding and oceanography, energy and power, vehicle transportation, heavy machinery, electronics and electrical appliances. As an object-oriented open-source CFD software package, OpenFOAM has convenient modular design, powerful multi-physics coupling, flexible code customization and high-efficiency parallel computing capabilities, and has received extensive attention in the academic and industrial circles in recent years. Compared with commonly used commercial CFD software, such as ANSYS Fluent, STAR-CD, STAR-CCM+, CFX, etc., which have closed algorithms and expensive copyrights, the source code of OpenFOAM is completely open and no additional software fees need to be paid. At the same time, it supports polyhedral meshes and can handle complex geometric configurations, and has powerful simulation and analysis capabilities for problems such as flow, combustion, heat transfer, multiphase flow and other various multi-physics couplings.

[0003] Two-phase flow is a flow system composed of two-phase substances (at least one of which is a fluid). If the number of phases of substances in the flow system exceeds two, it is called multiphase flow. Two-phase flow or multiphase flow is a complex flow phenomenon widely existing in nature and engineering fields, such as the drift of rain, snow, clouds and fog in the atmosphere, the circulation of blood in organisms, the movement of sediment in water conservancy projects, the pollution of air by soot in environmental engineering, and the flow and combustion in various liquid fuel power devices (such as internal combustion engines, gas turbines, aeroengines, liquid rocket engines, etc.). High-precision numerical simulation of two-phase flow or multiphase flow is an important aspect of CFD algorithm development and practical applications. Two-phase flow or multiphase flow is usually accompanied by other complex physical-chemical processes, such as atomization, fragmentation, evaporation / condensation, heat transfer of the liquid phase and gas-phase combustion, and fragmentation, melting, gasification, surface oxidation of the solid phase.

[0004] The numerical simulation of two-phase flow or multiphase flow is far more complex than that of single-phase flow. The Euler-Lagrange method is a numerical method for describing two-phase or multiphase flow systems, which can simulate the interaction between discrete phases such as particles, droplets or bubbles and the continuous medium. This method treats the continuous phase (i.e., the fluid phase) from the Eulerian perspective and the discrete phase from the Lagrangian perspective. The Lagrangian method treats the discrete phase as a mass point source for tracking and analysis. It does not rely on the concept of grids in continuous medium calculations, but completes the simulation of discrete terms by calculating the thermodynamic (phase change, heat transfer, etc.) and kinematic (force, displacement, etc.) evolution processes of each particle. The data information carried by Lagrangian particles is usually stored in a dedicated file system oriented to particles, rather than on the spatial Eulerian grid where it is usually located. As the particles evolve continuously, the information they carry also changes accordingly over time.

[0005] For example, in gas-liquid two-phase simulation, in addition to outputting Eulerian field data, OpenFOAM also outputs Lagrangian particle data containing information such as particle position, diameter, temperature, velocity, density, etc. These data are usually stored separately in different time folders in the form of independent files. Suppose 70 Lagrangian particle variables are output at a single moment in a certain calculation and a total of 1000 moments are output, then 70000 independent and scattered OpenFOAM result files will be obtained. In addition, the Lagrangian method usually tracks a large number of particles to improve the simulation accuracy. Suppose 1 million Lagrangian particles are tracked on average at each moment, then the total number of data points is 70×1000×1000000 = 7×10 10 . When carrying out data post-processing and result extraction and analysis, a large number of manual operations or script supports are required at each time step to convert the discrete particle information into a data format that can be directly recognized by common data processing software such as ParaView, Tecplot and Origin, etc. The efficiency is low and it is easy to make mistakes.

[0006] Therefore, after completing the simulation of two-phase flow or multiphase flow in OpenFOAM, the result post-processing faces problems such as large amount of data, high data discreteness, and difficulty in data visualization. This affects the analysis of the Lagrangian particle evolution process and also limits the in-depth research on two-phase flow or multiphase flow problems.

[0007] In view of the above problems, the present invention proposes a method for integrating Lagrangian particle data in OpenFOAM two-phase flow simulation, which can automatically and efficiently integrate any number of Lagrangian variables output on any number of Lagrangian particles and store them in a format that can be easily read by common data post-processing software. It can greatly improve the data processing efficiency, support two-phase flow or multiphase flow problems, especially the result visualization and in-depth analysis research for the discrete Lagrangian particles therein. Summary of the Invention

[0008] The object of the present invention is to provide a method for integrating Lagrangian particle data in OpenFOAM two-phase flow simulation. A one-stop post-processing solution for the results is provided for the large amount of Lagrangian particle data generated by OpenFOAM two-phase or multiphase flow simulation. This solution can efficiently and conveniently integrate any number of Lagrangian variables on any number of Lagrangian particles generated by OpenFOAM two-phase or multiphase flow simulation; extract the specified Lagrangian variables from the simulation results at any number of intermediate times and integrate them in a certain order, and then output them to a single file in a format that is easy to read and visualize by common data post-processing software.

[0009] To achieve the above object, the present invention provides a method for integrating Lagrangian particle data in OpenFOAM two-phase flow simulation, including the following steps:

[0010] S1. Set the current working path of OpenFOAM, that is, the working root directory, read the time parameter control file of the OpenFOAM case, read the discrete Euler grid file of OpenFOAM and create the case grid;

[0011] S2. Create a global blank file in the working root directory to store the Lagrangian particle data integrating the simulation results at each intermediate time;

[0012] S3. Write the variable names corresponding to the Lagrangian particle data to be read by the program on the first line of the global blank file to distinguish different Lagrangian variables;

[0013] S4. Read the multiple Lagrangian variables oriented to particles in OpenFOAM in the time folder in turn, and traverse all the times in the working root directory;

[0014] S5. Create a blank file in each time folder directory to store the Lagrangian particle data results at the current time, and traverse all the times in the working root directory;

[0015] S6. Write the respective Lagrangian particle data corresponding to the variable names to the global blank file in turn according to the unique index number, and traverse all the times in the working root directory;

[0016] S7. Write the variable names and the respective Lagrangian particle data corresponding to the variable names at the current time to the blank files in the respective time folder directories in turn according to the unique index number;

[0017] S8. Traverse all the times and all the Lagrangian particles. After completing data reading, integration, and output, print information on the screen, prompt that the operation is completed, and the program ends running.

[0018] Preferably, in S1, reading the time parameter control file of the OpenFOAM case includes creating a time object runTime through the createTime.H library file and initializing the time object by reading the control dictionary controlDict to control the time step and the output of results;

[0019] Reading the discretized Euler grid files of OpenFOAM includes the points file carrying all grid node coordinate information, the owner file of grid cell owner information, the neighbour file of adjacent grid cell information, the faces file of grid face information, and the boundary file of grid boundary condition information.

[0020] Preferably, before entering S2, it is judged whether the case grid is static or dynamic. If it is a static grid, it is read in at the initial moment. If it is a dynamic grid, the grid at the current moment is read in before reading the result file at each moment.

[0021] Preferably, in S2, a global blank file named AllPars.dat and of the corresponding type is created under the working root directory to store the Lagrangian particle data integrating the simulation results at each intermediate moment.

[0022] Preferably, in S3, the variable forms corresponding to the Lagrangian particle data are scalar, vector, or tensor interpolated in the gas phase. Among them, when the variable form is vector or tensor, the variable names of the respective components corresponding to the Lagrangian particle data are defined respectively.

[0023] Preferably, in S4, according to the order of the written variable names, the Lagrangian particle data in each time folder is read in turn:

[0024] Assume that a total of N f moments are read, and there are N s equivalent Lagrangian particle scalars at each moment. Then the total number of files read is N f ×N s ;

[0025] Among them, the number of equivalent Lagrangian particle scalars = the number of scalars + the number of vectors × the number of effective components + the number of tensors × the number of effective components.

[0026] Preferably, S5 is specifically as follows:

[0027] Traverse all time steps through the standard forAll function in OpenFOAM, and sequentially read the Lagrangian particle variables required in the intermediate results. For each time step entered, create a blank file named InstPars.csv with the specified name and type in the time folder directory to store the Lagrangian particle data results at the current time step. Meanwhile, write the same particle variable names as in the global file to the first row of the InstPars.csv file.

[0028] Preferably, in S6, for each time step, traverse all Lagrangian particles through the standard forAllConstIter function in OpenFOAM. In the AllPars.dat file, write all the Lagrangian particle data corresponding to the variable names in sequence according to the unique particle index number, and traverse all time steps in the working root directory.

[0029] Preferably, in S7, write the variable names to the blank file InstPars.csv in the current time folder, and then write all the Lagrangian particle data corresponding to the variable names at the current time step in sequence according to the unique particle index number.

[0030] Preferably, in S8, when the time step progresses, continuously add the results of the new time step to the AllPars.dat file. Meanwhile, create a new InstPars.csv file in the new time step directory and write the particle data at the current time step until the program ends at the end time step;

[0031] After the program ends, a global file integrating the specified Lagrangian particle data at all time steps is obtained. Assume that the number of particles output at time step j is N j , then the total number of data points contained in this global file is:

[0032] After the program ends, local files integrating the specified Lagrangian particle data at the current time step are obtained in N f time folder directories. Then, in the directory at time step j, the total number of data points contained in this local file is: N t,j = N s ·N j .

[0033] Therefore, the present invention adopts the above method for integrating Lagrangian particle data in OpenFOAM two-phase flow simulation, and the beneficial effects are as follows:

[0034] (1) For the simulation results of two-phase flow or multiphase flow in OpenFOAM, the present invention can automatically read a large amount of transient Lagrangian particle data, such as particle position, diameter, temperature, velocity, density and other information;

[0035] (2) The present invention can efficiently fuse multiple Lagrangian particle variables from different times in a specified order, correlate time and position information, and also support the extraction of full-set or subset data;

[0036] (3) Through standard file reading and writing operations, the present invention realizes the rapid fusion of a large amount of particle data and saves it in a format supported by common data post-processing software for further visualization and analysis.

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

[0038] Figure 1 is the overall flowchart of an embodiment of a method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation of the present invention;

[0039] Figure 2 is a schematic diagram of the physical model of the water droplet / air one-dimensional two-phase shock tube problem in Embodiment 1 of a method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation of the present invention;

[0040] Figure 3 is a spatio-temporal evolution cloud map of the water droplet diameter in the water droplet / air one-dimensional two-phase shock tube in Embodiment 1 of a method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation of the present invention;

[0041] Figure 4 is a spatio-temporal evolution cloud map of the Weber number of water droplets in the water droplet / air one-dimensional two-phase shock tube in Embodiment 1 of a method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation of the present invention;

[0042] Figure 5 is a schematic diagram of the combustion chamber of a scramjet engine with an ethylene fuel model for inhaled water droplets in Embodiment 2 of a method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation of the present invention;

[0043] Figure 6 is the transient spatial distribution of the droplet temperature in the combustion chamber of a scramjet engine in Embodiment 2 of a method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation of the present invention;

[0044] Figure 7 is the transient spatial distribution of the droplet Reynolds number in the combustion chamber of a scramjet engine in Embodiment 2 of a method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation of the present invention. Detailed Embodiments

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

[0046] Unless otherwise defined, technical or scientific terms used in this invention shall have the ordinary meanings as understood by those of ordinary skill in the art to which this invention pertains.

[0047] The present invention proposes a method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation. This method is written and compiled in C++ computer language to generate an executable file, which is consistent with the organizational structure of the existing OpenFOAM solver. After the user completes the numerical simulation of two-phase flow or multiphase flow based on OpenFOAM, the method established by the present invention can be used to fuse and analyze a large amount of transient Lagrangian particle data.

[0048] As Figure 1 shown, taking the simulation result of a two-phase flow composed of a continuous gas phase and discrete liquid droplets as an example, a method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation includes the following steps:

[0049] S1. Set the current working path of OpenFOAM, that is, the working root directory, read the time parameter control file of the OpenFOAM case, and read the discrete Euler grid file of OpenFOAM and create a case grid, which can be structured or unstructured.

[0050] Reading the necessary time parameter control file of the OpenFOAM case includes creating a time object runTime through the createTime.H library file and initializing the time object by reading the control dictionary controlDict, so as to control the time step (advancing from the initial moment to the end moment in increasing order of time) and the output of results (the moments and frequencies at which the results are written).

[0051] Reading the discrete Euler grid file that follows the OpenFOAM specification mainly includes the points file carrying all the grid node coordinate information, the owner file of the grid cell owner information, the neighbour file of the adjacent grid cell information, the faces file of the grid face information, and the boundary file of the grid boundary condition information. These files can be generated by the built-in blockMesh tool of OpenFOAM or imported by third-party software. These files together constitute the OpenFOAM structured or unstructured grid and are topologically sorted according to specific rules.

[0052] The Eulerian grid can be one-dimensional, two-dimensional or three-dimensional. A one-dimensional grid only reads the x coordinate at the center of each grid cell, a two-dimensional grid only reads its x and y coordinates, and a three-dimensional grid reads all its x, y, and z coordinates. The Eulerian grid of the case is read to determine the grid cell to which the Lagrangian particle belongs. After the OpenFOAM 5.x version, the Lagrangian particle position is no longer represented by three-dimensional global vector coordinates of x, y, and z, but by centroid coordinates.

[0053] Before entering S2, it is judged whether the case grid is static (the grid does not change during the calculation, and the same set of grids is shared at all times) or dynamic (the grid topology or resolution used at different times changes). If it is a static grid, it is read in once at the initial moment. If it is a dynamic grid, the grid at the current moment is read in before reading the result file at each moment.

[0054] S2. Create a global blank file named AllPars.dat with the specified name and type in the working root directory to store the Lagrangian particle data of the simulation results at each intermediate moment that are fused in a certain order later.

[0055] The format of the global blank file is not restricted. For example, the.dat data format is convenient for common data post-processing software such as Origin and Tecplot to read. At the same time, it can also be customized into any other file format according to user needs for output.

[0056] The fusion order of the Lagrangian particle data is not restricted by any means, and different variables can be sorted arbitrarily according to user preferences. For example, the variable X can be placed in the first place, the second place, or the last place.

[0057] The number of time folders storing the intermediate results is not restricted. Using the standard forAll loop in OpenFOAM, starting from the initial moment in increasing order of time, read sequentially until the end moment, and it is not required that the time folders are evenly distributed.

[0058] S3. Write the time t and the variable names corresponding to the Lagrangian particle data to be read by the program on the first line of the global blank file to distinguish different Lagrangian variables.

[0059] The variable form corresponding to the Lagrangian particle data can be a scalar (such as diameter, temperature), a vector (position, velocity), or a tensor interpolated in the gas phase (vorticity, stress). Among them, when the variable form is a vector or a tensor, the variable names of each component corresponding to the Lagrangian particle data need to be defined separately.

[0060] Lagrangian particle data and its variable names include the absolute position (spatial coordinates) of the particle at a given time \(x\), \(y\), \(z\), the particle diameter \(d\), the particle temperature \(T\), the particle velocity components \(U_x\), \(U_y\), \(U_z\), the particle density \(\rho\), and the Weber number \(We\), etc.

[0061] It is also possible to select any other existing Lagrangian particle data or define new variables according to user needs. The variable names are separated by spaces so that the data post-processing software can accurately identify different variable names.

[0062] S4. Read multiple Lagrangian variables for particles in OpenFOAM in the time folders in sequence, and traverse all time steps in the working root directory;

[0063] According to the order of the variable names written in S3, read the Lagrangian particle data in each time folder in sequence, or define and calculate new particle variables in each time folder through appropriate field quantity operations in OpenFOAM. There is no limit to the number of Lagrangian particle variables read, as long as they correspond to the aforementioned variable names:

[0064] Assume that a total of \(N\) f time steps are read, and at each time step, there are \(N\) s equivalent Lagrangian particle scalars. Then the total number of files read is \(N\) f \(\times N\) s ;

[0065] Among them, the number of equivalent Lagrangian particle scalars = the number of scalars + the number of vectors \(\times\) the number of effective components (1 for one-dimensional, 2 for two-dimensional, 3 for three-dimensional) + the number of tensors \(\times\) the number of effective components (1 for one-dimensional, 4 for two-dimensional, 9 for three-dimensional).

[0066] The file reading and writing in this step is completed through the IOdictionary class of the standard file reading and writing mechanism in OpenFOAM. For the Lagrangian particle variables already saved in each time folder, the files must be read and not written; for the new variables that need to be calculated, the files are not read but only written.

[0067] S5. Create a blank file in each time folder directory to store the Lagrangian particle data results at the current time step, and traverse all time steps in the working root directory. Specifically:

[0068] Traverse all time steps through the standard forAll function in OpenFOAM, and read the Lagrangian particle variables required in the intermediate results in sequence. Each time a time step is entered, create a blank file named InstPars.csv with the appropriate name and type in the time folder directory. The format of the blank file at each time step is not restricted. For example, the.csv data format is convenient for common data post-processing software such as Origin and Excel to read. It is also possible to customize and output any other file format according to user needs.

[0069] The blank files under each time directory are used to store the Lagrangian particle data results at the current moment, that is, the aforementioned read variables, for storing the Lagrangian particle data results at the current moment. At the same time, the same particle variable names as those in the global file are written at the first line of the InstPars.csv file. After the data is written out, combining these files in chronological order is equivalent to the aforementioned global file.

[0070] S6. At each moment, all Lagrangian particles are traversed through the OpenFOAM standard forAllConstIter function, and specific judgment conditions can be added to filter particles that meet certain characteristics. For example, when only focusing on particles with a diameter greater than 20 μm, an if(d>2×10 -5 ) judgment statement can be added.

[0071] Since the particles are constantly evolving, the Lagrangian particles written into the global file at each moment may have different numbers and index numbers, and various variable information carried by the particles also changes with time.

[0072] Some particles may leave the computational domain, some may merge with each other, and some may evaporate completely, which will cause the number of particles in the computational domain to decrease. While some particles cause the number of particles in the computational domain to increase through atomization and fragmentation.

[0073] Therefore, in the AllPars.dat file, all Lagrangian particle data corresponding to the variable names are written in sequence according to the unique particle index number, traversing all moments under the working root directory.

[0074] S7. In the blank files under each time folder directory in sequence according to the unique index number, write the variable names and the Lagrangian particle data corresponding to the variable names at the current moment. Specifically:

[0075] Write the variable names in the blank file InstPars.csv under the current moment folder. To maintain the consistency of the data structure, the order of the Lagrangian particle variables written out at each moment is the same as the order written out in the global file. Then write all the Lagrangian particle data corresponding to the variable names at the current moment in sequence according to the unique particle index number.

[0076] In the above S6 and S7, the particle position is determined by topology (the grid cell to which the particle belongs, that is, the unique index number) and geometry (the position of the particle in the grid cell, that is, the local coordinates), but the global coordinates are still output for post-processing.

[0077] S8. After traversing all moments and all Lagrangian particles, completing data reading, fusion, and output, print information on the screen to prompt that the operation is completed, and the program ends running.

[0078] As the time steps forward, the results at the new time are continuously added to the AllPars.dat file. Meanwhile, a new InstPars.csv file is created under the new time directory and the particle data at the current time is written into it until the program ends at the end time.

[0079] After the program ends, a global file that combines the specified Lagrangian particle data at all times is obtained. Assuming the number of particles output at time j is N j , then the total number of data points contained in this global file is:

[0080] After the program ends, local files that combine the specified Lagrangian particle data at the current time are obtained under N f time folder directories. Then, in the directory at time j, the total number of data points contained in this local file is: N t,j = N s ·N j .

[0081] The functions and effects of the method of the present invention will be further described below through two specific embodiments. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, rather than limiting the applicable scenarios of the present invention.

[0082] Embodiment 1:

[0083] The schematic diagram of a water droplet / air one-dimensional shock tube is as Figure 2 , with a total length of 1.2 m and both ends open, including a 0.72-m long pure gas phase section and a 0.48-m long gas-liquid two-phase section. The starting point of the gas-liquid two-phase section is denoted as x = 0, and the moment when the shock front enters the two-phase region is denoted as t = 0. A shock wave propagating from left to right enters the computational domain at the left end (x = -0.72 m) and propagates through the pure gas phase section and the gas-liquid two-phase section in sequence until it leaves the right end of the computational domain. The component of the pure gas phase section is air, and the mass fractions of oxygen and nitrogen are 0.233 and 0.767 respectively. The initial temperature and pressure of the gas are 293 K and 0.1 MPa respectively, and the incident shock Mach number is 1.3.

[0084] In the gas-liquid two-phase section, monodisperse water droplets are evenly distributed in the air. The initial diameter of the water droplets is 40 μm, the initial temperature is 293 K, and the initial density is 996.3 kg / m 3 , and the initial specific heat capacity is 4189.9 J / kg / K. The initial number density of the water droplets in the air is 2.98×10 10 / m 3 , and the initial volume fraction is 1.25×10 -4. Before the incident shock wave enters the computational domain, both the gas phase and the liquid phase are in a stationary state. The incident shock wave propagates in the pure gas phase section and reaches a steady state, and then enters the gas-liquid two-phase section and continues to propagate. Under the action of the shock wave, the water droplets accelerate rapidly, move, absorb heat, evaporate, and may be accompanied by fragmentation. This is a typical unsteady gas-liquid two-phase flow problem.

[0085] During the simulation, the calculation data is saved every 1 μs starting from t = 0, and a total of 1050 one-dimensional simulation results at different times are saved. After the calculation is completed in OpenFOAM, the key parameters of the Lagrangian droplets in the one-dimensional pipeline are fused using the method of the present invention. For example, the spatio-temporal evolution of the droplet diameter and the droplet Weber number are shown respectively as Figure 3 and Figure 4 shown. They clearly show the complete spatio-temporal evolution process of the corresponding variables on the Lagrangian particles during this process, and can further analyze the detailed shock wave evolution, droplet dynamics characteristics, and gas-droplet interaction, etc. Since the calculation itself is one-dimensional, the displayed cloud diagram is two-dimensional, that is, the x-t image of the corresponding Lagrangian particle variables (such as d, We).

[0086] It should be noted that even for the relatively simple one-dimensional two-phase flow model problem, its actual process is extremely complex. Mastering the complete spatio-temporal evolution process of the continuous gas phase and discrete droplets in the two-phase flow or multiphase flow simulation in real time is of great significance for understanding the complex two-phase flow or multiphase flow physical process and improving the corresponding application design, and it is also one of the manifestations of the practical value of the method of the present invention.

[0087] Example 2:

[0088] The physical problem of the ethylene fuel model scramjet engine combustion chamber is shown schematically as Figure 5 . The height of the combustion chamber inlet (y direction) is 65 mm, and the total length (x direction) is 1100 mm. The fuel inlet height is 21 mm, and the air inlet height is 38 mm. The two are separated by a solid wall step with a height of 6 mm and a length of 20 mm. The length of the constant cross-section mixing section is 370 mm, and then followed by a combustion section with a single-sided expansion angle of 3.6° until the combustion chamber outlet. The coordinate origin is located at the lower right corner of the combustion chamber inlet. A two-dimensional calculation model is adopted, and the total number of structured grid cells is 6.83 million.

[0089] The partially burned ethylene fuel enters the combustion chamber through the fuel inlet at a supersonic speed of 1.25 Mach, with a fuel static temperature of 1771.9K and a static pressure of 173.1kPa. The fuel components calculated by mass fraction are 60.67% nitrogen, 1.03% oxygen, 15.66% water vapor, 10.59% ethylene, and 12.05% carbon dioxide. The polluted air enters the combustion chamber through the air inlet at a supersonic speed of 2.15 Mach, with a static temperature of 491.9K and a static pressure of 97.7kPa. The air components calculated by mass fraction are 71.5% nitrogen, 23.3% oxygen, and 5.2% water vapor. The air also contains water droplets of the same mass as the water vapor. The initial temperature and diameter of the water droplets are 298.15K and 20μm, respectively, and the initial density and specific heat are 983.51kg / m 3 and 4186J / kg / K.

[0090] After the water droplets enter the combustion chamber with the air, they are affected by complex shock waves, compression waves and expansion waves, as well as high-temperature and high-speed fuel / air shear layers, and move, absorb heat, and evaporate in the combustion chamber. There is a significant dynamic evolution process from the inlet to the outlet. Therefore, this physical model is also a typical two-phase flow problem, and involves features such as supersonic combustion and shock waves. After the calculation converges, there are more than 700,000 Lagrangian particles in the calculation domain, which is a large number. In order to facilitate the display of results and the discovery of laws, this embodiment only exemplarily fuses the Lagrangian particle data at a single moment. Figure 6 The instantaneous temperature distribution on all Lagrangian particles in the computational domain after the calculation converges is given. Figure 7 The corresponding water droplet Reynolds number distribution is given. For ease of observation, only Figure 5 The areas defined by the middle dotted lines clearly show the spatial distribution of Lagrangian particles and the key variable information they carry.

[0091] Therefore, the present invention adopts the above-mentioned method of fusing Lagrangian particle data in OpenFOAM two-phase flow simulation, which can efficiently and conveniently fuse any Lagrangian particle variables at any intermediate time of OpenFOAM two-phase flow or multi-phase flow simulation results, and save them as a single file in a format that is easily readable by common data post-processing software, so as to carry out further visualization and analysis.

[0092] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation, characterized in that: The following steps are involved: S1. Set the current working path of OpenFOAM, i.e. the working root directory, read the time parameter control file of the OpenFOAM example, read the discrete Euler mesh file of OpenFOAM and create the example mesh; S2. Create a global blank file in the working root directory to store the Lagrangian particle data that integrates the simulation results of each intermediate moment; S3. Write the variable name corresponding to the Lagrangian particle data to be read by the program in the first line of the global blank file to distinguish different Lagrangian variables; S4, read multiple Lagrangian variables facing particles in OpenFOAM in the time folder in turn, and traverse all the moments in the working root directory; S5. Create a blank file in each time folder directory to store the Lagrangian particle data results at the current moment, and traverse all moments under the working root directory; S6. Write each Lagrangian particle data corresponding to the variable name into the global blank file in sequence according to the unique index number, and traverse all the moments under the working root directory; S7, writing the variable name and each Lagrangian particle data corresponding to the variable name at the current time into the blank files in the directory of each time folder in turn according to the unique index number; S8. After traversing all the time and all the Lagrangian particles and completing the data reading, fusion and output, the screen prints information and prompts that the operation is completed, and the program ends.

2. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation according to claim 1, characterized in that: In S1, reading the time parameter control file of the OpenFOAM example includes creating the time object runTime through the createTime.H library file and initializing the time object by reading the control dictionary controlDict to control the time step and the output of the results; Reading OpenFOAM discrete Euler mesh files includes points files carrying all mesh node coordinate information, owner files carrying mesh cell owner information, neighbor files carrying adjacent mesh cell information, faces files carrying mesh surface information, and boundary files carrying mesh boundary condition information.

3. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation according to claim 2, characterized in that: Before entering S2, determine whether the case mesh is static or dynamic. If it is a static mesh, read it once at the initial moment. If it is a dynamic mesh, read the mesh at the current moment before reading the result file at each moment.

4. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation according to claim 3, characterized in that: In S2, a global blank file named AllPars.dat is created in the working root directory to store the Lagrangian particle data that integrates the simulation results at each intermediate moment.

5. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation according to claim 4, characterized in that: In S3, the variable form corresponding to the Lagrangian particle data is a scalar, a vector or a tensor of gas phase interpolation, wherein when the variable form is a vector or a tensor, the variable names of the components of the variable corresponding to the Lagrangian particle data are defined respectively.

6. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation according to claim 5, characterized in that: In S4, the Lagrangian particle data in each time folder is read in sequence according to the variable name written: Assume that N f moments, each moment N s equivalent Lagrangian particle scalars, the total number of files read is N f ×N s ; Among them, the equivalent Lagrangian particle scalar number = scalar number + vector number × effective component number + tensor number × effective component number.

7. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation according to claim 6, characterized in that: S5 is as follows: All moments are traversed through the standard forAll function in OpenFOAM, and the required Lagrangian particle variables in the intermediate results are read in turn. Every time a moment is entered, a blank file with the name and type InstPars.csv is created in the time folder directory to store the Lagrangian particle data results of the current moment. At the same time, the particle variable name that is the same as that of the global file is written in the first line of the InstPars.csv file.

8. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation according to claim 7, characterized in that: In S6, all Lagrangian particles are traversed at each moment through the OpenFOAM standard forAllConstIter function. In the AllPars.dat file, all Lagrangian particle data corresponding to the variable name are written in sequence according to the particle unique index number, and all moments under the working root directory are traversed.

9. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation according to claim 8, characterized in that: In S7, the variable name is written into the blank file InstPars.csv in the current folder, and then all the Lagrangian particle data corresponding to the variable name at the current moment are written in sequence according to the particle unique index number.

10. A method for fusing Lagrangian particle data in OpenFOAM two-phase flow simulation according to claim 9, characterized in that: In S8, when time is stepped, the results of the new time are continuously added to the AllPars.dat file, and a new InstPars.csv file is created in the new time directory and the particle data of the current time is written until the program ends at the end time; After the program finishes running, a global file is obtained that integrates the Lagrangian particle data specified at all times. Assume that the number of particles output at time j is N j , then the total number of data points contained in the global file is: After the program finishes running, f The local file that integrates the Lagrangian particle data specified at the current time is obtained in the folder directory of time j. The total number of data points contained in the local file in the directory at time j is: N t,j =N s ·N j .

Citation Information

Cited By

  • Boundary physical quantity calculation method for OpenFOAM unsteady state simulation result

    CN121145734A