How to write particle input file for DEM-SQP and specify orientation

Please see the SQP Megathread where this is discussed. You will need to use a “Version 3” particle_input.dat which is not yet covered in the MFiX documentation but is discussed in that thread.

I would use a Python script to generate the particle positions. Numpy is very powerful and can do a lot of what you want with very little code. What kind of arrangement are you trying to produce?

For example here’s some code to produce a cubic lattice:

import numpy as np
xs = np.linspace(-1,1,21)
ys = np.linspace(-2,2,41)
zs = np.linspace(0,0.5, 11)
xyz = np.meshgrid(xs, ys, zs)
xyz = np.stack(xyz, axis=3).reshape(-1,3)
f = open("/tmp/grid.txt", "w")
np.savetxt(f, xyz)

will get you a grid of 21x41x11 points covering the range from (-1,-2,0) to (1,2,0.5). You can also use itertools.product as described in the linked article.

You will have to append this data to a Version 3 header, which you can copy from the example in the linked forum thread.

Then, to get the orientation desired: set the orientation quaternion. If all particles are oriented the same way you can use a constant value in the header, otherwise change F to T and specify the quaternion values for each particle (additional columns)

SuperDEM_quaternion F 1 0 0 0

Change 1 0 0 0 to whatever you want - you can use the Superquadric Designer for this - select Rotate object, move the object to the desired angle, then copy the quaternion values from the panel below:

1 Like