fix wall/region for sphere vs cylinder

Hi Community,

While using the fix wall/region command I am getting the error - Particle on or inside surface of region used in fix wall/region. I went through the mailing list and found the below script by Steve which is for a fluid confined in a sphere. This script is running fine. I modified just two lines of the script so that it can do the fluid confined in a cylinder instead of a sphere.

units lj
atom_style atomic
boundary s s p

lattice sc 0.5

region r1 sphere 0 0 0 5
#region r1 cylinder z 0 0 5 0 10
create_box 1 r1
create_atoms 1 region r1

mass 1 1.0
velocity all create 1.44 87287 loop geom

pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify delay 0 every 20 check no

fix 1 all nve

region r1a sphere 0 0 0 6
#region r1a cylinder z 0 0 10 0 15
fix 2 all wall/region r1a harmonic 20.0 0.0 1.0

dump 1 all xyz 100 dump.xyz
thermo 100
thermo_style custom step temp epair press

run 10000

The two lines to change from sphere to cylinder are

  1. I replaced the line - region r1 sphere 0 0 0 5 - with - region r1 cylinder z 0 0 5 0 10
  2. I replaced the line - region r1a sphere 0 0 0 6 - with - region r1a cylinder z 0 0 8 0 14

This should work fine, but I’m getting the above mentioned error.

Any help is very thankful.

Hi All,

I figure out that fix wall/region command used with a cylindrical region impose two walls at the entrance and exit of the cylinder also. I mean the wall is not just along the radial direction but also along the axial direction, which means the fluid is completely confined (in all directions) inside the cylinder. Now, this makes me wondering how one can simulate the fluid flow (Poiseuille type) in a cylinder using the fix wall/region with cylinder ? Mailing list has several posts taking about Poiseuille flow using the fix wall/region command.

Thanks in advance for your clarification …

Make the length of the cylinder much longer
than your simulation box. Then the "ends" of
the cylinder don't exist so far as the atoms
in the box are concerned.

Steve