Thread Previous • Date Previous • Date Next • Thread Next |
pcorreia@xxxxxxxxx wrote:
On Mon, Jun 11, 2007 at 01:40:50PM -0400, Harish Narayanan wrote:pcorreia@xxxxxxxxx wrote:In the Stokes demo the velocity solution is written as a vtk file velocity000000.vtu. How can I plot each of the components say u and v (I use Paraview)?Andhow to plot the vector field?Assuming you've opened the file velocity.pvd in Paraview: 1. In order to plot the vector field, add a "glyph" from the filter menu and point it to the velocity vector (U) as the data source. You can change the glyph density, size, shape, etc. 2. In order to plot a scalar, such as a velocity component or a norm, I use the "calculator" filter. Click calculator, and you can refer to the components as U_0 and U_1. So if you wanted to plot the velocity norm, you'd "calculate" norm (U) and plot the result, and if you wanted to just plot a component, you'd just use U_0 or U_1. HarishYou should also be able to extract the components in DOLFIN and then save (or plot) each one of them: Function u0 = u[0]; Function u1 = u[1]; Then plot(u0); plot(u1); should plot the two components as scalar fields. Or save each one to VTK format if you don't have Viper.I added this but it gives an error: // Solve PDE Function u; Function u0 = u[0]; Function u1 = u[1];
The above two lines shouldn't be here. They should be after pde.solve(...); Garth
Function p; pde.set("PDE linear solver", "direct"); pde.solve(u, p); // Plot solution plot(u); plot(p); plot(u0); plot(u1); // Save solution File ufile("velocity.xml"); ufile << u; File pfile("pressure.xml"); pfile << p; // Save solution in VTK format File ufile_pvd("velocity.pvd"); ufile_pvd << u; File pfile_pvd("pressure.pvd"); pfile_pvd << p; File u0_file_pvd("u.pvd"); u0_file_pvd << u0; File u1_file_pvd("v.pvd"); u1_file_pvd << u1; $>./demo Initializing PETSc (ignoring command-line arguments). Creating linear PDE with 3 boundary condition(s). terminate called after throwing an instance of 'std::runtime_error' what(): *** Error: Sub functions can only be extracted from discrete functions. p0_8737: p4_error: interrupt SIGx: 6/Anders _______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@xxxxxxxxxx http://www.fenics.org/mailman/listinfo/dolfin-dev_______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@xxxxxxxxxx http://www.fenics.org/mailman/listinfo/dolfin-dev
Thread Previous • Date Previous • Date Next • Thread Next |