Re: Time dependent spatially varying 2D source term representation

2013-03-25 Thread Jonathan Guyer
On Mar 25, 2013, at 9:32 AM, Jonathan Guyer wrote: > > On Mar 23, 2013, at 6:00 PM, Serbulent UNSAL wrote: > >>> Much more expediently done with >>> >>> return tmp.flatten() >>> >> >> No itertools.chain is clearly fastest method. It can be seen on >> http://stackoverflow.com/questions/4061

Re: Time dependent spatially varying 2D source term representation

2013-03-25 Thread Jonathan Guyer
On Mar 23, 2013, at 6:00 PM, Serbulent UNSAL wrote: >> Much more expediently done with >> >>return tmp.flatten() >> > > No itertools.chain is clearly fastest method. It can be seen on > http://stackoverflow.com/questions/406121/flattening-a-shallow-list-in-python But that post is about fi

Re: Time dependent spatially varying 2D source term representation

2013-03-23 Thread Serbulent UNSAL
2013/3/20 Jonathan Guyer : > > On Mar 20, 2013, at 4:51 PM, Serbulent UNSAL wrote: > ... > Why does it need to be in a matrix? If the calculation is based on your > coordinates, then let the shape of the coordinate dictate the shape of the > result, i.e., fn(x, y, t) will automatically be the sam

Re: Time dependent spatially varying 2D source term representation

2013-03-20 Thread Jonathan Guyer
On Mar 20, 2013, at 4:51 PM, Serbulent UNSAL wrote: > First I'm sorry for confusion. I should share both versions (slow one > and mine) but only share last version. But before that explaining > problem domain might be helpful for smoothing confusion away. > > I'm working on tumor modelling. The

Re: Time dependent spatially varying 2D source term representation

2013-03-20 Thread Serbulent UNSAL
Hi, First I'm sorry for confusion. I should share both versions (slow one and mine) but only share last version. But before that explaining problem domain might be helpful for smoothing confusion away. I'm working on tumor modelling. The code I sent is the part which calculates oxygen diffusion i

Re: Time dependent spatially varying 2D source term representation

2013-03-20 Thread Jonathan Guyer
On Mar 20, 2013, at 9:51 AM, Daniel Wheeler wrote: > On Wed, Mar 20, 2013 at 5:57 AM, Serbulent UNSAL wrote: > Dear Dan and Raymond, > > Thanks for your help to both. After your suggestions I review my code. > But changing X and Y like > > X = mesh.x > Y = mesh.y > > makes the code seriousl

Re: Time dependent spatially varying 2D source term representation

2013-03-20 Thread Daniel Wheeler
On Wed, Mar 20, 2013 at 5:57 AM, Serbulent UNSAL wrote: > Dear Dan and Raymond, > > Thanks for your help to both. After your suggestions I review my code. > But changing X and Y like > > X = mesh.x > Y = mesh.y > > makes the code seriously slow. > I'm a little confused. The variables "X" and "Y

Re: Time dependent spatially varying 2D source term representation

2013-03-20 Thread Serbulent UNSAL
Dear Dan and Raymond, Thanks for your help to both. After your suggestions I review my code. But changing X and Y like X = mesh.x Y = mesh.y makes the code seriously slow. Since in myFunc I'll make calculations based on t and x,y index and after that I'll have a a matrix of calculated values

Re: Time dependent spatially varying 2D source term representation

2013-03-19 Thread Daniel Wheeler
On Tue, Mar 19, 2013 at 4:35 PM, Raymond Smith wrote: > Oh, that's much cleaner. Thanks for that, Dan. > No problem. FYI, there is an open ticket on this issue http://matforge.org/fipy/ticket/447. -- Daniel Wheeler ___ fipy mailing list fipy@nist.gov

Re: Time dependent spatially varying 2D source term representation

2013-03-19 Thread Raymond Smith
Oh, that's much cleaner. Thanks for that, Dan. Ray On Tue, Mar 19, 2013 at 4:31 PM, Daniel Wheeler wrote: > I think Raymond pretty much covered all the bases. The way I would write > this is using > >time = Variable(0.) > >eqn = someTerms + mesh.x * mesh.y * t > >for step in range s

Re: Time dependent spatially varying 2D source term representation

2013-03-19 Thread Daniel Wheeler
I think Raymond pretty much covered all the bases. The way I would write this is using time = Variable(0.) eqn = someTerms + mesh.x * mesh.y * t for step in range steps: eqn.solve(...) t.setValue(t.value + dt) The key here (due to FiPy pathologies) is to realize that me

Re: Time dependent spatially varying 2D source term representation

2013-03-19 Thread Raymond Smith
Hi Serbulent, I was curious about the same thing, so I gave it a shot. I'm not sure if what I've done is a good way to do things, but I think I managed to get a source term that's a function of x, y. I modified your script in a number of ways, and wrote it so that myFunc takes positions as argumen

Time dependent spatially varying 2D source term representation

2013-03-19 Thread Serbulent UNSAL
Hi, First thanks to FiPy community for such a practical tool. I'm a newbie in FiPy and try to solve a problem based on source term. My equation is a 2D diffusion equation which has a source term as a function depends on x,y cordinates and time t \frac{ \partial c( \vec{x},t)}{\partial t} = D