A method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-02
- Publication Date
- 2026-08-14
AI Technical Summary
[0009]因此,在开展数据后处理及结果分析时,需对大量中间时刻的大量颗粒进行手动操作,效率低下且计算量巨大;难以实现对颗粒质量、动量及热量特征响应时间的自动、统一计算
(1)本发明针对OpenFOAM两相模拟产生的任意多个中间时刻、任意多个Lagrangian颗粒,自动、高效、便捷计算每个颗粒的质量、动量及热量特征响应时间,大幅提升数据后处理效率。
Smart Images

Figure CN122572099A_ABST
Abstract
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 calculating the characteristic response time of particles in OpenFOAM two-phase simulation. 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 various complex two-phase flow simulation problems, such as gas / liquid, gas / solid, liquid / solid mixed flows, and droplet spray combustion, there is generally an exchange of mass, momentum, and energy between discrete phase particles and the continuous phase medium. The characteristic response time of particles is typically used to quickly assess their response rate to external flow and mechanical / thermal environments under specific conditions. For the Eulerian-Lagrangian method in OpenFOAM, the Lagrangian discrete phase will be collectively referred to as particles, and only when the particles are evaporable will they be called droplets. Representative particle characteristic response times include mass, momentum, and thermal characteristic response times (mass characteristic response time is only meaningful for evaporable droplets).
[0004] The mass characteristic response time describes the time required for a droplet to completely evaporate from its initial diameter under ideal conditions of constant temperature, constant pressure, and a static gas phase (evaporation is dominated by diffusion). The mass characteristic response time can be estimated using the following formula: (1); In the formula, The density of the liquid phase is... Where is the droplet diameter, denoted as , where is the mass diffusion coefficient of the vapor after droplet evaporation in the gas phase. The saturated vapor concentration is the concentration at the surface of the droplet. It is an important parameter reflecting the strength of the droplet phase transition and mass transfer process.
[0005] The momentum characteristic response time describes the particle Reynolds number ( The time required for a particle's velocity to rise from rest to reach the gas phase velocity under conditions where the velocity is much less than 1. The momentum (velocity) characteristic response time can be estimated using the following formula: (2); In the formula, The viscosity is that of the gas phase; It directly affects the trajectory and distribution characteristics of particles.
[0006] The thermal characteristic response time describes the time required for a particle's temperature to reach the gas phase temperature under conditions where the particle's Reynolds number is much less than 1, the particle's interior remains in temperature equilibrium, and radiation is negligible. The thermal characteristic response time can be estimated using the following formula: (3); In the formula, Let be the specific heat capacity of the particulate phase. is the thermal conductivity of the continuous phase. It is the timescale that reflects the granular phase reaching thermal equilibrium with the continuous phase after being heated or cooled by the continuous phase. Although the above formula is in The derivation under the given conditions shows that their numerical changes are small at higher particle Reynolds numbers, and therefore they are considered applicable.
[0007] When simulating two-phase flow problems using the Eulerian-Lagrangian method in OpenFOAM, it is usually necessary to dynamically track a large number of unsteady Lagrangian particles in the flow field in order to accurately simulate the statistical behavior of the particles and the mass, momentum, and energy exchange between the continuous and discrete phases. For standard two-phase solvers in OpenFOAM, such as sprayFoam and reactingParcelFoam, a typical simulation example can track millions or even tens of millions of particles in the flow field in real time. However, the variables on the Lagrangian particles output by default in OpenFOAM are extremely limited. In particular, the response times of the three typical particle characteristics mentioned above are not directly output, but need to be manually calculated according to formulas (1)–(3). Even some quantities on the particles used in the formula, including , , , OpenFOAM does not output these intermediate values by default. These intermediate values also need to be calculated according to their respective definitions, which greatly complicates the calculation of particle feature response time.
[0008] Furthermore, for unsteady two-phase flow problems, it is usually necessary to track and analyze a large number of particles from intermediate time-series simulations, and the relevant information of the particles is scattered and stored in various time folders. For example, in a certain calculation, an average of five million Lagrangian particles are output at each time step, for a total of 2000 time steps. In formulas (1)–(3), calculating the three characteristic response times of the particles requires at least seven other variables on the particles, so the total amount of data that needs to be read and manipulated is at least [amount missing]. The amount of data is enormous, not even taking into account the additional data reading, computation, and storage introduced by calculating these seven other variables.
[0009] Therefore, when conducting data post-processing and result analysis, it is necessary to manually operate on a large number of particles at a large number of intermediate moments, which is inefficient and computationally intensive; it is difficult to achieve automatic and unified calculation of particle mass, momentum and thermal characteristics response time.
[0010] Therefore, there is an urgent need to establish a method for calculating the characteristic response time of particles in OpenFOAM two-phase simulations. For any number of intermediate times and any number of Lagrangian particles, the method should calculate the characteristic response time of mass, momentum, and heat on each particle and save the results as a Lagrangian particle field quantity file in the OpenFOAM standard to support further data post-processing and result analysis. Summary of the Invention
[0011] The purpose of this invention is to provide a method for calculating the characteristic response time of particles in OpenFOAM two-phase simulations. This method automatically, efficiently, and conveniently reads specified particle field quantities and calculates their mass characteristic response time, momentum characteristic response time, and thermal characteristic response time for a large number of intermediate time results and a large number of Lagrangian particles in OpenFOAM two-phase simulations. The calculation results are output in the OpenFOAM standard particle scalar field format, facilitating further data post-processing, result visualization, and statistical analysis, providing reliable data support for spray dynamics, two-phase flow mechanism research, and model verification.
[0012] To achieve the above objectives, this invention provides a method for calculating the characteristic response time of particles in an OpenFOAM two-phase simulation, comprising the following steps: S1. Set the current root directory of the OpenFOAM instance, access the OpenFOAM standard time control function, and add a time selector; S2. Read the normalized grid file stored discretely in OpenFOAM and create the simulation grid; S3. For the two-phase chemical reaction flow simulation of spray combustion, the name of the Lagrangian particle cloud is defined as reactingCloud, its type is a string constant variable, and the variable name is the generic cloudName; S4. Enter the time loop, read multiple time folders under the root directory of the example using the setTime member function of runTime, and process them one by one in time order; S5. In the current time folder, create an object instance of passiveParticleCloud. The motion of all particles in this passiveParticleCloud is obtained by interpolating the flow field velocity at their location. S6. Define a local integer variable np, and use the myCloud.size() function to get the number of Lagrangian particles contained in the passive particle cloud under the current time folder and assign it to the variable np; S7. Using a standard IOField class instance, create three scalar fields timeMass, timeMom, and timeThermo on the Lagrangian particles to store the mass, momentum, and thermal characteristic response times of all particles, respectively. S8. Using a standard IOField class instance, read other scalar fields on the Lagrangian particles required to calculate the characteristic response time, including rhoLiq, d, difLiq, Csw, muGas, CpLiq, and kappaGas. S9. Calculate the characteristic response time using the OpenFOAM standard field quantity operation, assign the values to the three scalar fields timeMass, timeMom, and timeThermo respectively, and save them to a file; S10. Iterate through all time folders in chronological order until the final time, then exit the time loop, print information on the screen, indicate that the operation is complete, and announce that the program has ended.
[0013] Preferably, in S1, the time object runTime is constructed by accessing the createTime.H header file. This time object 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 specifies the final time, the -noZero option excludes time 0, and the -time option, along with a list of times, allows for flexible selection of any specific time.
[0014] Preferably, in S2, the information carried by the discretely stored mesh file in OpenFOAM includes node coordinates, mesh cell owner, adjacent mesh cells, mesh surfaces, and boundary condition definitions; The created simulation mesh can be a one-dimensional, two-dimensional, or three-dimensional mesh. The one-dimensional mesh is a structured mesh, while the two-dimensional or three-dimensional mesh can be either a structured or unstructured mesh. The calculation grid can be either static or dynamic. If a static grid is used, a single set of grids is read in at the beginning. If a dynamic grid is used, the grid for the current time is read in each time folder.
[0015] Preferably, in S3, a constant variable cloudName of type string is declared using a const word to store the name of the Lagrangian particulate cloud; In OpenFOAM's Lagrangian framework, each particle set is abstracted as a cloud object, and the particle sets include solid particles, aerosols, droplets, and bubbles. reactingCloud is the specific string assigned, corresponding to the instance name of the reactingCloud class or its derived classes; for two-phase chemical reaction flows of spray combustion, particles are managed and searched in the object registry through reactingCloud.
[0016] Preferably, in S4, runTime is an object of the Time class, which is responsible for managing simulation time. Simulation time includes physical time, time step index, and time folder. `setTime` is a member function of the `Time` class that sets the current time of `runTime` to the name of the specified time step and updates the index of the internal time step. Use timeDirs as the parameter of the setTime function. timeDirs is a fileNameList containing the names of all time folders in the root directory of the instance, and iterates through the index of the time step in the current root directory of the instance using the integer variable timeI.
[0017] Preferably, in S5, the passive particle cloud is a class in the Lagrangian module of OpenFOAM, used to manage passive particles that do not participate in the flow field solution. The object instance of passiveParticleCloud is named myCloud. When reading, calculating or storing Lagrangian particle field data, the physical field quantities on the particles are registered to this object instance. The current computational grid is linked using the mesh parameter, providing spatial topology information for particle positioning and motion; the Lagrangian particle cloud name reactingCloud defined in S3 is invoked via cloudName.
[0018] Preferably, in S6, the data type of variable np is specified as integer type using the label keyword, and the passive granular cloud object defined in S5 is accessed through myCloud; The myCloud.size() function is a member function of the container in OpenFOAM, which returns the number of elements, i.e., particles, in the container.
[0019] Preferably, in S7, IOField is used. <scalar>The timeMass class instance creates a scalar field timeMass on all Lagrangian granules and registers it with the myCloud instance object in S5; pass <scalar>Declare timeMass as a scalar field. Each element of the scalar field timeMass corresponds to a scalar value, but is not bound to a specific grid position. The size of this scalar field timeMass is the same as the number of particles np read by S6 at the current time. If you need to define a vector field, declare IOField as <vector>The creation of timeMom and timeThermo follows the exact same specification as timeMass; for scalar fields on these three Lagrangian particles, the file is written only and not read.
[0020] Preferably, in S8, the other scalar fields on the Lagrangian particles are calculated according to formulas (1)–(3), namely, particle density rhoLiq, particle diameter d, vapor mass diffusion coefficient difLiq, saturated vapor concentration Csw, gas phase viscosity muGas, particle specific heat CpLiq, and gas phase thermal conductivity kappaGas: (1); (2); (3); in, For quality characteristic response time, The density of the liquid phase is... Where is the droplet diameter, denoted as , where is the mass diffusion coefficient of the vapor after droplet evaporation in the gas phase. The saturated vapor concentration at the droplet surface; The momentum characteristic response time, The viscosity is that of the gas phase; The thermal characteristic response time, Let be the specific heat capacity of the particulate phase. is the thermal conductivity of the continuous phase.
[0021] Preferably, in S9, according to formulas (1)–(3), the field quantity calculation of the OpenFOAM standard is used to calculate the mass, momentum and thermal characteristic response time of all particles respectively, and the calculated results are assigned to the three scalar fields timeMass, timeMom and timeThermo created in S7 in turn. Call the OpenFOAM standard write() function to save the calculation results to a file in the format of a Lagrangian particle scalar field.
[0022] Therefore, the present invention employs the above-mentioned method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation, and the beneficial effects are as follows: (1) This invention automatically, efficiently and conveniently calculates the mass, momentum and thermal characteristic response time of each particle for any number of intermediate moments and any number of Lagrangian particles generated by OpenFOAM two-phase simulation, greatly improving the efficiency of data post-processing.
[0023] (2) The calculation results of this invention are saved to a file in the standard Lagrangian particle scalar field format in OpenFOAM, which can be used for further data analysis and result visualization, providing standardized data support for studying the spatiotemporal evolution of the entire life cycle of Lagrangian particles.
[0024] (3) This invention provides a post-processing paradigm for extracting a wider range of Lagrangian particle scalar or vector field data, and provides a methodological basis for spray dynamics mechanism research, two-phase flow design and optimization, and numerical model development and verification.
[0025] 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
[0026] Figure 1 This is an overall flowchart of an embodiment of a method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation according to the present invention; Figure 2 This is a schematic diagram of an ethylene fuel scramjet combustion chamber with water droplets inhaled, according to an embodiment of the method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation of the present invention. Figure 3 This is an embodiment of the method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation according to the present invention, showing the mass characteristic response time distribution of water droplets; Figure 4 This is an embodiment of the method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation according to the present invention, showing the momentum characteristic response time distribution of water droplets; Figure 5 This is an embodiment of the method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation according to the present invention, which shows the thermal characteristic response time distribution of water droplets. Detailed Implementation
[0027] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0028] 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.
[0029] This invention proposes a method for calculating the characteristic response time of particles in OpenFOAM two-phase simulations. This 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 OpenFOAM simulations of unsteady continuous gas / discrete liquid two-phase flow and combustion numerical simulations as examples, the main steps include: S1. Set the current root directory of the OpenFOAM test case (i.e., the test case root directory), connect to the OpenFOAM standard time control functions, add a time selector, and allow users to specify specific time steps.
[0030] In this step, a time object `runTime` is constructed by accessing the `createTime.H` header file. This time object is initialized by parsing the `controlDict` dictionary, which allows for precise control of the simulation time step (progressing from the initial moment to the final moment) and determination of the various moments at which the simulation results are output.
[0031] 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, can be used to flexibly select any specific time.
[0032] S2. Read the normalized grid file stored discretely in OpenFOAM and create a simulation grid, which can be a structured or unstructured grid, or a static or dynamic grid.
[0033] In OpenFOAM, discretely stored mesh files carry information including node coordinates, mesh cell owners, adjacent mesh cells, mesh faces, and boundary condition definitions. They can be generated by OpenFOAM's built-in blockMesh tool or imported by third-party software and converted into OpenFOAM's local mesh file format.
[0034] The created simulation 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 either a structured mesh or an unstructured mesh.
[0035] The computational grid can be a static grid or a dynamic grid. If the computation uses a static grid (the same grid is used at all times), then a unique set of grids is read in at the beginning. If the computation uses a dynamic grid, then the grid for the current time is read in each time folder.
[0036] S3. For two-phase chemical reaction flow simulations such as spray combustion, the name of the Lagrangian particle cloud is defined as reactingCloud, and its type is a string constant variable with the variable name being the generic cloudName.
[0037] In this step, a constant variable cloudName of type string is declared using const word to store the name of the Lagrangian granular cloud.
[0038] In OpenFOAM's Lagrangian framework, each particle set is abstracted as a cloud object, and particle sets include solid particles, aerosols, droplets, and bubbles.
[0039] reactingCloud is the specific string to be assigned, usually corresponding to the instance name of the reactingCloud class or its derived classes; for two-phase chemical reaction flows such as spray combustion, particles need to be managed and searched in the object registry through reactingCloud, such as time step iteration, reading, writing or coupling calculation.
[0040] The string `reactingCloud` is merely an example and must match the name passed to the solver when creating the cloud instance. This name must be unique within the scope of the current algorithm to avoid conflicts with other clouds (such as `basicCloud`, `sprayCloud`, etc.).
[0041] S4. Enter the time loop, read multiple time folders under the root directory of the example using the setTime member function of runTime, and further process them one by one in chronological order.
[0042] Among them, runTime is an object of the Time class, which is responsible for managing simulation time, including physical time, time step index, and time folder, etc.
[0043] `setTime` is a member function of the `Time` class that sets the current time of `runTime` to the specified time step name (e.g., 0.5s) and updates the index of the internal time step.
[0044] Use timeDirs as the parameter of the setTime function. timeDirs is a fileNameList that contains the names of all time folders in the root directory of the instance (such as 0, 0.1, 0.2, etc.). Iterate through the index of the time step in the current instance root directory using the integer variable timeI.
[0045] S5. In the current time folder, create an instance of the passive particle cloud object. The motion of all particles in the passive particle cloud is obtained by interpolation of the flow field velocity at their location.
[0046] PassiveParticleCloud is a class in the Lagrangian module of OpenFOAM used to manage passive particles that do not participate in the flow field solution. Particles defined by passiveParticleCloud do not interact with the flow field, that is, there is no exchange of mass, momentum and energy between the two phases, and it is only used to track particle motion or for visualization.
[0047] The object instance of the passive particle cloud is named myCloud. When reading, calculating or storing Lagrangian particle field data, the physical field quantities on the particles must be registered with this object instance to ensure that only the Lagrangian particle field data is accessed without affecting the gas phase flow field.
[0048] The current computational grid (usually an fvMesh object) is linked using the mesh parameter, providing spatial topology information for particle localization and motion; the Lagrangian particle cloud name reactingCloud defined in S3 is invoked via cloudName.
[0049] S6. Define a local integer variable np, and use the myCloud.size() function to get the number of Lagrangian particles contained in the passive particle cloud in the current time folder and assign it to the variable np.
[0050] Specifically, the data type of the variable np is specified as an integer using the label keyword, and the passive granular cloud object defined in S5 is accessed through myCloud.
[0051] The myCloud.size() function is a member function of containers (such as cloud) in OpenFOAM, which returns the number of elements, i.e., particles, in the container.
[0052] S7. Using a standard IOField class instance, create three scalar fields timeMass, timeMom, and timeThermo on the Lagrangian particles to store the mass, momentum, and thermal characteristic response times of all particles, respectively.
[0053] Specifically through IOField <scalar>An instance of the timeMass class creates a scalar field timeMass on all Lagrangian granules and registers it with the myCloud instance object in S5. IOField is part of the Input / Output system in OpenFOAM, specifically designed for processing scalar data that is independent of grid topology.
[0054] pass <scalar>Declare timeMass as a scalar field. Each element of the scalar field timeMass corresponds to a scalar value (i.e., the mass characteristic response time of each droplet), but is not bound to a specific grid location. The size of this scalar field timeMass is the same as the number of particles np read by S6 at the current moment.
[0055] If you need to define a vector field, declare IOField as <vector>The creation of timeMom and timeThermo follows the exact same specification as timeMass; for scalar fields on these three Lagrangian particles, the file is written only and not read.
[0056] Whether all three scalar fields need to be created can be determined based on actual needs. For example, in a two-phase flow problem involving solid particles, there is no evaporation, and the mass characteristic response time is meaningless; therefore, there is no need to create the timeMass scalar field.
[0057] S8. Using a standard IOField class instance, read other scalar fields on the Lagrangian particles required to calculate the characteristic response time, including rhoLiq, d, difLiq, Csw, muGas, CpLiq, and kappaGas.
[0058] The three characteristic response times are calculated using formulas (1)–(3) and the other seven scalar fields on the Lagrangian particles, namely particle density rhoLiq, particle diameter d, vapor mass diffusion coefficient difLiq, saturated vapor concentration Csw, gas phase viscosity muGas, particle specific heat CpLiq, and gas phase thermal conductivity kappaGas. (1); (2); (3); in, For quality characteristic response time, The density of the liquid phase is... Where is the droplet diameter, denoted as , where is the mass diffusion coefficient of the vapor after droplet evaporation in the gas phase. The saturated vapor concentration at the droplet surface; The momentum characteristic response time, The viscosity is that of the gas phase; The thermal characteristic response time, Let be the specific heat capacity of the particulate phase. is the thermal conductivity of the continuous phase.
[0059] Since all seven physical quantities on the Lagrangian particles to be read are scalar fields, IOField will still be used. <scalar>This is a declaration. These seven scalar fields are read-only and not write-only; the order and number of reads (not limited to seven) are not restricted in any way.
[0060] S9. Calculate the characteristic response time using the OpenFOAM standard field quantity operation, assign the values to the three scalar fields timeMass, timeMom, and timeThermo respectively, and save them to a file.
[0061] Specifically, according to formulas (1)–(3), the field quantity calculations of the OpenFOAM standard are used to calculate the mass, momentum and thermal characteristic response times of all particles respectively, and the calculated results are assigned to the three scalar fields timeMass, timeMom and timeThermo created by S7 in sequence.
[0062] The OpenFOAM standard write() function is called to automatically save the calculation results to a file in the format of a Lagrangian particle scalar field.
[0063] These three characteristic response time files have the exact same organizational structure as other OpenFOAM default output particle scalar field files.
[0064] S10. Iterate through all time folders in chronological order until the final time, then exit the time loop, print information on the screen, indicate that the operation is complete, and announce that the program has ended.
[0065] Specifically, after calculating and outputting the response times of the three features at the current moment, it automatically enters the time folder of the next moment and repeats the operations from S4 to S9, traversing all moments in the root directory of the current example in chronological order.
[0066] After completing the calculations and output for the final moment, the program exits the time loop. It prints a completion message to the screen, terminates the program, and releases memory. The program obtains the mass, momentum, and thermal characteristic response time scalar fields for all Lagrangian particles in each time folder, supporting further data processing and analysis.
[0067] After completing numerical simulations of two-phase flow problems using OpenFOAM, users can utilize the method established in this invention for calculating the characteristic response time of particles in OpenFOAM two-phase simulations. This method automatically calculates and outputs the mass, momentum, and thermal characteristic response times of Lagrangian particles. The flowchart of this invention's method for calculating the characteristic response time of particles in OpenFOAM two-phase simulations is as follows: Figure 1 .
[0068] Step 1: 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 time of the numerical simulation results.
[0069] Step 2: Read the discretized mesh files in the root directory of the example, which conform to the OpenFOAM specification. 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.
[0070] Step 3: 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 step.
[0071] Step 4: Declare a string-type constant variable cloudName to store the name of the Lagrangian particulate cloud, reactingCloud (taking the gas-liquid two-phase spray combustion simulation problem as an example).
[0072] Step 5: Enter the time loop. Read the current time folder and create a passive particle cloud object instance. Define an integer variable `np` for the current time to store the number of Lagrangian particles at that moment.
[0073] Step 6: Create a Lagrangian particle scalar field to store the response times of all droplet mass, momentum, and thermal characteristics, and read the other Lagrangian particle scalar fields needed to calculate these three characteristic response times.
[0074] Step 7: According to the definitions of the three characteristic response times, use the field quantity calculation of the OpenFOAM standard to calculate the mass, momentum and thermal characteristic response times of all Lagrangian particles and save them to a file.
[0075] Finally, iterate through all time points in the root directory of the example until the final time point, then exit the time loop. Print a message on the screen indicating that the operation is complete, and the program terminates.
[0076] Example 1: A two-dimensional schematic diagram of the scramjet combustion chamber of a flat-plate configuration and ethylene fuel model is shown below. Figure 2 As shown. The combustion chamber inlet is 65 mm high and 1100 mm long. The mixing section is 370 mm long (i.e., 0–370 mm), followed by an expansion section at 3.6° on the upper wall of the combustion chamber until the outlet. The air and fuel inlets are 38 mm and 21 mm high, respectively, separated by a wall step 6 mm high and 20 mm long.
[0077] Supersonic air enters the combustion chamber at Mach 2.15 parallel to its length, with a static temperature and static pressure of 491.9 Kelvin and 97.7 kPa, respectively. The air is heated by an upstream hydrogen combustion heater, and oxygen is added to ensure the oxygen mass fraction in the heated air is the same as that in the atmosphere. By mass fraction, the air composition is 71.5% nitrogen, 23.3% oxygen, and 5.2% water vapor. Supersonic fuel enters the combustion chamber at Mach 1.25 parallel to the air, with a static temperature and static pressure of 1771.9 Kelvin and 173.1 kPa, respectively. The fuel is a partially combusted kerosene / air mixture, with a mass fraction composition of 60.67% nitrogen, 1.03% oxygen, 15.66% water vapor, 10.59% ethylene, and 12.05% carbon dioxide.
[0078] At the air inlet, water droplets enter the combustion chamber at the same velocity, simulating the intake of raindrops by a scramjet engine during flight. The water droplets have an initial temperature of 298.15 Kelvin, an initial diameter of 8 micrometers, and a mass flow rate twice that of water vapor in the air inlet.
[0079] The computational domain was discretized using 6.83 million structured hexahedral meshes. The minimum mesh lengths in the longitudinal and vertical directions were 62.5 μm and 50 μm, respectively. The maximum CFL (Courant-Friedrichs-Lewy) number did not exceed 0.1, corresponding to a physical time step of approximately 8 nanoseconds. A simplified mechanism of 10 components and 10 reaction steps for ethylene was used in the calculations.
[0080] This is a typical gas-liquid two-phase flow and combustion problem, and water droplets have significant evaporation characteristics. The method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation established in this invention can be used to calculate the mass, momentum and thermal characteristic response time of water droplets in the combustion chamber, so as to quickly evaluate the impact of water droplet intake on combustion chamber ignition and flame stability. Figure 3 The mass characteristic response time distribution of the water droplet. Figure 4 The momentum characteristic response time distribution of the water droplet. Figure 5 The thermal characteristic response time distribution of the water droplets. For ease of observation, Figure 3 – Figure 5 Only displayed Figure 1 The area defined by the dashed box. The total number of water droplets at this instant is 1,353,135.
[0081] In summary, this invention can automatically, efficiently, and conveniently calculate and output the mass, momentum, and thermal response times of any number of intermediate moments and any number of Lagrangian particles, based on the Eulerian-Lagrangian method, for numerical simulation results commonly used in OpenFOAM, such as sprayFoam and reactingParcelFoam. This provides reliable data support for the study of spray dynamics mechanisms, two-phase flow design and optimization, and the development and verification of numerical models.
[0082] Therefore, this invention employs the aforementioned method for calculating the characteristic response time of particles in OpenFOAM two-phase simulations. For any number of Lagrangian particles at any given time point in the two-phase simulation, it automatically, efficiently, and conveniently calculates the characteristic response times of particle mass, momentum, and heat. The results are saved to a file in the OpenFOAM standard Lagrangian particle scalar field format. Further data post-processing, result visualization, and statistical analysis can be performed, providing crucial time-scale data support for scientific and engineering applications in evaporative cooling, spray combustion, and two-phase flow mechanisms.
[0083] 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.< / scalar> < / vector> < / scalar> < / scalar> < / vector> < / scalar> < / scalar>
Claims
1. A method for calculating the characteristic response time of particles in an OpenFOAM two-phase simulation, characterized in that, Includes the following steps: S1. Set the current root directory of the OpenFOAM instance, access the OpenFOAM standard time control function, and add a time selector; S2. Read the normalized grid file stored discretely in OpenFOAM and create the simulation grid; S3. For the two-phase chemical reaction flow simulation of spray combustion, the name of the Lagrangian particle cloud is defined as reactingCloud, its type is a string constant variable, and the variable name is the generic cloudName; S4. Enter the time loop, read multiple time folders under the root directory of the example using the setTime member function of runTime, and process them one by one in time order; S5. In the current time folder, create an object instance of passiveParticleCloud. The motion of all particles in this passiveParticleCloud is obtained by interpolating the flow field velocity at their location. S6. Define a local integer variable np, and use the myCloud.size() function to get the number of Lagrangian particles contained in the passive particle cloud under the current time folder and assign it to the variable np; S7. Using a standard IOField class instance, create three scalar fields timeMass, timeMom, and timeThermo on the Lagrangian particles to store the mass, momentum, and thermal characteristic response times of all particles, respectively. S8. Using a standard IOField class instance, read other scalar fields on the Lagrangian particles required to calculate the characteristic response time, including rhoLiq, d, difLiq, Csw, muGas, CpLiq, and kappaGas. S9. Calculate the characteristic response time using the OpenFOAM standard field quantity operation, assign the values to the three scalar fields timeMass, timeMom, and timeThermo respectively, and save them to a file; S10. Iterate through all time folders in chronological order until the final time, then exit the time loop, print information on the screen, indicate that the operation is complete, and announce that the program has ended.
2. The method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation according to claim 1, characterized in that, In S1, the time object runTime is constructed by accessing the createTime.H header file. This time object 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 specifies the final time, the -noZero option excludes time 0, and the -time option, along with a list of times, allows for flexible selection of any specific time.
3. The method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation according to claim 2, characterized in that, In S2, the information carried by the discretely stored mesh files in OpenFOAM includes node coordinates, mesh cell owners, adjacent mesh cells, mesh surfaces, and boundary condition definitions. The created simulation mesh can be a one-dimensional, two-dimensional, or three-dimensional mesh. The one-dimensional mesh is a structured mesh, while the two-dimensional or three-dimensional mesh can be either a structured or unstructured mesh. The calculation grid can be either static or dynamic. If a static grid is used, a single set of grids is read in at the beginning. If a dynamic grid is used, the grid for the current time is read in each time folder.
4. The method for calculating the characteristic response time of particles in OpenFOAM two-phase simulation according to claim 3, characterized in that, In S3, a constant variable cloudName of type string is declared using a const word to store the name of the Lagrangian granular cloud; In OpenFOAM's Lagrangian framework, each particle set is abstracted as a cloud object, and the particle sets include solid particles, aerosols, droplets, and bubbles. reactingCloud is the specific string assigned, corresponding to the instance name of the reactingCloud class or its derived classes; for two-phase chemical reaction flows of spray combustion, particles are managed and searched in the object registry through reactingCloud.
5. The method for calculating the characteristic response time of particles in an OpenFOAM two-phase simulation according to claim 4, characterized in that, In S4, runtime is an object of the time class, which is responsible for managing simulation time. Simulation time includes physical time, time step index, and time folder. `setTime` is a member function of the `Time` class that sets the current time of `runTime` to the name of the specified time step and updates the index of the internal time step. Use timeDirs as the parameter of the setTime function. timeDirs is a fileNameList containing the names of all time folders in the root directory of the instance, and iterates through the index of the time step in the current root directory of the instance using the integer variable timeI.
6. The method for calculating the characteristic response time of particles in an OpenFOAM two-phase simulation according to claim 5, characterized in that, In S5, passiveParticleCloud is a class in the Lagrangian module of OpenFOAM used to manage passive particles that do not participate in the flow field solution. The object instance of passiveParticleCloud is named myCloud. When reading, calculating or storing Lagrangian particle field data, the physical field quantities on the particles are registered to this object instance. The current computational grid is linked using the mesh parameter, providing spatial topology information for particle positioning and motion; the Lagrangian particle cloud name reactingCloud defined in S3 is invoked via cloudName.
7. The method for calculating the characteristic response time of particles in an OpenFOAM two-phase simulation according to claim 6, characterized in that, In S6, the data type of variable np is specified as integer type using the label keyword, and the passive granular cloud object defined in S5 is accessed through myCloud; The myCloud.size() function is a member function of the container in OpenFOAM, which returns the number of elements, i.e., particles, in the container.
8. The method for calculating the characteristic response time of particles in an OpenFOAM two-phase simulation according to claim 7, characterized in that, In S7, through IOField <scalar>The timeMass class instance creates a scalar field timeMass on all Lagrangian granules and registers it with the myCloud instance object in S5;< / scalar> pass <scalar> Declare timeMass as a scalar field. Each element of the scalar field timeMass corresponds to a scalar value, but is not bound to a specific grid position. The size of this scalar field timeMass is the same as the number of particles np read by S6 at the current time.< / scalar> If you need to define a vector field, declare IOField as <vector> The creation of timeMom and timeThermo follows the exact same specification as timeMass; for scalar fields on these three Lagrangian particles, the file is written only and not read.< / vector> 9. The method for calculating the characteristic response time of particles in an OpenFOAM two-phase simulation according to claim 8, characterized in that, In S8, the other scalar fields on the Lagrangian particles are calculated according to formulas (1)–(3), namely, particle density rhoLiq, particle diameter d, vapor mass diffusion coefficient difLiq, saturated vapor concentration Csw, gas phase viscosity muGas, particle specific heat CpLiq, and gas phase thermal conductivity kappaGas: (1); (2); (3); in, For quality characteristic response time, The density of the liquid phase is... Where is the droplet diameter, denoted as , where is the mass diffusion coefficient of the vapor after droplet evaporation in the gas phase. The saturated vapor concentration at the droplet surface; The momentum characteristic response time, The viscosity is that of the gas phase; The thermal characteristic response time, Let be the specific heat capacity of the particulate phase. is the thermal conductivity of the continuous phase.
10. The method for calculating the characteristic response time of particles in an OpenFOAM two-phase simulation according to claim 9, characterized in that, In S9, according to formulas (1)–(3), the field quantity calculation of the OpenFOAM standard is used to calculate the mass, momentum and thermal characteristic response time of all particles respectively, and the calculated results are assigned to the three scalar fields timeMass, timeMom and timeThermo created in S7 in turn. Call the OpenFOAM standard write() function to save the calculation results to a file in the format of a Lagrangian particle scalar field.