Filling an imported STL with boundary particles

edited November 2016 in DualSPHysics_v4.0
Is there a reason why [ setdrawmode ] would be incompatible with an imported boundary object? I imported an STL [ drawfilestl file="path/to/my/object.stl" ], but neither [ setdrawmode mode="full" ] nor [ setdrawmode mode="solid" ] seem to have any effect on the boundary object imported from STL, which is being drawn as if [ setdrawmode mode="face" ].

The imported STL is being used as a DEM object, so for "relativeweight" purposes, it's quite important that the object isn't hollow.

Any guidance would be most appreciated.


  • That is why in the STL you only have information of faces. It is an issue of STL.
    If you want to fill an external object you can use fillbox after drawfileXXX

  • Thanks for your prompt reply, Alex! I was able to get it working by doing the following (using the [ fillbox ] syntax outlined on Page 44 of XML_GUIDE_v4.pdf as reference):

    1.) Pick a seed point inside the STL geometry. I used ParaView's "cube axis visibility" to find the bounds of my object and selected a point somewhere close to the center of the interior space.
    2.) For [ modefill ], I used "border|bound"
    3.) For the points, I selected points slightly below the minimum x, y, and z determined by ParaView's "cube axis visibility"
    4.) Size should be at least, but preferably slightly larger than, ( x_max - x_min ), ( y_max - y_min ), ( z_max - z_min ) as calculated from the confines visible with ParaView's "cube axis visibility"

    Following these steps filled my STL with boundary particles as desired.
  • Thanks for posting this Richmond!!!
    Really appreciated for other users!!!

  • I have the same issue. The code XML is:

    bound | border

    but it doesn't work...can you hel me to found the problem?
    Thank you in advance
  • setmkbound mk="1" /
    drawfilestl file="Esempio.stl"
    fillbox x="0.3" y="10.5" z="0.3"
    modefill bound | border /modefill
    point x="-0.5" y="-0.5" z="-0.5" /
    size x="69.11" y="11" z="20.61" /
  • Hi Davide,

    I'm not sure how to help without the STL, but usually it's a problem of the point coordinates not being defined correctly. If you want to know which values to use for x, y, and z for point, you can do this easily with ParaView.

    In Paraview, first load in your stl file, then apply the "Integrate Variables" filter. Open a new window (click the + sign next to "Layout #1") in Spreadsheet View, and then visualize the IntegrateVariables filter. The result should give you a Points field, which gives you the x, y, and z of the centroid of your object. Use these numbers for your point coordinates in your CaseXML and see if that helps to fill the STL with boundary particles.

    Best of luck,
  • Thanks for the answer Nick, I did what you told me but nothing. How can i post the .stl file? Thanks in advance
  • This "fillbox" approach is good for only if you have one or two DEM objects. What if you need to model hundreds of them? There should be a better way to do it.
  • Hi all,
    I have a question about the modefill option,
    if I use the modefill void /modefill my .stl geometry fills neatly. But when i use modefill bound /modefill or modefill border|bound /modefill it does not fill at all.

    Does someone know how i can fix this?

    Thanks in advance,

  • @Jsalet have you tried taking a look at the xml documentation? It can be found in the DualSPHysics folder.

    It is hard to pinpoint exactly what goes wrong without knowing your case. Remember if you use modefill void you fill every empty void inside a specific domain which you have chosen to intersect with the fillbox as shown in the picture.
  • Thank you @Asalih3d for your quick reply.

    I am modeling a dam break with a bridge which should start moving at certain wave heights. including DEM coupling. I loaded the bridge geometry using a .stl file. Though I found out that the geometry is hollow and therefore the deck started floating.

    Trying to use the fillbox option which i found indeed in the XML guide, and here on the forum, I thought i should use the modefill bound option so is could give it the proper density (of concrete) but this, I did not manage to get it working.

    I managed to run it once with the void modefill. The object has a higher total mass since it is not floating.
    Does this filled area now have the same density as the mkbound which it filled?

    Now I still do not understand what the different modefill options physically do, since i thought the void option would keep it an hollow object. And the bound option would make it a rigid filled object. But i think this thoughts are not correct.

    I attached how i used the fillmode in my case now.
    Though i am still not sure if this is the right way.

    Thanks in advance,
    kind regards
  • <modefill> border | bound </modefill> should work for filling your STL with boundary particles. Are you certain that the coordinates of the seed point for your fillbox are within the hollow region of your STL at 1:1000 scale?

    Re: "Does this filled area now have the same density as the mkbound which it filled?" ...yes, that's right, assuming you have assigned a rhopbody to particles with the same mk (in the <floatings> section). For what it's worth, I recently learned that if you know what the mass of the object should be, you might want to explicitly define it using massbody because mass will not change with dp during the simulation.
  • @Jsalet

    Yes, if we take a look at your provided code we see that in the first picture:
    1. You define the object as boundary, number 8
    2. You only want to put particles on the faces of the stl
    3. You import it and name it
    4. You change the scale to match with SI units I assume
    5. You reset the shape out fil
    6. You define a fillbox with starting point x y z (9 0.2 and 0.36)
    7. You define that - everything inside this fillbox, sourrounded by the walls of the stl, IF it is void insert particles - NOTE that since you are inserting these particles under "mkbound="8"", it will have the exact same properties, ie same density.
    By the way, do as @NWRichmond says about using massbody option. This is especially important since the mass of an object in DualSPHysics changes depending on initial particle distance - by defining mass instead of density no mistake can happen. Also as he said, if you have scaled your stl the fillpoint might be wrong - open in ParaView and try to correct it - just make sure the fill point is inside your geometry and that the fillbox overlaps the geometry you want to be filled.

    If it still does not work - start from the beginning trying to fill a simple square until you discover your mistake.

  • @NWRichmond
    Thank you for your reply.
    I am quite sure my seedpoint is correct since it fills when I use the " void " option but not when I use the border|bound option. That is exactly what I find strange in this case and I did not understand. Though I checked it again in paraview and it should be on the correct location.

    You are correct in the steps I take.
    Only in step 2. I want to put particles in the whole geometry but when uploading the stl file it is needed to use the fillbox since it is just putting particles in the face of the geometry. (I could use the modefill solid or full when calling a .stl, but then it does the same as when i use the modefill face, if I am correct).

    But now, if the density and therefore the mass of the object is correct when using void, I think this part of the model is working properly now. Though, I think there is a difference in compressibility between the void and the border|bound option.
  • the option drawfilestl only creates particles on the faces... since STL only has that information (faces)

    if you want to fill the interior with boundary particles of the same mk as the STL faces, then just add fillbox with seed point inside and limits of a box beyond the limits of the STL, however you have to use modefill VOID modefill since you want to create particles in the VOIDs insided the STL

    about correct mass or density: it is hard that the particles you create can discretize with high accuracy the exact geometry of the external model, so that the approximated mass computed automatically will converge to real value using very very high density
    Therefore, the best way to proceed is to impose the known mass value (massbody) in the XML

  • That explains a lot.
    I will use the massbody.

    Thank you very much for your help!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!