Stream function

Hello, i’m a new user of fenics.

I’d like to get the streamfunction psi of a given 2d thermal heat flux F=k.grad(T) so that the isolines of psi are parallel to F (or orthogonal to isolines of T).

  • First i solve the thermal equation to get the vector flux using a P2 interpolation
  • Then, streamfunction is a well-known problem in CFD and psi satisfies a vorticity equation defined here

Unfortunatly the streamlines are not parallel to F.

Did i miss something ?

thanks for helping.

Some points to consider are:

  • Is the flux \mathbf{F} solenoidal (i.e., does \nabla\cdot\mathbf{F} = 0)? A vector field must be divergence-free to have a streamfunction representation. You would only expect a solenoidal heat flux in the absence of any distributed heat sources.

  • Solving the Poisson equation with pure Neumann boundary conditions is ill-posed, which can lead to numerical issues if not done carefully, as discussed, e.g., in this thread.