Hi,
Modifying PointSource.cpp, line 92, from set(..) to add(..) solves the problem (see attached patch). Cheers /Josef ________________________________________ Från: [email protected] [[email protected]] för Josef Höök [[email protected]] Skickat: den 14 september 2011 13:05 Till: Josef Höök Ämne: [Question #171106]: Projecting a Gaussian distribution New question #171106 on DOLFIN: https://answers.launchpad.net/dolfin/+question/171106 I would like to project a particle cloud represented as a sum of dirac masses on a grid using PointSource. I have tried the following code but it gives me a set of points on the mesh instead of a nice Gaussian shaped function, any ideas why? Perhaps I'm not using the PointSource correctly? Cheers /J from dolfin import * import random mesh = Rectangle(-10,-10, 10,10,50,50) V = FunctionSpace(mesh, 'CG', 1) u = TrialFunction(V) v = TestFunction(V) a = inner(u,v)*dx A=assemble(a) L= v*dx b = assemble(L) n = 100000 for i in range(n): p= Point(random.normalvariate(0,1), random.normalvariate(0,1)) delta = PointSource(V, p, 1) delta.apply(b) u = Function(V) solve(A, u.vector(), b) -- You received this question notification because you asked the question.
dolfin-hook-2011-09-14.patch
Description: dolfin-hook-2011-09-14.patch
_______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

