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

Dear Experts!

  1. I want to generate a particle input file of about 59000 for DEM-SQP.? How I can generate it
  2. How to specify the orientation of particles in the domain? i.e I want to place initially all particles at 30 degree or 60 degree

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

ps: It would be nice if the settings from the GUI could be used directly to specify the orientation, without copying to the particle_input.dat. However, when the particle_input.dat is used, settings in the GUI are ignored, which can lead to confusion. Only the values in the particle_input.dat are used, except for the bounding sphere diameter, which is used for particle scaling… if the d_p0 in the mfix file does not match the specified bounding sphere diameter in particle_input.dat you will get odd results. We are working on improving this for a future release

1 Like

Dear @cgw
Thanks for insight.
I run DES_Particle_Generator from MFiX tools for 2D particle input file. But still I cannot understand how to get and declare(particles properties) data in version 3 file and run it to generate particle input file.
Your kind suggestion will be appricated in this regard.

It’s all in that 38-line header. Have you read this? SQP method using particles_input. data imports the particle position, but cannot be successfully read - #5 by cgw

The solver expects the data to start on line 39 so the header must be present and the first line must say Version 3.0

The table which starts with

Variable       Read(T/F)     Default value (when Read=F)

controls whether variables are read from the file (column must be present) or whether a default is applied to all particles (no column for that variable).

Here’s a full V3 particle_input.dat file which you can examine:

https://mfix.netl.doe.gov/forum/uploads/short-url/omGPgpFzQMd5e8ukRgSB1hZqMv4.dat

You basically want to take the first part of that file, set the values in the header correctly (# of particles, default values, etc) and then replace the data in that file with the data you have generated.

Dear @cgw
When I repalced the version 3 data into Pgen file (tools from mfix directly)


then following error prompt.

Still I am in learning face to generate particle input for dem-spq

The instructions I gave you were for how to create a particle_input.dat file for MFiX. You didn’t mention anything about tools/DES_Particle_Generator

That code has not been updated since 2006 and will create a “version 1” particle file, which is not suitable for DEM-SQP. I suppose you could use it as a starting point, but if you use something like the Python script above to generate particle positions, you won’t need to use DES_Particle_Generator at all.

If you do use it you will still have to attach the “Version 3.0” header.

The PGen file is input parameters to the DES particle generator, it is NOT the particle_input.dat file.

2
0
400
0.2
2.7
10
15
0.4

!
! This is a sample input file for the particle generator
!
! The above inputs are as follows:
! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
! 	dimension
! 	random distribution (if 1) or alligned distribution (if 0)
! 	number of particles
! 	particle radius
! 	particle density
! 	xlenth of the domain
! 	ylenth of the domain
! 	zlenth of the domain (if 2D enter 2*radius

So if you are using DES_particle_generator, you need to specify the parameters in the pgen file, run the particle generator, then turn the output of that into a “Version 3.0” particle_input.dat file for MFiX. But I would probably leave DES_particle_generator alone and just use a little Python script, as described above.

1 Like