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

How to modify a PDE solution in dolfin-FEniCS

0 votes

Hello: I need to change the form of a PDE solution in fenics,

All PDE can be expressed in like this:

$La = b$

and solve in this way:

a = .... #bilinear form
L = .... #linear form
V = .... #function space
bc = DirichletBC(V, psi0, psi0_boundary)
psi = Function(V)
solve(a == L, psi, bc)

But in this part I need to change the $\psi$ value to other funcion with the next transformation

$\psi_2 = \psi/norm(grad(\psi))$

Some one know how to get this new funcion since psi in FEniCS?

asked Mar 25, 2014 by ljofre FEniCS Novice (720 points)
edited Mar 25, 2014 by ljofre

1 Answer

+3 votes

Hi, see if you are happy with the following

grad_norm = norm(psi, 'h10')
psi0 = project(psi/grad_norm, V, bcs=bc)
answered Mar 26, 2014 by MiroK FEniCS Expert (80,920 points)
...