Background
The casting process modeling and simulation process needs to firstly carry out discrete processing on the three-dimensional geometric model of the analysis object, and different computational grids such as finite elements, finite differences and the like can be generated according to different discrete methods. The finite element mesh generation process is complex and tedious, and is generally applicable to simple geometric structures, but finite difference meshes are generally adopted for geometric model dispersion of complex assemblies.
The traditional finite difference grid with uniform size can generate sawtooth-shaped discrete errors at the boundary when the geometric model is discretized; in general, to eliminate the dispersion error, a smaller grid size is needed for dispersion, but this results in a huge amount of computational grids, which seriously reduces the computational efficiency. Modeling in the casting process and mesh generation in the simulation process are always the links which are most energy-consuming for CAE engineers.
Disclosure of Invention
The object of the present invention is to solve at least one of the technical drawbacks mentioned.
To this end, the invention aims to propose an automatic meshing method for casting process modeling and simulation applications.
To achieve the above object, an embodiment of the present invention provides an automatic mesh generation method for casting process modeling and simulation application, including the steps of:
step S1, reading the three-dimensional model file of the mold in parallel;
step S2, creating a multi-layer block structure frame layout;
step S3, subdividing the model meshes one by one;
step S4, checking and repairing the generated grid;
and step S5, outputting the node information to the grid file.
Further, in the step S1, multithreading is adopted to read the three-dimensional geometric model file data of the casting and the mold into corresponding data structures, respectively, and the maximum value and the minimum value are obtained according to each primitive in each model; and then, the maximum value and the minimum value of the three-dimensional geometric model of the whole mold and the casting are obtained.
Further, in step S2, the subdividing by using the multi-layer block structure adaptive local encryption technology model includes:
establishing a multi-layer block structure layout, and covering positions of a die and a casting three-dimensional model in the whole domain three-dimensional space by adopting irregular cuboid blocks layer by layer;
the membership between the cuboid blocks and the multithreads in the spatial domain and the thread IDs of the adjacent cuboid blocks are broadcast to all threads.
Further, in step S3, the step of subdividing the model mesh one by one adopts a manner of subdividing each model one by one, where subdividing each model includes:
assigning initial attribute values of grids to all discrete points in the whole domain;
solving intersecting lines of the model three-dimensional contour line layer by layer in the Z direction and storing the intersecting lines; solving the intersection points of the intersection lines in the Z direction layer by layer in the Y direction again, and storing the intersection points in pairs;
and solving the intersection points of the small sections formed by the intersection point pairs solved in the Z direction layer by layer in the X direction, and marking the grid attribute values of the intersection points as entity numbers corresponding to the current model.
Further, in step S4, the checking and repairing the generated mesh, where the checking and repairing of the mesh quality are both performed based on the mesh generated by the highest layer, includes:
if a plurality of grid cell attribute values are zero but are surrounded by the rest of the entity cells, the grid is considered to be a gap cell;
if a plurality of units adjacent to the gap unit are marked as entity units, and entity units with the same grid attribute exist in the range of two layers of units around the entity units, the units are determined to be non-continuous isolated units;
if the non-continuous isolated units exist, subdividing again by adopting smaller grid size until no non-continuous isolated units are generated; or directly endowing the non-continuous isolated cells with the mark attribute of the surrounding entity grid with lower priority.
Further, in the step S5, the outputting node information to the mesh file includes: and outputting the node space position information and the entity mark attribute information to a grid file for subsequent calculation.
According to the automatic mesh generation method for the casting process modeling and simulation application, which is disclosed by the embodiment of the invention, aiming at the automatic mesh generation method for the casting process CAE, the method adopts a multilayer encryption technology, can be used for carrying out automatic mesh generation, mesh quality inspection and bad mesh restoration on a three-dimensional model of a mold, greatly reduces the total calculation mesh amount on the basis of improving the approximation degree of the mesh model to a geometric model, and improves the calculation efficiency. The method adopts a high-performance parallel multi-layer block structure self-adaptive mesh generation algorithm; grid inspection and repair method. According to the invention, under the condition of a multi-layer block structure layout, the total grid number is reduced in order of magnitude under the condition of the same subdivision precision (the approximation degree of a three-dimensional geometric model in a spatial domain), and on the premise of keeping the calculation accuracy, the subsequent calculation efficiency is greatly improved; the mesh generation, the check and the repair are all automatically completed by the method provided by the invention without the participation of users; the grid division process is completely parallel, through measurement and calculation, the division time of a single complex model is within 10s, compared with the traditional finite element or finite difference discrete method, the use difficulty of a user is greatly reduced, and the division time is shortened.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
As shown in fig. 1, the automatic meshing method for modeling and simulation application of a casting process according to the embodiment of the present invention includes the following steps:
and step S1, reading the three-dimensional model file of the mold in parallel.
Reading three-dimensional geometric model file data of the casting and the die into corresponding data structures respectively by adopting multiple threads, and solving a maximum value and a minimum value according to each graphic element in each model; and then, the maximum value and the minimum value of the three-dimensional geometric model of the whole mold and the casting are obtained.
Step S2, a multi-tile structure frame layout is created. And each layer adopts different grid sizes to subdivide the three-dimensional geometric model of the mold on a three-dimensional space, and different attributes are calibrated according to attributes of the mold entity.
In this step, a multi-layer block structure adaptive local encryption technology model is adopted for subdivision, which includes:
when a model is split, firstly, a multi-layer block structure layout is created, and positions of the model and a casting three-dimensional model in a global three-dimensional space are covered layer by adopting irregular cuboid blocks; and broadcasting the membership between the cuboid blocks and the multithreads in the spatial domain and the thread IDs of the adjacent cuboid blocks to all the threads.
As shown in fig. 2, the block structure layout of the base layer, i.e., the first layer, is illustrated as a blue-colored frame in fig. 1 by clv, and the entire area is covered with a large rectangular block according to the size of the spatial domain; the second layer (clv ═ 2 in the figure) covers the area of space marked by the model with smaller cuboid blocks; the third layer (clv-3 in the figure) and the above layers (clv-4 in the figure) cover the space area of the model mark with a smaller cuboid than the layer below.
And step S3, subdividing the model meshes one by one.
After the multi-tile structure layout is created, discrete meshing may be performed on the model read into the data structure. The subdivision process is carried out by geometric models. The essence of mesh generation is to perform discrete processing on the three-dimensional continuous space where the model is located. The mesh generation of a single model is started from a basic layer, and then the rest layers are analogized. The model is subdivided by the base layer with larger mesh size, and the model is subdivided by the other layers with smaller mesh size. The specific subdivision algorithm is shown in the following figure 3, and the following subdivision steps are all block by block and are calculated in a multithread mode at the same time.
And (4) subdividing the model meshes one by one, and subdividing the single model one by one as shown in figure 3.
In the embodiment of the invention, the subdivision of each model comprises the following steps:
firstly, assigning an initial grid attribute value of 0 to all discrete points in a whole domain;
secondly, solving intersection lines of the three-dimensional contour line of the model layer by layer in the Z direction and storing the intersection lines; solving the intersection points of the intersection lines in the Z direction layer by layer in the Y direction again, and storing the intersection points in pairs;
and finally, solving the intersection points of the small sections formed by the intersection point pairs solved in the Z direction layer by layer in the X direction, and marking the grid attribute values of the intersection points as entity numbers corresponding to the current model, such as 1, 2, 3 and the like.
Step S4, the generated mesh is checked and repaired.
Because of errors or grid division precision errors caused by the fit clearance of the three-dimensional geometric model among the multi-model files, clearance units exist after grid division, the clearance units have no corresponding entity numbers, the initial attribute values are still kept, and serious calculation errors are caused; meanwhile, in the mesh generation process, due to the fact that the selected minimum mesh size is too large, a partial region of the model can generate a discontinuous mesh structure, and in flow calculation, the accuracy of flow calculation is seriously affected by an isolated region caused by discontinuous mesh units.
Therefore, after the mesh generation is finished, the quality of the generated mesh is checked and repaired by adopting the step. The checking and repairing of the grid quality are carried out on the basis of the grid generated by the highest layer, and the following steps are specifically adopted:
checking and repairing the generated grids, wherein the checking and repairing of the quality of the grids are performed on the basis of the grids generated by the highest layer, and the method comprises the following steps:
if a plurality of grid cell attribute values are zero but are surrounded by the rest of the entity cells, the grid is considered to be a gap cell;
if a plurality of cells adjacent to the gap cell are marked as entity cells, and entity cells with the same grid attribute exist in the range of two layers of cells around the entity cells, the cells are regarded as non-continuous isolated cells. As shown in fig. 4 (left diagram), the discretely distributed dark red grid is identified as non-continuous isolated cells.
If the non-continuous isolated units exist, subdividing again by adopting smaller grid size until no non-continuous isolated units are generated; or directly assigning the volume fraction below 1% to the labeling attributes of the surrounding lower priority entity grid.
And step S5, outputting the node information to the grid file.
Outputting node information to a mesh file, comprising: and outputting the node space position information and the entity mark attribute information to a grid file for subsequent calculation.
Specifically, the mesh subdivision is substantially discrete in a spatial domain, and a discrete process is to assign different entity label attributes to each discrete point (Xi, Yj, Zk) in the spatial domain. And after the mesh generation is finished and no mesh quality problem is detected, outputting the node space position information and the entity mark attribute information to a mesh file for subsequent calculation.
According to the automatic mesh generation method for the casting process modeling and simulation application, which is disclosed by the embodiment of the invention, aiming at the automatic mesh generation method for the casting process CAE, the method adopts a multilayer encryption technology, can be used for carrying out automatic mesh generation, mesh quality inspection and bad mesh restoration on a three-dimensional model of a mold, greatly reduces the total calculation mesh amount on the basis of improving the approximation degree of the mesh model to a geometric model, and improves the calculation efficiency. The method adopts a high-performance parallel multi-layer block structure self-adaptive mesh generation algorithm; grid inspection and repair method. According to the invention, under the condition of a multi-layer block structure layout, the total grid number is reduced in order of magnitude under the condition of the same subdivision precision (the approximation degree of a three-dimensional geometric model in a spatial domain), and on the premise of keeping the calculation accuracy, the subsequent calculation efficiency is greatly improved; the mesh generation, the check and the repair are all automatically completed by the method provided by the invention without the participation of users; the grid division process is completely parallel, through measurement and calculation, the division time of a single complex model is within 10s, compared with the traditional finite element or finite difference discrete method, the use difficulty of a user is greatly reduced, and the division time is shortened.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made in the above embodiments by those of ordinary skill in the art without departing from the principle and spirit of the present invention. The scope of the invention is defined by the appended claims and equivalents thereof.