[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/OnScale/Engineering_Python/master/pyevtk_test.py [Back]  [Original]

# -*- coding: utf-8 -*-
"""
Created on Wed Nov 19 15:58:45 2014

@author: adminGH
"""

from evtk.hl import gridToVTK 

import numpy as np 

# Dimensions 
nx, ny, nz = nd1, nd2, nd3
lx, ly, lz = 0.5, 0.5, 1.0 
dx, dy, dz = lx/nx, ly/ny, lz/nz 

ncells = nx * ny * nz 
npoints = (nx + 1) * (ny + 1) * (nz + 1) 

# Coordinates 
x = np.arange(0, lx + 0.1*dx, dx, dtype='float64') 
y = np.arange(0, ly + 0.1*dy, dy, dtype='float64') 
z = np.arange(0, lz + 0.1*dz, dz, dtype='float64') 

# Variables 
pressure = np.random.rand(ncells).reshape( (nx, ny, nz)) 
temp = np.random.rand(npoints).reshape( (nx + 1, ny + 1, nz + 1)) 

gridToVTK("./rectilinear", x, y, z, cellData = {"pressure" : pressure}, pointData = {"temp" : temp}) 

Web Proxy Viewer  |  New URL  |  Original Page