Set velocities for a dynamic group...


I’m conducting smoothed particle hydrodynamics simulations. I’d like to create a (static) region within the domain whereby all particles within that region have a prescribed velocity. Obviously, particles will flow into and out of that region, so a dynamic group is in order (I believe).

I’ve created the region, then created a dynamic group of particles within that region (which updates every timestep). Now, I’m having trouble assigning the velocity for that dynamic group. I tried the fix_move command, but that does not work with dynamic groups. I tried the velocity command with the set keyword, but it does not seem to do anything. Does the velocity command work every time step? Here are the related commands I have used:

region vregion block 2.0 2.3 0.2 0.8 EDGE EDGE side in units box
group vpush dynamic all region vregion every 1

velocity vpush set 0.01 0.0 0.0 units box

Any help with this situation would be much appreciated! Thanks.

Velocity only acts once, when it is encountered in the script. I am not knowledgeable enough about fix move to know whether or not it can act on a dynamic group. I know fix addforce can, but I don’t know if adding a force rather than setting a velocity will achieve the same effect in your case.

Yes, the addforce fix does work with dynamic groups, and I have implemented it. In a broader sense, it is not as desirable a solution as a constant velocity region. I want to implement such velocity regions near inflow and outflow boundaries (particles will be displaced from the outflow boundary to the inflow boundary with displace_atom command). This will mean that I need buffer regions of constant velocity to avoid free surface effects.

So, it would be great if I could prescribe the velocity in a dynamic group, or in a static region.


Paul, how do you plan to handle the case of atoms that are outside the dynamic group? If they are not ‘moved’ by the fix anymore due to be dropped from the dynamic group, they will not move at all unless you have a second fix with a second dynamic group that takes over time integration.

It would be easier to create a custom fix based on fix nve where you insert a check on a defined region and all particles that are inside, they will be moved by a fixed velocity, while the rest will experience standard velocity-verlet time integration. Should be a rather straightforward modification and much more efficient since no dynamic group updates in every step are needed.


Thank you for your reply, Axel. I see what you are saying about atoms outside the group. But they still belong to ‘all’, so I will time integrate them with the fix meso. Also, SPH is distinct from MD in that an atom’s force depends also on neighboring atoms’ velocities, so atom velocities just outside the region will conform to those inside the region.

I think I will do a custom fix to override velocities for atoms inside a defined region. That way I can have two (or more) dynamic regions with specified velocities.

Please note, that you must not time integrate particles twice. So time integration on group all is not an option unless you have a customized fix that can change how velocities and/or positions are updated based on some condition (e. g. being inside a given region).