[lammps-users] how to get temperature gradient

Dear all,

I am working on graphite and water heat transfer. I fix heat on my graphite wall and expect to get temperature gradient on my water. I was doing this like below:

compute ke water ke/atom
variable temp atom c_ke[]/1.5
fix 1 water ave/spatial 1 5000 5000 z lower 0.1 v_temp file tmp.profile units reduced

But since I used fix shake for my water, the way I used to compute temperature is not right cause I need to substract out of degree of freedom for water molecules

So could you give me some suggestions about how to do this?

Also when we divide water region into 10 bins, we can not make sure the whole water molecule is in the same bin. For examples, one H may be in bin 2, but its O may be in bin 1.

So in my case, should I code this postprocessing by myself in Lammps or Lammps can do it?

Thank you for your help.

Best wishes!

ziyuan
PhD student
Aerospace Engineering
ODU

If you use compute temp, it will subtract out degrees-of-freedom
for bonds that are frozen due to SHAKE. If you want to do
this in layers, and figure out which entire molecules are in which
layers, you'll need to post-process it.

Steve

Thanks Steve, I got it.

I really appreciate it.

ziyuan

Dear Steve

You know I am working on graphite and water heat transfer. I fix heat on my graphite
wall and expect to get temperature gradient on my water. I expect my hotwall which I add heat will have high temperature and the coldwall will have low temperature. But I ran my case already to 5 ns, my wall temperature hasn’t become steady yet. They are still fluctuating a lot and it seems the temperature becomes higher and higher. Sometimes hotwall has lower temperature and coldwall has higher. I am wondering if I made any mistakes.

Here is my input file. atom type 1 is O, 2 is H and 3 is Cabon

units metal
dimension 3
atom_style full
boundary p p f
bond_style harmonic
angle_style harmonic
read_data data.test

pair_style hybrid airebo 3.0 1 1 lj/cut/coul/long 10.0 10.0 lj/cut 10.0
pair_coeff 1 1 lj/cut/coul/long 0.00674 3.16556
pair_coeff 1*2 2 lj/cut/coul/long 0.0 0.0
pair_coeff 1 3 lj/cut 0.00479 3.28069
pair_coeff 2 3 lj/cut 0 0
pair_coeff * * airebo CH.airebo NULL NULL C

kspace_style pppm 1.0e-4
kspace_modify slab 3.0

group water type 1 2
group coldwall molecule 296
group hotwall molecule 297

timestep 0.0002
minimize 0.0 1.0e-8 5000 5000

velocity all create 280.0 3213112 mom yes rot yes dist gaussian
fix 1 water shake 0.0001 20 0 b 1 a 1

fix 2 all nvt 280.0 280.0 0.01
run 1000000
unfix 2

fix 31 hotwall heat 10 0.0000001
fix 32 coldwall heat 10 -0.0000001
fix 33 all nve

run 30000000

I will feel appreciate if you can have a look at my input file and give me some suggestion.

Thank you very much.

ziyuan

I don't know, maybe try a langevin thermostat on the walls, instead
of fix heat.

Steve

Can you put show us the plot how much temperature is increasing on the hot side and when in becomes lower than cold side?
How many atoms do you have in hot and cold graphite sheets?

Hi, Vikas

Thank you for your reply. You are right. Maybe my graphite atoms number is not enough. Cause in order to test if this works or not, I used the smallest scale for efficiency purpose. Both my hot and cold sheets only have 160 atoms.

I increased both my hot and cold sheets to 4 layers and contains 640 atoms for each. Hope this time it can reach to steady state. If it still doens’t work, I will show you the plot of my temperature variation.

Thank you again.

ziyuan

Dear All,

In our group, we did heat transfer problem like this way. We apply NVT to both hot and cold wall without applying any ensemble on the liquid inside the wall and we got temperature gradient. But in lammps, we have to assign emsemble on the liquid or it won’t do time integration.

So my question is that, why in lammps time integeration has to be related with ensemble? Isn’t it just integrating based on a Newton second law?

So what NVE ensemble really does?

ziyuan

Ensemble and integrator aren't the same things. In the example you provide, you have used two different integrators - but it's not clear what ensemble your system lives in.
Matt

Quoting shiziyuan <[email protected]...>:

Dear All,

In our group, we did heat transfer problem like this way. We apply NVT to
both hot and cold wall without applying any ensemble on the liquid inside
the wall and we got temperature gradient. But in lammps, we have to assign
emsemble on the liquid or it won't do time integration.

So my question is that, why in lammps time integeration has to be related
with ensemble? Isn't it just integrating based on a Newton second law?

So what NVE ensemble really does?

it just integrates the equations of motion without changing
number of particles, volume or (kinetic) energy.

the fact that your code doesn't call this NVE ensemble
is a choice of your code. you are overinterpreting the
term ensemble in this context. the nvt or nve choices in
LAMMPS integrate the equations of of motion _as if_
that _specific part_ of the system was in an nvt or nve
ensemble. your real ensemble may still be something
different (e.g. when you run NEMD, or use fix berendsen).

it is just convenient from the point of implementation to
do things the way they are done in lammps.

cheers,
   axel.