Draft examples, patches, clarify interface reconstruct in RHEO

This commit is contained in:
jtclemm
2024-05-19 11:22:52 -06:00
parent 343f8afbf6
commit 8d25c510c1
32 changed files with 1265 additions and 274 deletions

View File

@ -134,6 +134,8 @@ Lowercase directories
+-------------+------------------------------------------------------------------+
| rerun | use of rerun and read_dump commands |
+-------------+------------------------------------------------------------------+
| rheo | RHEO simulations of fluid flows and phase transitions |
+-------------+------------------------------------------------------------------+
| rigid | rigid bodies modeled as independent or coupled |
+-------------+------------------------------------------------------------------+
| shear | sideways shear applied to 2d solid, with and without a void |

View File

@ -10,8 +10,12 @@ particles can dynamically change between a fluid and solid state, e.g. during
melting/solidification, which determines how they interact and their physical
behavior. The package is designed with modularity in mind, so one can easily
turn various features on/off, adjust physical details of the system, or
develop new capabilities. Additional numerical details can be found in
:ref:`(Palermo) <howto_rheo_palermo>` and :ref:`(Clemmer) <howto_rheo_clemmer>`.
develop new capabilities. For instance, the numerics associated with
calculating gradients, reproducing kernels, etc. are separated into distinct
classes to simplify the development of new integration schemes which can call
these calculations. Additional numerical details can be found in
:ref:`(Palermo) <howto_rheo_palermo>` and
:ref:`(Clemmer) <howto_rheo_clemmer>`.
----------
@ -29,12 +33,17 @@ other RHEO fixes.
Typically, RHEO requires atom style rheo. In addition to typical atom
properties like positions and forces, particles store a local density,
viscosity, pressure, and status. If thermal evolution is modeled, one must
use atom style rheo/thermal which also include a local temperature and
conductivity. The status variable uses bitmasking to track various
properties of a particle such as its current state of matter (fluid or solid)
and its location relative to a surface. Many of these properties (and others)
can be easily accessed using
:doc:`compute rheo/property/atom <fix_rheo_property_atom>`.
use atom style rheo/thermal which also includes a local energy, temperature, and
conductivity. Note that the temperature is always derived from the energy.
This implies the *temperature* attribute of :doc:`the set command <set>` does not
affect particles. Instead, one should use the *sph/e* attribute.
The status variable uses bitmasking to track various properties of a particle
such as its current state of matter (fluid or solid) and its location relative
to a surface. Some of these properties (and others) can be accessed using
:doc:`compute rheo/property/atom <fix_rheo_property_atom>`. The *status* attribute
in :doc:`the set command <set>` only allows control over the first bit which sets
the state of matter, 0 is fluid and 1 is solid.
Fluid interactions, including pressure forces, viscous forces, and heat exchange,
are calculated using :doc:`pair rheo <pair_rheo>`. Unlike typical pair styles,
@ -61,7 +70,8 @@ in the same elastic body.
In systems with thermal evolution, fix rheo/thermal can optionally set a
melting/solidification temperature allowing particles to dynamically swap their
state between fluid and solid. Using the *react* option, one can specify a maximum
state between fluid and solid when the temperature exceeds or drops below the
critical temperature, respectively. Using the *react* option, one can specify a maximum
bond length and a bond type. Then, when solidifying, particles will search their
local neighbors and automatically create bonds with any neighboring solid particles
in range. For BPM bond styles, bonds will then use the immediate position of the two

View File

@ -65,7 +65,7 @@ the setup of a run. Data is then preserved across run commands and is
written to :doc:`binary restart files <restart>` such that restarting
the system will not reset the reference state of a bond or the timer.
This bond style is based on a model described in Ref.
This bond style is based on a model described in
:ref:`(Clemmer) <howto_rheo_clemmer>`. The force has a magnitude of
.. math::

View File

@ -16,19 +16,18 @@ Syntax
.. parsed-literal::
possible attributes = phase, chi, surface, surface/r,
possible attributes = phase, surface, surface/r,
surface/divr, surface/n/x, surface/n/y,
surface/n/z, coordination, cv, shift/v/x,
shift/v/y, shift/v/z, energy, temperature, heatflow,
conductivity, cv, viscosity, pressure,
status, rho, grad/v/xx, grad/v/xy, grad/v/xz,
rho, grad/v/xx, grad/v/xy, grad/v/xz,
grad/v/yx, grad/v/yy/, grad/v/yz, grad/v/zx,
grad/v/zy, grad/v/zz
.. parsed-literal::
*phase* = atom phase state
*chi* = atom local phase metric
*surface* = atom surface status
*surface/r* = atom distance from the surface
*surface/divr* = divergence of position at atom position
@ -42,7 +41,6 @@ Syntax
*cv* = atom specific heat
*viscosity* = atom viscosity
*pressure* = atom pressure
*status* = atom full status
*rho* = atom density
*grad/v/\** = atom velocity gradient
*nbond/shell* = number of oxide bonds
@ -70,14 +68,32 @@ computes as inputs. See for example, the
:doc:`fix ave/chunk <fix_ave_chunk>`, and
:doc:`atom-style variable <variable>` commands.
The possible attributes are described in more detail in other RHEO doc
pages including :doc:`the RHEO howto page <Howto_rheo>`. Many
properties require their respective fixes, listed below in related
commands, be defined.
Many properties require their respective fixes, listed below in related
commands, be defined. For instance, the *viscosity* attribute is the
viscosity of a particle calculated by
:doc:`fix rheo/viscous <fix_rheo_viscosity>`. The meaning of less obvious
properties is described below.
The *phase* property indicates whether the particle is in a fluid state,
a value of 0, or a solid state, a value of 1.
The *surface* property indicates the surface designation produced by
the *interface/reconstruct* option of :doc:`fix rheo <fix_rheo>`. Bulk
particles have a value of 0, surface particles have a value of 1, and
splash particles have a value of 2. The *surface/r* property is the
distance from the surface, up to the kernel cutoff length. Surface particles
have a value of 0. The *surface/n* properties are the components of the
surface normal vector.
The *shift/v* properties are the components of the shifting velocity
produced by the *shift* option of :doc:`fix rheo <fix_rheo>`.
The *surface/n/\** and *shift/v/\** attributes are vectors that require
specification of the *x*, *y*, or *z* component, e.g. *surface/n/x*.
The *nbond/shell* property is the number of shell bonds that have been
activated from :doc:`bond style rheo/shell <bond_rheo_shell>`.
The *grad/v/\** attribute is a tensor and requires specification of
the *xx*, *yy*, *zz*, *xy*, *xz*, *yx*, *yz*, *zx*, or *zy* component,
e.g. *grad/v/xy*.

View File

@ -92,7 +92,8 @@ Shifting is then disabled in the direction away from the free surface to
prevent it from diffusing particles away from the bulk fluid. Surface
detection can also be used to control surface-nucleated effects like
oxidation when used in combination with
:doc:`fix rheo/oxidation <fix_rheo_oxidation>`.
:doc:`fix rheo/oxidation <fix_rheo_oxidation>`. Surface detection is not
performed on solid bodies.
The *surface/detection* keyword takes three arguments: *sdstyle*, *limit*,
and *limi/splash*. The first, *sdstyle*, specifies whether surface particles

View File

@ -35,10 +35,12 @@ for use with bond style :doc:`bond rheo/shell <bond_rheo_shell>`.
Every timestep, particles check neighbors within a distance of *cut*.
This distance must be smaller than the kernel length defined in
:doc:`fix rheo <fix_rheo>`. If both particles are on the fluid surface,
or within a distance of *rsurf* from the surface, a bond of type
*btype* is created between the two particles. This process is
further described in Ref. :ref:`(Clemmer) <howto_rheo_clemmer>`.
:doc:`fix rheo <fix_rheo>`. Bonds of type *btype* are created between
pairs of particles that satisfy one of two conditions. First, if both
particles are on the fluid surface, or within a distance of *rsurf*
from the surface. Secondly, if one particle is on the fluid surface
and the other bond is solid. This process is further described in
:ref:`(Clemmer) <howto_rheo_clemmer>`.
If used in conjunction with solid bodies, such as those generated
by the *react* option of :doc:`fix rheo/thermal <fix_rheo_thermal>`,

View File

@ -55,12 +55,20 @@ rheo/thermal. In addition, it defines multiple thermal properties of
particles and handles melting/solidification, if applicable. For more details
on phase transitions in RHEO, see :doc:`the RHEO howto <Howto_rheo>`.
Note that the temperature of a particle is always derived from the energy.
This implies the *temperature* attribute of :doc:`the set command <set>` does
not affect particles. Instead, one should use the *sph/e* attribute.
For each atom type, one can define attributes for the *conductivity*,
*specific/heat*, *latent/heat*, and critical temperature (*Tfreeze*).
The conductivity and specific heat must be defined for all atom types.
The latent heat and critical temperature are optional. However, a
critical temperature must be defined to specify a latent heat.
Note, if shifting is turned on in :doc:`fix rheo <fix_rheo>`, the gradient
of the energy is used to shift energies. This may be inappropriate in systems
with multiple atom types with different specific heats.
For each property, one must first define a list of atom types. A wild-card
asterisk can be used in place of or in conjunction with the *types* argument
to set the coefficients for multiple pairs of atom types. This takes the

View File

@ -717,7 +717,7 @@ of analysis.
* - rheo
- atom-ID atom-type status rho x y z
* - rheo/thermal
- atom-ID atom-type status rho temperature x y z
- atom-ID atom-type status rho energy x y z
* - smd
- atom-ID atom-type molecule volume mass kradius cradius x0 y0 z0 x y z
* - sph

View File

@ -1,87 +0,0 @@
# ------ 2D dam break ------ #
dimension 2
units lj
atom_style rheo
boundary f s p
comm_modify vel yes
newton off
comm_style tiled
# ------ Create simulation box ------ #
variable sf equal 0.05
variable n equal 1.0/(${sf}^2)
variable cut equal 3.0*${sf}
region box block -1 55 -1 20 -0.01 0.01 units box
create_box 2 box
lattice sq ${n}
region left_wall block -1 0 EDGE EDGE -0.01 0.01 units box
region right_wall block 53.66 EDGE EDGE EDGE -0.01 0.01 units box
region bot_wall block 0.01 53.65 -1 0 -0.01 0.01 units box
region interior block 0.01 10 0.01 20 -0.01 0.01 units box
create_atoms 1 region interior
create_atoms 2 region left_wall
create_atoms 2 region right_wall
create_atoms 2 region bot_wall
group fluid type 1
group static_wall type 2
group dyn_wall type 3
group rig union static_wall dyn_wall
# ------ Model parameters ------ #
variable rho0 equal 1.0
variable mp equal ${rho0}/${n}
variable cs equal 10
variable zeta equal 1
variable Dr equal 0.1*${cut}*${cs}
variable dt_max equal 0.1*${cut}/${cs}/3
variable g equal 0.0245
variable fext equal ${g}/${n}
variable eta equal 0.05
mass * ${mp}
variable d0 atom (${rho0}*${g}*(20-y)/${cs}/${cs})+${rho0}
set group all rheo/rho ${rho0}
set group fluid rheo/rho v_d0
set group all rheo/status 0
set group rig rheo/status 2
timestep ${dt_max}
pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr}
pair_coeff * *
# ------ Fixes & computes ------ #
fix 1 all rheo ${cut} RK1 32 shift surface/detection coordination 26
fix 2 all rheo/viscosity constant ${eta}
fix 3 all rheo/pressure linear
fix 4 rig setforce 0.0 0.0 0.0
fix 5 fluid addforce 0.0 -${fext} 0.0
fix 6 all balance 1000 1.1 rcb
compute 1 all rheo/property/atom rho phase surface
# ------ Output & Run ------ #
thermo 10
thermo_style custom step time ke press
variable skin equal 0.2*${cut}
neighbor ${skin} bin
neigh_modify one 5000
dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*]
run 400000

View File

@ -0,0 +1,74 @@
# ------ 2D water balloon ------ #
dimension 2
units lj
atom_style hybrid rheo bond
boundary m m p
comm_modify vel yes
newton off
region box block -40 40 0 80 -0.01 0.01 units box
create_box 1 box bond/types 1 extra/bond/per/atom 15 extra/special/per/atom 50
region fluid sphere -10 40 0 30 units box side in
lattice hex 1.0
create_atoms 1 region fluid
region shell sphere -10 40 0 27 units box side out
group shell region shell
set group shell rheo/status 1
set group all vx 0.005 vy -0.04
# ------ Model parameters ------#
variable cut equal 3.0
variable n equal 1.0
variable rho0 equal 1.0
variable cs equal 1.0
variable mp equal ${rho0}/${n}
variable zeta equal 0.05
variable kappa equal 0.01*${rho0}/${mp}
variable dt_max equal 0.1*${cut}/${cs}/3
variable eta equal 0.05
variable Cv equal 1.0
variable L equal 1.0
variable Tf equal 1.0
mass * ${mp}
timestep 0.1
pair_style hybrid/overlay rheo ${cut} artificial/visc ${zeta} rheo/solid
pair_coeff * * rheo
pair_coeff * * rheo/solid 1.0 1.0 1.0
special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0
create_bonds many shell shell 1 0 1.5
special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0
bond_style bpm/spring
bond_coeff 1 1.0 1.0 1.0
# A lower critical strain allows the balloon to pop
#bond_coeff 1 1.0 0.05 1.0
# ------ Drop balloon ------#
fix 1 all rheo ${cut} quintic 0 &
shift &
surface/detection coordination 22 8
fix 2 all rheo/viscosity * constant ${eta}
fix 3 all rheo/pressure * linear
fix 4 all wall/harmonic ylo EDGE 2.0 1.0 1.0
compute rho all rheo/property/atom rho
compute phase all rheo/property/atom phase
compute nbond all nbond/atom
# ------ Output & Run ------ #
thermo 200
thermo_style custom step time ke press atoms
dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_nbond c_rho
run 30000

View File

@ -0,0 +1,81 @@
# ------ 2D dam break ------ #
dimension 2
units lj
atom_style rheo
boundary f f p
comm_modify vel yes
newton off
# ------ Create simulation box ------ #
variable n equal 1.0
variable cut equal 3.0
variable dx equal 4.0
region box block -1 200 -1 80 -0.1 0.1 units box
#region box block -1 100 -1 40 -0.1 0.1 units box
create_box 2 box
lattice hex ${n}
region fluid block $(xlo+v_dx) $(xlo+44.0) $(ylo+v_dx) $(yhi-16.0) EDGE EDGE units box
#region fluid block $(xlo+v_dx) $(xlo+20.0) $(ylo+v_dx) $(yhi-10.0) EDGE EDGE units box
region walls block $(xlo+v_dx) $(xhi-v_dx) $(ylo+v_dx) $(yhi-v_dx) EDGE EDGE units box side out
create_atoms 1 region fluid
create_atoms 2 region walls
group fluid type 1
group rig type 2
# ------ Model parameters ------ #
variable rho0 equal 1.0
variable mp equal ${rho0}/${n}
variable cs equal 1.0
variable zeta equal 0.05
variable dt_max equal 0.1*${cut}/${cs}/3
variable eta equal 0.05
variable Dr equal 0.05
mass * ${mp}
set group all rheo/rho ${rho0}
set group all rheo/status 0
set group rig rheo/status 1
timestep ${dt_max}
pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr}
pair_coeff * *
# ------ Fixes & computes ------ #
fix 1 all rheo ${cut} quintic 10 &
shift &
surface/detection coordination 22 8 &
interface/reconstruct
#fix 1 all rheo ${cut} RK1 10 surface/detection coordination 36 10 interface/reconstruct shift
fix 2 all rheo/viscosity * constant ${eta}
fix 3 all rheo/pressure * linear
fix 4 all gravity 5e-4 vector 0 -1 0
fix 5 rig setforce 0.0 0.0 0.0
compute rho all rheo/property/atom rho
compute phase all rheo/property/atom phase
compute p all rheo/property/atom pressure
compute surf all rheo/property/atom surface
compute sn all rheo/property/atom surface/n/x surface/n/y
compute vshift all rheo/property/atom shift/v/x shift/v/y
# ------ Output & Run ------ #
thermo 100
thermo_style custom step time ke press
dump 1 all custom 20 atomDump id type x y vx vy fx fy c_rho c_phase c_surf c_p c_vshift[*] c_sn[*]
#thermo 1
run 300000 # 400000

View File

@ -0,0 +1,80 @@
# ------ 2D Ice Cube Pour ------ #
dimension 2
units lj
atom_style hybrid rheo/thermal bond
boundary m m p
comm_modify vel yes
newton off
special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0
region box block -25 25 0 100 -0.01 0.01 units box
create_box 1 box bond/types 1 extra/bond/per/atom 15 extra/special/per/atom 50
region fluid block $(xlo+1) $(xhi-1) $(ylo+1) $(ylo+30) EDGE EDGE units box
lattice sq 1.0
create_atoms 1 region fluid
set group all sph/e 8.0
# ------ Model parameters ------#
variable cut equal 3.0
variable n equal 1.0
variable rho0 equal 1.0
variable cs equal 1.0
variable mp equal ${rho0}/${n}
variable zeta equal 0.05
variable kappa equal 0.01*${rho0}/${mp}
variable dt_max equal 0.1*${cut}/${cs}/3
variable eta equal 0.05
variable Cv equal 1.0
variable L equal 1.0
variable Tf equal 1.0
mass * ${mp}
timestep 0.1
pair_style hybrid/overlay rheo ${cut} artificial/visc ${zeta} rheo/solid
pair_coeff * * rheo
pair_coeff * * rheo/solid 1.0 1.0 1.0
bond_style bpm/spring
bond_coeff 1 1.0 1.0 1.0
# ------ Pour particles ------#
molecule my_mol "square.mol"
# Wall region extends far enough in z to avoid contact
region wall block EDGE EDGE EDGE EDGE -5 5 side in open 4 units box
region drop block -16 16 70 90 EDGE EDGE side in units box
fix 1 all rheo ${cut} quintic 0 &
thermal &
shift &
surface/detection coordination 22 8
fix 2 all rheo/viscosity * constant ${eta}
fix 3 all rheo/pressure * linear
fix 4 all rheo/thermal conductivity * constant ${kappa} &
specific/heat * constant ${Cv} &
Tfreeze * constant ${Tf} &
latent/heat * constant ${L} &
react 1.5 1
fix 5 all wall/region wall harmonic 1.0 1.0 1.0
fix 6 all gravity 5e-4 vector 0 -1 0
fix 7 all deposit 8 0 1000 37241459 mol my_mol region drop near 2.0 vy -0.02 -0.02
compute rho all rheo/property/atom rho
compute phase all rheo/property/atom phase
compute temp all rheo/property/atom temperature
compute eng all rheo/property/atom energy
compute nbond all nbond/atom
# ------ Output & Run ------ #
thermo 200
thermo_style custom step time ke press atoms
dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond c_rho
run 30000

View File

@ -0,0 +1,658 @@
#Made with create_mol.py
100 atoms
342 bonds
Coords
#ID x y z
1 -4 -4 0
2 -3 -4 0
3 -2 -4 0
4 -1 -4 0
5 0 -4 0
6 1 -4 0
7 2 -4 0
8 3 -4 0
9 4 -4 0
10 5 -4 0
11 -4 -3 0
12 -3 -3 0
13 -2 -3 0
14 -1 -3 0
15 0 -3 0
16 1 -3 0
17 2 -3 0
18 3 -3 0
19 4 -3 0
20 5 -3 0
21 -4 -2 0
22 -3 -2 0
23 -2 -2 0
24 -1 -2 0
25 0 -2 0
26 1 -2 0
27 2 -2 0
28 3 -2 0
29 4 -2 0
30 5 -2 0
31 -4 -1 0
32 -3 -1 0
33 -2 -1 0
34 -1 -1 0
35 0 -1 0
36 1 -1 0
37 2 -1 0
38 3 -1 0
39 4 -1 0
40 5 -1 0
41 -4 0 0
42 -3 0 0
43 -2 0 0
44 -1 0 0
45 0 0 0
46 1 0 0
47 2 0 0
48 3 0 0
49 4 0 0
50 5 0 0
51 -4 1 0
52 -3 1 0
53 -2 1 0
54 -1 1 0
55 0 1 0
56 1 1 0
57 2 1 0
58 3 1 0
59 4 1 0
60 5 1 0
61 -4 2 0
62 -3 2 0
63 -2 2 0
64 -1 2 0
65 0 2 0
66 1 2 0
67 2 2 0
68 3 2 0
69 4 2 0
70 5 2 0
71 -4 3 0
72 -3 3 0
73 -2 3 0
74 -1 3 0
75 0 3 0
76 1 3 0
77 2 3 0
78 3 3 0
79 4 3 0
80 5 3 0
81 -4 4 0
82 -3 4 0
83 -2 4 0
84 -1 4 0
85 0 4 0
86 1 4 0
87 2 4 0
88 3 4 0
89 4 4 0
90 5 4 0
91 -4 5 0
92 -3 5 0
93 -2 5 0
94 -1 5 0
95 0 5 0
96 1 5 0
97 2 5 0
98 3 5 0
99 4 5 0
100 5 5 0
Types
#ID type
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
44 1
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 1
65 1
66 1
67 1
68 1
69 1
70 1
71 1
72 1
73 1
74 1
75 1
76 1
77 1
78 1
79 1
80 1
81 1
82 1
83 1
84 1
85 1
86 1
87 1
88 1
89 1
90 1
91 1
92 1
93 1
94 1
95 1
96 1
97 1
98 1
99 1
100 1
Masses
#ID mass
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
44 1
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 1
65 1
66 1
67 1
68 1
69 1
70 1
71 1
72 1
73 1
74 1
75 1
76 1
77 1
78 1
79 1
80 1
81 1
82 1
83 1
84 1
85 1
86 1
87 1
88 1
89 1
90 1
91 1
92 1
93 1
94 1
95 1
96 1
97 1
98 1
99 1
100 1
Bonds
#ID type atom1 atom2
1 1 1 2
2 1 1 11
3 1 1 12
4 1 2 3
5 1 2 11
6 1 2 12
7 1 2 13
8 1 3 4
9 1 3 12
10 1 3 13
11 1 3 14
12 1 4 5
13 1 4 13
14 1 4 14
15 1 4 15
16 1 5 6
17 1 5 14
18 1 5 15
19 1 5 16
20 1 6 7
21 1 6 15
22 1 6 16
23 1 6 17
24 1 7 8
25 1 7 16
26 1 7 17
27 1 7 18
28 1 8 9
29 1 8 17
30 1 8 18
31 1 8 19
32 1 9 10
33 1 9 18
34 1 9 19
35 1 9 20
36 1 10 19
37 1 10 20
38 1 11 21
39 1 11 12
40 1 11 22
41 1 12 21
42 1 12 13
43 1 12 22
44 1 12 23
45 1 13 22
46 1 13 23
47 1 13 14
48 1 13 24
49 1 14 23
50 1 14 24
51 1 14 15
52 1 14 25
53 1 15 24
54 1 15 16
55 1 15 25
56 1 15 26
57 1 16 25
58 1 16 26
59 1 16 17
60 1 16 27
61 1 17 26
62 1 17 18
63 1 17 27
64 1 17 28
65 1 18 27
66 1 18 28
67 1 18 19
68 1 18 29
69 1 19 28
70 1 19 29
71 1 19 20
72 1 19 30
73 1 20 29
74 1 20 30
75 1 21 22
76 1 21 31
77 1 21 32
78 1 22 23
79 1 22 31
80 1 22 32
81 1 22 33
82 1 23 24
83 1 23 32
84 1 23 33
85 1 23 34
86 1 24 25
87 1 24 33
88 1 24 34
89 1 24 35
90 1 25 26
91 1 25 34
92 1 25 35
93 1 25 36
94 1 26 27
95 1 26 35
96 1 26 36
97 1 26 37
98 1 27 28
99 1 27 36
100 1 27 37
101 1 27 38
102 1 28 29
103 1 28 37
104 1 28 38
105 1 28 39
106 1 29 30
107 1 29 38
108 1 29 39
109 1 29 40
110 1 30 39
111 1 30 40
112 1 31 32
113 1 31 41
114 1 31 42
115 1 32 33
116 1 32 41
117 1 32 42
118 1 32 43
119 1 33 34
120 1 33 42
121 1 33 43
122 1 33 44
123 1 34 35
124 1 34 43
125 1 34 44
126 1 34 45
127 1 35 36
128 1 35 44
129 1 35 45
130 1 35 46
131 1 36 37
132 1 36 45
133 1 36 46
134 1 36 47
135 1 37 38
136 1 37 46
137 1 37 47
138 1 37 48
139 1 38 39
140 1 38 47
141 1 38 48
142 1 38 49
143 1 39 40
144 1 39 48
145 1 39 49
146 1 39 50
147 1 40 49
148 1 40 50
149 1 41 51
150 1 41 42
151 1 41 52
152 1 42 51
153 1 42 43
154 1 42 52
155 1 42 53
156 1 43 52
157 1 43 53
158 1 43 44
159 1 43 54
160 1 44 53
161 1 44 54
162 1 44 45
163 1 44 55
164 1 45 54
165 1 45 46
166 1 45 55
167 1 45 56
168 1 46 55
169 1 46 56
170 1 46 47
171 1 46 57
172 1 47 56
173 1 47 48
174 1 47 57
175 1 47 58
176 1 48 57
177 1 48 58
178 1 48 49
179 1 48 59
180 1 49 58
181 1 49 59
182 1 49 50
183 1 49 60
184 1 50 59
185 1 50 60
186 1 51 52
187 1 51 61
188 1 51 62
189 1 52 53
190 1 52 61
191 1 52 62
192 1 52 63
193 1 53 54
194 1 53 62
195 1 53 63
196 1 53 64
197 1 54 55
198 1 54 63
199 1 54 64
200 1 54 65
201 1 55 56
202 1 55 64
203 1 55 65
204 1 55 66
205 1 56 57
206 1 56 65
207 1 56 66
208 1 56 67
209 1 57 58
210 1 57 66
211 1 57 67
212 1 57 68
213 1 58 59
214 1 58 67
215 1 58 68
216 1 58 69
217 1 59 60
218 1 59 68
219 1 59 69
220 1 59 70
221 1 60 69
222 1 60 70
223 1 61 71
224 1 61 62
225 1 61 72
226 1 62 71
227 1 62 63
228 1 62 72
229 1 62 73
230 1 63 72
231 1 63 73
232 1 63 64
233 1 63 74
234 1 64 73
235 1 64 74
236 1 64 65
237 1 64 75
238 1 65 74
239 1 65 66
240 1 65 75
241 1 65 76
242 1 66 75
243 1 66 76
244 1 66 67
245 1 66 77
246 1 67 76
247 1 67 68
248 1 67 77
249 1 67 78
250 1 68 77
251 1 68 78
252 1 68 69
253 1 68 79
254 1 69 78
255 1 69 79
256 1 69 70
257 1 69 80
258 1 70 79
259 1 70 80
260 1 71 72
261 1 71 81
262 1 71 82
263 1 72 73
264 1 72 81
265 1 72 82
266 1 72 83
267 1 73 74
268 1 73 82
269 1 73 83
270 1 73 84
271 1 74 75
272 1 74 83
273 1 74 84
274 1 74 85
275 1 75 76
276 1 75 84
277 1 75 85
278 1 75 86
279 1 76 77
280 1 76 85
281 1 76 86
282 1 76 87
283 1 77 78
284 1 77 86
285 1 77 87
286 1 77 88
287 1 78 79
288 1 78 87
289 1 78 88
290 1 78 89
291 1 79 80
292 1 79 88
293 1 79 89
294 1 79 90
295 1 80 89
296 1 80 90
297 1 81 82
298 1 81 91
299 1 81 92
300 1 82 83
301 1 82 91
302 1 82 92
303 1 82 93
304 1 83 84
305 1 83 92
306 1 83 93
307 1 83 94
308 1 84 85
309 1 84 93
310 1 84 94
311 1 84 95
312 1 85 86
313 1 85 94
314 1 85 95
315 1 85 96
316 1 86 87
317 1 86 95
318 1 86 96
319 1 86 97
320 1 87 88
321 1 87 96
322 1 87 97
323 1 87 98
324 1 88 89
325 1 88 97
326 1 88 98
327 1 88 99
328 1 89 90
329 1 89 98
330 1 89 99
331 1 89 100
332 1 90 99
333 1 90 100
334 1 91 92
335 1 92 93
336 1 93 94
337 1 94 95
338 1 95 96
339 1 96 97
340 1 97 98
341 1 98 99
342 1 99 100

View File

@ -0,0 +1,102 @@
# ------ 2D oxidizing bar ------ #
dimension 2
units lj
atom_style hybrid rheo/thermal bond
boundary m m p
comm_modify vel yes
newton off
region box block -60 60 0 80 -0.01 0.01 units box
create_box 3 box bond/types 2 extra/bond/per/atom 20 extra/special/per/atom 50
region lbar block -15 0 3 80 EDGE EDGE units box
region rbar block 0 15 3 80 EDGE EDGE units box
region bar union 2 lbar rbar
region floor block EDGE EDGE EDGE 3.0 EDGE EDGE units box
lattice hex 1.0
create_atoms 1 region bar
create_atoms 3 region floor
set region rbar type 2
group bar type 1 2
group rbar type 2
group floor type 3
set group all sph/e 0.0
set group all rheo/status 1
# ------ Model parameters ------#
variable cut equal 3.0
variable n equal 1.0
variable rho0 equal 1.0
variable cs equal 1.0
variable mp equal ${rho0}/${n}
variable zeta equal 0.05
variable kappa equal 0.1*${rho0}/${mp}
variable dt_max equal 0.1*${cut}/${cs}/3
variable eta equal 0.05
variable Cv equal 1.0
variable L equal 0.1
variable Tf equal 1.0
mass * ${mp}
timestep 0.1
pair_style hybrid/overlay rheo ${cut} artificial/visc ${zeta} rheo/solid
pair_coeff * * rheo
pair_coeff * * rheo/solid 1.0 1.0 1.0
special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0
create_bonds many bar bar 1 0 1.5
special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0
bond_style hybrid bpm/spring rheo/shell t/form 100
bond_coeff 1 bpm/spring 1.0 1.0 1.0
bond_coeff 2 rheo/shell 0.2 0.2 0.1
# ------ Apply dynamics ------#
# Note: surface detection is not performed on solid bodies, so cannot use surface property
compute coord all rheo/property/atom coordination
variable surf atom c_coord<22
group surf dynamic all var surf every 10
fix 1 all rheo ${cut} quintic 0 &
thermal &
shift &
surface/detection coordination 22 8
fix 2 all rheo/viscosity * constant ${eta}
fix 3 all rheo/pressure * linear
fix 4 all rheo/thermal conductivity * constant ${kappa} &
specific/heat * constant ${Cv} &
Tfreeze * constant ${Tf} &
latent/heat * constant ${L} &
react 1.5 1
fix 5 rbar rheo/oxidation 1.5 2 1.0
fix 6 all wall/harmonic ylo EDGE 2.0 1.0 1.0
fix 7 all gravity 5e-5 vector 0 -1 0
fix 8 floor setforce 0.0 0.0 0.0
fix 9 surf add/heat linear 1.1 0.05
fix 10 floor add/heat constant 0 overwrite yes # fix the temperature of the floor
compute surf all rheo/property/atom surface
compute rho all rheo/property/atom rho
compute phase all rheo/property/atom phase
compute status all rheo/property/atom status
compute temp all rheo/property/atom temperature
compute eng all rheo/property/atom energy
compute nbond_shell all rheo/property/atom nbond/shell
compute nbond_solid all nbond/atom bond/type 1
# ------ Output & Run ------ #
thermo 200
thermo_style custom step time ke press atoms
dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond_solid c_nbond_shell c_rho c_surf c_status
run 40000

View File

@ -9,28 +9,23 @@ comm_modify vel yes
# ------ Create simulation box ------ #
variable sf equal 0.2
variable n equal 1.0/(${sf}^2)
variable cut equal 3.5*${sf}
variable n equal 1.0
variable cut equal 3.0
region box block 0 20 -10 10 -0.01 0.01 units box
region box block 0 20 -10 10 -0.01 0.01
create_box 2 box
lattice sq ${n}
region topwall block INF INF 7 10 INF INF units box
region block block INF INF -6.99 6.99 INF INF units box
region botwall block INF INF -10 -7 INF INF units box
region inner block INF INF -7.5 7.5 INF INF units box
region walls block INF INF -7.5 7.5 INF INF units box side out
create_atoms 2 region topwall
create_atoms 2 region botwall
create_atoms 1 region block
create_atoms 2 region walls
create_atoms 1 region inner
group fluid type 1
group rig type 2
variable dr equal 0.1*${sf}
displace_atoms fluid random $(0.1*v_sf) ${dr} 0 135414 units box
displace_atoms fluid random 0.1 0.1 0 135414 units box
# ------ Model parameters ------ #
@ -39,15 +34,19 @@ variable cs equal 1.0
variable mp equal ${rho0}/${n}
variable zeta equal 1.0
variable kappa equal 1.0*${rho0}/${mp}
variable fext equal 1e-3/${n}
variable eta equal 0.1
variable fext equal 1e-4/${n}
variable dt_max equal 0.1*${cut}/${cs}/3
variable Dr equal 0.05*${cut}*${cs}
variable eta equal 0.1
variable gd0 equal 5e-4
variable npow equal 0.5
variable K equal 0.001
mass * ${mp}
set group all rheo/rho ${rho0}
set group all rheo/status 0
set group rig rheo/status 2
set group rig rheo/status 1
timestep ${dt_max}
@ -58,12 +57,13 @@ pair_coeff * *
# ------ Fixes & computes ------ #
fix 1 all rheo ${cut} quintic 0 shift
fix 2 all rheo/viscosity constant ${eta}
fix 3 all rheo/pressure linear
fix 2 all rheo/viscosity * constant ${eta}
#fix 2 all rheo/viscosity * power ${eta} ${gd0} ${K} ${npow}
fix 3 all rheo/pressure * linear
fix 4 rig setforce 0.0 0.0 0.0
fix 5 fluid addforce ${fext} 0.0 0.0
compute 1 all rheo/property/atom rho phase
compute rho all rheo/property/atom rho
# ------ Output & Run ------ #
@ -71,11 +71,7 @@ compute 1 all rheo/property/atom rho phase
thermo 200
thermo_style custom step time ke press
variable skin equal 0.2*${cut}
neighbor ${skin} bin
neigh_modify one 5000
#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*]
dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho
run 20000

View File

@ -10,19 +10,16 @@ newton off
# ------ Create simulation box ------ #
variable sf equal 0.1
variable n equal 1.0/(${sf}^2)
variable cut equal 3.5*${sf}
variable n equal 1.0
variable cut equal 3.0
region box block 0 10 0 10 -0.01 0.01 units box
region box block 0 40 0 40 -0.01 0.01
create_box 1 box
lattice sq ${n}
create_atoms 1 region box
variable dr equal 0.1*${sf}
displace_atoms all random ${dr} ${dr} 0 135414 units box
displace_atoms all random 0.1 0.1 0 135414 units box
# ------ Model parameters ------ #
@ -53,22 +50,17 @@ pair_coeff * *
# ------ Fixes & computes ------ #
fix 1 all rheo ${cut} quintic 0 shift
fix 2 all rheo/viscosity constant ${eta}
fix 3 all rheo/pressure linear
compute 1 all rheo/property/atom rho phase
fix 1 all rheo ${cut} RK1 8 shift
fix 2 all rheo/viscosity * constant ${eta}
fix 3 all rheo/pressure * linear
compute rho all rheo/property/atom rho
# ------ Output & Run ------ #
thermo 200
thermo_style custom step time ke press
variable skin equal 0.2*${cut}
neighbor ${skin} bin
neigh_modify one 10000 #increase number of allowed neighbors
#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*]
#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho
run 10000

View File

@ -68,7 +68,7 @@ FixAddHeat::FixAddHeat(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) {
if (strcmp(arg[iarg], "overwrite") == 0) {
if (iarg + 1 >= narg) utils::missing_cmd_args(FLERR, "fix add/heat", error);
overwrite_flag = utils::bnumeric(FLERR, arg[iarg + 1], false, lmp);
overwrite_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
} else {
error->all(FLERR, "Illegal fix add/heat command, invalid argument {}", arg[iarg]);

View File

@ -227,7 +227,6 @@ void BondRHEOShell::compute(int eflag, int vflag)
if (t < EPSILON || std::isnan(t))
t = store_bond(n, i1, i2);
delx = x[i1][0] - x[i2][0];
dely = x[i1][1] - x[i2][1];
delz = x[i1][2] - x[i2][2];

View File

@ -213,12 +213,10 @@ void ComputeRHEOGrad::compute_peratom()
// Add corrections for walls
if (interface_flag) {
if (fluidi && (!fluidj)) {
compute_interface->correct_v(vi, vj, i, j);
//compute_interface->correct_v(vj, vi, j, i);
compute_interface->correct_v(vj, vi, j, i);
rhoj = compute_interface->correct_rho(j, i);
} else if ((!fluidi) && fluidj) {
compute_interface->correct_v(vj, vi, j, i);
//compute_interface->correct_v(vi, vj, i, j);
compute_interface->correct_v(vi, vj, i, j);
rhoi = compute_interface->correct_rho(i, j);
} else if ((!fluidi) && (!fluidj)) {
rhoi = rho0[itype];
@ -346,7 +344,7 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf,
} else if (comm_stage == COMMFIELD) {
if (velocity_flag) {
if (remap_v_flag & pbc_flag & (mask[j] & deform_groupbit)) {
if (remap_v_flag && pbc_flag && (mask[j] & deform_groupbit)) {
for (k = 0; k < dim; k++)
buf[m++] = v[j][k] + dv[k];
} else {

View File

@ -165,11 +165,11 @@ void ComputeRHEOInterface::compute_peratom()
fluidj = !(status[j] & PHASECHECK);
w = compute_kernel->calc_w_quintic(i, j, dx[0], dx[1], dx[2], sqrt(rsq));
status_match = 0;
norm[i] += w;
status_match = 0;
if ((fluidi && fluidj) || ((!fluidi) && (!fluidj)))
status_match = 1;
if (status_match) {
chi[i] += w;
} else {
@ -307,30 +307,26 @@ void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf)
/* ---------------------------------------------------------------------- */
void ComputeRHEOInterface::correct_v(double *vi, double *vj, int i, int j)
void ComputeRHEOInterface::correct_v(double *v_solid, double *v_fluid, int i_solid, int i_fluid)
{
double wall_prefactor, wall_denom, wall_numer;
wall_numer = 2.0 * cut * (chi[i] - 0.5);
if (wall_numer < 0) wall_numer = 0;
wall_denom = 2.0 * cut * (chi[j] - 0.5);
if (wall_denom < wall_max) wall_denom = wall_max;
wall_numer = MAX(2.0 * cut * (chi[i_solid] - 0.5), 0.0);
wall_denom = MAX(2.0 * cut * (chi[i_fluid] - 0.5), wall_max);
wall_prefactor = wall_numer / wall_denom;
vi[0] = (vi[0] - vj[0]) * wall_prefactor + vi[0];
vi[1] = (vi[1] - vj[1]) * wall_prefactor + vi[1];
vi[2] = (vi[2] - vj[2]) * wall_prefactor + vi[2];
v_solid[0] = (v_solid[0] - v_fluid[0]) * wall_prefactor;
v_solid[1] = (v_solid[1] - v_fluid[1]) * wall_prefactor;
v_solid[2] = (v_solid[2] - v_fluid[2]) * wall_prefactor;
}
/* ---------------------------------------------------------------------- */
double ComputeRHEOInterface::correct_rho(int i, int j)
double ComputeRHEOInterface::correct_rho(int i_solid, int i_fluid)
{
// i is wall, j is fluid
//In future may depend on atom type j's pressure equation
int itype = atom->type[i];
return MAX(rho0[itype], atom->rho[i]);
int itype = atom->type[i_solid];
return MAX(rho0[itype], atom->rho[i_solid]);
}
/* ---------------------------------------------------------------------- */

View File

@ -292,9 +292,14 @@ void ComputeRHEOPropertyAtom::pack_surface(int n)
int *mask = atom->mask;
int nlocal = atom->nlocal;
double label;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = (status[i] & SURFACECHECK);
else buf[n] = 0.0;
label = 0;
if (mask[i] & groupbit) {
if (status[i] & STATUS_SURFACE) label = 1.0;
if (status[i] & STATUS_SPLASH) label = 2.0;
}
buf[n] = label;
n += nvalues;
}
}

View File

@ -50,23 +50,18 @@ ComputeRHEOSurface::ComputeRHEOSurface(LAMMPS *lmp, int narg, char **arg) :
int dim = domain->dimension;
comm_forward = 2;
comm_reverse = dim * dim + 1;
nmax_store = 0;
grow_arrays(atom->nmax);
}
/* ---------------------------------------------------------------------- */
ComputeRHEOSurface::~ComputeRHEOSurface()
{
// Remove custom property if it exists
int tmp1, tmp2, index;
index = atom->find_custom("rheo_divr", tmp1, tmp2);
if (index != -1) atom->remove_custom(index, 1, 0);
index = atom->find_custom("rheo_rsurface", tmp1, tmp2);
if (index != -1) atom->remove_custom(index, 1, 0);
index = atom->find_custom("rheo_nsurface", tmp1, tmp2);
if (index != -1) atom->remove_custom(index, 1, 3);
memory->destroy(divr);
memory->destroy(rsurface);
memory->destroy(nsurface);
memory->destroy(B);
memory->destroy(gradC);
}
@ -87,29 +82,6 @@ void ComputeRHEOSurface::init()
cutsq = cut * cut;
// Create rsurface, divr, nsurface arrays as custom atom properties,
// can print with compute property/atom
// no grow callback as there's no reason to copy/exchange data, manually grow
// For B and gradC, create a local array since they are unlikely to be printed
int dim = domain->dimension;
int tmp1, tmp2;
index_divr = atom->find_custom("rheo_divr", tmp1, tmp2);
if (index_divr == -1) index_divr = atom->add_custom("rheo_divr", 1, 0);
divr = atom->dvector[index_divr];
index_rsurf = atom->find_custom("rheo_rsurface", tmp1, tmp2);
if (index_rsurf == -1) index_rsurf = atom->add_custom("rheo_rsurface", 1, 0);
rsurface = atom->dvector[index_rsurf];
index_nsurf = atom->find_custom("rheo_nsurface", tmp1, tmp2);
if (index_nsurf == -1) index_nsurf = atom->add_custom("rheo_nsurface", 1, dim);
nsurface = atom->darray[index_nsurf];
nmax_store = atom->nmax;
memory->create(B, nmax_store, dim * dim, "rheo/surface:B");
memory->create(gradC, nmax_store, dim * dim, "rheo/surface:gradC");
// need an occasional half neighbor list
neighbor->add_request(this, NeighConst::REQ_DEFAULT);
}
@ -148,7 +120,7 @@ void ComputeRHEOSurface::compute_peratom()
firstneigh = list->firstneigh;
// Grow and zero arrays
if (nmax_store <= atom->nmax)
if (nmax_store < atom->nmax)
grow_arrays(atom->nmax);
size_t nbytes = nmax_store * sizeof(double);
@ -253,6 +225,10 @@ void ComputeRHEOSurface::compute_peratom()
else
test = coordination[i] < threshold_z;
// Treat nonfluid particles as bulk
if (status[i] & PHASECHECK)
test = 0;
if (test) {
if (coordination[i] < threshold_splash)
status[i] |= STATUS_SPLASH;
@ -272,6 +248,7 @@ void ComputeRHEOSurface::compute_peratom()
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
fluidi = !(status[i] & PHASECHECK);
jlist = firstneigh[i];
jnum = numneigh[i];
@ -280,11 +257,14 @@ void ComputeRHEOSurface::compute_peratom()
j = jlist[jj];
j &= NEIGHMASK;
fluidj = !(status[j] & PHASECHECK);
dx[0] = xtmp - x[j][0];
dx[1] = ytmp - x[j][1];
dx[2] = ztmp - x[j][2];
rsq = lensq3(dx);
if (rsq < cutsq) {
if (fluidi) {
if ((status[i] & STATUS_BULK) && (status[j] & STATUS_SURFACE)) {
status[i] &= SURFACEMASK;
status[i] |= STATUS_LAYER;
@ -292,10 +272,10 @@ void ComputeRHEOSurface::compute_peratom()
if (status[j] & STATUS_SURFACE)
rsurface[i] = MIN(rsurface[i], sqrt(rsq));
}
if (j < nlocal || newton) {
if ((status[j] & STATUS_BULK) && (status[i] & STATUS_SURFACE)) {
if (fluidj && (j < nlocal || newton)) {
if ((status[j] & STATUS_BULK) && (status[j] & PHASECHECK) && (status[i] & STATUS_SURFACE)) {
status[j] &= SURFACEMASK;
status[j] |= STATUS_LAYER;
}
@ -307,6 +287,16 @@ void ComputeRHEOSurface::compute_peratom()
}
}
// clear normal vectors for non surface particles
for (i = 0; i < nall; i++) {
if (mask[i] & groupbit) {
if (!(status[i] & STATUS_SURFACE))
for (a = 0; a < dim; a++)
nsurface[i][a] = 0.0;
}
}
// forward/reverse status and rsurface
comm_stage = 1;
comm_reverse = 2;
@ -416,18 +406,11 @@ void ComputeRHEOSurface::grow_arrays(int nmax)
{
int dim = domain->dimension;
// Grow atom variables and reassign pointers
memory->grow(atom->dvector[index_divr], nmax, "atom:rheo_divr");
memory->grow(atom->dvector[index_rsurf], nmax, "atom:rheo_rsurface");
memory->grow(atom->darray[index_nsurf], nmax, dim, "atom:rheo_nsurface");
divr = atom->dvector[index_divr];
rsurface = atom->dvector[index_rsurf];
nsurface = atom->darray[index_nsurf];
// Grow local variables
memory->grow(divr, nmax, "rheo/surface:divr");
memory->grow(rsurface, nmax, "rheo/surface:rsurface");
memory->grow(nsurface, nmax, dim, "rheo/surface:nsurface");
memory->grow(B, nmax, dim * dim, "rheo/surface:B");
memory->grow(gradC, nmax, dim * dim, "rheo/surface:gradC");
nmax_store = atom->nmax;
nmax_store = nmax;
}

View File

@ -42,7 +42,6 @@ class ComputeRHEOSurface : public Compute {
private:
int surface_style, nmax_store, threshold_z, threshold_splash, interface_flag;
int threshold_style, comm_stage;
int index_divr, index_rsurf, index_nsurf;
double cut, cutsq, *rho0, threshold_divr;
double **B, **gradC;

View File

@ -72,6 +72,7 @@ void ComputeRHEOVShift::init()
compute_interface = fix_rheo->compute_interface;
compute_surface = fix_rheo->compute_surface;
rho0 = fix_rheo->rho0;
cut = fix_rheo->cut;
cutsq = cut * cut;
cutthird = cut / 3.0;
@ -174,16 +175,14 @@ void ComputeRHEOVShift::compute_peratom()
// Add corrections for walls
if (interface_flag) {
if (fluidi && (!fluidj)) {
compute_interface->correct_v(vi, vj, i, j);
//compute_interface->correct_v(vj, vi, j, i);
compute_interface->correct_v(vj, vi, j, i);
rhoj = compute_interface->correct_rho(j, i);
} else if ((!fluidi) && fluidj) {
compute_interface->correct_v(vj, vi, j, i);
//compute_interface->correct_v(vi, vj, i, j);
compute_interface->correct_v(vi, vj, i, j);
rhoi = compute_interface->correct_rho(i, j);
} else if ((!fluidi) && (!fluidj)) {
rhoi = 1.0;
rhoj = 1.0;
rhoi = rho0[itype];
rhoj = rho0[jtype];
}
}
@ -196,7 +195,7 @@ void ComputeRHEOVShift::compute_peratom()
w4 = w * w * w * w / (w0 * w0 * w0 * w0);
dr = -2 * cutthird * (1 + 0.2 * w4) * wp * rinv;
if (mask[i] & groupbit) {
if ((mask[i] & groupbit) && fluidi) {
vmag = sqrt(vi[0] * vi[0] + vi[1] * vi[1] + vi[2] * vi[2]);
prefactor = vmag * volj * dr;
@ -206,7 +205,7 @@ void ComputeRHEOVShift::compute_peratom()
}
if (newton_pair || j < nlocal) {
if (mask[j] & groupbit) {
if ((mask[j] & groupbit) && fluidj) {
vmag = sqrt(vj[0] * vj[0] + vj[1] * vj[1] + vj[2] * vj[2]);
prefactor = vmag * voli * dr;
@ -241,7 +240,11 @@ void ComputeRHEOVShift::correct_surfaces()
double nx, ny, nz, vx, vy, vz, dot;
for (i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
if ((status[i] & STATUS_SURFACE) || (status[i] & STATUS_LAYER)) {
if (status[i] & PHASECHECK) continue;
//if ((status[i] & STATUS_SURFACE) || (status[i] & STATUS_LAYER)) {
if (status[i] & STATUS_SURFACE) {
nx = nsurface[i][0];
ny = nsurface[i][1];
vx = vshift[i][0];
@ -266,6 +269,10 @@ void ComputeRHEOVShift::correct_surfaces()
} else {
vshift[i][2] = 0.0;
}
} else if (status[i] & STATUS_SPLASH) {
vshift[i][0] = 0.0;
vshift[i][1] = 0.0;
vshift[i][2] = 0.0;
}
}
}

View File

@ -43,6 +43,7 @@ class ComputeRHEOVShift : public Compute {
int nmax_store;
double dtv, cut, cutsq, cutthird;
int surface_flag, interface_flag;
double *rho0;
class NeighList *list;
class ComputeRHEOInterface *compute_interface;

View File

@ -125,7 +125,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) :
interface_flag = 1;
} else if (strcmp(arg[iarg], "rho/sum") == 0) {
rhosum_flag = 1;
} else if (strcmp(arg[iarg], "self/mass")) {
} else if (strcmp(arg[iarg], "self/mass") == 0) {
self_mass_flag = 1;
} else if (strcmp(arg[iarg], "density") == 0) {
if (iarg + n >= narg) error->all(FLERR, "Illegal rho0 option in fix rheo");
@ -145,7 +145,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) :
iarg += 1;
}
if (self_mass_flag && !rhosum_flag)
if (self_mass_flag && (!rhosum_flag))
error->all(FLERR, "Cannot use self/mass setting without rho/sum");
if (lmp->citeme) lmp->citeme->add(cite_rheo);
@ -227,6 +227,26 @@ void FixRHEO::init()
if (modify->get_fix_by_style("^rheo$").size() > 1)
error->all(FLERR, "Can only specify one instance of fix rheo");
if (atom->status_flag != 1)
error->all(FLERR,"fix rheo command requires atom property status");
if (atom->rho_flag != 1)
error->all(FLERR,"fix rheo command requires atom property rho");
if (atom->pressure_flag != 1)
error->all(FLERR,"fix rheo command requires atom property pressure");
if (atom->viscosity_flag != 1)
error->all(FLERR,"fix rheo command requires atom property viscosity");
if (thermal_flag) {
if (atom->esph_flag != 1)
error->all(FLERR,"fix rheo command requires atom property esph with thermal setting");
if (atom->temperature_flag != 1)
error->all(FLERR,"fix rheo command requires atom property temperature with thermal setting");
if (atom->heatflow_flag != 1)
error->all(FLERR,"fix rheo command requires atom property heatflow with thermal setting");
if (atom->conductivity_flag != 1)
error->all(FLERR,"fix rheo command requires atom property conductivity with thermal setting");
}
}
/* ---------------------------------------------------------------------- */
@ -386,6 +406,7 @@ void FixRHEO::initial_integrate(int /*vflag*/)
for (i = 0; i < nlocal; i++) {
if (status[i] & STATUS_NO_SHIFT) continue;
if (status[i] & PHASECHECK) continue;
if (mask[i] & groupbit) {
for (a = 0; a < dim; a++) {

View File

@ -79,7 +79,7 @@ namespace RHEO_NS {
enum Status{
// Phase status
STATUS_SOLID = 1 << 0,
// STATUS_REACTIVE = 1 << 1,
// Gap for future phase: STATUS_ = 1 << 1,
// Surface status
STATUS_BULK = 1 << 2,

View File

@ -30,6 +30,7 @@
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
using namespace LAMMPS_NS;
using namespace RHEO_NS;
@ -55,6 +56,8 @@ FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) :
{
if (narg != 6) error->all(FLERR,"Illegal fix command");
force_reneighbor = 1;
next_reneighbor = -1;
comm_forward = 3;
cut = utils::numeric(FLERR, arg[3], false, lmp);
@ -82,8 +85,9 @@ FixRHEOOxidation::~FixRHEOOxidation()
int FixRHEOOxidation::setmask()
{
int mask = 0;
mask |= PRE_FORCE;
mask |= POST_INTEGRATE;
mask |= PRE_FORCE;
mask |= POST_FORCE;
return mask;
}
@ -133,25 +137,19 @@ void FixRHEOOxidation::setup_pre_force(int /*vflag*/)
if (!fix_rheo->surface_flag) error->all(FLERR,
"fix rheo/oxidation requires surface calculation in fix rheo");
compute_surface = fix_rheo->compute_surface;
pre_force(0);
}
/* ---------------------------------------------------------------------- */
void FixRHEOOxidation::pre_force(int /*vflag*/)
{
int *status = atom->status;
for (int i = 0; i < atom->nlocal; i++)
if (num_bond[i] != 0)
status[i] |= STATUS_NO_SHIFT;
}
/* ---------------------------------------------------------------------- */
void FixRHEOOxidation::post_integrate()
{
int i, j, n, ii, jj, inum, jnum, bflag;
int i, j, n, ii, jj, inum, jnum, bflag, fluidi, fluidj;
int *ilist, *jlist, *numneigh, **firstneigh;
double delx, dely, delz, rsq;
tagint tagi, tagj;
@ -163,6 +161,8 @@ void FixRHEOOxidation::post_integrate()
tagint **bond_atom = atom->bond_atom;
int **bond_type = atom->bond_type;
int *num_bond = atom->num_bond;
int *mask = atom->mask;
int *status = atom->status;
double *rsurface = compute_surface->rsurface;
double **x = atom->x;
@ -175,10 +175,15 @@ void FixRHEOOxidation::post_integrate()
// Note: surface designation lags one timestep, acceptable error
comm->forward_comm(this);
int added_bonds = 0;
// loop over neighbors of my atoms
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
if (rsurface[i] > rsurf) continue;
if (!(mask[i] & groupbit)) continue;
// Exclude particles that aren't solid or surface
fluidi = !(status[i] & PHASECHECK);
if (fluidi && (rsurface[i] > rsurf)) continue;
tagi = tag[i];
@ -188,8 +193,13 @@ void FixRHEOOxidation::post_integrate()
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
j &= NEIGHMASK;
if (!(mask[j] & groupbit)) continue;
if (rsurface[j] > rsurf) continue;
fluidj = !(status[j] & PHASECHECK);
if (fluidj && (rsurface[j] > rsurf)) continue;
// Skip solid-solid, leaves surface-surface or surface-solid
if ((!fluidi) && (!fluidj)) continue;
tagj = tag[j];
@ -218,6 +228,8 @@ void FixRHEOOxidation::post_integrate()
}
if (bflag) continue;
added_bonds += 1;
// Add bonds to owned atoms
// If newton bond off, add to both, otherwise add to whichever has a smaller tag
@ -230,6 +242,23 @@ void FixRHEOOxidation::post_integrate()
}
}
}
int added_bonds_all;
MPI_Allreduce(&added_bonds, &added_bonds_all, 1, MPI_INT, MPI_SUM, world);
if (added_bonds_all > 0)
next_reneighbor = update->ntimestep;
}
/* ---------------------------------------------------------------------- */
void FixRHEOOxidation::post_force(int /*vflag*/)
{
int *status = atom->status;
int *num_bond = atom->num_bond;
for (int i = 0; i < atom->nlocal; i++)
if (num_bond[i] != 0)
status[i] |= STATUS_NO_SHIFT;
}
/* ---------------------------------------------------------------------- */

View File

@ -34,8 +34,9 @@ class FixRHEOOxidation : public Fix {
void init() override;
void init_list(int, class NeighList *) override;
void setup_pre_force(int) override;
void pre_force(int) override;
void post_integrate() override;
void pre_force(int) override;
void post_force(int) override;
int pack_forward_comm(int, int *, double *, int, int *) override;
void unpack_forward_comm(int, int, double *) override;
int *nbond;

View File

@ -259,7 +259,8 @@ void FixRHEOThermal::init()
compute_grad = fix_rheo->compute_grad;
compute_vshift = fix_rheo->compute_vshift;
dtf = 0.5 * update->dt * force->ftm2v;
dt = update->dt;
dth = 0.5 * update->dt;
if (atom->esph_flag != 1)
error->all(FLERR,"fix rheo/thermal command requires atom property esph");
@ -337,7 +338,7 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/)
for (i = 0; i < nlocal; i++) {
if (status[i] & STATUS_NO_SHIFT) continue;
for (a = 0; a < dim; a++)
energy[i] += dtv * vshift[i][a] * grade[i][a];
energy[i] += dt * vshift[i][a] * grade[i][a];
}
}
@ -363,7 +364,7 @@ void FixRHEOThermal::post_integrate()
itype = type[i];
cvi = calc_cv(i, itype);
energy[i] += dtf * heatflow[i];
energy[i] += dth * heatflow[i];
temperature[i] = energy[i] / cvi;
if (Tc_style[itype] != NONE) {
@ -376,6 +377,8 @@ void FixRHEOThermal::post_integrate()
temperature[i] = Ti;
}
// Check phase change if Ti != Tci
if (Ti > Tci) {
// If solid, melt
if (status[i] & STATUS_SOLID) {
@ -383,7 +386,9 @@ void FixRHEOThermal::post_integrate()
status[i] |= STATUS_MELTING;
n_melt += 1;
}
} else {
}
if (Ti < Tci) {
// If fluid, freeze
if (!(status[i] & STATUS_SOLID)) {
status[i] &= PHASEMASK;
@ -400,6 +405,23 @@ void FixRHEOThermal::post_integrate()
MPI_Allreduce(&n_freeze, &n_freeze_all, 1, MPI_INT, MPI_SUM, world);
if (cut_bond > 0 && (n_melt_all || n_freeze_all)) {
// If a particle freezes, check if it already has bonds of that type
// If so, assume it was inserted as a solid particle
// Note: inserted solid particle may still shift one timestep
int *num_bond = atom->num_bond;
int **bond_type = atom->bond_type;
for (i = 0; i < atom->nlocal; i++) {
if (status[i] & STATUS_FREEZING) {
for (int n = 0; n < num_bond[i]; n++) {
if (bond_type[i][n] == btype) {
status[i] &= ~STATUS_FREEZING;
break;
}
}
}
}
// Forward status + positions (after inititial integrate, before comm)
comm->forward_comm(this);
@ -464,11 +486,6 @@ void FixRHEOThermal::pre_force(int /*vflag*/)
}
}
}
// Add temporary options, wiped by preceding fix rheo preforce
for (int i = 0; i < nall; i++)
if (status[i] & STATUS_SOLID)
status[i] |= STATUS_NO_SHIFT;
}
/* ---------------------------------------------------------------------- */
@ -482,7 +499,7 @@ void FixRHEOThermal::final_integrate()
//Integrate energy
for (int i = 0; i < atom->nlocal; i++) {
if (status[i] & STATUS_NO_INTEGRATION) continue;
energy[i] += dtf * heatflow[i];
energy[i] += dth * heatflow[i];
}
}
@ -490,8 +507,8 @@ void FixRHEOThermal::final_integrate()
void FixRHEOThermal::reset_dt()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dt = update->dt;
dth = 0.5 * update->dt;
}
/* ---------------------------------------------------------------------- */

View File

@ -48,7 +48,7 @@ class FixRHEOThermal : public Fix {
private:
double *cv, *Tc, *kappa, *L;
double dtf, dtv;
double dt, dth;
double cut_kernel, cut_bond, cutsq_bond;
int *cv_style, *Tc_style, *kappa_style, *L_style;
int btype;

View File

@ -208,14 +208,14 @@ void PairRHEO::compute(int eflag, int vflag)
// Add corrections for walls
rhoi = rho[i];
rhoj = rho[j];
rho0i = rho[itype];
rho0j = rho[jtype];
rho0i = rho0[itype];
rho0j = rho0[jtype];
Pi = pressure[i];
Pj = pressure[j];
fmag = 0;
if (interface_flag) {
if (fluidi && (!fluidj)) {
compute_interface->correct_v(vi, vj, i, j);
compute_interface->correct_v(vj, vi, j, i);
rhoj = compute_interface->correct_rho(j, i);
Pj = fix_pressure->calc_pressure(rhoj, jtype);
@ -223,7 +223,7 @@ void PairRHEO::compute(int eflag, int vflag)
fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0j * csq_ave * h * rinv;
} else if ((!fluidi) && fluidj) {
compute_interface->correct_v(vj, vi, j, i);
compute_interface->correct_v(vi, vj, i, j);
rhoi = compute_interface->correct_rho(i, j);
Pi = fix_pressure->calc_pressure(rhoi, itype);