CN115268937A - Multi-phase flow field initialization method, device, equipment and medium - Google Patents

Multi-phase flow field initialization method, device, equipment and medium Download PDF

Info

Publication number
CN115268937A
CN115268937A CN202211179288.4A CN202211179288A CN115268937A CN 115268937 A CN115268937 A CN 115268937A CN 202211179288 A CN202211179288 A CN 202211179288A CN 115268937 A CN115268937 A CN 115268937A
Authority
CN
China
Prior art keywords
target
multiphase flow
flow field
link library
dynamic link
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211179288.4A
Other languages
Chinese (zh)
Other versions
CN115268937B (en
Inventor
张伦
王建涛
牟斌
蒋浩
向栋
张健
李明
王子维
郭永恒
刘钒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Computational Aerodynamics Institute of China Aerodynamics Research and Development Center
Original Assignee
Computational Aerodynamics Institute of China Aerodynamics Research and Development Center
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Computational Aerodynamics Institute of China Aerodynamics Research and Development Center filed Critical Computational Aerodynamics Institute of China Aerodynamics Research and Development Center
Priority to CN202211179288.4A priority Critical patent/CN115268937B/en
Publication of CN115268937A publication Critical patent/CN115268937A/en
Application granted granted Critical
Publication of CN115268937B publication Critical patent/CN115268937B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a method, a device, equipment and a medium for initializing a multiphase flow field, and relates to the technical field of multiphase flow numerical simulation. The method comprises the following steps: acquiring a target initialization function source code corresponding to the initialization requirement of the target multiphase flow field through a main program of numerical simulation software and a preset interactive interface of a dynamic link library; compiling the target initialization function source code by using a preset compiler based on the operating system operated by the numerical simulation software to obtain a target dynamic link library corresponding to the target initialization function source code, and then adding the information of the target dynamic link library in a configuration parameter file of a main program of the numerical simulation software; and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and initializing the target multiphase flow field based on the information of the target dynamic link library in the configuration parameter file. Through the scheme, the initialization of the multiphase flow field can be more flexible and efficient.

Description

Multiphase flow field initialization method, device, equipment and medium
Technical Field
The invention relates to the technical field of multiphase flow numerical simulation, in particular to a method, a device, equipment and a medium for initializing a multiphase flow field.
Background
Multiphase flow is an important branch of the field of fluid mechanics, and the term "phase" generally refers to the thermodynamic state of matter, generally divided into solid, liquid and gas phases. Compared with the single-phase flow problem, because multi-phase flow involves the combined action among multiple phases, the simulation complexity and the calculation difficulty of the multi-phase flow are extremely high, and the initialization of a multi-phase flow field is more complicated, which is a problem to be solved firstly. For single-phase streaming problems, the global domain is usually uniformly initialized directly using uniform incoming streams, and developers need only write a single function to cover almost all initialization possibilities. However, the initial field of the multiphase flow problem generally has the non-uniform characteristics of components and flow field parameters, and generally needs to be individually treated according to specific problems. Because developers cannot exhaust all possibilities in software, and users are strictly prohibited from accessing and modifying the main program source code, in order to ensure the security of the source code and give users enough freedom to implement the initialization process for different multiphase flow problems, the following two strategies are generally adopted at present: the interpretation method is complex in realization and needs to write an interpreter manually by interpreting sentences input by a user one by one to realize corresponding functions, and meanwhile, the efficiency is greatly influenced for a calculation-intensive program such as computational fluid mechanics due to high interpretation time complexity; the compiling method is divided into a static link library and a dynamic link library, wherein the static link library and an implicit dynamic link library are required to be completed in the compiling and linking stage, and a compiling system compiles and links according to a header file and a library file of the dynamic library, namely the library is required to be added into the project of an application program, so that a called function prototype and an address are determined. For the static library, recompilation is required for each modification, which brings great inconvenience to the use of users. In conclusion, how to perform initialization of the multiphase flow field more flexibly and efficiently needs to be further solved.
Disclosure of Invention
In view of this, the present invention provides a method, an apparatus, a device and a medium for initializing a multiphase flow field, which are more flexible and efficient in initializing the multiphase flow field. The specific scheme is as follows:
in a first aspect, the present application discloses a method for initializing a multiphase flow field, comprising:
acquiring a target initialization function source code corresponding to the initialization requirement of the target multiphase flow field through a main program of numerical simulation software and a preset interactive interface of a dynamic link library;
compiling the target initialization function source code by using a preset compiler based on an operating system operated by the numerical simulation software to obtain a target dynamic link library corresponding to the target initialization function source code, and then adding information of the target dynamic link library into a configuration parameter file of a main program of the numerical simulation software;
and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and initializing the target multiphase flow field based on the information of the target dynamic link library in the configuration parameter file.
Optionally, before the obtaining of the source code of the target initialization function corresponding to the initialization requirement of the target multiphase flow field through the main program of the numerical simulation software and the preset interactive interface of the dynamic link library, the method further includes:
and calling a corresponding system function based on an operating system environment operated by the numerical simulation software to construct a preset interactive interface of a main program of the numerical simulation software and a dynamic link library.
Optionally, before the obtaining of the target initialization function source code corresponding to the initialization requirement of the target multiphase flow field through the main program of the numerical simulation software and the preset interactive interface of the dynamic link library, the method further includes:
and determining a corresponding target initialization function source code according to the initialization requirement of the target multiphase flow field.
Optionally, the determining a corresponding target initialization function source code according to the initialization requirement of the target multiphase flow field includes:
determining a target calculation domain, a target phase and a target area corresponding to a target in a target multiphase flow field according to the initialization requirement of the target multiphase flow field;
and determining a corresponding target initialization function source code according to the target calculation domain, the target phase and the target area corresponding to the target.
Optionally, the adding the information of the target dynamic link library in the configuration parameter file of the main program of the numerical simulation software includes:
adding path information and name information of the target dynamic link library in a configuration parameter file of a main program of the numerical simulation software;
correspondingly, the obtaining of the operation instruction of the multiphase flow solver of the numerical simulation software and the initializing of the target multiphase flow field based on the information of the target dynamic link library in the configuration parameter file include:
and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and initializing the target multiphase flow field based on the path information and the name information of the target dynamic link library in the configuration parameter file.
Optionally, the obtaining an operation instruction of a multiphase flow solver of the numerical simulation software, and initializing the target multiphase flow field based on the path information and the name information of the target dynamic link library in the configuration parameter file include:
and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and calling the target dynamic link library based on the path information and the name information of the target dynamic link library in the configuration parameter file so as to initialize the target multiphase flow field.
Optionally, the operating system running based on the numerical simulation software compiles the source code of the target initialization function by using a preset compiler to obtain a target dynamic link library corresponding to the source code of the target initialization function, and includes:
and if the operating system operated by the numerical simulation software is Linux, compiling the source code of the target initialization function by using a GCC compiler to obtain a target dynamic link library corresponding to the source code of the target initialization function.
In a second aspect, the present application discloses a multiphase flow field initialization apparatus, comprising:
the source code acquisition module is used for acquiring a target initialization function source code corresponding to the initialization requirement of the target multiphase flow field through a main program of the numerical simulation software and a preset interactive interface of the dynamic link library;
a source code compiling module, configured to compile the target initialization function source code by using a preset compiler based on an operating system in which the numerical simulation software operates, obtain a target dynamic link library corresponding to the target initialization function source code, and then add information of the target dynamic link library to a configuration parameter file of a main program of the numerical simulation software;
and the flow field initialization module is used for acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software and initializing the target multiphase flow field based on the information of the target dynamic link library in the configuration parameter file.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the steps of the multiphase flow field initialization method disclosed in the foregoing disclosure.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the steps of the multiphase flow field initialization method disclosed in the foregoing disclosure.
When the multi-phase flow field is initialized, a target initialization function source code corresponding to the initialization requirement of a target multi-phase flow field is obtained through a main program of numerical simulation software and a preset interactive interface of a dynamic link library, an operating system running based on the numerical simulation software utilizes a preset compiler to compile the target initialization function source code and obtain a target dynamic link library corresponding to the target initialization function source code, then information of the target dynamic link library is added into a configuration parameter file of the main program of the numerical simulation software, finally an operation instruction of a multi-phase flow solving program of the numerical simulation software is obtained, and the target multi-phase flow field is initialized based on the information of the target dynamic link library in the configuration parameter file. Therefore, when the multi-phase flow field is initialized, firstly, a target initialization function code corresponding to an initialization requirement of a target multi-phase flow field is obtained through an interactive interface of a main program and a dynamic link library, a preset compiler is further utilized to compile a target initialization function source code so as to obtain a target dynamic link library corresponding to the target initialization function source code, information of the target dynamic link library is added into a configuration parameter file of the main program of the numerical simulation software, and when the multi-phase flow solving program of the numerical simulation software is obtained and executed, the target multi-phase flow field is initialized based on the information of the target dynamic link library. Therefore, when the multi-phase flow field is initialized, the target initialization function source code is compiled into the target dynamic link library through the preset compiler, the explicit dynamic link library is adopted, the operation system function can realize the operations such as loading and unloading of the dynamic link library, the function address and the error information can be flexibly called, and compared with the static link library and the implicit dynamic link library, the method is more flexible, and therefore the method is more efficient when the multi-phase flow field is initialized. In conclusion, the multi-phase flow field initialization method is more flexible and efficient when a multi-phase flow field is initialized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of an initialization method of a multiphase flow field provided in the present application;
FIG. 2 is a flow chart of a specific multiphase flow field initialization method provided herein;
FIG. 3 is a schematic view of an exemplary calculation domain of a dam break provided herein;
FIG. 4 is a schematic view of an initialization process of a multiphase flow field provided herein;
FIG. 5 is a cloud graph of the initial volume fraction of a break provided herein;
fig. 6 is a schematic structural diagram of an initializing apparatus for multiphase flow field provided in the present application;
fig. 7 is a block diagram of an electronic device provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The initial field of the multiphase flow problem generally has the non-uniform characteristics of components and flow field parameters, and generally needs to be separately processed according to specific problems. Because developers cannot exhaust all possibilities in software, and users are strictly prohibited from accessing and modifying the main program source code, in order to ensure the source code security and simultaneously give users enough freedom to implement the initialization process for different multiphase flow problems, the following two strategies are generally adopted at present: the interpretation method is complex in realization and needs to write an interpreter manually by interpreting sentences input by a user one by one to realize corresponding functions, and meanwhile, the efficiency is greatly influenced for a calculation-intensive program such as computational fluid mechanics due to high interpretation time complexity; the compiling method is divided into a static link library and a dynamic link library, wherein the static link library and an implicit dynamic link library are required to be completed in the compiling and linking stage, and a compiling system compiles and links according to a header file and a library file of the dynamic library, namely the library is required to be added into the project of an application program, so that the prototype and the address of a called function are determined. For a static library, recompilation is required for each modification, which brings great inconvenience to the use of users. Therefore, the multiphase flow field initialization method can be more flexible and efficient in the process of carrying out the multiphase flow field initialization.
The embodiment of the invention discloses a multiphase flow field initialization method, which comprises the following steps of:
step S11: and acquiring a target initialization function source code corresponding to the initialization requirement of the target multiphase flow field through a main program of the numerical simulation software and a preset interactive interface of the dynamic link library.
In this embodiment, the preset interactive interface is an interactive interface between a main program preset by a main program developer of the numerical simulation software and an external dynamic link library. Specifically, a user determines a target initialization function source code corresponding to an initialization requirement in advance according to the initialization requirement of a target multiphase flow field, and inputs the target initialization function source code from the preset interactive interface to obtain the target initialization function source code. By the technical scheme, the target initialization function source code corresponding to the initialization requirement of the target multiphase flow field is obtained, so that the corresponding target dynamic link library is constructed based on the target initialization function source code.
Step S12: and compiling the target initialization function source code by using a preset compiler based on the operating system operated by the numerical simulation software to obtain a target dynamic link library corresponding to the target initialization function source code, and then adding the information of the target dynamic link library in a configuration parameter file of a main program of the numerical simulation software.
In this embodiment, according to an operating system run by the numerical simulation software, the target initialization function source code is compiled by using a corresponding preset compiler, a target dynamic link library corresponding to the target initialization function source code is obtained, and information of the target dynamic link library is further added to a configuration parameter file of a main program of the numerical simulation software. According to the technical scheme, the target dynamic link library corresponding to the initialization requirement of the target multiphase flow field is obtained, and the information of the target dynamic link library is added in the configuration parameter file of the main program of the numerical simulation software, so that the target multiphase flow field can be initialized based on the information of the target dynamic link library when the running instruction of the multiphase flow solving program in the numerical simulation software is obtained subsequently.
Step S13: and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and initializing the target multiphase flow field based on the information of the target dynamic link library in the configuration parameter file.
In this embodiment, the operation instruction of the multiphase flow solver of the numerical simulation software is an instruction corresponding to the initialization requirement of the target multiphase flow field. Specifically, an operation instruction of a multiphase flow solving program sent by a user from a preset interface is obtained, and the target multiphase flow field is initialized based on target dynamic link library information in the configuration parameter file. According to the technical scheme, the target initialization function source code is compiled into the target dynamic link library through the preset compiler, the explicit dynamic link library is adopted to enable the operating system function to realize the operations of loading, unloading and the like of the dynamic link library, the function address and the error information can be flexibly called, and compared with the static link library and the implicit dynamic link library, the method is more flexible, and therefore the method is more efficient in multi-phase flow field initialization.
It can be seen that, when the multi-phase flow field is initialized, in this embodiment, first, a target initialization function code corresponding to an initialization requirement of a target multi-phase flow field is obtained through an interactive interface between a main program and a dynamic link library, and a preset compiler is further used to compile a target initialization function source code to obtain a target dynamic link library corresponding to the target initialization function source code, information of the target dynamic link library is added to a configuration parameter file of the main program of the numerical simulation software, and when a multi-phase flow solving program of the numerical simulation software is obtained and executed, the target multi-phase flow field is initialized based on the information of the target dynamic link library. Therefore, when the multi-phase flow field is initialized, the target initialization function source code is compiled into the target dynamic link library through the preset compiler, the explicit dynamic link library is adopted, the operation system function can realize the operations such as loading and unloading of the dynamic link library, the function address and the error information can be flexibly called, and compared with the static link library and the implicit dynamic link library, the method is more flexible, and therefore the method is more efficient when the multi-phase flow field is initialized. In conclusion, the multi-phase flow field initialization method is more flexible and efficient when a multi-phase flow field is initialized.
Referring to fig. 2, the embodiment of the present invention discloses a specific multiphase flow field initialization method, and compared with the previous embodiment, the present embodiment further describes and optimizes the technical solution.
Step S21: and acquiring a target initialization function source code corresponding to the initialization requirement of the target multiphase flow field through a main program of the numerical simulation software and a preset interactive interface of the dynamic link library.
In this embodiment, before obtaining a source code of a target initialization function corresponding to an initialization requirement of a target multiphase flow field through a main program of numerical simulation software and a preset interactive interface of a dynamic link library, the method further includes: and calling a corresponding system function based on an operating system environment operated by the numerical simulation software to construct a preset interactive interface of a main program of the numerical simulation software and a dynamic link library. Specifically, a main program developer calls a system function according to the running operating system environment, and writes an interface for interaction between the main program and an external library, wherein the system function under Windows is as follows:
HMODULE LoadLibraryA(LPCSTR lpLibFileName);
FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
the system functions under Linux are as follows:
void *dlopen(const char *file, int mode);
void *dlsym(void *handle, const char *name);
further, before obtaining a target initialization function source code corresponding to the initialization requirement of the target multiphase flow field through a main program of the numerical simulation software and a preset interactive interface of the dynamic link library, the method further includes: and determining a corresponding target initialization function source code according to the initialization requirement of the target multiphase flow field. Specifically, a target calculation domain, a target phase and a target area corresponding to a target in a target multiphase flow field are determined according to the initialization requirement of the target multiphase flow field; and determining a corresponding target initialization function source code according to the target calculation domain, the target phase and the target area corresponding to the target.
In one embodiment, a dam break algorithm, a typical multiphase flow problem, is initialized. Firstly, a developer writes an interface initflow (Q) for interaction between a main program and an external library, the interface externally provides a grid unit original variable array Q [7] and a unit coordinate array centroid [3], the implementation mode is realized by using Fortran language, and the preset interface writing language does not limit a certain programming language. The preset interactive interface code is as follows:
ABSTRACT INTERFACE
SUBROUTINE initflow(Q, centroid) bind(c)
USE, INTRINSIC :: iso_c_binding
REAL(c_double),dimension(7),intent(inout) :: Q
REAL(c_double),dimension(3),intent(in) :: centroid
END SUBROUTINE
END INTERFACE;
further, the initialization requirement of the target multiphase flow field is determined, a schematic diagram of a calculation domain of a dam break calculation example is shown in fig. 3, the calculation domain is a rectangular region of [0, 1.61] mx [0, 0.9] m, the range of [0, 0.6] mx [0, 0.3] m is water initially, other regions are gas, and the target initialization function source code is written according to the initialization requirement of the target multiphase flow field and a preset interaction interface. The file name of the source code of the target initialization function is user DefineFunction.c, and the source code of the target initialization function is as follows:
#include<stdio.h>
#include<math.h>
void DamBreak(double Q[7], double centroid[3])
{
if(centroid[0]<0.6 && centroid[2]<0.3)
{
Q[5] = 0.0; //water
}
else
{
Q[5] = 1.0; //gas
}
};
according to the technical scheme, the initialization requirement of the target multiphase flow field is compiled into the corresponding target initialization function source code by using C language, so that the target initialization function source code is compiled into the corresponding target dynamic link library by the preset compiler in the following process.
Step S22: and compiling the target initialization function source code by using a preset compiler based on the operating system operated by the numerical simulation software to obtain a target dynamic link library corresponding to the target initialization function source code, and then adding path information and name information of the target dynamic link library in a configuration parameter file of a main program of the numerical simulation software.
In a specific embodiment, if the operating system where the numerical simulation software runs is Linux, the GCC compiler is used to compile the source code of the target initialization function and obtain a target dynamic link library corresponding to the source code of the target initialization function. Specifically, compiling the target initialization function source code into a target dynamic link library based on the operating system environment and the compiler is as follows:
gcc -shared userDefineFunction.c -fPIC -o libuser.so -std=gnu99;
so, compiling the source code of the target initialization function and generating a target dynamic link library named as library. Further, a path of the dynamic link library and an initialization function name are specified in the configuration parameter file of the main program, and the following attributes are added in the parameter configuration file param.inf of the main program:
dynamicLibName = "../../libuser.so"
subroutineName = "DamBreak";
and adding the path information and the name information of the target dynamic link library in a configuration parameter file of a main program of the numerical simulation software. Through the technical scheme, the corresponding target dynamic link library is generated, so that the target multiphase flow field can be initialized based on the target dynamic link library after the running instruction of the multiphase flow solving program is obtained subsequently.
Step S23: and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and initializing the target multiphase flow field based on the path information and the name information of the target dynamic link library in the configuration parameter file.
In this embodiment, a schematic diagram of an initialization flow of a multiphase flow field is shown in fig. 4, where the obtaining of an operation instruction of a multiphase flow solver of the numerical simulation software and the initializing of the target multiphase flow field based on the path information and the name information of the target dynamic link library in the configuration parameter file include: and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and calling the target dynamic link library based on the path information and the name information of the target dynamic link library in the configuration parameter file so as to initialize the target multiphase flow field.
In one embodiment, the initialization code is as follows:
mpiexec –n 16 ./mixture;
and calling the target dynamic link library based on the path information and the name information of the target dynamic link library in the configuration parameter file so as to initialize the target multiphase flow field and initialize a dam break calculation example, wherein a dam break initialization volume fraction cloud chart is shown in fig. 5. According to the technical scheme, the target initialization function source code is compiled into the target dynamic link library through the preset compiler, the explicit dynamic link library is adopted to enable the operating system function to realize the operations of loading, unloading and the like of the dynamic link library, the function address and the error information can be flexibly called, and compared with the static link library and the implicit dynamic link library, the method is more flexible, and therefore the method is more efficient in multi-phase flow field initialization.
Therefore, in the embodiment, the target multiphase flow field is initialized by calling the target dynamic link library, so that the method is more flexible compared with a static link library and an implicit dynamic link library and has higher operation efficiency compared with an interpretation method.
Referring to fig. 6, an embodiment of the present application discloses a multiphase flow field initialization apparatus, including:
the source code obtaining module 11 is configured to obtain a target initialization function source code corresponding to an initialization requirement of a target multiphase flow field through a main program of the numerical simulation software and a preset interactive interface of the dynamic link library;
a source code compiling module 12, configured to compile the target initialization function source code by using a preset compiler based on an operating system in which the numerical simulation software operates, obtain a target dynamic link library corresponding to the target initialization function source code, and then add information of the target dynamic link library to a configuration parameter file of a main program of the numerical simulation software;
a flow field initialization module 13, configured to obtain an operation instruction of a multiphase flow solver of the numerical simulation software, and initialize the target multiphase flow field based on the information of the target dynamic link library in the configuration parameter file.
It can be seen that, when the multiphase flow field is initialized, in this embodiment, first, a target initialization function code corresponding to an initialization requirement of a target multiphase flow field is obtained through an interactive interface between a main program and a dynamic link library, and a preset compiler is further utilized to compile a target initialization function source code to obtain a target dynamic link library corresponding to the target initialization function source code, information of the target dynamic link library is added to a configuration parameter file of the main program of the numerical simulation software, and when the multiphase flow solving program of the numerical simulation software is obtained and executed, the target multiphase flow field is initialized based on the information of the target dynamic link library. Therefore, when the multi-phase flow field is initialized, the target initialization function source code is compiled into the target dynamic link library through the preset compiler, the explicit dynamic link library is adopted, the operation system function can realize the operations of loading, unloading and the like of the dynamic link library, the function address and the error information can be flexibly called, and compared with the static link library and the implicit dynamic link library, the method is more flexible, and therefore the method is more efficient when the multi-phase flow field is initialized. In conclusion, the method and the device can be more flexible and efficient when the multiphase flow field is initialized.
In some embodiments, the multiphase flow field initialization apparatus further includes:
and the interface construction module is used for calling a corresponding system function based on an operating system environment operated by the numerical simulation software so as to construct a preset interaction interface of a main program of the numerical simulation software and a dynamic link library.
In some embodiments, the multiphase flow field initialization apparatus further includes:
and the source code determining module is used for determining a corresponding target initialization function source code according to the initialization requirement of the target multiphase flow field.
In some specific embodiments, the source code determining module specifically includes:
the area determining unit is used for determining a target calculation domain, a target phase and a target area corresponding to a target in a target multiphase flow field according to the initialization requirement of the target multiphase flow field;
and the code writing unit is used for determining a corresponding target initialization function source code according to the target calculation domain, the target phase and the target area corresponding to the target.
In some embodiments, the source code compiling module 12 is specifically configured to: adding path information and name information of the target dynamic link library in a configuration parameter file of a main program of the numerical simulation software;
correspondingly, the flow field initialization module 13 is specifically configured to: and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and initializing the target multiphase flow field based on the path information and the name information of the target dynamic link library in the configuration parameter file.
In some embodiments, the flow field initialization module 13 is specifically configured to: and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and calling the target dynamic link library based on the path information and the name information of the target dynamic link library in the configuration parameter file so as to initialize the target multiphase flow field.
In some embodiments, the source code compiling module 12 is specifically configured to: and if the operating system operated by the numerical simulation software is Linux, compiling the target initialization function source code by using a GCC compiler and obtaining a target dynamic link library corresponding to the target initialization function source code.
Fig. 7 illustrates an electronic device 20 according to an embodiment of the present application. The electronic device 20 may further include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. The memory 22 is used for storing a computer program, and the computer program is loaded and executed by the processor 21 to implement relevant steps in the multiphase flow field initialization method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to acquire external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
In addition, the storage 22 is used as a carrier for storing resources, and may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage manner may be a transient storage manner or a permanent storage manner.
The operating system 221 is used for managing and controlling each hardware device on the electronic device 20, and the computer program 222 may be Windows Server, netware, unix, linux, or the like. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the multiphase flow field initialization method performed by the electronic device 20 disclosed in any of the foregoing embodiments.
Further, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the multi-phase flow field initialization method disclosed in the foregoing. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, which are not described herein again.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The method, the device, the equipment and the medium for initializing the multiphase flow field provided by the invention are described in detail, specific examples are applied in the description to explain the principle and the implementation mode of the invention, and the description of the examples is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method for initializing a multiphase flow field, comprising:
acquiring a target initialization function source code corresponding to the initialization requirement of the target multiphase flow field through a main program of numerical simulation software and a preset interactive interface of a dynamic link library;
compiling the target initialization function source code by using a preset compiler based on an operating system operated by the numerical simulation software to obtain a target dynamic link library corresponding to the target initialization function source code, and then adding information of the target dynamic link library into a configuration parameter file of a main program of the numerical simulation software;
and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and initializing the target multiphase flow field based on the information of the target dynamic link library in the configuration parameter file.
2. The method for initializing a multiphase flow field according to claim 1, wherein before obtaining a source code of a target initialization function corresponding to an initialization requirement of a target multiphase flow field through a main program of numerical simulation software and a preset interactive interface of a dynamic link library, the method further comprises:
and calling a corresponding system function based on an operating system environment operated by the numerical simulation software to construct a preset interactive interface of a main program of the numerical simulation software and a dynamic link library.
3. The method for initializing a multiphase flow field according to claim 1, wherein before obtaining a source code of a target initialization function corresponding to an initialization requirement of a target multiphase flow field through a main program of numerical simulation software and a preset interactive interface of a dynamic link library, the method further comprises:
and determining a corresponding target initialization function source code according to the initialization requirement of the target multiphase flow field.
4. The method for initializing a multiphase flow field according to claim 3, wherein the determining a source code of a corresponding target initialization function according to an initialization requirement of a target multiphase flow field comprises:
determining a target calculation domain, a target phase and a target area corresponding to a target in a target multiphase flow field according to the initialization requirement of the target multiphase flow field;
and determining a corresponding target initialization function source code according to the target calculation domain, the target phase and the target area corresponding to the target.
5. The multiphase flow field initialization method of claim 1, wherein the adding of the information of the target dynamic link library to the configuration parameter file of the main program of the numerical simulation software comprises:
adding path information and name information of the target dynamic link library in a configuration parameter file of a main program of the numerical simulation software;
correspondingly, the obtaining of the operation instruction of the multiphase flow solver of the numerical simulation software and the initializing of the target multiphase flow field based on the information of the target dynamic link library in the configuration parameter file include:
and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and initializing the target multiphase flow field based on the path information and the name information of the target dynamic link library in the configuration parameter file.
6. The method for initializing the multiphase flow field according to claim 5, wherein the obtaining of the operation instruction of the multiphase flow solver of the numerical simulation software and the initializing of the target multiphase flow field based on the path information and the name information of the target dynamic link library in the configuration parameter file comprises:
and acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software, and calling the target dynamic link library based on the path information and the name information of the target dynamic link library in the configuration parameter file so as to initialize the target multiphase flow field.
7. The multiphase flow field initialization method according to any one of claims 1 to 6, wherein the operating system running based on the numerical simulation software compiles the target initialization function source code by using a preset compiler to obtain a target dynamic link library corresponding to the target initialization function source code, and includes:
and if the operating system operated by the numerical simulation software is Linux, compiling the target initialization function source code by using a GCC compiler and obtaining a target dynamic link library corresponding to the target initialization function source code.
8. A multiphase flow field initialization device, comprising:
the source code acquisition module is used for acquiring a target initialization function source code corresponding to the initialization requirement of the target multiphase flow field through a main program of the numerical simulation software and a preset interactive interface of the dynamic link library;
a source code compiling module, configured to compile the target initialization function source code by using a preset compiler based on an operating system run by the numerical simulation software, obtain a target dynamic link library corresponding to the target initialization function source code, and then add information of the target dynamic link library to a configuration parameter file of a main program of the numerical simulation software;
and the flow field initialization module is used for acquiring an operation instruction of a multiphase flow solving program of the numerical simulation software and initializing the target multiphase flow field based on the information of the target dynamic link library in the configuration parameter file.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the steps of the multiphase flow field initialization method of any one of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the steps of the multiphase flow field initialization method of any one of claims 1 to 7.
CN202211179288.4A 2022-09-27 2022-09-27 Multi-phase flow field initialization method, device, equipment and medium Active CN115268937B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211179288.4A CN115268937B (en) 2022-09-27 2022-09-27 Multi-phase flow field initialization method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211179288.4A CN115268937B (en) 2022-09-27 2022-09-27 Multi-phase flow field initialization method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN115268937A true CN115268937A (en) 2022-11-01
CN115268937B CN115268937B (en) 2023-02-17

Family

ID=83757650

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211179288.4A Active CN115268937B (en) 2022-09-27 2022-09-27 Multi-phase flow field initialization method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115268937B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103399779A (en) * 2013-07-02 2013-11-20 中国科学院沈阳自动化研究所 Semi-physical simulation platform and simulation method thereof used in cement clinker calcining process
CN106529030A (en) * 2016-11-09 2017-03-22 中国南方电网有限责任公司超高压输电公司检修试验中心 Boundary searching method of last circuit breaker
CN110032425A (en) * 2019-03-22 2019-07-19 北京智游网安科技有限公司 A kind of dynamic link library file virtual method, system and storage medium
CN111258674A (en) * 2020-01-14 2020-06-09 清华大学 Software module integration system and operation method of numerical application program
CN111914014A (en) * 2020-08-17 2020-11-10 深圳市联恒星科技有限公司 Big data platform and application thereof
CN113486566A (en) * 2021-07-13 2021-10-08 南开大学 Method for performing porous medium and multiphase fluid mixed simulation by using virtual particle phase
US20210404849A1 (en) * 2020-06-26 2021-12-30 Schlumberger Technology Corporation Multiphase flowmeter and related methods
CN114384229A (en) * 2021-12-14 2022-04-22 中国科学院武汉岩土力学研究所 Multiphase flow cylindrical model test system and test method
CN114723177A (en) * 2022-05-16 2022-07-08 郑州大学 Flood disaster prediction and early warning method based on DA-SSL
CN114925338A (en) * 2022-05-10 2022-08-19 北京字节跳动网络技术有限公司 Compiling method, device, equipment, medium and product

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103399779A (en) * 2013-07-02 2013-11-20 中国科学院沈阳自动化研究所 Semi-physical simulation platform and simulation method thereof used in cement clinker calcining process
CN106529030A (en) * 2016-11-09 2017-03-22 中国南方电网有限责任公司超高压输电公司检修试验中心 Boundary searching method of last circuit breaker
CN110032425A (en) * 2019-03-22 2019-07-19 北京智游网安科技有限公司 A kind of dynamic link library file virtual method, system and storage medium
CN111258674A (en) * 2020-01-14 2020-06-09 清华大学 Software module integration system and operation method of numerical application program
US20210404849A1 (en) * 2020-06-26 2021-12-30 Schlumberger Technology Corporation Multiphase flowmeter and related methods
CN111914014A (en) * 2020-08-17 2020-11-10 深圳市联恒星科技有限公司 Big data platform and application thereof
CN113486566A (en) * 2021-07-13 2021-10-08 南开大学 Method for performing porous medium and multiphase fluid mixed simulation by using virtual particle phase
CN114384229A (en) * 2021-12-14 2022-04-22 中国科学院武汉岩土力学研究所 Multiphase flow cylindrical model test system and test method
CN114925338A (en) * 2022-05-10 2022-08-19 北京字节跳动网络技术有限公司 Compiling method, device, equipment, medium and product
CN114723177A (en) * 2022-05-16 2022-07-08 郑州大学 Flood disaster prediction and early warning method based on DA-SSL

Non-Patent Citations (6)

* Cited by examiner, † Cited by third party
Title
WEI LI等: "Preliminary study of coupling CFD code FLUENT and system code RELAP5", 《ANNALS OF NUCLEAR ENERGY》 *
刘欢等: "基于3D-LBM的多相流快速模拟", 《计算机应用研究》 *
周振红 等: "基于组件的水力数值模拟可视化系统", 《水科学进展》 *
牛佳乐等: "基于Lab VIEW与MATLAB混合编程的气液两相流测量软件开发", 《实验室研究与探索》 *
牟斌 等: "空化流动隐式求解方法研究", 《空气动力学学报》 *
陈益峰等: "多相流传输THM全耦合数值模型及程序验证", 《岩石力学与工程学报》 *

Also Published As

Publication number Publication date
CN115268937B (en) 2023-02-17

Similar Documents

Publication Publication Date Title
CN111832736B (en) Method, apparatus and computer readable storage medium for processing machine learning model
JP7324831B2 (en) DEPLOYMENT METHOD, DEPLOYMENT DEVICE AND ELECTRONIC DEVICE OF OPERATORS IN DEEP LEARNING FRAMEWORK
EP2323031A2 (en) Calling of late bound functions from an external program environment
KR20050011685A (en) Description language for an extensible compiler and tools infrastructure
US9459986B2 (en) Automatic generation of analysis-equivalent application constructs
CN110457044B (en) Haxe application compiling method and device and electronic equipment
Cruz-Filipe et al. A core model for choreographic programming
El-Korashy et al. CapablePtrs: Securely compiling partial programs using the pointers-as-capabilities principle
WO2009009138A1 (en) A programming environment with support for handle and non-handle user-created classes
Sentilles et al. Save-ide-a tool for design, analysis and implementation of component-based embedded systems
Chakravarthy et al. Edicts: implementing features with flexible binding times
Botturi et al. Model-driven design for the development of multi-platform smartphone applications
CN115268937B (en) Multi-phase flow field initialization method, device, equipment and medium
CN110377367B (en) Component configuration method and device, electronic terminal and computer readable storage medium
CN114168151B (en) Container-based program compiling method and device, electronic equipment and storage medium
CN114610409A (en) Webpack-based calling system and method and electronic device
KR20100110710A (en) Method for simplifying interfaces having dynamic libraries
CN114840195A (en) Privatization method for iOS SDK static library
Vaughan et al. Migrating from pvm to mpi. i. the unify system
Matsuura et al. mimium: a self-extensible programming language for sound and music
RU2799988C2 (en) System and method for dynamic visualization of software elements
Forstner et al. Model-based system development for embedded mobile platforms
Böckenkamp roslaunch2: versatile, flexible and dynamic launch configurations for the robot operating system
KR101213651B1 (en) Method for binarizing initial script on operating system, and operating method of binary script
Charan et al. Customizing AOSP for different embedded devices

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant