问题描述( 二 )

< MX; jx++) {/* Extract c1 and c2, and set kinetic rate terms. *///取出对应格子的空间起始点x,yc1 = IJKth(udata,1,jx,jy);c2 = IJKth(udata,2,jx,jy);//计算R1,R2qq1 = Q1*c1*C3;//R1,R2的第一项qq2 = Q2*c1*c2;//R1,R2的第二项qq3 = q3*C3;//R1的第三项qq4 = q4coef*c2;//R1的第四项,也是R2的第三项rkin1 = -qq1 - qq2 + TWO*qq3 + qq4;//R1rkin2 = qq1 - qq2 - qq4;//R2/* Set vertical diffusion terms. *///取出c1,c2在前一个格子,后一个格子的值c1dn = IJKth(udata,1,jx,jy+idn);c2dn = IJKth(udata,2,jx,jy+idn);c1up = IJKth(udata,1,jx,jy+iup);c2up = IJKth(udata,2,jx,jy+iup);vertd1 = cyup*(c1up - c1) - cydn*(c1 - c1dn);vertd2 = cyup*(c2up - c2) - cydn*(c2 - c2dn);/* Set horizontal diffusion and advection terms. */ileft = (jx == 0) ? 1 : -1;iright =(jx == MX-1) ? -1 : 1;c1lt = IJKth(udata,1,jx+ileft,jy);c2lt = IJKth(udata,2,jx+ileft,jy);c1rt = IJKth(udata,1,jx+iright,jy);c2rt = IJKth(udata,2,jx+iright,jy);hord1 = hordco*(c1rt - TWO*c1 + c1lt);hord2 = hordco*(c2rt - TWO*c2 + c2lt);horad1 = horaco*(c1rt - c1lt);horad2 = horaco*(c2rt - c2lt);/* Load all terms into udot. */IJKth(dudata, 1, jx, jy) = vertd1 + hord1 + horad1 + rkin1;IJKth(dudata, 2, jx, jy) = vertd2 + hord2 + horad2 + rkin2;}}return(0);}