trouble importing STL files

Submitted by msandli on Tue, 08/21/2012 - 00:57

I'm hoping I'm encountering a common enough fault that someone will be able to help me without even seeing my code. I'm trying to import an STL file from solidworks into a LIGGGHTS script. Basically, I've substituted the mesh.stl file in the meshGran examples for my own file. Whenever I run the simulation, the output file says "Import and parallelization of mesh cad containing 0 triangle(s) successful", even though while saving the ASCII STL file from Solidworks, it says my model has 72 triangles (or something like that), and when I try to open the STL file in solidworks, I get the shape I'm looking for.

After watching the particles fall off the bottom of the screen for the 100th time, I'm getting short on ideas. As I said, the only change I know that I've made is replacing "mesh.stl" with my own file (the output file says it detects a solid body in my STL file, so it knows that something is there). Is there something special about the mesh.stl supplied with this tutorial? When I open it in solidworks, I can't edit it or even measure it, so I don't know a lot about it. Has anyone had this problem using solidworks before? Or is there some other tweak I need to give LIGGGHTS to make it recognize that my stl file is more than 0 triangles?

Thanks

msandli | Tue, 08/21/2012 - 02:11

Here is the input script:

(start)
# Wall import from CAD
atom_style granular
boundary m m m
newton off
atom_modify sort 0 0

communicate single vel yes
units si

region reg block -0.01 0.51 -0.06 0.01 -1.0 0.01 units box
create_box 1 reg

neighbor 0.02 bin
neigh_modify delay 0

#Material properties required for new pair styles

fix m1 all property/global youngsModulus peratomtype 5.e6
fix m2 all property/global poissonsRatio peratomtype 0.45
fix m3 all property/global coefficientRestitution peratomtypepair 1 0.7
fix m4 all property/global coefficientFriction peratomtypepair 1 0.05
fix m5 all property/global characteristicVelocity scalar 2.

#New pair style
pair_style gran/hooke/history #Hooke without cohesion
pair_coeff * *

timestep 0.00005

fix 1 all nve/sphere
fix 2 all gravity 9.81 vector 0.0 0.0 -1.0

#import triangular mesh
fix cad all mesh/surface file periodic_structure.stl type 1 move 0. 0. 0. rotate axis 1. 0. 0. angle -90. #temperature 100.

#use the imported mesh as granular wall
fix granwalls all wall/gran/hooke/history mesh n_meshes 1 meshes cad

#insertion region (for deprecated pour/legacy)
#region bc block 0.21 0.25 -0.045 -0.005 -0.015 -0.00 units box

#definition of insertion face
fix inface all mesh/surface file insertion_face.stl type 1

#distributions for insertion
fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 2500 radius constant 0.005
fix pdd1 all particledistribution/discrete 1. 1 pts1 1.0

group nve_group region reg

#particle insertion
fix ins nve_group insert/stream seed 5330 distributiontemplate pdd1 &
maxattempt 100 nparticles 10000 particlerate 1000 overlapcheck yes all_in no vel constant 0. 0. -1.0 &
insertion_face inface extrude_length 0.02

fix ts all check/timestep/gran 1000 0.1 0.1
compute 1 all erotate/sphere
thermo_style custom step atoms ke c_1 f_ts[1] f_ts[2] vol
thermo 1000
thermo_modify lost ignore norm no
compute_modify thermo_temp dynamic yes

#dump commands
dump dmp all custom 300 post/dump*.meshGran id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius
dump dmpstl all mesh/stl 300 post/dump*.stl
dump dmpics all image 300 post/dump*.meshGran.jpg type type adiam .08
#insert particles
run 10000 upto
unfix ins

#run
run 40000 upto
(end)

As I said, the only thing I *think* I did was change the file for the #import triangular mesh line, called here "periodic_structure.stl".

I'm not sure how to upload the stl file. Should I just cut and paste the vector matrix? I don't see an option on these forums to upload a file, which I would imagine would be easier. Sorry if it's an HTML thing, I don't know much about that language.

cstoltz | Tue, 08/21/2012 - 04:03

To upload a file, I think you may have to create a new thread. If you can add it to this thread, I'm not seeing the option to do so either. If you do upload the file, please also upload the file 'insertion_face.stl'.

For the deck you've uploaded (without seeing the STL file), the only thing that jumps out at me is the boundary statement where you're using shrink-wrap boundaries. I've had trouble with these in the past and never did figure out how to resolve the issue. Can you try using 'boundary f f f' instead and see if it will work?

Regards,
Chris

msandli | Tue, 08/21/2012 - 14:27

Tapan,

Thank you for the help, I've uploaded the files to my original post. Again, insertion_face came with the meshGran tutorial. Periodic_structure was made with solidworks 2012 if it makes any difference. I've also uploaded an output file, so you can see a few lines down where it says it detects a solid body, but a few lines after that, it says it imported 0 triangles.

Chris,

I switched to the f f f boundary, and the only thing that changed is that my region now stays locked in place. Before, as the particles would fall, they would make my region expand with them. Now, they just leave the region. Can I make the imported mesh appear in the simple dump jpg images? Or do I have to hook up to some external processor? I understand I can dump the stl files seperately, but I would like to have the walls and the particles together.

Thanks everyone for your help.

cstoltz | Tue, 08/21/2012 - 15:28

Okay, there are a few problems here that are causing the job to not run correctly:

1) There is a rotation applied to the geometry that pushes it outside the defined region of the simulation. This appears to be why it is failing to load.

2) When I took out the rotation and expanded the region, the geometry and insertion face loaded properly, but the insertion face is not lined up to be able to put particles into your slot hopper. You need to move it into the proper location.

3) You need to either specify the domain for the simulation tight to the geometry and put in periodic boundaries, or put side walls on your geometry. Otherwise, the particles will just fall out the sides of your slot hopper.

4) The dump command for the jpg files doesn't work as written. I suggest using the dump commands for the particles and STL as written in the stock deck and then post-processing w/ Paraview (or use something like Meshlab if you just want to see the STL's).

Regards,
Chris

msandli | Tue, 08/21/2012 - 18:03

something that might answer 1-3: which way do the coordinate axes point in LIGGGHTS? I assume its positive X towards me and to the left, positive Y to the right, and positive Z up, but I can't find in the manual where this is specified. I also noticed how, when I pulled up my stl in solidworks, it was laying on its side: even if I would have had it correct, the particles would've just fallen through. Also, is there a way to fix the origin, and then I can move the meshes? I couldn't find this option in the list of fix styles, but I very well could have missed it. Or is the origin "fixed" according to what is in the stl files, and I need to move it accordingly?

Also, periodic boundaries are the eventual goal, but until I can get the particles to fall into anything (which I think will be helped by your other suggestions), I will have to worry about that later.

As for 4, I will have to worry about that later as well. As you can see, I'm still learning this software. I think once I get it going, I will be able to tell if I'm doing it right or wrong with simple jpg images. I will eventually want to move onto more sophisticated software, as I'd like to do heat transfer simulations with this, but when that time comes, I'm sure you'll see more forum posts from me.

Again, thanks so much for the help. I will report back with any progress/digress.

msandli | Wed, 08/22/2012 - 02:09

I've been concentrating on just getting my stl file to upload correctly. I was just able to get all triangles to upload, and the shape and orientation were correct in the stl dump file.

The stl file (and, I'm assuming, the original solidworks file) has an origin associated with it. If I were to use the move or rotate or etc commands, is this the origin that LIGGGHTS will use? and will it initially put it at the origin of my region?

also, just curiously, I had to make my region over 1000 units si in all directions. I thought si used mks, and my drawing definitely isn't supposed to be nearly 1000 m long....

cstoltz | Wed, 08/22/2012 - 04:24

If you look at the STL file in a text editor, you can get an idea of the dimensions and location of the geometry. It will be saved relative to the origin in SolidWorks, and then loaded relative to the same origin in LIGGGHTS. Keep in mind that if you save it in units of mm in SolidWorks, and then specify units of SI in LIGGGHTS, the geometry will be imported at a size 1000x what it should be. In this case, either save it from SolidWorks in SI dimensions, or use the scale option to scale down your geometry when importing into LIGGGHTS.

Chris

tapsab | Tue, 08/21/2012 - 04:21

The author of the thread (msandli) should be able to upload attachments to their original comment (Just hit "Edit" that appears next to the title of the thread and an option to attach files should be there at the bottom of the original comment)

You wont be able to upload the file with .stl extension, just change it to .txt and whoever wants to use it can change it back to .stl after downloading it.

Best,
Tapan