Processing math: 100%
본문 바로가기

LIGGGHTS

Variable of variable

LIGGGHTS에서 equal, atom variable은 variable이 정의가 될 때 값이 정해지지 않고, fix, compute, print 등에서 조회될 때 값이 update된다.

 

예를 들어, 아래와 같은 경우 fix로 정의된 print시 매 ${screen_nstep}마다 servo_z_position variable이 호출되어 값이 update된다.

fix                topcap_ovp all mesh/surface/stress/servo file top_cap.stl type 2 com 0.0 0.0 ${topcap_ini_z} ctrlPV force axis 0 0 1 target_val ${topcap_force_z} vel_max ${topcap_vel_max}
variable           servo_z_position equal f_topcap_ovp[9]

fix                print_test all print ${screen_nstep} "${servo_z_position}" screen yes append servo.deb

 

그런데, 가끔 문제가 생기는 경우가 있는데 variable안에 variable이 포함되는 경우 이다. 예를 들어 보자.

fix                topcap_ovp all mesh/surface/stress/servo file top_cap.stl type 2 com 0.0 0.0 ${topcap_ini_z} ctrlPV force axis 0 0 1 target_val ${topcap_force_z} vel_max ${topcap_vel_max}
variable           servo_z_position equal f_topcap_ovp[9]

variable           ak equal (${dim_B}*${dim_L}*${servo_z_position})
variable           ak1 equal (v_dim_B*v_dim_L*v_servo_z_position)

fix                print_stress all print ${screen_nstep} "${dim_B}, ${dim_L}, ${servo_z_position}, ${ak}, ${ak1}" screen yes append servo.deb

결과를 보면 {servo_z_position}과 v_servo_z_position의 결과가 다르게 나타남을 알 수 있다.{variable}는 변수 update가 이루어 지지 않으나, v_variable은 update가 이루어짐을 알 수 있다.

0.05, 0.05, 0.0269800010000105, 6.75e-05, 6.74500025000263e-05
current step, dt, time = 2220000, 1e-06, 2.22
0.05, 0.05, 0.0269600010000211, 6.75e-05, 6.74000025000528e-05
current step, dt, time = 2240000, 1e-06, 2.24
0.05, 0.05, 0.0269400010000316, 6.75e-05, 6.7350002500079e-05
current step, dt, time = 2260000, 1e-06, 2.26
0.05, 0.05, 0.0269200010000421, 6.75e-05, 6.73000025001053e-05
current step, dt, time = 2280000, 1e-06, 2.28
0.05, 0.05, 0.0269000010000526, 6.75e-05, 6.72500025001315e-05
current step, dt, time = 2300000, 1e-06, 2.3
0.05, 0.05, 0.0268800010000632, 6.75e-05, 6.7200002500158e-05
current step, dt, time = 2320000, 1e-06, 2.32
0.05, 0.05, 0.0268600010000737, 6.75e-05, 6.71500025001843e-05
current step, dt, time = 2340000, 1e-06, 2.34
0.05, 0.05, 0.0268400010000842, 6.75e-05, 6.71000025002105e-05
current step, dt, time = 2360000, 1e-06, 2.36
0.05, 0.05, 0.0268200010000947, 6.75e-05, 6.70500025002368e-05
current step, dt, time = 2380000, 1e-06, 2.38
0.05, 0.05, 0.0268000010001053, 6.75e-05, 6.70000025002633e-05
current step, dt, time = 2400000, 1e-06, 2.4
0.05, 0.05, 0.0267800010001158, 6.75e-05, 6.69500025002895e-05
current step, dt, time = 2420000, 1e-06, 2.42
0.05, 0.05, 0.0267600010001263, 6.75e-05, 6.69000025003158e-05
current step, dt, time = 2440000, 1e-06, 2.44
0.05, 0.05, 0.0267400010001369, 6.75e-05, 6.68500025003423e-05
current step, dt, time = 2460000, 1e-06, 2.46
0.05, 0.05, 0.0267200010001474, 6.75e-05, 6.68000025003685e-05

'LIGGGHTS' 카테고리의 다른 글