Visualizing 2D and 3D vector and tensor data from firedrake in python #3443
Unanswered
Arijit-Majumdar
asked this question in
Firedrake support
Replies: 2 comments 3 replies
-
I don't know how to visualise a plane, but to visualise a component of a vector For the plane I guess you could build the array you wanted using point evaluation and then plot it with ordinary matplotlib routines. |
Beta Was this translation helpful? Give feedback.
2 replies
-
For serious plotting you should output to VTU and use paraview. This will give you a lot of plotting options beyond those which are in the basic built-in plotting functionality. It will also be vastly faster (especially in 3D). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am trying to solve linear thermoelasticity problem in firedrake for both 2D and 3D geometries. My function space for displacement and solution function is as follows
V = VectorFunctionSpace(mesh, "CG", 1)
u_soln = Function(V)
Afterwards I am calculating the stress and the strain rate tensor using the following functions
def epsilon(u, Temp):
return 0.5*(grad(u) + grad(u).T) - alpha*Temp*Id
def sigma(u, Temp):
return lambda_*div(u)*Id + 2*mu*epsilon(u, Temp)
I wanted to know what is the syntax for plotting contours of different components of the displacement (u_soln) and stress/strain tensor in python? I tried the following lines for the vertical displacement but it gave me an error
tricontourf(u_soln[1], axes=axes)
Also, for a 3D domain, how do I get the displacement or stress/strain at a given plane (e.g. z = 0.5) and make a contour plot of specific components?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions