Layers
Diffusion in heterogeneous environments
Functions
model.c File Reference

Function for solving the forward problem with the 3-layer model. More...

#include "header.h"
Include dependency graph for model.c:

Go to the source code of this file.

Functions

void calc_diffusion_curve_layer (int nt, int nz, int nr, int iprobe, int jprobe, int iz1, int iz2, int nolayer, double dt, double dr, double sdelay, double sduration, 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, char *imagebasename, double image_spacing, double *p)
 Calculates the concentration as a function of space and time and returns the probe concentration as a function of time; also outputs the concentration as images if that option was chosen. More...
 

Detailed Description

Function for solving the forward problem with the 3-layer model.

This file is similar to model.c for fit-layer except that it can output the concentration as images. The concentration is calculated on an nz*(nr+1) grid for is for z: 0 -> zmax and r: 0 -> rmax. If this concentration grid were output as an image it would be rectangular of aspect ratio about 1:2, with the maximum intensity at the left side of the image (source at r=0). Instead the output images are nearly square with the source (r=0) in the middle column of the images. The left side of the images are a mirror of the right side. I.e. the output images have dimensions of nz*(2*nr-1) and are for z: 0 -> zmax and r: -rmax -> rmax.

Author
David Lewis, CABI, NKI
Date
2012-2013

Definition in file model.c.

Function Documentation

void calc_diffusion_curve_layer ( int  nt,
int  nz,
int  nr,
int  iprobe,
int  jprobe,
int  iz1,
int  iz2,
int  nolayer,
double  dt,
double  dr,
double  sdelay,
double  sduration,
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,
char *  imagebasename,
double  image_spacing,
double *  p 
)

Calculates the concentration as a function of space and time and returns the probe concentration as a function of time; also outputs the concentration as images if that option was chosen.

This function solves the diffusion equation in each layer $ k $ ,

\[ \frac{\partial c_k(\vec r, t)}{\partial t} = D_{free} \theta_k \nabla^2{c_k(\vec r, t)} + s/\alpha_k - \kappa_k c_k(\vec r, t) \quad , \]

subject to the continuity conditions at the interfaces between layers

\[ c(\vec r_k, t) = c(\vec r_{k+1}, t) \quad \]

\[ \alpha_k \theta_k \nabla c(\vec r_k, t) = \alpha_{k+1} \theta_{k+1} \nabla c(\vec r_{k+1}, t) \quad \]

and the boundary condition $ c(\vec r, t) = 0 $ (total absorption) at the top, the bottom, and the side of the cylinder, where

$ c_k(\vec r, t) $ = concentration in layer $ k $

$ D_{free} $ = free diffusion coefficient

$ \theta_k $ = permeability in layer $ k $

$ s_k(\vec r, t) $ = source in layer $ k $

$ \alpha_k $ = extracellular volume fraction in layer $ k $

$ \kappa_k $ = nonspecific clearance factor in layer $ k $

This function calls convolve3() to compute the Laplacian in cylindrical coordinates.

Parameters
[in]ntNumber of support points in time
[in]nzNumber of rows of concentration matrix
[in]nrNumber of columns of concentration matrix
[in]iprobez-index of probe location
[in]jprober-index of probe location
[in]iz1z-index of SR-SP boundary
[in]iz2z-index of SP-SO boundary
[in]nolayerFlag for whether to model a single homogeneous environment (true) or to model a 3-layer environment
[in]dtSpacing in time ( $ t_{i+1} = t_i + \Delta t $)
[in]drSpacing in r (in this program, $ \Delta z = \Delta r $)
[in]sdelaySource delay (time before source starts)
[in]sdurationDuration of source
[in]alpha_soExtracellular volume fraction in SO layer
[in]theta_soPermeability in SO layer
[in]kappa_soNonspecific clearance factor in SO layer
[in]alpha_spExtracellular volume fraction in SP layer
[in]theta_spPermeability in SP layer
[in]kappa_spNonspecific clearance factor in SP layer
[in]alpha_srExtracellular volume fraction in SR layer
[in]theta_srPermeability in SR layer
[in]kappa_srNonspecific clearance factor in SR layer
[in]dfreeFree diffusion coefficient
[in]tTime array
[in]sSource array
[in]invrArray for $ 1/r $ values
[out]pProbe array (concentration as a function of time)

Definition at line 101 of file model.c.

Here is the call graph for this function:

Here is the caller graph for this function: