-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHYDRA_csv2structured.m
65 lines (55 loc) · 1.95 KB
/
HYDRA_csv2structured.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function s = HYDRA_csv2structured(basecase, fname, beta1_fac)
tecfile = '/Data/ojj23/dns-work/channel-flows/RANS/M1-2_Re2k2-bsl/tecplot.dat';
[zone, VARlist] = tec2mat(tecfile,'debug');
if nargin < 3
beta1 = [];
end
blk = basecase.blk;
gas = basecase.gas;
bcs = basecase.bcs;
s = RANSSlice(blk,gas,bcs);
s.blk = basecase.blk;
s.gas = basecase.gas;
s.beta1_fac = beta1_fac;
gam = gas.gam;
data = readtable(fname);
xv = data.Points_0;
yv = data.Points_1;
rv = data.density;
uv = data.relativeVelocityVector_0;
vv = data.relativeVelocityVector_1;
wv = data.relativeVelocityVector_2;
pv = data.staticPressure;
kv = data.turbulentKineticEnergy;
ov = data.turbulentOmega;
dv = data.wallDistance;
ri = scatteredInterpolant(xv, yv, rv);
ui = scatteredInterpolant(xv, yv, uv);
vi = scatteredInterpolant(xv, yv, vv);
wi = scatteredInterpolant(xv, yv, wv);
pi = scatteredInterpolant(xv, yv, pv);
ki = scatteredInterpolant(xv, yv, kv);
oi = scatteredInterpolant(xv, yv, ov);
di = scatteredInterpolant(xv, yv, dv);
for ib = 1:length(blk.x)
fprintf('Interpolating block %d/%d\n',[ib, length(blk.x)]);
disp('Interpolating ro')
s.ro{ib} = ri(blk.x{ib}, blk.y{ib});
disp('Interpolating u')
s.u{ib} = ui(blk.x{ib}, blk.y{ib});
disp('Interpolating v')
s.v{ib} = vi(blk.x{ib}, blk.y{ib});
disp('Interpolating w')
s.w{ib} = wi(blk.x{ib}, blk.y{ib});
disp('Interpolating p')
pnow = pi(blk.x{ib}, blk.y{ib});
s.Et{ib} = pnow/(gam-1) + 0.5*s.ro{ib}.*(s.u{ib}.^2 + s.v{ib}.^2 + s.w{ib}.^2);
disp('Interpolating k')
s.k{ib} = ki(blk.x{ib}, blk.y{ib});
disp('Interpolating omega')
s.omega{ib} = oi(blk.x{ib}, blk.y{ib});
disp('Interpolating wallDistance')
s.blk.walldist{ib} = di(blk.x{ib}, blk.y{ib});
end
s.getBCs;
end