沉淀溶解平衡
Model was written in NetLogo 6.4.0
•
Viewed 73 times
•
Downloaded 4 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
; Li Ying created this module at Shaanxi Normal University in 2024. If you mention this model in a publication, we ask that you include the citations below. ;Ying, L. (2024). Precipitation Dissolution Equilibrium. School of Chemistry and Chemical Engineering, Shaanxi Normal University. breed [mode8_ag_t mode8_ag] breed [mode8_cl_t mode8_cl] breed [mode8_i_t mode8_i] breed [mode8_s_t mode8_s] breed [mode8_ag2s_t mode8_ag2s] breed [mode8_agi_t mode8_agi] breed [mode8_agcl_t mode8_agcl] globals[ Ksp_agcl dissolution_flag_agcl Precipitation_flag_agcl dissolution_flag_agi Precipitation_flag_agi dissolution_flag_ag2s Precipitation_flag_ag2s y y_agcl total_cl total_i total_s ] to setup clear-all output-print " AgCl(s) <==> Ag+ (aq)+Cl- (aq)" ;设置画布颜色 ask patches with [pycor < 1] [ set pcolor sky + 4 ] ask patches with [pycor > 0] [ set pcolor white ] ;;初始化海龟 set-default-shape mode8_ag_t "ag" set-default-shape mode8_cl_t "cl" set-default-shape mode8_i_t "i" set-default-shape mode8_s_t "s" set-default-shape mode8_ag2s_t "ag2s" set-default-shape mode8_agi_t "agi" set-default-shape mode8_agcl_t "agcl" ;;初始化turtle let total-mode8_agcl_t 320 ; 总共海龟的数量 let rows 8 ; 行数 let columns 40 ; 列数 let distance-between-turtles 1 ; 海龟之间的间隔 let current-turtle 0 let row 0 while [row < rows] [ let column 0 while [column < columns] [ create-mode8_agcl_t 1 [ setxy column * distance-between-turtles row * distance-between-turtles - 24 set size 1.8 set heading 30 ; 设置海龟的朝向为右侧(0°) ] set column column + 1 set current-turtle current-turtle + 1 ] set row row + 1 ] set dissolution_flag_agcl 0 set Precipitation_flag_agcl 0 set y 0 set total_cl 13 set y_agcl -17 reset-ticks end to go set Ksp_agcl (1.77 * 10 ^ (-10)) Precipitation_dissolution_agcl Precipitation_dissolution_agi Precipitation_dissolution_ag2s ask mode8_ag_t [ ; 随机选择运动距离和角度 let distance_ag 2 ifelse (ycor > -17) and (ycor < (y - 1)) and (xcor > -19) and (xcor < 19) [ set heading random 360 ][ ; 左边墙 ifelse (xcor < -19) [ set heading 90 ][] ; 右边墙 ifelse (xcor > 19) [ set heading 270 ][] ; 下面墙 ifelse (ycor < -17) [ set heading 0 ][] ; 上面墙 ifelse (ycor > (y - 1)) [ set heading 180 ][] ; 左上角 ifelse (xcor <= -19) and (ycor >= (y - 1)) [ set heading 135 ][] ; 右上角 ifelse (xcor >= 19) and (ycor >= (y - 1)) [ set heading 315 ][] ; 左下角 ifelse (xcor <= -19) and (ycor <= -17) [ set heading 45 ][] ; 右下角 ifelse (xcor >= 19) and (ycor <= -17) [ set heading 225 ][] ] fd 1 ] ask mode8_cl_t [ ; 随机选择运动距离和角度 let distance_cl 2 ifelse (ycor > -17) and (ycor < (y - 1)) and (xcor > -19) and (xcor < 19) [ set heading random 360 ][ ; 左边墙 ifelse (xcor < -19) [ set heading 90 ][] ; 右边墙 ifelse (xcor > 19) [ set heading 270 ][] ; 下面墙 ifelse (ycor < -17) [ set heading 0 ][] ; 上面墙 ifelse (ycor > (y - 1)) [ set heading 180 ][] ; 左上角 ifelse (xcor <= -19) and (ycor >= (y - 1)) [ set heading 135 ][] ; 右上角 ifelse (xcor >= 19) and (ycor >= (y - 1)) [ set heading 315 ][] ; 左下角 ifelse (xcor <= -19) and (ycor <= -17) [ set heading 45 ][] ; 右下角 ifelse (xcor >= 19) and (ycor <= -17) [ set heading 225 ][] ] fd 1 ] ask mode8_i_t [ ; 随机选择运动距离和角度 let distance_ag 2 ifelse (ycor > -17) and (ycor < (y - 1)) and (xcor > -19) and (xcor < 19) [ set heading random 360 ][ ; 左边墙 ifelse (xcor < -19) [ set heading 90 ][] ; 右边墙 ifelse (xcor > 19) [ set heading 270 ][] ; 下面墙 ifelse (ycor < -17) [ set heading 0 ][] ; 上面墙 ifelse (ycor > (y - 1)) [ set heading 180 ][] ; 左上角 ifelse (xcor <= -19) and (ycor >= (y - 1)) [ set heading 135 ][] ; 右上角 ifelse (xcor >= 19) and (ycor >= (y - 1)) [ set heading 315 ][] ; 左下角 ifelse (xcor <= -19) and (ycor <= -17) [ set heading 45 ][] ; 右下角 ifelse (xcor >= 19) and (ycor <= -17) [ set heading 225 ][] ] fd 1 ] ask mode8_s_t [ ; 随机选择运动距离和角度 let distance_ag 2 ifelse (ycor > -17) and (ycor < (y - 1)) and (xcor > -19) and (xcor < 19) [ set heading random 360 ][ ; 左边墙 ifelse (xcor < -19) [ set heading 90 ][] ; 右边墙 ifelse (xcor > 19) [ set heading 270 ][] ; 下面墙 ifelse (ycor < -17) [ set heading 0 ][] ; 上面墙 ifelse (ycor > (y - 1)) [ set heading 180 ][] ; 左上角 ifelse (xcor <= -19) and (ycor >= (y - 1)) [ set heading 135 ][] ; 右上角 ifelse (xcor >= 19) and (ycor >= (y - 1)) [ set heading 315 ][] ; 左下角 ifelse (xcor <= -19) and (ycor <= -17) [ set heading 45 ][] ; 右下角 ifelse (xcor >= 19) and (ycor <= -17) [ set heading 225 ][] ] fd 1 ] tick end to Precipitation_dissolution_agcl ;溶解-ancl if dissolution_flag_agcl = 0[ let temp_number_agcl count mode8_ag_t let turtle_xys [] if temp_number_agcl < total_cl[ if count turtles with [breed = mode8_agcl_t and ycor = y_agcl] = 0[ set y_agcl ( y_agcl - 1) ] let mode8_agcl_t_molecule one-of turtles with [breed = mode8_agcl_t and ycor = y_agcl] ;;将一个agcl分子变成ag + cl ask mode8_agcl_t_molecule [ let xys list xcor ycor ; 创建一个包含当前乌龟坐标对的列表 set turtle_xys lput xys turtle_xys ; 将当前乌龟的坐标对添加到列表中 set breed mode8_ag_t set size 1.8 ];;创建一个cl foreach turtle_xys [ xy -> create-mode8_cl_t 1 [ setxy (item 0 xy) (item 1 xy) ; 根据坐标对生成乌龟 set size 1.8 ; 可根据需要设置乌龟颜色 ] ] ] ] ; if temp_number_agcl = total[ ; set dissolution_flag 1 ; ] ;沉淀-agcl if Precipitation_flag_agcl = 0[ if ticks mod 50 = 0 [ ask mode8_ag_t [ let meeting-mode8_cl_t mode8_cl_t in-radius 1 if count meeting-mode8_cl_t > 0 [ ; 在半径2的范围内相遇时,创建新的turtle let turtles-here-mode8_ag_t turtles with [breed = mode8_ag_t] let turtles-here-mode8_cl_t turtles with [breed = mode8_cl_t] let turtle_mode8_ag_t one-of turtles-here-mode8_ag_t in-radius 1 let turtle_mode8_cl_t one-of turtles-here-mode8_cl_t in-radius 1 if turtle_mode8_ag_t != nobody and turtle_mode8_cl_t != nobody [ if count mode8_ag_t > 2[ ask turtle_mode8_ag_t [ set breed mode8_agcl_t set size 1.8 ] ask mode8_agcl_t [ if ycor > y_agcl [ let rounded_ycor round ycor set rounded_ycor rounded_ycor - 1 set heading 30 ;; 向下移动一个单位 set ycor rounded_ycor ] ] ; 删除原来的mode8_cl_t turtle ask turtle_mode8_cl_t [ die ] ] ] ] ] ] ] end to up_T set Ksp_agcl (2150 * 10 ^ (-12)) set total_cl 46 end to add_water ;设置画布颜色 ask patches with [pycor < 14] [ set pcolor sky + 4 ] ask patches with [pycor > 13] [ set pcolor white ] set total_cl 20 end to add_NaCl create-mode8_cl_t 18 [ let random-xcor-xcor random 36 - 18 let random-ycor-ycor random -16 - 1 setxy random-xcor-xcor random-ycor-ycor set size 1.8 ; 设置海龟大小 ] set total_cl 7 end to add_KI create-mode8_i_t 20 [ let random-xcor-xcor random 36 - 18 let random-ycor-ycor random -16 - 1 setxy random-xcor-xcor random-ycor-ycor set size 1.8 ; 设置海龟大小 ] set total_i 5 set Precipitation_flag_agi 1 set dissolution_flag_agi 1 set Precipitation_flag_agcl 1 end to Precipitation_dissolution_agi if ticks mod 2 = 0 [ ;沉淀-agi if Precipitation_flag_agi = 1[ ask mode8_ag_t [ let meeting-mode8_i_t mode8_i_t in-radius 1 if count meeting-mode8_i_t > 0 [ ; 在半径2的范围内相遇时,创建新的turtle let turtles-here-mode8_ag_t turtles with [breed = mode8_ag_t] let turtles-here-mode8_i_t turtles with [breed = mode8_i_t] let turtle_mode8_ag_t one-of turtles-here-mode8_ag_t in-radius 1 let turtle_mode8_i_t one-of turtles-here-mode8_i_t in-radius 1 if turtle_mode8_ag_t != nobody and turtle_mode8_i_t != nobody [ if count mode8_ag_t > 2[ ask turtle_mode8_ag_t [ set breed mode8_agi_t set size 1.8 ] ask mode8_agi_t [ if ycor > -17 [ let rounded_ycor round ycor set rounded_ycor rounded_ycor - 1 set ycor rounded_ycor set heading 30 ;; 向下移动一个单位 ] ] ; 删除原来的mode8_i_t turtle ask turtle_mode8_i_t [ die ] ] ] ] ] ] let temp_number_agi count mode8_i_t let turtle_xys [] if temp_number_agi < total_i[ ;溶解-agi if dissolution_flag_agi = 1[ let mode8_agi_t_molecule one-of turtles with [breed = mode8_agi_t] ;;将一个agi分子变成ag + i ask mode8_agi_t_molecule [ let xys list xcor ycor ; 创建一个包含当前乌龟坐标对的列表 set turtle_xys lput xys turtle_xys ; 将当前乌龟的坐标对添加到列表中 set breed mode8_ag_t set size 1.8 ];;创建一个i foreach turtle_xys [ xy -> create-mode8_i_t 1 [ setxy (item 0 xy) (item 1 xy) ; 根据坐标对生成乌龟 set size 1.8 ; 可根据需要设置乌龟颜色 ] ] ] ] ] end to add_Na2S create-mode8_s_t 15 [ let random-xcor-xcor random 36 - 18 let random-ycor-ycor random -16 - 1 setxy random-xcor-xcor random-ycor-ycor set size 1.8 ; 设置海龟大小 ] set total_s 2 set total_i 2 set Precipitation_flag_ag2s 1 set dissolution_flag_ag2s 1 set Precipitation_flag_agi 0 set dissolution_flag_agi 1 end to Precipitation_dissolution_ag2s if ticks mod 2 = 0 [ let temp_number_ag2s count mode8_s_t let turtle_xys [] let x_temp 0 let y_temp 0 if temp_number_ag2s < total_s[ ;溶解-ag2s if dissolution_flag_ag2s = 1[ let mode8_ag2s_t_molecule one-of turtles with [breed = mode8_ag2s_t] ;;将一个ag2s分子变成2ag + s ask mode8_ag2s_t_molecule [ set x_temp xcor set y_temp ycor set breed mode8_s_t set size 1.8 print count mode8_s_t print count mode8_ag2s_t ];; create-mode8_ag_t 2 [ setxy x_temp y_temp ; 根据坐标对生成乌龟 set size 1.8 ; 可根据需要设置乌龟颜色 ] ] print temp_number_ag2s ] ;沉淀-ag2s if Precipitation_flag_ag2s = 1[ ask mode8_ag_t [ let meeting-mode8_ag_t mode8_ag_t in-radius 1 let meeting-mode8_s_t mode8_s_t in-radius 1 if count meeting-mode8_ag_t >= 2 and count meeting-mode8_s_t >= 1 [ ; 在半径2的范围内相遇时,创建新的turtle print count mode8_s_t let turtles-here-mode8_ag_t turtles with [breed = mode8_ag_t] let turtles-here-mode8_s_t turtles with [breed = mode8_s_t] let turtle_mode8_ag1_t one-of turtles-here-mode8_ag_t in-radius 1 ask turtle_mode8_ag1_t [ die ] let turtle_mode8_ag2_t one-of turtles-here-mode8_ag_t in-radius 1 ask turtle_mode8_ag2_t [ die ] let temp_mode8_s_t one-of turtles with[breed = mode8_s_t] ask temp_mode8_s_t[ set breed mode8_ag2s_t set size 1.8 ] ; ask mode8_ag2s_t [ ; if ycor > -17 [ ; let rounded_ycor round ycor ; set rounded_ycor rounded_ycor - 1 ; set ycor rounded_ycor ; set heading 30 ;; 向下移动一个单位 ; ] ; ] ] ] ] ] end
There is only one version of this model, created 7 months ago by Ying Li.
This model does not have any ancestors.
This model does not have any descendants.