LIGGGHTS에서 simuldation data를 저장하는 방법은 총 3가지가 있다.
write_data, write_restart, write_dump
write_data와 write_dump는 text 포맷으로 저장하며, write_restart는 binary 포맷을 지원한다.
문제는 저장 후 load시 simulation box 변경을 하는 경우이다. atom의 pluviation단계와 이후 단계에서 simulation영역이 달라지는 경우 LIGGGHTS에서는 load-balancing을 통한 processor grid를 재설정 하지 않기 때문에, simulation box의 사이즈를 조정하며 processor당 할당되는 simulation 영역을 최적화 해주어야 한다.
그런데, write_restart는 저장되는 정보는 가장 많으나 atom remap등과 같은 processor당 할당 atom등과 같은 정보들을 가지고 있기 때문에 read_restart단계에서 simulation box의 사이즈 조정이 불가능하다. (single processor의 경우 가능)
예를들어, time step의 경우 write_restart를 사용하는 경우 저장되지만 write_data로는 저장되지 않는다. 그리고, read_data, creat_box명령어는 time step을 0으로 초기화 한다.
따라서, time step의 조정은 다음의 명령어를 사용한다.
reset_timestep N
따라서, 가장 기본적인 정보 (atom ID, type, x, y, z, density, radius)만을 저장하여 read하는 경우 simulation box size의 크기 조정이 가능하므로 이 방법을 사용할 수 있다.
그런데, text포맷을 사용하므로 atom의 개수가 기하 급수적으로 늘어난다면? 이건 나중에 닥쳤을때 해결책을 찾아보도록 하자.
### This is test file for read_data
### 1. Initializaion Phase
# Preliminaries
atom_style granular
atom_modify map array # necessary?
boundary f f f # default is p p p
newton off # need more information and examples
communicate single vel yes
units si # This command cannot be used after the simulation box
hard_particles yes
dimension 3 # default value is 3
# Neighbor listing
neighbor 0.003 bin
neigh_modify delay 0
# Declare domain
region domain_1 block -0.1 0.1 -0.1 0.1 -0.1 0.1 units box # xmin-max ymin-max zmin-max
create_box 2 domain_1 # Declare number of atom types used in the simulation, This affect "fix property/global"
variable dt_ equal 0.00001
timestep ${dt_}
fix grav_acc all gravity 9.81 vector 0.0 0.0 -1.0
### 2. Setup properties
# Material and interaction properties required
fix m_1 all property/global youngsModulus peratomtype 2.e7 2.e7
fix m_2 all property/global poissonsRatio peratomtype 0.25 0.25
fix m_3 all property/global coefficientRestitution peratomtypepair 2 0.1 0.1 0.1 0.1
fix m_4 all property/global coefficientFriction peratomtypepair 2 0.01 0.01 0.01 0.01
pair_style gran model hertz tangential history #Hertzian without cohesion
pair_coeff * *
### 3. Create atoms
create_atoms 1 single 0.0 0.0 0.00 # atom #2
set atom 1 type 1 density 2000 diameter 0.005
### 4. Setup variables
variable step_now equal step
variable time_now equal step*v_dt_
### 4. Import Mesh from STL
fix box_base all mesh/surface file base.stl type 2 scale 1.0
fix box_side all mesh/surface file side_wall.stl type 2 scale 1.0
fix box_moving_L all mesh/surface file moving_wall_L.stl type 2 scale 1.0
fix box_moving_R all mesh/surface file moving_wall_R.stl type 2 scale 1.0
fix gran_walls all wall/gran model hertz tangential history mesh n_meshes 4 meshes box_base box_side box_moving_L box_moving_R
### 4. Set equation of motion
fix integral_eq_motion all nve/sphere
compute rke all erotate/sphere update_on_run_end yes
### 5. Create Imaging informations
run 1
dump dump_mesh_base all mesh/vtk 100 post/base_mesh_*.vtk id vel box_base
dump dump_mesh_side all mesh/vtk 100 post/side_mesh_*.vtk id vel box_side
dump dump_stl_moving_L all mesh/stl 100 post/moving_L_stl_*.stl box_moving_L
dump dump_stl_moving_R all mesh/stl 100 post/moving_R_stl_*.stl box_moving_R
dump dump_atoms all custom/vtk 100 post/atoms*.vtk id type x y z vx vy vz omegax omegay omegaz density diameter
### Setup print
fix print_time all print 100 "current step, dt, time = ${step_now}, ${dt_}, ${time_now}" screen yes
### 7. Run
run 10000 upto
print " "
print "===="
print "simulation end"
print "===="
change_box all x final -0.05 0.05 y final -0.05 0.05 z final -0.05 0.05
write_data akt.txt
Simulation box는 앞선 파일의 change_box를 사용하기 보다는 아래의 write_data로 만들어지는 파일에서 수정하는 것이 사소한 오류를 줄일 수 있다.
LAMMPS data file via write_data, version Version LIGGGHTS-PUBLIC 3.8.0, compiled 2023-04-24-22:04:34 by jinsun, git commit 5207ed861b1351eb03ccd7bc4c4e612b00c8ff56, timestep = 10000
1 atoms
2 atom types
-5.0000000000000003e-02 5.0000000000000003e-02 xlo xhi
-5.0000000000000003e-02 5.0000000000000003e-02 ylo yhi
-5.0000000000000003e-02 5.0000000000000003e-02 zlo zhi
Atoms
1 1 5.0000000000000001e-03 2.0000000000000000e+03 0.0000000000000000e+00 0.0000000000000000e+00 -1.2501482905408676e-02 0 0 0
Velocities
1 0.0000000000000000e+00 0.0000000000000000e+00 -4.0535180816119558e-14 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
이건 이어지는 해석 파일
# Preliminaries
atom_style granular
atom_modify map array # necessary?
boundary f f f # default is p p p
newton off # need more information and examples
communicate single vel yes
units si # This command cannot be used after the simulation box
hard_particles yes
dimension 3 # default value is 3
# Neighbor listing
neighbor 0.003 bin
neigh_modify delay 0
read_data akt.txt
variable dt_ equal 0.00001
timestep ${dt_}
fix grav_acc all gravity 9.81 vector 0.0 0.0 -1.0
### 2. Setup properties
# Material and interaction properties required
fix m_1 all property/global youngsModulus peratomtype 2.e7 2.e7
fix m_2 all property/global poissonsRatio peratomtype 0.25 0.25
fix m_3 all property/global coefficientRestitution peratomtypepair 2 0.1 0.1 0.1 0.1
fix m_4 all property/global coefficientFriction peratomtypepair 2 0.01 0.01 0.01 0.01
pair_style gran model hertz tangential history #Hertzian without cohesion
pair_coeff * *
## 4. Setup variables
variable step_now equal step
variable time_now equal step*v_dt_
### 4. Import Mesh from STL
fix box_base all mesh/surface file base.stl type 2 scale 1.0
fix box_side all mesh/surface file side_wall.stl type 2 scale 1.0
fix box_moving_L all mesh/surface file moving_wall_L.stl type 2 scale 1.0
fix box_moving_R all mesh/surface file moving_wall_R.stl type 2 scale 1.0
fix gran_walls all wall/gran model hertz tangential history mesh n_meshes 4 meshes box_base box_side box_moving_L box_moving_R
### 4. Set equation of motion
fix integral_eq_motion all nve/sphere
compute rke all erotate/sphere update_on_run_end yes
### 5. Create Imaging informations
run 1
dump dump_mesh_base all mesh/vtk 100 post/base_mesh_*.vtk id vel box_base
dump dump_mesh_side all mesh/vtk 100 post/side_mesh_*.vtk id vel box_side
dump dump_stl_moving_L all mesh/stl 100 post/moving_L_stl_*.stl box_moving_L
dump dump_stl_moving_R all mesh/stl 100 post/moving_R_stl_*.stl box_moving_R
dump dump_atoms all custom/vtk 100 post/atoms*.vtk id type x y z vx vy vz omegax omegay omegaz density diameter
### Setup print
fix print_time all print 100 "current step, dt, time = ${step_now}, ${dt_}, ${time_now}" screen yes
### 7. Run
reset_timestep 10000
run 20000 upto
print " "
print "===="
print "simulation end"
print "===="
'LIGGGHTS' 카테고리의 다른 글
GranWall에 작용하는 Force의 추출 (0) | 2023.08.17 |
---|---|
Atom은 죽지 않는다. ID를 남길 뿐이다. (0) | 2023.08.10 |
Variable of variable (1) | 2023.08.05 |
Atom style variable의 연산 (0) | 2023.08.01 |
Thermo style variable (0) | 2023.08.01 |