# How to Construct this Functional

Asked by
Jack
on 2010-05-29

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(

u = TrialFunction(

f = Coefficient(

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:
- 2010-05-29

- Last query:
- 2010-05-29

- Last reply:

Jack (attacking-chess) said : | #1 |

Problem solved.

To post a message you must log in.