-->

Tutorial (under construction)

Opening Comments

JSim can solve several kinds of diffusion equations.

Section One: Diffusion in a single bounded region

Consider the following equation for a single bounded region:

Snapshots of solution at various times. Illustrative Diagram

Model 1: Diffusion in a distributed region. From the RunTime GUI, click on Source (bottom of page) to see the source code. Notice that an initial condition and two boundary conditions are required. From the RunTime menu, click on C0fgen_1 to see the initial distribution of material.

On the plotpage named Contours and Snapshots, the top panel is a contour plot of C(x,t). The middle plots are snapshots of the solution at specific times as a function of distance. The bottom plots are snapshots of the solution at specific distances as a function of time.

Section Two: Diffusion in a single region with advection

Consider the following equation for a single region with inlow and outflow:

Snapshots of solution at various times. Illustrative Diagram

After the model runs go to the source code page (Source tab) from the RunTime GUI. You should examine the code and note the differences between it and the previous model. Careful attention should be given to the initial condition and the boundary conditions.

Section Three: (Advanced) 1-D Random Walk Diffusion

Probability Density Function from 1-D Random Walks. Illustrative Diagram

This is a simple diffusion which uses some of the advanced features of JSim's Mathematical Modeling Language (MML). It uses realState variables and also a “procedure” written in Java.

A thousand separate random walks in one-dimension are taken with 21 steps. Going left or right is randomly chosen and the step size is also randomly chosen. The procedure, regrid, takes every ntime point (10th point in the sample program) and constructs the probability density distribution. for those points. The user can save the data and use the optimizer to fit a Gaussian distribution to the data. The cumulative distribution is also calculated.

This model demonstrates that a large number of random walks in one dimension after n steps produces a Gaussian distribution.

Section Four: (Advanced) Random Walk in Two Dimensions

Three hundred Particles are released from the origin and each takes 60 random steps. The number of times the discretized grid locations are visited are counted. This is a contour plot of the logarithm of the total visits plus one-half in each grid location.

 Illustrative Diagram

 
Tutorials/Diffusion.txt · Last modified: 22Jul08, 10:26 am by garyr
 

Model development and archiving support at physiome.org provided by the following grants: NIH/NHLBI T15 HL88516-01 Modeling for Heart, Lung and Blood: From Cell to Organ, 4/1/07-3/31/11; NSF BES-0506477 Adaptive Multi-Scale Model Simulation, 8/15/05-7/31/08; NIH/NHLBI R01 HL073598 Core 3: 3D Imaging and Computer Modeling of the Respiratory Tract, 9/1/04-8/31/09; as well as prior support from NIH/NCRR P41 RR01243 Simulation Resource in Circulatory Mass Transport and Exchange, 12/1/1980-11/30/01 and NIH/NIBIB R01 EB001973 JSim: A Simulation Analysis Platform, 3/1/02-2/28/07.