-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export velocity field as vector such that one can use the Paraview streamtracer function #77
Labels
Comments
The goal would be putting the funcitonality provided by this code pd = PlotData2D(sol)
using Printf
mkpath("out") # Create output directory automatically
Velocities_String = "out/Velocities.vtk"
Velocities = open(Velocities_String, "w")
write(Velocities, "# vtk DataFile Version 3.0\n")
write(Velocities, "vtk output\n")
write(Velocities, "ASCII\n")
write(Velocities, "DATASET STRUCTURED_GRID\n")
Nx = length(pd.x)
Ny = length(pd.y)
NumPoints = Int(Nx * Ny)
NumPointsString = string(Int(Nx * Ny))
write(Velocities, "DIMENSIONS ", string(Nx), " ", string(Ny), " 1\n")
write(Velocities, "POINTS ", NumPointsString, " float\n")
for i in 1:Nx
for j in 1:Ny
write(Velocities, "$(pd.x[i]) $(pd.y[j]) 0\n")
end
end
write(Velocities, "\n")
write(Velocities, "POINT_DATA ", NumPointsString, "\n")
write(Velocities, "\n")
write(Velocities, "VECTORS U float\n")
v1 = pd.data[2]
v2 = pd.data[3]
for i in 1:Nx
for j in 1:Ny
# Need to transpose back (note interchanged `j, i`), see l. 528 of src/visualization/utilities.jl
write(Velocities, string(v1[j,i]), " ", string(v2[j,i]), " 0\n")
end
end
close(Velocities) in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, the velocity field is exported as three scalars. If you want to use Paraview to compute e.g. the streamlines a vector-valued velocity field is required.
Exporting the velocities (and maybe also the magnetic field) as a vector-field would be a nice feature/change.
The text was updated successfully, but these errors were encountered: