94 void calc_diffusion_curve_layer_fit_layer(
int nt,
int nz,
int nr,
int iprobe,
int jprobe,
int iz1,
int iz2,
int nolayer,
double dt,
double dr,
double sd,
double st,
double alpha_so,
double theta_so,
double kappa_so,
double alpha_sp,
double theta_sp,
double kappa_sp,
double alpha_sr,
double theta_sr,
double kappa_sr,
double dfree,
double *t,
double *s,
double *invr,
double *p)
97 double dstar_so = theta_so * dfree;
98 double dstar_sp = theta_sp * dfree;
99 double dstar_sr = theta_sr * dfree;
100 double const_so1 = dstar_so * dt /
SQR(dr);
101 double const_so2 = dstar_so * dt / (2.0 * dr);
102 double const_sp1 = dstar_sp * dt /
SQR(dr);
103 double const_sp2 = dstar_sp * dt / (2.0 * dr);
104 double const_sr1 = dstar_sr * dt /
SQR(dr);
105 double const_sr2 = dstar_sr * dt / (2.0 * dr);
141 for (i=0; i<nz*(nr+1); i++)
145 int nds = lround(sd/dt);
147 error(
"nds=%d, nt=%d. Delay start should be < total expt time",
149 for (k=0; k<nds; k++)
154 for (k=nds; k<nt; k++) {
155 p[k] = c[
INDEX(iprobe,jprobe)];
158 if (nolayer ==
FALSE) {
164 for (j=0; j<nr+1; j++) {
165 cb_sr[j] = ( dstar_sr * alpha_sr * c[
INDEX(iz1,j)]
166 + dstar_sp * alpha_sp * c[
INDEX(iz1+1,j)] )
167 / ( dstar_sr * alpha_sr + dstar_sp * alpha_sp );
169 cb_so[j] = ( dstar_sp * alpha_sp * c[
INDEX(iz2,j)]
170 + dstar_so * alpha_so * c[
INDEX(iz2+1,j)] )
171 / ( dstar_sp * alpha_sp + dstar_so * alpha_so );
174 for (j=0; j<nr+1; j++) {
175 for (i=0; i<iz1+1; i++)
177 c_sr[
INDEX(iz1+1,j)] = 2.0 * cb_sr[j] - c[
INDEX(iz1,j)];
179 c_sp[
INDEX(0,j)] = 2.0 * cb_sr[j] - c[
INDEX(iz1+1,j)];
180 for (i=iz1+1; i<iz2+1; i++)
182 c_sp[
INDEX(iz2-iz1+1,j)] = 2.0 * cb_so[j] - c[
INDEX(iz2,j)];
184 c_so[
INDEX(0,j)] = 2.0 * cb_so[j] - c[
INDEX(iz2+1,j)];
185 for (i=iz2+1; i<nz; i++)
190 convolve3(iz1+2, nr+1, c_sr, const_sr1, const_sr2, invr, dc_sr);
192 convolve3(iz2-iz1+2, nr+1, c_sp, const_sp1, const_sp2, invr,
194 convolve3(nz-iz2, nr+1, c_so, const_so1, const_so2, invr, dc_so);
197 for (j=0; j<nr+1; j++) {
198 for (i=0; i<iz1+1; i++)
202 for (i=iz1+1; i<iz2+1; i++)
204 + dc_sp[
INDEX(i-iz1,j)];
206 for (i=iz2+1; i<nz; i++)
208 + dc_so[
INDEX(i-iz2,j)];
213 if (k==0) printf(
"\nNOTE: nolayer = %d, " 214 "so using the 1 layer model\n\n", nolayer);
217 convolve3(nz, nr+1, c, const_sr1, const_sr2, invr, dc);
220 for (i=0; i<nz*(nr+1); i++)
228 if (t[k] + dt/2.0 < sd + st) {
229 for (i=0; i<nz*(nr+1); i++)
234 for (j=0; j<nr+1; j++) {
235 for (i=0; i<iz1+1; i++)
236 c[
INDEX(i,j)] *= (1. - kappa_sr * dt);
237 for (i=iz1+1; i<iz2+1; i++)
238 c[
INDEX(i,j)] *= (1. - kappa_sp * dt);
239 for (i=iz2+1; i<nz; i++)
240 c[
INDEX(i,j)] *= (1. - kappa_so * dt);
void calc_diffusion_curve_layer_fit_layer(int nt, int nz, int nr, int iprobe, int jprobe, int iz1, int iz2, int nolayer, double dt, double dr, double sd, double st, double alpha_so, double theta_so, double kappa_so, double alpha_sp, double theta_sp, double kappa_sp, double alpha_sr, double theta_sr, double kappa_sr, double dfree, double *t, double *s, double *invr, double *p)
Calculates the concentration as a function of space and time and returns the probe concentration as a...
void convolve3(int M, int N, double *a, double scale1, double scale2, double *invr, double *out)
Calculates updates to the concentration in a layer by applying the Laplacian in cylindrical coordinat...