Layers
Diffusion in heterogeneous environments
Functions
model.c File Reference

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

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include "header.h"
Include dependency graph for model.c:

Go to the source code of this file.

Functions

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 function of time. More...
 

Detailed Description

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

Author
David Lewis, CABI, NKI
Date
2012-2013

Definition in file model.c.

Function Documentation

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 function of time.

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]sdSource delay (time before source starts)
[in]stDuration 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 94 of file model.c.

Here is the call graph for this function:

Here is the caller graph for this function: