Comments (9)
Dear @banesullivan,
Really appreciate your quick response :)
I will attach you the data and the beginning of the code which does the preprocessing part:
import pyvista as pv
import numpy as np
import pickle
import matplotlib as mpl
import matplotlib.pyplot as plt
D = 1 # <!--- diameter of the wind turbine-->
Lx = 4 * D # <!---Length of the domain on x-->
Ly = 1.5 * D
Lz = 1.5 * D
nx = 415
ny = 145
nz = 145
dx = Lx/nx
dy = Ly/ny
dz = Lz/nz
uvec_file = open("U_0_415_snap600_steady.dms", "rb")
uvec_0_415_time = np.array(pickle.load(uvec_file))
vvec_file = open("V_0_415_snap600_steady.dms", "rb")
vvec_0_415_time = np.array(pickle.load(vvec_file))
wvec_file = open("W_0_415_snap600_steady.dms", "rb")
wvec_0_415_time = np.array(pickle.load(wvec_file))
x0 = np.linspace(0, 4, 415) #Lx
x1 = np.linspace(0, 1.5, 145) #Ly
x2 = np.linspace(0, 1.5, 145) #Lz
x0grid, x1grid = np.meshgrid(x0, x2)
# <!---Compute vorticity and save in file-->
dw_dy = np.gradient(wvec_0_415_time, 2*dy, axis=1)
dv_dz = np.gradient(vvec_0_415_time, 2*dz, axis=0)
du_dz = np.gradient(uvec_0_415_time, 2*dz, axis=0)
dw_dx = np.gradient(wvec_0_415_time, 2*dx, axis=2)
dv_dx = np.gradient(vvec_0_415_time, 2*dx, axis=2)
du_dy = np.gradient(uvec_0_415_time, 2*dy, axis=1)
wx = dw_dy - dv_dz
wy = du_dz - dw_dx
wz = dv_dx - du_dy
Enstrophy = np.sqrt(wx**2 + wy**2 + wz**2)
The data files are big so I cannot attach them. Do you prefer an url to my github or one drive ?
Thanks :) :)
from pyvista-support.
Hi @banesullivan !!
Yesterday I was so tired from work and I went sleep directly, sorry for the late answer.
Once, I come from work I will continue working on my thesis and try what you explained me. I will also ask my supervisor first, in order to avoid misunderstandings. I will be very happy to share these examples with the community and help that faced the same problems.
I like the features that Pyvista offers, so I will continue exploring its capabilities. I would let you know if I have any new issue.
I was struggling with it, so I really appreciate your help :) :)
Have a nice day!
from pyvista-support.
Hi @ElHouas! Thanks for posting your question! I should be able to help with this one - could you share with me a direct download link to the data file in this example? I can't seem to find the data file on research gate
from pyvista-support.
A URL to either works for me!
from pyvista-support.
Here are the three links for the pickle files. Let me know if everything is okay
File U_0_415_snap600_steady:
https://imperiallondon-my.sharepoint.com/:u:/g/personal/ie3518_ic_ac_uk/EV1489B-gvdOjiWXTyUeAbABCIsWDIcGNPsql_gFxTdiYw?e=8dgOmF
File V_0_415_snap600_steady:
https://imperiallondon-my.sharepoint.com/:u:/g/personal/ie3518_ic_ac_uk/EaaBlu4YP_ZLugw3k9cTBaEBYrX_Y-gIXYOGZwIvdhp5Ew?e=hMeVUv
File W_0_415_snap600_steady:
https://imperiallondon-my.sharepoint.com/:u:/g/personal/ie3518_ic_ac_uk/Ee9UhS-7lLxDoniA72W40AYBWwBopciYG9DK-X_0y0lUyw?e=eqvItK
Thanks a lot :)
from pyvista-support.
Okay so normally this is quite easy with all mesh types - however, I just realized there's a pretty major bug with pyvista.UniformGrid.points
where the points aren't ordered properly...
Normally, you would simply perform:
grid['axial'] = grid.points[:,2]
grid.plot(scalars='axial')
to have the grid
colored by the z component of its spatial reference. Unfortunately, the UniformGrid
class returns the points in the improper order for this to work with UniformGrid
. This leaves you with two options until the next release (I fixed this in pyvista/pyvista@13ae67d):
- casting to
pyvista.UnstructuredGrid
- using the
.elevation()
filter
Casting as an unstructured grid is costly and should be avoided. Try using the .elevation()
filter which by default will add an array for the z component of the mesh which is what I believe you are attempting:
... # the code to create the dataset
# PyVista can handle F-ordered 3D NumPy arrays!
grid = pv.wrap(Enstrophy)
axial = grid.elevation()
# A nice camera position I found manually
cpos = [(446.9417095818895, -223.12196318769293, -327.0090049982658),
(66.75124640066495, 95.17559002456603, 188.9825771285702),
(-0.23712139635742802, -0.8951474486847606, 0.377471175724276)]
contours = axial.contour(isosurfaces=5, scalars='values')
contours.plot(scalars='Elevation', cmap='rainbow', cpos=cpos)
from pyvista-support.
Also, this is a really cool dataset and is an excellent example for volume rendering:
grid.active_scalar_name = 'values'
plotter = pv.Plotter(notebook=False)
plotter.add_volume(grid, scalars='values', cmap='viridis', opacity='sigmoid_6')
plotter.show(cpos=cpos)
from pyvista-support.
And here's a neat way to get a profile view (I took log of the values here):
grid['log(v)'] = np.log10(grid['values'])
slc = grid.slice()
plotter = pv.Plotter(shape=(2,1), notebook=False)
plotter.add_mesh(slc,
scalars='log(v)',
cmap='viridis',
lighting=False)
plotter.view_vector([1,0,0], viewup=[0, 1, 0])
plotter.subplot(0,1)
plotter.add_mesh(slc,
scalars='values',
cmap='viridis',
lighting=False)
plotter.link_views()
plotter.show()
from pyvista-support.
@ElHouas - this dataset is quite cool and useful for examples - would it be okay for us to include this or another one similar to it (that you've made) in our examples
module?
from pyvista-support.
Related Issues (20)
- create uniform mesh HOT 3
- Change the orientation of a scalar bar's title
- Applying textures on models from .obj files HOT 6
- How to create an Unstructured grid from points and faces HOT 2
- Type of data, plotting with glyphs HOT 3
- Controlling the thickness and orientation of a slice in Pyvista HOT 3
- Controlling the image position in window, without any click
- Mask/Remove Voxels in Air (small intersection with surface) HOT 3
- custom slider parameters
- running pyvista on headless machine with Centos OS HOT 1
- Seismic Horizon with Pyvista HOT 8
- Algorithm in sample function?
- Automatically updates HOT 3
- Slow interaction HOT 1
- read from text HOT 4
- Uniform Grid thresholding question HOT 8
- Take data by an input x,y,x coordinate (csv file) from vtk data file HOT 4
- Program broke when creating a mesh using pv.PolyData() HOT 4
- ATTENTION: Please move questions to PyVista's Discussions HOT 1
- plotter.enable_terrain_style not working for me HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyvista-support.