How to Construct this Functional

Asked by Jack

Hi

How do I write this in UFL form file:

phi = integral ( dot( -grad u, grad (1/r) ) ) dx

where 'r' is the distance from a fixed point, .i.e., sqrt( (x - x')^2 + (y-y')^2 + (z-z')^2 ).

At the moment, I have, say for 1D:

v = TestFunction(element)
u = TrialFunction(element)
f = Coefficient(element)

a = .....
L = .....

x = u.cell().x # global spatial coordinate
x_prime = 100
r = sqrt(x - x_prime)**2)

M = -( dot(grad(u), grad(1.0/r) )*dx

But, I get the following error:

Shape mismatch in Sum.

*** FFC: Shape mismatch in Sum.

Thanks

Jack

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Jack
Solved:
Last query:
Last reply:
Revision history for this message
Jack (attacking-chess) said :
#1

Problem solved.