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

Dividing mesh function by a constant

0 votes

Dear all,

I have created a function as an instance of a function object and projected it onto the finite element space V:

     u_1 = project(u0, V).

Now, how can I define a function that is u_1 divided by a scalar?

Thanks for your help in this presumably trivial matter.

asked Mar 23, 2016 by wilhelmbraun FEniCS User (2,070 points)

1 Answer

+2 votes

Hi, consider

u_2 = Function(V)
u_2.vector()[:] = u_1.vector()/2
answered Mar 23, 2016 by hernan_mella FEniCS Expert (19,460 points)
...