# Calculating the number of molecules diffusing out of a volume [closed]

I have a system of reactions that are governed by differential equations.

They are reacting inside of a volume with known dimensions i.e lbh. I don't have any other information on their position inside that volume. I simply know there are 200 of A, 300 of B etc.

when molecules pass out of this volume they no longer react in the same way and move around in a Brownian fashion.

I want to know how often molecules leave this volume and I want to simulate this system.

I suppose I want a flux, or a probability distribution showing how likely an individual molecule leaves. I want to be able to "Count" the number of molecules left in V at the end of a timestep.

Ways I have thought about solving this:

Fick's first law: I get a flux with this, but I thought you couldn't apply it in systems where the concentration isn't constant.

Fick's second law: I don't really know how I would put it into my simulation

Smirnov density:

$$p(t)=\frac{x_0}{\sqrt{4\pi Dt^3}}\exp\left(-\frac{x_0^2}{4Dt}\right)$$

got this from https://physics.stackexchange.com/questions/93498/simulating-diffusion-from-bulk-to-individual-particles haven't really seen any other information on this. Maybe it's called something different?

With this equation there is a problem in that I don't know where the particles are in the volume.

The other approach I have thought of is using gibson-bruck next reaction and treating a transition as a reaction.

Please provide computational details in your answer, I need to be able to implement this.

• I take it this model is a microscale model? Could you include the ODEs governing your reactions, as well as all of the other equations for time- (and possibly position-)dependent quantities? What are typical values for the length and volume of your system? What are typical values for the concentration or number of molecules of species in your system? (Is it really 200 or 300?) Jan 16 '14 at 9:03
• Hi Geoff, Sorry for taking ages to reply... It's meant to be a generic system, so the ODEs are whatever the user decides to use. The typical lengths 10 to 1 10^-6 meters. Concentration can vary massively. Jan 21 '14 at 13:30
• Just to clarify, since it's not clear in your reply: your length scales are 1e1 to 1e-6 meters? It would really help to have a concrete range of concentrations, even if the range is massive. My concern here is that conventional treatments of microscale models of diffusion and chemical reaction could be undesirable for parts of your parameter space because cheaper macroscale models could describe the physics more efficiency without much sacrifice in accuracy. Jan 21 '14 at 19:53