On Dec 2, 2008, at 4:28 PM, Ionut Vancea wrote:

Here I mean something like:

\bar{\Phi}(r)=\int dr'\Phi(r')V(r-r')

\nabla f(\bar{\Phi})


As a first cut, I would try to implement this something like:

x, y = mesh.getCellCenters()
r = CellVariable(mesh=mesh, value=sqrt(x**2 + y**2))
Phi = CellVariable(mesh=mesh, value=...)
def V(delta): return ...

integrator = numerix.vectorize(lambda rPrime: (Phi * V(rPrime - r)).getCellVolumeAverage())
barPhi = CellVariable(mesh=mesh, value=integrator(r))

Note that I've swapped the meaning of r and r' in the integral because of the way r is scoped overall.

Making barPhi automatically update with changes in Phi or the coefficients of V() would be a little more tricky, but not impossible. Let's get it working the way you expect it to and then we can put together a new IntegratedCellVariable.

P.S. nice romanian words, thanks :)

You're welcome. I'm afraid I can't remember much else. "Da, multumesc", "vreau o sticla cu vin", and the painfully obvious "nu vorbesc Romaneste bine" are about it. It's a beautiful country.


Reply via email to