How-To prepare a simulation using fix insert/stream/predefined in Aspherix®
Description:
This text describes how to generate and write a packing that can be used in a simulation that uses a fix insert/stream/predefined.
Introduction:
A simulation that uses a fix insert/stream/predefined requires two preceding simulations. Thus, a three step procedure will be described in the following:
Step 1: Extrude a planar mesh, generate particles in the resulting volume and compress them
Step 2: Write out the data of the compressed particles in a file
Step 3: Create a simulation that inserts these new particles
Detailed description:
Step 1:
The purpose of this step is to create a volume in which particles are loosely inserted at first. Then, this volume is compressed to create a dense particle packing.
To create a such a volume the insertion face that will be used in the final simulation in step 3 has to be extruded. In order for this to work it is required that the insertion face is planar. In the input script you want to create a fix mesh/surface with option extrude_planar, e.g.
fix extrusion all mesh/surface file meshes/plane.stl type 1 extrude_planar 0.1
This will extrude the mesh in the opposite sign of the normal of the insertion face by 0.1 unit (meter). This command should be followed by
run 0
in order to generate the mesh. To use the generated walls they need to be added to a new fix mesh/surface by using the fix option, e.g.
fix side_walls all mesh/surface fix extrusion type 1
unfix extrude
This will use the generated walls of the fix with id extrusion to create the appropriate mesh. And remove the original insertion face.
Two compress the particles that will be inserted later, two new meshes should be created. One at the original position of the insertion face and one offset by the value used before in the opposite direction of the insertion face normal (assumed here to be (0 0 1)). There are different ways to move meshes, in this case we will use mesh module servo as follows:
fix compress1 all mesh/surface/stress/servo file meshes/plane.stl type 1 reference_point 0 0 0 stress on com 0 0 0 ctrlPV force axis 0 0 -1 target_val 100 vel_max 1 kp 5
fix compress2 all mesh/surface/stress/servo file meshes/plane.stl type 1 move 0 0 -0.1 reference_point 0 0 0 stress on com 0 0 0 ctrlPV force axis 0 0 1 target_val 100 vel_max 1 kp 5
fix walls all wall/gran model hertz mesh n_meshes 3 side_walls compress1
compress 2
The final command sets all current walls to solid walls that use a certain contact model.
The last part of step 1 consists of adding particles to the simulation. This can be achieved by creating a new mesh/surface with the insertion face and using a fix insert/stream to create a loose packing inside the generated volume.
fix ins_face all mesh/surface/planar file meshes/plane.stl type 1
fix ins all insert/stream seed 123457 distributiontemplate pdd1 nparticles INF overlapcheck yes all_in yes orientation random vel constant 0 0 1 particlerate 100 insertion_face ins_face extrude_length 0.99 parallel yes save_template yes
Note that an appropriate particledistribution needs to be created before. The particlerate determines how many particles will be attempted to be inserted. The extrude_length parameter should be equal to the extrusion length used above (0.1) minus two times the bounding box of the inserted particle templates (i.e. radius of the spheres, length of fibers, etc.). Note that the save_template keyword with “yes” (which is also the default) is mandatory for Step 2 to work.
run 1
unfix ins
Creates the particles and removes the insertion. The latter is required as we do not wish for more particles to be inserted during the compression.
Now a run command should follow that allows the particles to be compressed until the desired packing density is reached. Again there are several options on how to achieve this. One way is to run the simulations for short time intervals and check at the end of each interval whether the compressive plates still move. This can be achieved by using variables and the output of the mesh module servo which allows the extraction of the current mesh position.
At the end of the compression a restart file should be written using
write_restart restart/post_compression.data
and the positions of compress1 and compress2 should be written to a temporary file, e.g.
print "variable posXcompress1 equal ${f_compress1[7]}" file tmpFile.txt
print "variable posYcompress1 equal ${f_compress1[8]}" append tmpFile.txt
print "variable posZcompress1 equal ${f_compress1[9]}" append tmpFile.txt
print "variable posXcompress2 equal ${f_compress2[7]}" append tmpFile.txt
print "variable posYcompress2 equal ${f_compress2[8]}" append tmpFile.txt
print "variable posZcompress2 equal ${f_compress2[9]}" append tmpFile.txt
Step 2:
While the other steps can be run in parallel, this step needs to run on one processor only. The restart file from Step 1 is read using
read_restart restart/post_compression.data
Next, the particle templates, the particle distribution, the ins_face and the ins fixes from Step 1 are added to this input file (using exactly the same options as in Step 1). The last two lines of the input file should be
fix pack_writer all packing/prepare file restart/stream.data fix_insert ins mesh_shift 0 0 0.123 insert_extend 0.023
run 0
The file property is the file name to which the data will be written and fix_insert indicates the fix insert/stream with which the particles were created. The property mesh_shift should indicate by how much the wall was shifted that was originally on the position of the insertion face. In our case this would be the position of compress1 which can be accessed by (f_compress1**7*, f_compress1**8**, f_compress1**9**)*. The property insert_extend contains the distance between the two compressive plates. In our case this would be the distance between compress1 and compress2 which can be computed using the variables saved in “tmpFile.txt”. The run command calls the actual writing routine and should not be omitted.
Step 3:
With all the work done in the previous steps, the data is now ready to be used in a real simulation. Note that the particletemplates and particledistribution used in the insertion need to be exactly the same as in the previous steps. The key fix is of type insert/stream/predefined, e.g.
fix ins all insert/stream/predefined seed 123457 distributiontemplate pdd1 nparticles 200 vel constant 0. 0. 1. file restart/stream.data move 1. 0. 2. volume_fraction 0.018
Note that vel, the insertion velocity can currently only be constant and needs to be a positive multiple of the insertion face normal. The file property points towards the file written in Step 2 and the move option allows to move the insertion face inside the domain. The volume_fraction keyword finally permits the reduction of the particle volume fraction to a desired value which cannot be higher than the maximum volume fraction achieved in Step 1.
The remainder of the input file can be as every other input file including dumps, walls, etc.
Questions?
If any questions remain, do not hesitate to contact us.