[CSC 330] Moving Forward with Diffusion

Andrew J. Pounds pounds_aj at mercer.edu
Sat Oct 15 10:04:24 EDT 2022


I know that some of you are starting to work on the diffusion problem.  
Let me alert you to something that you have to be VERY cautious about.  
In your physical simulation you have to conserve mass.  If you look at 
the java code I gave you, I keep up with a variable called "sumval" 
which is the total number of the particles across the entire cube.  It 
starts out at 1x10^21 and should remain basically at that value during 
the entire simulation.  You will notice some slight variation when you 
run the Java code, but pay close attention to where the number is 
actually changing -- it is changing at the very edge of the last digit 
of precision.  The point is that the simulation, as it runs, does not 
gain or lose mass -- mass is conserved.

As you implement this code in other languages make sure that mass is 
conserved.

Many of you will want to try and speed it up (I mean do you really need 
all those nested loops) - but if you do the actual simulation time 
should be roughly the same and the mass must be conserved.


-- 
*/Andrew J. Pounds, Ph.D./*
/Professor of Chemistry and Computer Science/
/Director of the Computational Science Program/
/Mercer University, Macon, GA 31207 (478) 301-5627/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://theochem.mercer.edu/pipermail/csc330/attachments/20221015/f0bd3d6a/attachment.html>


More information about the csc330 mailing list