On May 29, 2012, at 4:35 AM, Yun Tao wrote: > Q1: > As observed from previous testing under both 1 and 2-D, the preservation of a > probability density function under pure convection is extremely sensitive to > the mesh's spatial resolution. However, though we have an equation that helps > us determine the proper mesh size to use for a diffusion process, I can't > find similar equations on the site relating TimeStepDuration, dx or dy, and > convection/diffusion coefficients for all the convection terms. For my model, > I'm specifically interested in the TimeStepDuration I should set for a > (VanLeer) advection-diffusion 2D equation under fixed spatial resolution that > yields accurate solutions.
The constraint on timestep is the Courant-Friedrichs-Lewy (CFL) condition. Basically, nothing is allowed to advect more than one grid spacing in a single timestep. So $\Delta t < K \Delta x / |u|$, where $\Delta x$ is the smallest cell dimension, $|u|$ is the maximum magnitude of your advection velocity, and $K$ is a safety margin of something like 0.1. > An interesting note about solution stability: even when the viewer window is > much smaller than the grid area, the solutions tend to fall apart (or > generate these comb-effects) near the edges of the viewer window. > Furthermore, small regions of solutions along those window's edges appear > unstable (see video's bottom and left-hand edges). This is a bug in the Matplotlib2DGridViewer. Thanks for bringing it to our attention. I've filed http://matforge.org/fipy/ticket/444 on this so that we find a fix. The issue is that the image is not actually cropped when you set the limits, only the labels on the axes change. So, the anomalies in the solution are still happening at the boundaries of the simulation. You can see this if you use a Matplotlib2DViewer instead of a Matplotlib2DGridViewer (which FiPy automatically supplies when you ask for a MatplotlibViewer). > This noise makes it necessary to pre-set datamin and datamax in the viewer. > But, the pre-sets are problematic when one is dealing with probability > density functions that may easily break free from the limited range. Any > advice would be deeply appreciated. As to how to correct the boundary issues, I think this is germane: http://www.ctcms.nist.gov/fipy/documentation/FAQ.html#how-do-i-apply-an-outlet-or-inlet-boundary-condition, but Wheeler is better to address that. > Q2: > As the solution evolves under pure advection, I noticed that the minimum > value of the solution gets exponentially smaller. Over 300 time steps of pure > advection, the sample module's log10(min(phi)) are: > > [ -5.06578143 -5.46372144 -5.86166144 -6.25960145 -6.65754146 ... > -130.41688416 -130.81482417 -131.21276418 -131.61070418 -132.00864419] > > I'm not sure where the minimal value resides in my bivariate plot. Plus, this > exponential decrease makes it impossible to logarithmically scale the > colorbar in a useful way. I would expect these very small values to arise at the top-right corner as your data advects away. It is easy to see that this is the case by plotting log10(phi) instead of phi and removing the data limits. There is nothing to flow in at the top-right so the solution is trending to zero. > Q3: > I am desperate to figure out how to have to solution advect to a fixed point > in space. I've tried IF statements to no avail. Again, any pointer will be a > life-saver. I don't understand what you want to happen here. Do you want everything to advect toward a fixed point or do you want the peak in the distribution to advect toward that point? Either way, I don't understand what you mean about IF statements. _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
