Hi everyone,
I normally use ParaView for all my plotting, but I am currently creating some demos for my project and I want to produce plots as preliminary/quick results.
For a MWE I just present the first Poisson demo:
from dolfin import *
import matplotlib.pyplot as plt
mesh = UnitSquareMesh(32, 32)
(x, y) = SpatialCoordinate(mesh)
element = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
V = FunctionSpace(mesh, element)
u = Function(V)
v = TestFunction(V)
f = Constant(-6.0)
g = 1+ x**2 + 2*y**2
bc = DirichletBC(V, g, DomainBoundary())
F = inner(grad(u), grad(v))*dx - f*v*dx
solve(F == 0, u, bc)
c= plot(u)
plt.colorbar(c)
plt.show()
This produces the image
Here u is naturally plotted on an (x,y) grid. Is there a way to plot it in a (x, 1-y) grid?
I know I can change the boundary conditions to do the exact same thing (and in ParaView). I was just wondering if there was a way to do it as post-processing in FEniCS.
I realise in this example it is way easier to edit the boundary conditions, but my real problem requires many sign changes that would make it unnecessarily confusing.
I looked at the documentation for plot , but I am not sure it contains an exhaustive list of all the options. The option “scale” scales the vector field in my example, so I wonder if there is a function “transpose” or similar.
Thank you!