← Back to team overview

dolfin team mailing list archive

[Question #112703]: How to Construct this Functional

 

New question #112703 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/112703

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


-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.