### Save post-processed answer in pvd

184
views
0
10 months ago by
Hi there

After solving a differential equation I get an scalar field p, to calculate velocities in x and y direction I have the relationships
$vx=\frac{w^3}{12\mu}\frac{\partial p}{\partial x};vy=\frac{w^3}{12\mu}\frac{\partial p}{\partial y}$vx=w312μ px ;vy=w312μ py

I'm using this code and it is plotting a reasonable result

dpx = Dx(p,0)
dpy = Dx(p,1)
dp = (w**3/(12*mu))*sqrt(dpx**2+dpy**2)

plot(dpx)​

but if I want to save the variable in a pvd file with file << dpx is giving me a TypeError

Could you please help me with the propper way to transform dpx dpy and dp so they can be saved in a pvd file?

Thank you very much!!!
Community: FEniCS Project

2
10 months ago by
You need to project dpx = Dx(p,0)in some function space. Try something like:

dpx = project(Dx(p,0), V) # Here V is the function space
File("foo.pvd") << dpx​
Thank you very much!!!
written 10 months ago by Ruben Gonzalez