-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathplot_lcfs_realspace.py
More file actions
36 lines (28 loc) · 850 Bytes
/
plot_lcfs_realspace.py
File metadata and controls
36 lines (28 loc) · 850 Bytes
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 16 17:53:03 2021
@author: jonathan
"""
import os
import numpy as np
from mayavi import mlab
folder = ".."
# load output from FFTW example 'app_flux_surface.c'
lcfs_R = np.loadtxt(os.path.join(folder, "lcfs_R.dat"))
lcfs_Z = np.loadtxt(os.path.join(folder, "lcfs_Z.dat"))
n_zeta, n_theta = np.shape(lcfs_R)
# assume W7-X
nfp = 5
# regular grid in phi = zeta/nfp
phiGrid = 2.0*np.pi*np.arange(n_zeta)/(n_zeta*nfp)
# compute X,Y from R,phi
lcfs_X = np.zeros([n_zeta, n_theta])
lcfs_Y = np.zeros([n_zeta, n_theta])
for i in range(n_zeta):
for j in range(n_theta):
lcfs_X[i,j] = lcfs_R[i,j]*np.cos(phiGrid[i])
lcfs_Y[i,j] = lcfs_R[i,j]*np.sin(phiGrid[i])
# plot real-space geometry of flux surface using Mayavi
mlab.mesh(lcfs_X, lcfs_Y, lcfs_Z)
mlab.show()