Skip to content
Snippets Groups Projects
Commit 3ef6c487 authored by Adrien Crovato's avatar Adrien Crovato
Browse files

Add z coordinate to slices

parent e28e5174
No related branches found
No related tags found
1 merge request!3Version 1.2
Pipeline #37678 passed with warnings
......@@ -91,9 +91,12 @@ def create_slices(body, sol, fname, ys):
for i in range(len(ys)):
# get data on cut section
coords, connct, cvalues = extract_data(cut_grid(grid, [0., ys[i], 0.]), snames)
# normalize x-coordinate by local chord
xc = np.zeros((coords.shape[0], 1))
xc[:,0] = (coords[:,0] - min(coords[:,0])) / (max(coords[:,0]) - min(coords[:,0]))
# normalize x and z-coordinates by local chord
xc = np.zeros((coords.shape[0], 2))
ile = np.argmin(coords[:,0]) # LE index
crd = max(coords[:,0]) - min(coords[:,0]) # chord
xc[:,0] = (coords[:,0] - coords[ile,0]) / crd
xc[:,1] = (coords[:,2] - coords[ile,2]) / crd
# average value at points from values at cell center
nvalues = np.zeros((coords.shape[0], len(sol.keys())))
for j in range(connct.shape[0]):
......@@ -101,16 +104,16 @@ def create_slices(body, sol, fname, ys):
for k in range(len(pids)):
for l in range(len(sol.keys())):
nvalues[connct[j][k], l] += cvalues[snames[l]][j] / len(pids)
# create dataset holding x-coordinates and values and sort it
# create dataset holding coordinates and values and sort it
xc_vals = np.hstack((xc, nvalues))
sort(connct, xc_vals)
xc_vals = np.vstack((xc_vals, xc_vals[0,:]))
# write to file
hdr = 'x/c'
hdr = f'y = {ys[i]}, c = {crd}\n'
hdr += '{:>9s}, {:>10s}'.format('x/c', 'z/c')
for name in snames:
hdr += f', {name}'
hdr += f'\ny = {ys[i]}'
np.savetxt(fname+f'_slice_{i}.dat', xc_vals, fmt='%1.5e', delimiter=',', header=hdr)
hdr += ', {:>10s}'.format(name)
np.savetxt(fname+f'_slice_{i}.dat', xc_vals, fmt='%+1.4e', delimiter=',', header=hdr)
def interpolate_modes(fname, surf_nodes, flat=True):
"""Read modal displacements and interpolate them on surface grid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment