This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

What is the difference between u.interpolate() and project()/interpolate() ?

0 votes

In the demo program Cahn-Hilliard equation, if I change " #Create intial conditions and interpolate" codes from

u.interpolate(u_init)
u0.interpolate(u_init)

to

u = project(u_init, ME) or interpolate(u_init, ME) 
u0 = project(u_init, ME) or interpolate(u_init, ME)

the output result will show errors "Segmentation fault". If only change one line and keep another line code unchanged, the output will not change after first loop.
I thought u.interpolate(u_init) is same as u = interpolate(u_init, ME), but it seems I am wrong. What is the difference between u.interpolate() and u = project()/interpolate() ?

asked Aug 1, 2016 by sejabs FEniCS Novice (330 points)

1 Answer

0 votes

Ok, I can also answer the question myself. If we change the order between

split(u)

and

u = project(u_init, ME),

everything goes well. So if split(u) goes first, using u.interpolate after, I think so.

answered Aug 2, 2016 by sejabs FEniCS Novice (330 points)
...