Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 33 additions & 32 deletions Python_analysis/Postprocessing/load_analyze_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#%% open Eric's matlab file for DIII-D magnetic field

on_nersc=1
on_nersc=0
if on_nersc==0:
filename='/home/21b/ExperimentalInputs/DIIID/200236/Matts_Bfield_data.mat'

Expand All @@ -42,7 +42,8 @@
#run_directory=['/home/21b/KORC_RUNS/FROM_PERLMUTTER/TEST21']
#run_directory=['/home/21b/KORC_RUNS/FROM_PERLMUTTER/TEST20b_rr']
#run_directory=['/pscratch/sd/m/mbeidler/KORC_GPU_RUNS/DIIID_177031_GPU_TEST21a']
run_directory=['/home/21b/KORC/test/elong_trans/rank_1']
#run_directory=['/home/21b/KORC/test/elong_trans/rank_1']
run_directory=['/home/21b/KORC/test/mars_EM/rank_1']

for kk in range(0,dir_num):

Expand Down Expand Up @@ -341,16 +342,13 @@

#%% open KORC field file

useextfield=0
useextfield=1

if useextfield==1:

#filename=r"/home/21b/KORC_RUNS/LOCAL/TEST2/AORSA_D3D_171089_200MHz_EFITgrid.h5"

if on_nersc==0:
filename=r"../"+run_directory[0]+"/DIII_200236_MARS_CaseA.h5"
else:
filename=r"../../"+run_directory[0]+"/DIII_200236_MARS_CaseA.h5"
#filename=r"../../"+run_directory[0]+"/DIII_200236_MARS_CaseA.h5"
filename=r"/home/21b/KORC/test/mars_EM/ARC_42533M20_MARS.h5"

with h5py.File(filename,'r') as f:
NR=int(f['NR'][0])
Expand Down Expand Up @@ -388,7 +386,7 @@
interp_br = RegularGridInterpolator((Rg,Zg), np.transpose(BR_g[:,:]),method='cubic')
interp_bz = RegularGridInterpolator((Rg,Zg), np.transpose(BZ_g[:,:]),method='cubic')

Rq=1.7
Rq=4.
Zq=0.

psip_q=interp_psip([Rq,Zq])
Expand Down Expand Up @@ -475,19 +473,23 @@
vperp=vmag*np.sin(np.radians(eta))
vpll=vmag*np.cos(np.radians(eta))

rm=np.sqrt((R-R0)**2+((zz-Z0)/kappa)**2)
try:
rm=np.sqrt((R-R0)**2+((zz-Z0)/kappa)**2)
except:
rm=np.sqrt((R-R0)**2+(zz-Z0)**2)

flagDecon=np.zeros(np.shape(flagCon))
flagDecon[(flagCon<1) & (flagRE>0)]=1
confined=np.sum(flagCon,axis=1)
deconfined=np.sum(flagDecon,axis=1)

flagTherm=np.zeros(np.shape(flagCol))
flagTherm[flagCol<1 & (flagRE>0)]=1
Thermal=np.sum(flagTherm,axis=1)
Energetic=np.sum(flagCol,axis=1)

if 'flagRE' in outputs_list:
flagDecon=np.zeros(np.shape(flagCon))
flagDecon[(flagCon<1) & (flagRE>0)]=1
confined=np.sum(flagCon,axis=1)
deconfined=np.sum(flagDecon,axis=1)

flagTherm=np.zeros(np.shape(flagCol))
flagTherm[flagCol<1 & (flagRE>0)]=1
Thermal=np.sum(flagTherm,axis=1)
Energetic=np.sum(flagCol,axis=1)

Total=np.sum(flagRE,axis=1)

flagActive=flagRE*flagCon*flagCol
Expand All @@ -503,16 +505,15 @@
flagSecondary[:,flagRE[-1,:]<1]=0
Secondary=np.sum(flagSecondary,axis=1)

Ipart=qe*vpll*bPHI/(2*np.pi*R*bmag)
Ipart[flagActive==0]=0
Itot=np.sum(Ipart,axis=1)
Ipri=np.sum(Ipart*flagPrimary,axis=1)
Isec=np.sum(Ipart*flagSecondary,axis=1)

IPOLpart=qe*vpll*bpol/(2*np.pi*R*bmag)
IPOLpart[flagActive==0]=0
IPOL=np.sum(IPOLpart,axis=1)

Ipart=qe*vpll*bPHI/(2*np.pi*R*bmag)
Ipart[flagActive==0]=0
Itot=np.sum(Ipart,axis=1)
Ipri=np.sum(Ipart*flagPrimary,axis=1)
Isec=np.sum(Ipart*flagSecondary,axis=1)

IPOLpart=qe*vpll*bpol/(2*np.pi*R*bmag)
IPOLpart[flagActive==0]=0
IPOL=np.sum(IPOLpart,axis=1)

#KE=me*c**2/qe*np.sum((g-1)*flagActive)
#KEtot=me*c**2/qe*np.sum((1-1)*flagRE)
Expand Down Expand Up @@ -1055,7 +1056,7 @@ def velocity_magnetic_to_collapsed_cartesian(v, eta, chi, Bx, By, Bz, phi_raw, p
plt.rc('legend', fontsize=SMALL_SIZE)
plt.rc('figure', titlesize=SMALL_SIZE)

plot_histrm=1
plot_histrm=0
plot_LAC_ParamScaling=0
plot_LAC_Escaling=0
plot_GPUscaling=0
Expand All @@ -1074,7 +1075,7 @@ def velocity_magnetic_to_collapsed_cartesian(v, eta, chi, Bx, By, Bz, phi_raw, p
plot_bz=0
plot_bphi=0
plot_psip=0
plot_histRZ_ext=0
plot_histRZ_ext=1
plot_histKeta=0
plot_histK=0
plot_histeta=0
Expand All @@ -1097,7 +1098,7 @@ def velocity_magnetic_to_collapsed_cartesian(v, eta, chi, Bx, By, Bz, phi_raw, p
plot_evoI = 0
plot_evoRE = 0

timeind_p=100
timeind_p=0
timeind_g=0

#tloss=time[12]
Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_nvhpc_gpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cmake \
-DCMAKE_Fortran_FLAGS="-acc=gpu -gpu=deepcopy,cc89 -Mfree -fPIC -c++libs -Mpreprocess -DDOUBLE_PRECISION" \
-DCMAKE_C_FLAGS="-mp -DDOUBLE_PRECISION" \
-DCMAKE_CXX_FLAGS="-std=c++11 -mp -DDOUBLE_PRECISION" \
-DCMAKE_Fortran_FLAGS_DEBUG='-g -gpu=debug -O1 -Minfo=accel' \
-DCMAKE_Fortran_FLAGS_DEBUG='-g -gpu=debug -O1' \
..

make -j VERBOSE=1
Expand Down
9 changes: 6 additions & 3 deletions src/korc_fields.f90
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ subroutine analytical_fields_p_ACC(T_R,T_T,T_Z, &
Br = Br + sqrt(dBr_norm_squared)
end if

B_X = Bzeta*cZ - Bp*sT*sZ + Br*cT*sZ
B_Y = -Bzeta*sZ - Bp*sT*cZ + Br*cT*cZ
B_Z = Bp*cT + Br*sT
B_X = Bzeta*cZ - Bp*sT*sZ/kappa + Br*cT*sZ
B_Y = -Bzeta*sZ - Bp*sT*cZ/kappa + Br*cT*cZ
B_Z = Bp*cT + Br*sT/kappa

Ezeta = -E0/( 1.0_rp + eta*cT)

Expand Down Expand Up @@ -2210,6 +2210,9 @@ subroutine load_field_data_from_hdf5(params,F)
if (F%dims(2).gt.0) then
dset = '/GR'
call load_array_from_hdf5(h5file_id,dset,F%GR)

dset = '/FR'
call load_array_from_hdf5(h5file_id,dset,F%FR)
endif

end if
Expand Down
Loading
Loading