A method, device, equipment and readable storage medium for generating dynamic streamlines
By generating streamline segments with colors and rendering them cyclically, the problem of difficult to dynamically display the streamline graph of CFD simulation is solved, and dynamic simulation and intuitive understanding of the fluid environment are achieved.
Patent Information
- Application Number
- CN202210701417.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-20
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-06-20
AI Technical Summary
The existing CFD simulated streamline diagrams are difficult to achieve dynamic display, which affects the concrete display of the simulated streamline diagrams.
By obtaining fluid environment data and streamline point data, a target streamline with color is generated and split into multiple sets of streamline segments, a dynamic streamline is formed through circular rendering, and a flow mark is added to show the wind direction.
Dynamic simulation of the fluid environment is realized, making the simulation results more intuitive and concrete, and making it easier for relevant technical personnel to understand and adjust the model structure.
Smart Images

Figure CN114998486B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer-aided design, and particularly relates to a method, device, equipment and readable storage medium for generating dynamic streamlines. Background Art
[0002] Computational Fluid Dynamics (CFD) can be used to simulate the motion of different fluid particles at the same moment. Currently, when analyzing the fluid environment of a building, CFD is usually used to numerically simulate the fluid environment of an urban block to obtain a CFD simulation streamline diagram. Taking natural wind as an example, the CFD simulation streamline diagram is used to simulate the real natural wind environment, so that relevant technicians can reasonably adjust the building structure of the building according to the simulation results to ensure that the building structure meets the building design requirements. As a reference parameter, the CFD simulation streamline diagram can be intuitively derived through computer graphics. However, most current CFD simulation software is PC-side software or web-side simulation display, and the output CFD simulation streamline diagrams are all static, making it difficult to dynamically display the CFD simulation streamline diagram, which affects the concrete display of the simulation streamline diagram. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a method, device, equipment and readable storage medium for generating dynamic streamlines to solve the problem that it is difficult to dynamically display existing streamlines.
[0004] According to a first aspect, an embodiment of the present invention provides a method for generating dynamic streamlines, including: obtaining fluid environment data and streamline point data corresponding to the fluid environment data; determining color data corresponding to the streamline point data based on the fluid environment data; generating a target streamline based on the color data and the streamline point data; splitting the target streamline based on a preset length to obtain multiple groups of streamline segments; and cyclically rendering the multiple groups of streamline segments to generate dynamic streamlines.
[0005] The method for generating dynamic streamlines provided by the embodiments of the present invention simulates the fluid environment through streamline point data and corresponding color data, generates a target streamline with colors, and then splits the target streamline into multiple groups of streamline segments, and cyclically renders the multiple groups of streamline segments to form a visually dynamic streamline. By using this dynamic streamline to simulate the real fluid environment, the simulation result is more intuitive and concrete, which is convenient for relevant technicians to intuitively understand the simulation result to ensure the reasonable adjustment of the subsequent model structure.
[0006] In combination with the first aspect, in the first embodiment of the first aspect, the loop rendering of the multiple groups of flow line segments to generate dynamic streamlines includes: obtaining the flow directions of the multiple groups of flow line segments and a preset rendering duration; performing loop rendering on the multiple groups of flow line segments according to the flow directions and the preset rendering duration to obtain the dynamic streamlines.
[0007] The method for generating dynamic streamlines provided by the embodiments of the present invention obtains dynamic streamlines by performing loop rendering on multiple groups of flow line segments according to the flow directions of the multiple groups of flow line segments and a preset rendering duration, ensuring an accurate simulation of the real fluid environment by the dynamic streamlines.
[0008] In combination with the first embodiment of the first aspect, in the second embodiment of the first aspect, the method further includes: constructing flow markers for the multiple groups of flow line segments according to the flow directions; adding the flow markers to the streamline heads of the multiple groups of flow line segments respectively.
[0009] In combination with the second embodiment of the first aspect, in the third embodiment of the first aspect, the adding the flow markers to the streamline heads of the multiple groups of flow line segments respectively includes: obtaining the direction vectors of each streamline head, the reference vector for rotation, and the reference position points of the flow markers;
[0010] calculating the angles between each direction vector and the reference vector and the offset distances of the reference position points of the flow markers relative to the streamline heads; rotating the reference position points of the flow markers according to each angle to obtain the rotated positions of the flow markers; moving the rotated positions of the flow markers to the corresponding positions of the streamline heads according to the offset distances.
[0011] The method for generating dynamic streamlines provided by the embodiments of the present invention facilitates the intuitive display of the wind direction in the fluid environment by setting flow markers at the streamline heads of each group of flow line segments.
[0012] In combination with the first aspect, in the fourth embodiment of the first aspect, the generating the target streamline based on the color data and the streamline point data includes: drawing an initial streamline according to the streamline point data; rendering the initial streamline data in a point coloring manner with the color data to obtain the target streamline.
[0013] The method for generating dynamic streamlines provided by the embodiments of the present invention generates an initial streamline from the streamline point data and renders the color data onto the initial streamline in a point coloring manner, thereby obtaining a target streamline with colors. By simulating the real fluid environment parameters with the target streamline, the subsequent generated dynamic streamlines can be made more realistic.
[0014] Combined with the fourth embodiment of the first aspect, in the fifth embodiment of the first aspect, the method further includes: generating a color band corresponding to the target streamline based on the color of the target streamline.
[0015] The method for generating a dynamic streamline provided by the embodiments of the present invention generates a corresponding color band through the color of the target streamline, facilitating intuitive analysis of the fluid environment of a building by relevant technicians based on this color band.
[0016] Combined with the first aspect, in the sixth embodiment of the first aspect, the determining the color data corresponding to the streamline point data based on the fluid environment data includes: determining the flow velocity corresponding to each streamline point based on the correspondence between the fluid environment data and the streamline point data; performing color conversion on the flow velocity corresponding to each streamline point to obtain the color data corresponding to each streamline point.
[0017] The method for generating a dynamic streamline provided by the embodiments of the present invention converts the flow velocity into color data and represents the flow velocity in the current fluid environment with color data when generating the dynamic streamline, making the simulation of the fluid environment more intuitive.
[0018] According to the second aspect, an embodiment of the present invention provides a device for generating a dynamic streamline, including: an acquisition module for acquiring fluid environment data and streamline point data corresponding to the fluid environment data; a determination module for determining color data corresponding to the streamline point data based on the fluid environment data; a generation module for generating a target streamline based on the color data and the streamline point data; a splitting module for splitting the target streamline based on a preset length to obtain multiple sets of streamline segments; a rendering module for rendering the multiple sets of streamline segments in a loop to generate a dynamic streamline.
[0019] According to the third aspect, an embodiment of the present invention provides an electronic device, including: a memory and a processor, which are communicatively connected to each other, and the memory stores computer instructions, and the processor executes the computer instructions to execute the method for generating a dynamic streamline according to the first aspect or any embodiment of the first aspect.
[0020] According to the fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions for causing a computer to execute the method for generating a dynamic streamline according to the first aspect or any embodiment of the first aspect.
[0021] It should be noted that for the corresponding beneficial effects of the device for generating a dynamic streamline, the electronic device, and the computer-readable storage medium provided by the embodiments of the present invention, please refer to the description of the corresponding content in the method for generating a dynamic streamline, and details will not be elaborated herein. Brief Description of the Drawings
[0022] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0023] Figure 1 is a flowchart of a method for generating a dynamic streamline according to an embodiment of the present invention;
[0024] Figure 2 is another flowchart of a method for generating a dynamic streamline according to an embodiment of the present invention;
[0025] Figure 3 is yet another flowchart of a method for generating a dynamic streamline according to an embodiment of the present invention;
[0026] Figure 4 is still another flowchart of a method for generating a dynamic streamline according to an embodiment of the present invention;
[0027] Figure 5 is a schematic diagram of splitting a target streamline according to an embodiment of the present invention;
[0028] Figure 6 is a schematic diagram of a dynamic streamline according to an embodiment of the present invention;
[0029] Figure 7 is a structural block diagram of a device for generating a dynamic streamline according to an embodiment of the present invention;
[0030] Figure 8 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. Detailed Embodiments
[0031] In order to make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
[0032] The CFD simulation streamline diagram is used as a reference parameter, which can be intuitively derived through computer graphics. However, most current CFD simulation software is for PC or web-based simulation displays, and the output CFD simulation streamline diagrams are all static, making it difficult to dynamically display the CFD simulation streamline diagrams and affecting the concrete display of the simulation streamline diagrams.
[0033] Based on this, the technical solution of the present invention splits the streamline into multiple groups of streamline segments and performs cyclic rendering on the multiple groups of streamline segments to form a visually dynamic streamline, making the simulation result more intuitive and more concrete, and thus facilitating relevant technical personnel to intuitively understand the simulation result to ensure the reasonable adjustment of the subsequent model structure.
[0034] According to an embodiment of the present invention, an embodiment of a method for generating a dynamic streamline is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0035] In this embodiment, a method for generating a dynamic streamline is provided, which can be used in electronic devices such as mobile phones, tablets, computers, etc. Figure 1 is a flowchart of a method for generating a dynamic streamline according to an embodiment of the present invention, as Figure 1 shown, the process includes the following steps:
[0036] S11, obtain fluid environment data and streamline point data corresponding to the fluid environment data.
[0037] The fluid environment data is used to characterize the environmental information formed by the fluid under the influence of the building. The fluid environment data may include the flow velocity and flow direction of the fluid. The electronic device can determine the fluid environment data generated under the influence of the building according to the fluid information at the geographical location where the building is located and the structural design of the building.
[0038] The streamline point data is multiple three-dimensional points that make up the fluid. Multiple streamlines around the building are generated through the streamline point data, and the fluid environment formed around the building is characterized by the streamline.
[0039] Taking natural wind as an example, the fluid environment data is used to characterize the wind field formed by natural wind under the influence of the building. The fluid environment data includes wind speed and wind direction. The electronic device can determine the fluid environment data generated by natural wind under the influence of the building according to the meteorological data at the geographical location where the building is located and the structural design of the building. The streamline point data is multiple three-dimensional points that make up the streamline. Multiple streamlines around the building are generated through the streamline point data, and the wind field generated around the building is characterized by the streamline.
[0040] For example, meteorological data can be uploaded by technicians or exported by electronic devices from a meteorological platform. Of course, there can also be other acquisition methods, which are not limited here. The electronic device performs a joint analysis of the meteorological data and the building to generate fluid environment data affected by the building, and extracts streamline point data from it. For example, the electronic device can call the loader function provided by THREEJS to read the meteorological data file, extract the meteorological data at the location where the building is located from it, and then determine the fluid environment data and streamline point data based on the meteorological data and the building.
[0041] S12. Determine color data corresponding to the streamline point data based on the fluid environment data.
[0042] The color data is used to represent the flow velocity of the fluid in the fluid environment data, and different flow velocities are represented by different colors. The color data can be represented by RGB three-color values. The electronic device can analyze the flow velocity of the fluid environment data at each streamline point data, and then determine the color data corresponding to each streamline point based on the flow velocity.
[0043] S13. Generate a target streamline based on the color data and the streamline point data.
[0044] The streamline point data and the color data are in one-to-one correspondence. The electronic device can perform streamline drawing on each streamline point data according to a 3D drawing protocol (such as WebGL), and render the color data to each streamline point respectively during the streamline drawing process to generate a colored streamline, that is, the target streamline.
[0045] S14. Split the target streamline based on a preset length to obtain multiple groups of streamline segments.
[0046] The preset length is a benchmark length preset for splitting the target streamline. The preset length can be a fixed length with the same length value, or a length with different length values, which is not limited here. Taking a fixed length with the same length value as an example, the electronic device splits the target streamline according to the preset length to obtain multiple groups of streamline segments with the same length, as Figure 5 shown.
[0047] S15. Render multiple groups of streamline segments in a loop to generate a dynamic streamline.
[0048] The electronic device performs loop rendering on multiple groups of streamline segments based on the visual difference of the human eye to form a visually dynamic streamline. Specifically, the electronic device can set the rendering time of each streamline segment in multiple groups of streamline segments, and render each streamline segment in sequence according to the rendering time to achieve the effect of a dynamic streamline.
[0049] The method for generating dynamic streamlines provided in this embodiment simulates a fluid environment through streamline point data and corresponding color data, generates target streamlines with colors, and then splits the target streamlines into multiple groups of streamline segments, and forms visually dynamic streamlines by cyclically rendering the multiple groups of streamline segments. By simulating a real fluid environment through the dynamic streamlines, the simulation results are made more intuitive and concrete, which is convenient for relevant technicians to intuitively understand the simulation results to ensure reasonable adjustment of the subsequent model structure.
[0050] In this embodiment, a method for generating dynamic streamlines is provided, which can be used in electronic devices such as mobile phones, tablet computers, and computers. Figure 2 It is a flowchart of the method for generating dynamic streamlines according to an embodiment of the present invention, as Figure 2 shown, and the process includes the following steps:
[0051] S21, obtain fluid environment data and streamline point data corresponding to the fluid environment data. For detailed description, refer to the relevant description corresponding to the above embodiment, which will not be elaborated here.
[0052] S22, determine color data corresponding to the streamline point data based on the fluid environment data. For detailed description, refer to the relevant description corresponding to the above embodiment, which will not be elaborated here.
[0053] S23, generate target streamlines based on the color data and the streamline point data. For detailed description, refer to the relevant description corresponding to the above embodiment, which will not be elaborated here.
[0054] S24, split the target streamlines based on a preset length to obtain multiple groups of streamline segments. For detailed description, refer to the relevant description corresponding to the above embodiment, which will not be elaborated here.
[0055] S25, cyclically render the multiple groups of streamline segments to generate dynamic streamlines.
[0056] Specifically, the above step S25 may include:
[0057] S251, obtain the flow directions of the multiple groups of streamline segments and a preset rendering duration.
[0058] The flow direction is used to characterize the rendering direction of each streamline segment in each group of streamline segments, and this flow direction is consistent with the fluid flow direction corresponding to the current fluid environment. The preset rendering duration is the rendering display time of each streamline segment, and this preset rendering duration is determined based on the human eye visual difference, and as long as it can meet the human eye visual difference, no specific limitation is made on the preset rendering duration here.
[0059] S252, cyclically render the multiple groups of streamline segments according to the flow direction and the preset rendering duration to obtain dynamic streamlines.
[0060] The electronic device constructs a drawing environment based on a 3D drawing protocol. Taking WebGL as an example, technicians can pre-construct controls such as scenes, lights, cameras, WebGLRender, and controls required for 3D rendering on the electronic device. Accordingly, as Figure 6 shown, when the electronic device performs streamline rendering, it can cyclically render each streamline segment in multiple groups of streamline segments to the web side (such as a browser) according to the obtained flow direction and the preset rendering duration in the pre-constructed drawing environment, generating a visually dynamic streamline.
[0061] As an alternative implementation, as Figure 3 shown, before cyclically rendering multiple groups of streamline segments according to the flow direction and the preset rendering duration, the above step S25 may further include:
[0062] S210, constructing flow marks for multiple groups of streamline segments according to the flow direction.
[0063] The flow mark is used to visually display the flow direction of the streamline. The flow mark can be arrows of different styles and can be a direction indication. The form of the flow mark is not limited here as long as it can represent the flow direction. The electronic device constructs a set of reference coordinate points of the flow mark according to the obtained flow direction, for example, [[-1,0,0],[0,4,0],[0,4,0],[1,0,0]].
[0064] S220, adding the flow marks to the streamline heads of multiple groups of streamline segments respectively.
[0065] The electronic device determines the streamline heads of each streamline segment in each group according to the flow direction, then rotates the flow mark according to the flow direction, rotates it to the corresponding direction, and at the same time moves it to the position where the streamline head is located, completing the addition of the flow mark. Thus, when cyclically rendering multiple groups of streamline segments according to the flow direction and the preset rendering duration, a target streamline with flow marks and colors is generated.
[0066] Specifically, the above step S220 may include:
[0067] (1) Obtaining the direction vectors of each streamline head, the reference vector for rotation, and the reference position points of the flow mark.
[0068] Technicians set the reference vector for rotation and the reference position points of the flow mark. For example, const zeroVector = new THREE.Vector(0,1,0). Accordingly, the electronic device can respond to the setting operation of the technicians, determine the reference position points of the flow mark, and generate the reference vector of the flow mark. The rotation angle of the flow mark can be determined according to the reference vector.
[0069] According to the flow direction, the streamline heads of each streamline segment in each group can be determined. The electronic device can obtain the positions and directions of two points dir1 and dir2 at the streamline head, and use the position of the last point dir1 as the addition position of the flow mark, that is, the position point of the streamline head. The electronic device normalizes the two points dir1 and dir2 at the streamline head to generate a direction vector dir.
[0070] (2) Calculate the angle between each direction vector and the streamline reference vector, and the offset distance of the reference position point of the flow mark relative to the streamline head.
[0071] Based on the calculation of the angle between vectors, the electronic device can calculate the angle between the direction vector dir of each streamline segment and the streamline reference vector zeroVector respectively. At the same time, calculate the offset distance between the position where the flow mark is located and the position point where the streamline head is located.
[0072] (3) Rotate the reference position point of the flow mark according to each angle to obtain the rotated position point of the flow mark.
[0073] Taking the Z-axis (0, 0, 1) as the reference, the electronic device determines the rotation amount of the flow mark according to this angle, and this rotation amount can be represented by a quaternion. The electronic device rotates the reference position point of the flow mark according to this quaternion to make it consistent with the flow direction of the streamline, and then determines the position point of the flow mark after rotation.
[0074] (4) Move the rotated position point of the flow mark to the corresponding position point of the streamline head according to the offset distance.
[0075] Based on the offset distance calculated between the position points of each streamline head and the reference position point of the flow mark obtained by it, the electronic device sequentially moves the rotated position point of the flow mark to the position points where the corresponding streamline heads are located.
[0076] In a specific embodiment, a technician can declare two arrays ArrU and ArrPointLoop through a preset programming language (such as JavaScript) to store three-dimensional streamline point data and its corresponding color data respectively, and at the same time set a reference line length (such as 10 points) as the preset length for splitting the target streamline.
[0077] Correspondingly, after obtaining the streamline point data and its corresponding color data, the electronic device stores them in the array ArrPointLoop and the array ArrU respectively; splits the target streamline according to the reference line length (i.e., the preset length) to obtain multiple streamline segments of a fixed length, and generates a streamline point array, namely a point segment array grouploop and a color array groupu corresponding to each point in the point segment.
[0078] To more intuitively observe the flow direction of the dynamic streamline, a technician can set to add arrows to the head of each streamline. Accordingly, the electronic device can respond to the technician's setting operation, add arrows to the head of the streamline at each streamline segment, and perform cyclic rendering on the streamline segment according to the flow direction and the preset rendering duration, so as to generate a dynamic streamline with arrows.
[0079] It should be noted that the way for the technician to add arrows to the head of each streamline is as follows:
[0080] Set the reference coordinate points streampoints of the arrow, for example: [[-1,0,0],[0,4,0],[0,4,0],[1,0,0]]. Since there are certain differences in the flow direction of each streamline, a technician can declare a quaternion to rotate the arrow to the corresponding direction.
[0081] Based on the for loop method, while constructing the array of each streamline point, the technician places the arrow at the corresponding head of the streamline and keeps it consistent with the direction of the head of the streamline. The specific implementation method is as follows:
[0082] (1) Set a for loop with a limit length of a preset value (here 5 is taken as an example), and set the loop factor as i;
[0083] (2) Declare two arrays iArrPoint and iArrU;
[0084] (3) Set a second for loop, set its limit length to the length of grouploop divided by the set number of loop groups groupstep = 5 (5 here is a custom length), and set the loop factor as j;
[0085] (4) Take out the corresponding distributed streamline points and their colors: const minLoop = grouploop[j * groupstep + i]; const minu = groupu[j * groupstep + i];
[0086] (5) Determine the outer loop subscript. In different loop subscript cases (for example, switch case 0: push data and break; case 1: push data and break; case 2: push data and break; case 3: push data and break; case 4: push data and break; default: break;), put minloop and minu into iArrPoint and iArrU respectively, rotate the defined arrow to the corresponding direction and move it to the position point at the head of the streamline, and then put the arrow position points obtained after rotation into iArrPoint and iArrU respectively. Thus, arrows can be added to each streamline.
[0087] (6) In the outer for loop, put iArrU and iArrPoint into ArrU and ArrPointLoop respectively. When rendering, a dynamic streamline effect with arrows can be achieved.
[0088] The method for generating a dynamic streamline provided in this embodiment facilitates the intuitive display of the wind direction in the fluid environment by setting flow markers at the heads of the streamlines in each group of streamline segments. By cyclically rendering multiple groups of streamline segments according to the flow directions of the multiple groups of streamline segments and a preset rendering duration, a dynamic streamline is obtained, ensuring an accurate simulation of the real fluid environment by the dynamic streamline.
[0089] In this embodiment, a method for generating a dynamic streamline is provided, which can be used in electronic devices such as mobile phones, tablet computers, and computers. Figure 4 It is a flowchart of the method for generating a dynamic streamline according to an embodiment of the present invention, as Figure 4 shown. This process includes the following steps:
[0090] S31, obtain fluid environment data and streamline point data corresponding to the fluid environment data. For a detailed description, refer to the relevant description corresponding to the above embodiment, which will not be elaborated here.
[0091] S32, determine color data corresponding to the streamline point data based on the fluid environment data.
[0092] Specifically, the above step S32 may include:
[0093] S321, determine the flow velocity corresponding to each streamline point based on the correspondence between the fluid environment data and the streamline point data.
[0094] Fluid environment data includes the flow velocity and flow direction of the fluid. There is a one-to-one correspondence between the fluid environment data and the streamline point data, that is, each streamline point has a corresponding flow velocity and flow direction. The electronic device can determine the corresponding flow velocity and flow direction based on the correspondence between the fluid environment data and the streamline point data.
[0095] S322, perform color conversion on the flow velocity corresponding to each streamline point to obtain color data corresponding to each streamline point.
[0096] To more intuitively display the flow velocity of each streamline point, the electronic device can convert the flow velocity of each point into corresponding color data based on the RGB conversion method. The specific implementation process is as follows: Technicians can declare a streamline point array polyArray and a color array colorU. Correspondingly, the electronic device can store the streamline point data in the array polyArray and store the color data corresponding to each streamline point in the array colorU.
[0097] It should be noted that the streamline points and the streamline point colors are one-to-one corresponding values, so the lengths of the streamline point array polyArray and the color array colorU are equal.
[0098] S33, generate a target streamline based on the color data and the streamline point data.
[0099] Specifically, the above step S33 may include:
[0100] S331, draw an initial streamline according to the streamline point data.
[0101] The electronic device performs initial streamline drawing based on the streamline point data. Specifically, the electronic device traverses each streamline point and sequentially connects each streamline point to generate an initial streamline.
[0102] S332, render the initial streamline data in the way of point coloring according to the color data to obtain the target streamline.
[0103] The initial streamline is a black line. The electronic device can sequentially traverse the color array and render it on the initial line in the way of point coloring to generate a target streamline with colors.
[0104] In a specific implementation manner, technicians can declare a streamline point line segment array PointsLoop, a point line segment color array baseColorU, and an empty colors array to perform subsequent target streamline generation.
[0105] Accordingly, the electronic device traverses the streamline point array polyArray in a loop, puts each small line segment point into the point line segment array PointsLoop and the corresponding point line segment color array baseColorU as standby dynamic streamline data; calls BufferGeometry in the third-party library THREEJS of WebGL, and generates a geometry object bufferGeometry corresponding to the point line segment array PointsLoop according to the setFromPoints method of BufferGeometry (for convenience of description, assume that the geometry object bufferGeometry is named baseGeometryLine); assigns the point line segment color array baseColorU to baseGeometryLine; creates a basic line material material and sets it to point coloring; uses baseGeometryLine and material to construct LineSegments to generate the initial line baseLine; adding this to the scene scene can display the black initial streamline baseLine.
[0106] The electronic device sequentially traverses the point line segment color array baseColorU, calls the Lut method in the MATH module corresponding to THREEJS to obtain the color value corresponding to each point line segment, and puts the color value into the colors array; then uses the clolors array to assign values to the initial streamline baseLine; then calls the rendering method in webGL to re-render the assigned initial streamline baseLine, and the target streamline with colors can be drawn.
[0107] It should be noted that in order to retain the original streamline point data and color data for static streamline generation or for convenient data inspection, the electronic device can copy the data in PointsLoop and baseColorU and put them into the corresponding backup arrays newPointsLoop and newU respectively.
[0108] As an optional implementation manner, the above method may further include: generating a color band corresponding to the target streamline based on the color of the target streamline.
[0109] The electronic device can also generate a color band bar, call the Lut method in the MATH module corresponding to THREEJS to obtain the color values in the point line segments, and color the color band bar according to the magnitude of the color values to generate a color band corresponding to the target streamline, such as Figure 6 the simulation of the natural wind environment around the building by the dynamic streamline shown.
[0110] Generate a color band corresponding to the target streamline, facilitating intuitive analysis of the fluid environment of the building by relevant technicians based on this color band.
[0111] S34. Split the target streamline based on a preset length to obtain multiple sets of streamline segments. For detailed descriptions, refer to the relevant descriptions corresponding to the above embodiments, which will not be elaborated here.
[0112] S35. Render multiple sets of streamline segments in a loop to generate a dynamic streamline. For detailed descriptions, refer to the relevant descriptions corresponding to the above embodiments, which will not be elaborated here.
[0113] The method for generating a dynamic streamline provided in this embodiment generates an initial streamline from streamline point data, renders color data onto the initial streamline based on point coloring, and then obtains a target streamline with color. Simulate real fluid environment parameters through the target streamline to ensure that the subsequent generated dynamic streamline is more realistic. By converting the flow velocity into color data and representing the fluid flow velocity in the current fluid environment with color data when generating the dynamic streamline, the simulation of the fluid environment becomes more intuitive.
[0114] In this embodiment, a device for generating a dynamic streamline is also provided. This device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be elaborated here. As used below, the term "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0115] This embodiment provides a device for generating a dynamic streamline, as Figure 7 shown, including:
[0116] An acquisition module 41, configured to acquire fluid environment data and streamline point data corresponding to the fluid environment data. For detailed descriptions, refer to the relevant descriptions corresponding to the above method embodiments, which will not be elaborated here.
[0117] A determination module 42, configured to determine color data corresponding to the streamline point data based on the fluid environment data. For detailed descriptions, refer to the relevant descriptions corresponding to the above method embodiments, which will not be elaborated here.
[0118] A generation module 43, configured to generate a target streamline based on the color data and the streamline point data. For detailed descriptions, refer to the relevant descriptions corresponding to the above method embodiments, which will not be elaborated here.
[0119] A splitting module 44, configured to split the target streamline based on a preset length to obtain multiple sets of streamline segments. For detailed descriptions, refer to the relevant descriptions corresponding to the above method embodiments, which will not be elaborated here.
[0120] A rendering module 45 is configured to loop-render multiple sets of flow line segments to generate dynamic flow lines. For detailed descriptions, please refer to the relevant descriptions corresponding to the above method embodiments, which will not be elaborated here.
[0121] The dynamic flow line generation device provided in this embodiment simulates a fluid environment through flow line point data and corresponding color data, generates target flow lines with colors, then splits the target flow lines into multiple sets of flow line segments, and forms visually dynamic flow lines by loop-rendering the multiple sets of flow line segments. By simulating a real fluid environment with the dynamic flow lines, the simulation results are made more intuitive and concrete, thus facilitating relevant technical personnel to intuitively understand the simulation results to ensure reasonable adjustment of the subsequent model structure.
[0122] The dynamic flow line generation device in this embodiment is presented in the form of functional units. Here, the unit refers to an ASIC circuit, a processor and a memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0123] The further functional descriptions of the above modules are the same as those in the corresponding above embodiments, which will not be elaborated here.
[0124] An embodiment of the present invention further provides an electronic device having the above Figure 7 shown dynamic flow line generation device.
[0125] Please refer to Figure 8 , Figure 8 which is a schematic structural diagram of an electronic device provided by an optional embodiment of the present invention. As Figure 8 shown, the electronic device may include: at least one processor 501, such as a Central Processing Unit (CPU), at least one communication interface 503, a memory 504, and at least one communication bus 502. Among them, the communication bus 502 is used to realize the connection and communication between these components. Among them, the communication interface 503 may include a display screen (Display) and a keyboard (Keyboard). Optionally, the communication interface 503 may further include a standard wired interface and a wireless interface. The memory 504 may be a high-speed volatile random access memory (Random Access Memory, RAM), or a non-volatile memory, such as at least one disk memory. Optionally, the memory 504 may further be at least one storage device located far from the aforementioned processor 501. Among them, the processor 501 may be combined with Figure 7 the device described above. The memory 504 stores application programs, and the processor 501 calls the program codes stored in the memory 504 to execute any of the above method steps.
[0126] Among them, the communication bus 502 can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 502 can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 8 it is only represented by a thick line in Figure 8 , but it does not mean that there is only one bus or one type of bus.
[0127] Among them, the memory 504 can include volatile memory, such as random-access memory (RAM); the memory can also include non-volatile memory, such as flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); the memory 504 can also include a combination of the above types of memory.
[0128] Among them, the processor 501 can be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of a CPU and an NP.
[0129] Among them, the processor 501 can further include a hardware chip. The above-mentioned hardware chip can be an Application-Specific Integrated Circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The above-mentioned PLD can be a Complex Programmable Logic Device (CPLD), a Field-Programmable Gate Array (FPGA), a Generic Array Logic (GAL), or any combination thereof.
[0130] Optionally, the memory 504 is further configured to store program instructions. The processor 501 can call the program instructions to implement the method for generating a dynamic streamline as shown in the embodiments of the present application Figure 1 and 4 the embodiments.
[0131] An embodiment of the present invention further provides a non-transitory computer storage medium, which stores computer-executable instructions that can execute the processing method of the dynamic streamline generation method in any of the above method embodiments. Among them, the storage medium can be a magnetic disk, an optical disc, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memories.
[0132] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A method for generating a dynamic streamline, characterized in that, Including: Obtain fluid environment data and streamline point data corresponding to the fluid environment data; Determine color data corresponding to the streamline point data based on the fluid environment data; Generate a target streamline based on the color data and the streamline point data; Split the target streamline based on a preset length to obtain multiple groups of streamline segments; Obtain the flow directions of the multiple groups of streamline segments; Construct flow markers for the multiple groups of streamline segments according to the flow directions; Obtain the direction vectors of the respective streamline heads of the multiple groups of streamline segments, the reference vector for rotation, and the reference position points of the flow markers of the multiple groups of streamline segments; Calculate the angles between each of the direction vectors and the reference vector and the offset distance of the reference position point of the flow marker relative to the streamline head; rotate the reference position point of the flow marker according to each of the angles to obtain the rotated flow marker position point; Move the rotated flow marker position point to the position point of the corresponding streamline head according to the offset distance; Render the multiple groups of streamline segments in a loop to generate a dynamic streamline.
2. The method according to claim 1, wherein The rendering the multiple groups of streamline segments in a loop to generate a dynamic streamline includes: Obtain a preset rendering duration; Render the multiple groups of streamline segments in a loop according to the flow direction and the preset rendering duration to obtain the dynamic streamline.
3. The method according to claim 1, wherein The generating a target streamline based on the color data and the streamline point data includes: Draw an initial streamline according to the streamline point data; Render the initial streamline in a point coloring manner with the color data to obtain a target streamline.
4. The method according to claim 3, wherein It further includes: Generate a color band corresponding to the target streamline based on the color of the target streamline.
5. The method according to claim 1, wherein The determining color data corresponding to the streamline point data based on the fluid environment data includes: Determine the flow velocity corresponding to each streamline point based on the correspondence between the fluid environment data and the streamline point data; Perform color conversion on the flow velocities corresponding to each streamline point to obtain color data corresponding to each streamline point.
6. A generating device for dynamic streamlines, characterized in that, Including: An acquisition module for obtaining fluid environment data and streamline point data corresponding to the fluid environment data; A determination module for determining color data corresponding to the streamline point data based on the fluid environment data; A generation module for generating a target streamline based on the color data and the streamline point data; A splitting module for splitting the target streamline based on a preset length to obtain multiple groups of streamline segments; A rendering module for obtaining the flow directions of the multiple groups of streamline segments; Constructing flow markers for the multiple groups of streamline segments according to the flow directions; Obtaining the direction vectors of the respective streamline heads of the multiple groups of streamline segments, the reference vector for rotation, and the reference position points of the flow markers of the multiple groups of streamline segments; Calculate the included angles between each of the direction vectors and the reference vector, and the offset distance of the reference position point of the flow marker relative to the head of the streamline; rotate the reference position point of the flow marker according to each of the included angles to obtain the rotated position point of the flow marker; move the rotated position point of the flow marker to the position point of the corresponding streamline head according to the offset distance; loop-render the multiple groups of flow line segments to generate dynamic streamlines.
7. An electronic device, characterized in that, Comprising: A memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to execute the method for generating the dynamic streamline according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to execute the method for generating the dynamic streamline according to any one of claims 1-5.
Citation Information
Patent Citations
Method for dynamically showing regional air quality and meteorological field
CN103472502A
Interactive System and Method Providing Real-Time Virtual Reality Visualization of Simulation Data
US20210327138A1