HELP in simulating water and air

Dear all

I’m trying to simulate a water column which is surrounded by air in a block that have fix walls (in sph model)

But i’ve faced many problems and questions. my code has too many errors in answers. i tryed to use hybrid/tait for water and air both and exert gravity to both but the air doesn’t move at all and the water colomn just goes down directly without any moving and shaking like a rigid body and even permeates to the wall.

i don’t know how to rewrite the code to get a reliable answer.

should i use two pair style for water and gas seperatly? if yes how?

how can i make the walls inscrutable?

why my model (even just a water column) doesn’t move just like the water collapse example?

If somebody could clarify this it would be greatly appreciated.

#my code
{
echo both
processors * * 1
units lj
dimension 2
newton on
boundary f f p
atom_style meso

create simulation box

region box block -60 60 -50 50 -0.25 0.25 units box
create_box 3 box
mass 1 0.1
mass 2 0.155
mass 3 0.2

create water particles

region water block -55 -35 -45 15 inf. inf. units box
lattice sq 2
create_atoms 1 region water

create air1

region air1 block -55 -35 15 45 inf. inf. units box
lattice sq 2
create_atoms 2 region air1

create air2

region air2 block -35 55 -45 45 inf. inf. units box
lattice sq 2
create_atoms 2 region air2

create bc1

region bc1 block -60 -55 -50 50 -0.25 0.25 units box
lattice sq 20
create_atoms 3 region bc1

create bc2

region bc2 block -60 60 45 50 -0.25 0.25 units box
lattice sq 20
create_atoms 3 region bc2

create bc3

region bc3 block 55 60 -50 50 -0.25 0.25 units box
lattice sq 20
create_atoms 3 region bc3

create bc4

region bc4 block -60 60 -50 -45 -0.25 0.25 units box
lattice sq 20
create_atoms 3 region bc4
group water type 1
group air type 2
group bc type 3
variable h equal 0.03
variable k equal 0.0000000000003
variable c equal 10.0
variable dt equal 0.1*{h}/{c}
variable nrun equal 15.0/{dt} pair_style hybrid/overlay sph/rhosum 1 sph/taitwater pair_coeff * * sph/taitwater 1000.0 {c} 1.0 {h} # use target density of 1000, soundspeed {c} for Tait’s EOS
pair_coeff 1 1 sph/rhosum {h} pair_coeff 1 2 sph/rhosum {h}
pair_coeff 1 3 sph/rhosum {k} pair_coeff 1*2 3 none #pair_coeff 1*3 3 none #pair_coeff 3*1 3 none pair_coeff 2 2 sph/rhosum {h}
#pair_style sph/idealgas
delete_atoms overlap .005 all all
#delete_atoms porosity air2 0.5 12345
#delete_atoms porosity air2 0.7 12345
fix gfix air gravity -9.81 vector 0 1 0
fix gfix1 water gravity -9.81 vector 0 1 0
compute rho_peratom all meso_rho/atom
compute e_peratom all meso_e/atom
compute esph all reduce sum c_e_peratom
compute ke all ke
variable etot equal c_esph+c_ke+f_gfix
fix dtfix all dt/reset 1 NULL {dt} 0.5 units box fix integrate_water_fix water meso fix integrate_bc_fix bc meso/stationary fix zeroforce bc setforce 0 0 0 dump dump_id all custom 100 dump.lammpstrj id type xs ys zs c_rho_peratom c_e_peratom fx fy dump_modify dump_id first yes thermo 10 thermo_modify norm no thermo_modify lost ignore #neigh_modify every 5 delay 0 check no variable skin equal 0.3*{h}
neighbor {skin} bin # set Verlet list skin distance run {nrun}
}

(Currently, at least), if you want to simulate water (or any molecular
system), you must create a LAMMPS data file (in addition to specifying
the force-field parameters).

If you don't want to generate the DATA file by hand, then there is a
list of tools which can help you do that here:

http://lammps.sandia.gov/prepost.html

If you want to generate the file by hand, the file-format is explained here:
http://lammps.sandia.gov/doc/read_data.html
http://lammps.sandia.gov/doc/atom_style.html

Disclaimer: I wrote one of these tools (moltemplate). The
introductory tutorial (Chapter4) in the moltemplate manual
(http://www.moltemplate.org/doc/moltemplate_manual.pdf) explains how
to use moltemplate to build a box of water. It explains how to choose
force-field parameters (SPC/E or TIP3P), how to add bonds and
constraints, and how to control the geometry. You can modify this
example to arrange the water molecules in any shape you want, and mix
them with other molecules or ions.
(http://lammps.sandia.gov/threads/jpggLopy_3CLM.jpg)
There is also an example of water between two graphene sheets (and a
nanotube) here:
http://www.moltemplate.org/images/nanotube+water/nanotube+walls+water_side_pbc_t=0ps.jpg
You can also build these examples using other software.

First, my apologies. I wrote my standard response to your question
without reading your input script. I have some questions. If you are
using the SPH model, then I suppose that you do NOT want to simulate
water molecules explicitly. In that case, without a picture, it's
quite difficult to understand what you are trying to do. (What do the
atoms in your system represent?)
I think if you could show (or draw) a picture of what you are trying
to do and post it, it would be easier to reply.

Also: why are you using fix gravity? Gravity should not be relevant
at these length scales.

Generally, I typically recommend that when a system is behaving
strangely, try simplifying it (until it stops behaving strangely).
Visualization is important as well. Have you had success using LAMMPS
to simulate more simple systems. (SPH simulations are a little bit
more complicated than simple langevin simulations, for example.)

Andrew

If you have not yet read these, then here are some links to LAMMPS
tutorials and the documentation
http://icme.hpc.msstate.edu/mediawiki/index.php/LAMMPS_tutorials
chapter4 of the moltemplate manual
http://sites.google.com/site/akohlmey/software/topotools/topotools-tutorial---part-2
http://lammps.sandia.gov/howto.html
http://lammps.sandia.gov/scripts.html

Most LAMMPS molecular simulations require you to use these commands:
http://lammps.sandia.gov/doc/run.html
http://lammps.sandia.gov/doc/timestep.html
http://lammps.sandia.gov/doc/dump.html
http://lammps.sandia.gov/doc/read_data.html
http://lammps.sandia.gov/doc/write_data.html
http://lammps.sandia.gov/doc/thermo.html
http://lammps.sandia.gov/doc/include.html
http://lammps.sandia.gov/doc/fix_nve.html
http://lammps.sandia.gov/doc/fix_nh.html
http://lammps.sandia.gov/doc/fix_langevin.html
http://lammps.sandia.gov/doc/fix_shake.html

http://lammps.sandia.gov/doc/restart.html
http://lammps.sandia.gov/doc/write_restart.html
http://lammps.sandia.gov/doc/read_restart.html
http://lammps.sandia.gov/doc/fix.html
http://lammps.sandia.gov/doc/group.html
http://lammps.sandia.gov/doc/compute.html
http://lammps.sandia.gov/doc/print.html
http://lammps.sandia.gov/doc/variable.html
http://lammps.sandia.gov/doc/rerun.html
http://lammps.sandia.gov/doc/fix_rigid.htm

My apologese again for posting two completely unhelpful messages. I
did not realize what fix SPH does. I retract my replies to your
question. Hopefully someone with more clue replies to your question.

You can look at the example problems in examples/USER/sph.
You can also contact the author of the USER-SPH package
if you think something within SPH is not working as expected.

Steve