static void WebRatesB(realtype x, realtype y, realtype t, realtype c[], realtype cB[], realtype rate[], realtype rateB[], WebData wdata) { int i, j, ns; realtype fac, *bcoef; realtype (*acoef)[NS]; ns = wdata->ns; acoef = wdata->acoef; bcoef = wdata->bcoef; fac = ONE + ALPH*x*y; for (i = 0; i < ns; i++) rate[i] = bcoef[i]*fac; for (j = 0; j < ns; j++) for (i = 0; i < ns; i++) rate[i] += acoef[i][j]*c[j]; for (i = 0; i < ns; i++) { rateB[i] = cB[i]*rate[i]; rate[i] = c[i]*rate[i]; } for (j = 0; j < ns; j++) for (i = 0; i < ns; i++) rateB[i] += acoef[j][i]*c[j]*cB[j]; }
static void InitUserData(WebData wdata) { int i, j, ns; realtype *bcoef, *diff, *cox, *coy, dx, dy; realtype (*acoef)[NS]; acoef = wdata->acoef; bcoef = wdata->bcoef; diff = wdata->diff; cox = wdata->cox; coy = wdata->coy; ns = wdata->ns = NS; for (j = 0; j < NS; j++) { for (i = 0; i < NS; i++) acoef[i][j] = 0.; } for (j = 0; j < NP; j++) { for (i = 0; i < NP; i++) { acoef[NP+i][j] = EE; acoef[i][NP+j] = -GG; } acoef[j][j] = -AA; acoef[NP+j][NP+j] = -AA; bcoef[j] = BB; bcoef[NP+j] = -BB; diff[j] = DPREY; diff[NP+j] = DPRED; } /* Set remaining problem parameters */ wdata->mxns = MXNS; dx = wdata->dx = DX; dy = wdata->dy = DY; for (i = 0; i < ns; i++) { cox[i] = diff[i]/SQR(dx); coy[i] = diff[i]/SQR(dy); } /* Set remaining method parameters */ wdata->mp = MP; wdata->mq = MQ; wdata->mx = MX; wdata->my = MY; wdata->srur = SQRT(UNIT_ROUNDOFF); wdata->mxmp = MXMP; wdata->ngrp = NGRP; wdata->ngx = NGX; wdata->ngy = NGY; SetGroups(MX, NGX, wdata->jgx, wdata->jigx, wdata->jxr); SetGroups(MY, NGY, wdata->jgy, wdata->jigy, wdata->jyr); }
/* This routine computes the interaction rates for the species c_1, ... ,c_ns (stored in c[0],...,c[ns-1]), at one spatial point and at time t. */ static void WebRates(realtype x, realtype y, realtype t, realtype c[], realtype rate[], WebData wdata) { int i, j, ns; realtype fac, *bcoef; realtype (*acoef)[NS]; ns = wdata->ns; acoef = wdata->acoef; bcoef = wdata->bcoef; for (i = 0; i < ns; i++) rate[i] = ZERO; for (j = 0; j < ns; j++) for (i = 0; i < ns; i++) rate[i] += c[j] * acoef[i][j]; fac = ONE + ALPH*x*y; for (i = 0; i < ns; i++) rate[i] = c[i]*(bcoef[i]*fac + rate[i]); }