Reading velocities from external file during run

Submitted by davidf on Thu, 05/29/2014 - 18:50

Dear community,
I was wondering if it's possible to tell LIGGGHTS to read from an external file that containes coordinates (x,y,z) and velocity components (vx,vy,vz),
so that the particles will experience a force (with "fix add force") that will be dependent on their coordinates. For example, if my particle is located
at (x1, y1, z1) at time t1, LIGGGHTS will check the file for the closest coordinate and the corresponding velocity to act on the particle ?

sbateman | Fri, 05/30/2014 - 17:26

It's not clear what exactly you are trying to accomplish.

If you want to directly set the particles' velocities (i.e., not add a force), then take a look at "fix move" and atom-style variables. You can use some variables to write a function to compute what a particle's velocity should be based on its position.

If you want to actually add a force to the particles (i.e., not a set velocity), you can do that with "fix addforce" or "fix setforce".

If you have a dump file with particle trajectories from a simulation you have already run, take a look at the "rerun" command.

For anything more complicated, you will probably have to code up something yourself. It's not too difficult to add another "fix".

davidf | Mon, 06/02/2014 - 08:22

Thanks for your comment.
I have results from a separate CFD calculation: the velocity field of the gas.
I'm trying to "couple" it to the particles motion by reading the velocity data from the file and then calculating the drag force on each particle as a function of its position in the system
according to the CFD data (which, again, is positions and velocity components).
So, basically this will be a one-way coupled simulation.

Hope this makes sense

Daniel Queteschiner | Tue, 06/03/2014 - 11:52

This is something that probably won't work out of the box and will require some custom code. I've done something similar a couple of months ago.
My solution involved adding a new compute command that calculates per atom variables (like e.g., compute displace/atom) representing the drag force on each particle and then using the fix addforce or fix setforce commands to apply the force on the particles.
If you want to go that way, your compute should
1) load the CFD data from file (probably a new one every few timesteps; I added a compute_modify to change the input file every X timesteps (see also 'every' parameter of run command))
2) locate each atom in your CFD volume
2a) interpolate CFD data at particle's position
3) calculate drag force (e.g. using Schiller-Naumann)