George
George

Reputation: 5681

Trying to implement Fick's first law of diffusion in a simulation of water movement across cell membrane

I want to do the above simulation using fick's law with the use of finite differences. My problem is at the set up of the whole problem.

I will list some values and declarations from the paper and how i tried to implement them.(the cell is divided into 6 compartments)

Physical properties:

  1. The initial volume of the cell ,V0.
  2. The initial volume of osmotically active water within the cell,Viw0.

Here, i did :

V0 = ... # just a variable
V = sc.zeros(5) 
V[0] = ...  # this goes for Viw0

Boundary conditions:

  1. Initial concentration of solute within the cell , Ci0
  2. Concentration in the bulk medium C7 (this goes out of the cell)

Here, I did:

C = sc.zeros(5)
C[0] = ... #this goes for Ci0
C7 = ...

Fick's first law:

F = -D * dc/dx

# F the rate of transfer per unit of a section

# c the concentration of diffusing substance

# x the space coordinate measured normal to the section

Here, I don't know what the argument of the function must be :

def F(what to put here?):

        dc = 0.1    # I don't know what to do with the dc!
        return -(D*dc)/dx

Also, how to implement the finite difference method? (I have a class in which i implement the method).

Below, links to the paper:

Page 1
Page 2
Page 3
Page 4

Upvotes: 1

Views: 2628

Answers (2)

talonmies
talonmies

Reputation: 72335

You haven't said anything about whether concentration is a degree of freedom of the system or not, nor how you will model the mass transport or anything else, nor anything about the temporal features of the problem (ie. are you looking to analyse the transient or steady state problem?). So trying to suggest how to structure code to solve such a poorly described problem is both premature and futile.

To answer the only partially sensible part of your question, to compute a first order, one dimensional finite difference approximation of the flux term you might do something like this:

import numpy as np

def F(c,D,x):
    """Assume c and x are numpy arrays of equal size and D is a scalar"""
    # differencing of the concentration field
    deltac = np.diff(c)
    deltax = np.diff(x)

    return -D * deltac / deltax

There are a lot of subtleties in selection of appropriate order and direction of differencing depending on the actual system of differential equations and their properties, but that is far beyond the scope of this question and the information that has been given about the problem.

Upvotes: 3

gary
gary

Reputation: 4255

If I understand your question, it seems you want to write a program to help visualize diffusion across these various cells. The animated GIF on the Fick's Law Wikipedia page should help us think about what such a graph/plot/gradient may look like. I'm not suggesting that you need to create an animation, but I believe part of your work might be to show various diffusion gradients (the bottom row) as a function of the properties of a given cell (i.e. the concentration, spatial coordinate and/or a value of D).

So after a little searching, I think this paper may help think about the problem as a game: 'The Diffusion Game' - Using Symbolic Mathematics Software to Play the Game on a Large Scale (pdf). Fick's Law starts about half way into the paper.

But, if you're going to be creating gradient plots, you should take a look at the matplotlib module for Python as mentioned in this question: Gradient facecolor matplotlib bar plot.

Finally, to try to help answer your question, if you just want the raw data (i.e. numbers) I believe you want to create a vector of possible values of the concentration of the diffusing substance, c, and the spatial coordinate, x. Otherwise, use matplotlib for a visual representation. In Python a vector of values for the concentration parameter might look like this:

c = [round(i*0.1, 2) for i in range(0, 10)]    # not sure of the typical range

This is a list comprehension which returns [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]. (I use round() since I saw 0.300000004 as one of the numbers.) You could do the same for the value x and/or D in order to define F as a matrix for varying c, x and D values.

Upvotes: 2

Related Questions