在X轴上从X_Y_Z(单独的数据集)可视化三维网格,而无需使用xdmf [英] Visualization of 3-dimensional grid from X_Y_Z(seperate datasets) on Paraview without using xdmf
问题描述
我曾经使用 xdmf 脚本来解析netcdf文件,以创建
I used to parse netcdf files with an xdmf script in order to create 3DSMesh
on paraview. On top of it, I was adding scalar or vector fields. (So 3DSMesh provides physical coordinates).
我从来没有,尽管实际上这是最好的方法.可以,所以我还可以. 请让我知道是否有更方便的方法.
我可以使用以下脚本创建3维网格.
I am able to create a 3-dimensional grid with the following script.
<?xml version="1.0" ?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf xmlns:xi="http://www.w3.org/2001/XInclude" Version="2.0">
<Domain>
<Grid Name="gridxyz">
<Topology TopologyType="3DSMesh" NumberOfElements="0032 0032 0063">
</Topology>
<!-- Read Coordinates -->
<Geometry GeometryType="X_Y_Z">
<DataItem Name="X" Format="HDF" NumberType="Float" Precision="8" Dimensions="0032 0032 0063">
grid_x.nc:/gridx
</DataItem>
<DataItem Name="Y" Format="HDF" NumberType="Float" Precision="8" Dimensions="0032 0032 0063">
grid_y.nc:/gridy
</DataItem>
<DataItem Name="Z" Format="HDF" NumberType="Float" Precision="8" Dimensions="0032 0032 0063">
grid_z.nc:/gridz
</DataItem>
</Geometry>
<!-- Read Scalar -->
<!-- Here I have bunch of scalars stored in different netcdf files -->
</Grid>
</Domain>
</Xdmf>
专业人士
-
当有人需要重复的任务时,
- xdmf脚本非常有用.
- xdmf scripts are great when someone needs repetitive tasks.
-
此脚本需要以某种方式生成或手动键入.并且需要在尺寸或变量名称更改时进行更新
this script(s) needs to be generated somehow, or typed by hand. And required to be updated, when the dimensions or variable names are changed
Pros
如果要读取其他标量,则需要添加一行
if I want to read another scalar, I need to add a line
最近我意识到,我可以通过单击open(Paraview4.3)来打开带有paraview的netcdf文件.因此,(几年前,我无法在Paraview上打开netcdf文件),我不再需要这些xdmf脚本了.
Recently I realize, I can open netcdf files with paraview just by clicking open(Paraview4.3). So, I do not need these xdmf scripts anymore (few years ago I was not able to open netcdf files on Paraview).
如何通过Paraview GUI创建
3DSMesh
.那可能吗?还是有其他简单/快速的方法(而不是编写python脚本)? 有什么办法读取1D坐标并使用它们创建3D几何?
How can I create
3DSMesh
via Paraview GUI. Is that possible? Or is there any other simple/faster way (instead of writing a python script) ? Is there any way read 1D coordinates and create 3D geometry using them ?
推荐答案
这就是我设法做到的方式.当然,这不是最快的方法,但是对我有用.
That's how I manage to do that. Certainly it's not the fastest way, but it works for me.
当您打开NetCDF文件时,paraview会要求您选择阅读器,我总是使用 NetCDF文件通用和CF约定.
When you open a NetCDF file, paraview asks you to choose a reader, I always use NetCDF files generic and CF conventions .
此后,在点击应用"按钮之前,您必须在下拉菜单中选择适当的尺寸" .
After that, before hitting "Apply" button you have to select the appropriate "Dimensions" in the dropdown menu.
您的数据现在必须显示为UniformGrid,数据(X,Y,Z)作为标量字段,因此您必须转换为 grid 才能更具体地使用StructuredGrid.为此,请应用"ImageDataToPointSet" 过滤器.
Your data now must be displayed as a UniformGrid, with your data(X,Y,Z) as scalars fields so you must transform to a grid to be more specific a StructuredGrid. In order to do that, apply the "ImageDataToPointSet" filter.
然后,应用计算器" 过滤器 选中坐标结果" 字段,然后执行以下操作:
After that, apply a "Calculator" filter check "Coordinate Results" field and do the following:
如果您的数据显示为计算器字段中的X,Y,Z列
If your data appears as X, Y , Z colummns put in the calculator field the expression
(X * iHat)+(Y * jHat)+(Z * kHat)
如果您的数据以其他名称显示,请用这些名称替换x,y,z
if your data appears with other names, substitute x, y, z with those names
表达式表示x沿î向量的方向,y沿j向量的方向,依此类推
The expression means that x is in the direction of the î vector, y is in the direction of the j vector and so on
希望有帮助!
这篇关于在X轴上从X_Y_Z(单独的数据集)可视化三维网格,而无需使用xdmf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!