Ansys Learning Forum › Forums › Discuss Simulation › LS Dyna › Discrete Element Method (DEM) › Reply To: Discrete Element Method (DEM)
Hi,Â
Yes, LSPP has no control over the number of particles, however, there is a workaround with SPH and then with conversion, you can first create an SPH in place of DES and then use the following sudo routine to replace the SPH with DES . It would be easier if you isolate the SPH as a separate include file Â
READÂ input_filenameÂ
SET output_filenameÂ
SET density TO 1000
OPEN input_file FOR READING
OPEN output_file FOR WRITING
FOR EACH line IN input_file:
 IF line STARTS WITH "*ELEMENT_SPH":
WRITEÂ "*ELEMENT_DISCRETE_SPHERE_VOLUME" TO output_file
WRITE header_line TO output_file
ELSE IF line STARTS WITH "*":
CONTINUE
ELSE IF line IS NOT EMPTY AND NOT COMMENT:
SPLIT line INTO data SET mass TO FLOAT(data[2])
 // Calculate volume, radius, and inertia
SET volume TO mass / density
SET radius TO ((3 / (4 * PI)) * volume)^(1 / 3)
SET inertia TO (2 / 5) * mass * radius^2
// Format outputÂ
WRITE formatted_output TO output_file
CLOSE input_file
CLOSE output_file
END
Cheers, RamÂ