Created
August 24, 2016 07:32
-
-
Save zhulianhua/3e39272e7c75b9760141ff9459361816 to your computer and use it in GitHub Desktop.
Convert plain data to Tecplot format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import numpy as np | |
from numpy import * | |
L = 1.0 | |
N = 60; | |
dx = L/N; | |
x = (arange(N) + 0.5)*dx | |
y = (arange(N) + 0.5)*dx | |
X, Y = meshgrid(x, y) | |
RHO = genfromtxt("rho.dat") | |
U = genfromtxt("u.dat") | |
V = genfromtxt("v.dat") | |
T = genfromtxt("T.dat") | |
QX = genfromtxt("qx.dat") | |
QY = genfromtxt("qy.dat") | |
T = 400.0*T | |
DATA = [X,Y,RHO,U,V,T,QX,QY] | |
fp = open("results.dat", "w") | |
fp.write(" VARIABLES = X, Y, RHO, U, V, T, QX, QY ") | |
fp.write("ZONE I = %d , J = %d DATAPACKING=BLOCK\n"%(N,N)) | |
for dt in DATA: | |
for j in range(N): | |
for i in range(N): | |
fp.write("%e\t"%dt[j,i]) | |
fp.write("\n") | |
fp.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment