Search

CN-122021429-A - OpenFOAM unsteady simulation result boundary surface Euler field data fusion method

CN122021429ACN 122021429 ACN122021429 ACN 122021429ACN-122021429-A

Abstract

The invention discloses a method for fusing OpenFOAM unsteady simulation result boundary surface Euler field data, which comprises the steps of firstly setting an OpenFOAM current working root directory, reading a grid file and creating an example grid, creating a global blank file to store the boundary surface Euler field data, writing variable names in the first row of the global blank file, designating and searching the names of concerned boundary surfaces, sequentially reading a plurality of boundary surface Euler field data in a time folder, sequentially writing all boundary surface Euler field data corresponding to the variable names in the global blank file according to the grid number of the boundary surface, and printing information and prompting operation on a screen until the program finishes running after the data reading, fusing and outputting are completed. The method for fusing the OpenFOAM unsteady simulation result boundary surface Euler field data can efficiently acquire boundary surface physical parameter space-time evolution data, remarkably improves processing efficiency, and provides a one-stop solution for the post-processing of the OpenFOAM unsteady simulation boundary surface data.

Inventors

  • HUANG ZHIWEI
  • ZHANG CHI

Assignees

  • 上海交通大学

Dates

Publication Date
20260512
Application Date
20260128

Claims (9)

  1. 1. The method for fusing OpenFOAM unsteady simulation result boundary surface Euler field data is characterized by comprising the following steps of: S1, setting a current working root directory of OpenFOAM, reading an OpenFOAM discrete grid file and creating an example grid, wherein the example grid is a static grid or a dynamic grid; S2, creating a global blank file under a working root directory, and storing boundary surface Euler field data of the fused simulation results at each intermediate moment; S3, writing variable names corresponding to Euler field data of the boundary surface to be read in the first row of the global blank file, wherein the variable names comprise pressure, temperature and speed The component of direction and the speed are The component of direction and the speed are The directional component, the heat release rate, the component mass fraction and the chemical reaction rate; s4, designating the name of the concerned boundary surface by the character type, and searching the name of the boundary surface in the grid file by using a FINDPATCHID boundary searching function of the OpenFOAM standard; s5, sequentially reading a plurality of boundary surface Euler field data which are independently stored in the time folder in the form of OpenFOAM standard output files, and traversing all moments under the root directory; s6, sequentially writing Euler field data of each boundary surface corresponding to the variable name into the global blank file according to the boundary surface grid number, and traversing all moments under the working root directory; And S7, traversing all the time and all the boundary surface grids, printing information on a screen after finishing data reading, fusion and output, and prompting the completion of operation until the program is finished to run.
  2. 2. The method for fusing OpenFOAM unsteady simulation result boundary surface euler field data according to claim 1, wherein in S1, information carried by OpenFOAM discrete grid files includes node coordinates, grid cell owners, adjacent grid cells, grid planes and boundary condition definitions; The computing grid is a one-dimensional grid, a two-dimensional grid or a three-dimensional grid, the one-dimensional grid is structured, and the two-dimensional grid or the three-dimensional grid is structured or unstructured; If the calculation uses a static grid, a unique set of grids is read in an initial one-time mode, and if the calculation uses a dynamic grid, grids under each time folder are sequentially read according to time.
  3. 3. The method for fusing OpenFOAM unsteady simulation result boundary surface euler field data according to claim 1, wherein in S4, boundary surface names are defined and defined as character types by using label keywords embedded in OpenFOAM, and the concerned boundary surface is positioned by character string matching; Boundary surface names, boundary types, initial grid surface element numbers of boundary surfaces and contained grid surface element numbers defined by grid files are all in constant/polyMesh/boundary files for static grids, and polyMesh/boundary files under the folder of each time for dynamic grids.
  4. 4. The method for fusing OpenFOAM unsteady simulation result boundary surface euler field data according to claim 1, wherein in S4, the boundary surface name defined by the label key is searched and matched in the grid file by using FINDPATCHID boundary search function of the OpenFOAM standard, if the incorrect boundary surface name is defined, the operation is terminated while returning error prompt information.
  5. 5. The method for fusing OpenFOAM unsteady simulation result boundary surface Euler field data as set forth in claim 1, wherein in S5, boundary surface Euler field data under each time folder is sequentially read according to variable name sequence written in S3, new variables are defined and calculated under each time folder through field quantity operation of OpenFOAM standard, and common reading is assumed Each time instant The total number of the read files is that of the equivalent Euler scalar 。
  6. 6. The method for fusing OpenFOAM unsteady state simulation result boundary surface euler field data according to claim 5, wherein in S5, the number of equivalent euler scalars is the number of scalar fields plus the number of vector fields times the number of vector field effective components, plus the number of tensor fields times the number of tensor field effective components; The vector field effective component number of the one-dimensional grid is 1, the vector field effective component number of the two-dimensional grid is 2, the vector field effective component number of the three-dimensional grid is 3, the tensor field effective component number of the one-dimensional grid is 1, the tensor field effective component number of the two-dimensional grid is 4, and the tensor field effective component number of the three-dimensional grid is 9.
  7. 7. The method for fusing OpenFOAM unsteady simulation result boundary surface Euler field data according to claim 6, wherein in S5, file reading and writing is completed through a file reading and writing mechanism IOdictionary of an OpenFOAM standard, files are not required to be read and written for Euler field amounts stored in folders in each time, and files are not required to be read and written for new field amounts required to be calculated.
  8. 8. The method for fusing OpenFOAM unsteady simulation result boundary surface Euler field data as defined in claim 1, wherein in S6, all grid surface elements contained on the boundary surface of interest are circularly traversed at forAll for each moment; For static grids, the data written into the global file at each moment has the same organization structure, all the moments are sequentially written into the field values of all grid cells according to the fixed field values and the grid cell numbering sequence, and for dynamic grids, the data written into the global file at each moment has different grid structures.
  9. 9. The method for fusing OpenFOAM unsteady simulation result boundary surface Euler field data as claimed in claim 1, wherein in S7, a result is output once every time of circulation, and a next blank new line is inserted; after the program is run, a global data file containing Euler field data of a specific boundary surface at each moment is obtained, and the assumption is that The number of grid surface elements written at the moment is The global data file contains the total number of data points 。

Description

OpenFOAM unsteady simulation result boundary surface Euler field data fusion method Technical Field The invention relates to the technical field of post-processing of computational fluid dynamics data, in particular to a method for fusing OpenFOAM unsteady simulation result boundary surface Euler field data. Background With the rapid development of computer hardware and software technology, computational fluid dynamics (CFD: computational Fluid Dynamics) has been widely used in various fields such as aerospace, weapon industry, marine, energy power, vehicle traffic, reworking machinery, electronic and electric appliances, etc. OpenFOAM, an object-oriented open source CFD software package, has a convenient modular design, a strong multi-physical field coupling, flexible code customization and efficient parallel computing capability, and has recently received extensive attention from academia and industry. Compared with common CFD commercial software such as ANSYS Fluent, STAR-CD, STAR-CCM+, CFX and the like, the algorithm is closed, the copyright is expensive, the OpenFOAM source code is completely opened, and additional software cost is not required to be paid. Meanwhile, the device supports a polyhedral grid, can process complex geometric configuration, and has strong simulation and analysis capability aiming at the problems of flow, combustion, heat transfer and other various multi-physical field coupling. In CFD simulation, the boundary surface is the interface where the fluid system exchanges mass, momentum, or energy with the external environment or internal structure. All internal flow phenomena and their driving mechanisms are affected by boundary conditions. Physical parameters at the boundary surface (e.g., pressure, temperature, velocity, wall shear, component concentration, turbulence characteristics parameters, etc.) can be used to understand overall system behavior, verify design goals, and evaluate engineering feasibility. For example, in the aspects of aircraft wing mechanical property evaluation and load analysis, pressure distribution is an important data source for calculating wing lift force and differential pressure resistance, and is important for aircraft stability and aerodynamic control. Wall shear stress is an important influencing factor for boundary layer development, and wall friction resistance can be directly obtained by integrating the wall shear stress. In the aspects of heat transfer analysis and thermal management, the wall temperature directly reflects the thermal state of the component and is a direct index for judging whether the allowable temperature of the material is exceeded and evaluating the cooling effect, and the wall heat flux density is a core parameter for evaluating the heat exchange efficiency. In order to monitor the dynamic evolution process of important parameters on a boundary surface in the calculation process, a large number of intermediate time results often need to be saved when the OpenFOAM is used for carrying out unsteady state calculation. A typical OpenFOAM post-processing flow is to manually locate and select a target boundary surface using a visualization tool such as ParaView, and then sample or derive data for a single or multiple time steps. If the time sequence evolution of a certain parameter is required to be studied, repeated manual operation is required to be carried out on hundreds or even thousands of catalogues at different moments, and finally, a script is written by oneself to splice and fuse the data scattered in each time folder according to the variable sequence. OpenFOAM is relatively weak in data post-processing, and for certain research problems, a user is often required to develop appropriate post-processing code, and the application range is often limited. For example, in modeling complex unsteady gas phase combustion problems, openFOAM will obtain a large amount of euler field data including pressure, temperature, velocity, heat release rate, mass fraction of components, and chemical reaction rate, among others. These results are typically stored in separate files scattered under different time folders. Assuming that a single time is calculated to output 100 euler field variables for a total of 1000 times, 100000 independent and decentralized OpenFOAM standard output files will be obtained. When carrying out data post-processing and result extraction analysis, a specific boundary surface at each moment needs to be manually selected, the efficiency is low, misoperation is easy to generate, and analysis on the time evolution process of key variables on the boundary surface is limited. Therefore, there is a need for a post-processing tool that can automatically and massively extract euler field data on a boundary surface from OpenFOAM simulation results according to user specific requirements and integrate and output the data in time sequence. Disclosure of Invention The invention aims to provide a method for fusing Euler fi