gpusph
gpusph copied to clipboard
about the function addSTLmesh()
Hello everyone and @Oblomov : I want to use addSTLMesh() function to import an boundary file in stl format. like this: GeometryID topo_stl = addSTLMesh(GT_FIXED_BOUNDARY, FT_BORDER, Point(0,0,0),"boundary.stl");
But I got "failed to open STL ".
So I want to know which format of stl file can be used here. (the binary or ascii format? Must it be closed bounary of stl file?)
Could someone share a example stl file and the command? That will be great.
I think the problem result in the stl format.
Thanks a lot.
Hello @Dongxueyang
the error failed to open STL
indicates that the file is not being found, so this is not a file format problem, but a path issue (since you are not specifying a path, the .stl
file should be in the same directory where you're starting GPUSPH from).
Concerning the format, GPUSPH currently only supports uncompressed binary STL files.
@Oblomov Thanks a lot. The problem is the path of stl file. I give the right path of the stl file and import stl file successfully.
And I got another error like this: Generating problem particles... FATAL: STLMesh::Fill not implemented yet
And I have find the error accurred at this function:
int STLMesh::Fill(PointVect&, double, bool)
{throw runtime_error("STLMesh::Fill not implemented yet"); }
So could you help me the reason of this error? Is it related to the domain of the stl file?
Thanks a lot. Dong
Ah, this is a bit of a bother. Basically, the only kind of filling we support for the STL mesh currently is by creating a particle for each vertex. This works (for FT_BORDER
) when the boundary model is single layer (e.g. Lennard-Jones or Monaghan-Kajtar). However, for multi-layer boundary models (such as the DYN_BOUNDARY
and DUMMY_BOUNDARY
models), we need multiple layers of particles to materialize the boundary, and for the STL this is not supported at the moment, since there isn't an “obvious” way to do a filling towards the inside of an STL mesh that properly respects the chosen inter-particle spacing.
Can you please provide some additional details about how the geometry of the STL is (open, closed, how is it oriented) and how you intend to use it? We might be able to devise an alternative solution.
@Oblomov Thanks a lot. I change the boudary type to LJ_BOUNDARY and set the number of layer to one, and then I can run the simulation successfully. I check the reusults in vtu format. I can see the sph particles located the vertexes of stl meshes. So thanks for your help on this question.
After that, the boundary in stl file is an open boundary( it just like a bottom of the domain but with a complex geometry, not a plane). Now I want to set some fluid in this domain, of which the bottom is the open stl file, as follows:
How can I add the fluid. I just want to keep the fluid on top of the stl boundary and delete the part of bellow the stl boundary.
Could you give me some advice to add this kind of fluid. (boolean operations?)
Thanks a lot.
Dong
@Oblomov I find that the boundary generated by stl file. Only initialize sph particles at the vertexes of the stl meshes, which will have great effects on the simulation. When I add some fluid to the domain, I must set the space between fluid particles is similar to the stl element, so that there will not be fluid particles crossing the boundary. But this means I must change the stl mesh when I want to change the space of the fluid particles. Is there other ways to solve this problem? If I want to generate a river channel boundary, which format of the boundary will be good and convince to use? the pointclouds or DEM file? Hope your reply, thanks.
Dong
@Dongxueyang the handling of irregular boundaries such as in this case is in general non-trivial. GPUSPH has limited capabilities to handle “arbitrary” meshes. In particular, it doesn't currently handle things related to their filling (“above”, for the fluid, and “below”, for the multi-layer boundary models). This is due to the complexity (in the general case) for the inside/outside test for a mesh.
Moreover, as I understand it, you also have the requirement to dynamically change resolutions, which would require also the possibility to coarsen/refine the mesh. These are very complex operations, and while their implementation in GPUSPH is a possibility (assuming someone is willing to work on it), for the moment it's better delegated to external tools (such as MeshLab).
Given your particular application (bathymetry) and the requirement to dynamically change resolution, I think you should consider using a DEM (Digital Elevation Model) instead. The main restriction in the DEM formats that GPUSPH supports is that their xy projection must be a regular grid. Judging from the pictures you shared, however, this doesn't seem to be too strong a restriction in your case, as the mesh you have seems to be based on a regular point distribution in the x and y directions. The supported DEM formats are GRASS ASCII grid, VTK STRUCTURED_POINTS
in ASCII format, and gridded XYZ files. (I think it should be possible to add support for STL files such as yours but I'd need a sample to work with).