On Jun 23, 2008, at 2:19 PM, Jonathan Guyer wrote:
I would do it like this:

xVar = CellVariable(mesh=mesh, value=x)
delta = 1. * ((xVar > x_s) & (xVar < x_s + 1))

Thanks. This is exactly what I was trying to do.

But I believe this gives me an incorrect solution (checked against analytical solution) since the time integration would assume that the source has a fixed position during each time interval `dt`.

The time integration is first order and the way I declare delta above should have the exact same effect as moving delta.setValue into the loop.

Hmm, that makes sense. Somehow I think I should have realized that these were the same.

Do you get better agreement if you reduce the timestep?

Yeah, smaller timesteps help; the convergence is a little slower than I imagined, though. I may have some other errors in my code that's causing problems (my actual code isn't the same as the example I gave).

Thanks for your help!
-Tony

Reply via email to