From beb9270be4be36c1b6567ea4c6670c376777c633 Mon Sep 17 00:00:00 2001 From: Jeff Candy Date: Tue, 3 Sep 2024 23:55:28 -0700 Subject: [PATCH] More parameters added to JSON writer --- cgyro/bin/cgyro_json | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/cgyro/bin/cgyro_json b/cgyro/bin/cgyro_json index 27c8ff893..feda90299 100755 --- a/cgyro/bin/cgyro_json +++ b/cgyro/bin/cgyro_json @@ -1,29 +1,40 @@ #!/usr/bin/env python import json +import numpy as np from pygacode.cgyro import data sim = data.cgyrodata('./') +#-------------------------------------------------------------- +# json.cgyro.localdump + d = {} d['RMIN'] = sim.rmin d['RMAJ'] = sim.rmaj -d['SHEAR'] = sim.shear d['Q'] = sim.q +d['SHEAR'] = sim.shear d['Z'] = sim.z[:].tolist() d['MASS'] = sim.mass[:].tolist() d['DENS'] = sim.dens[:].tolist() d['TEMP'] = sim.temp[:].tolist() d['DLNNDR'] = sim.dlnndr[:].tolist() +d['DLNTDR'] = sim.dlntdr[:].tolist() +d['MACH'] = sim.mach +d['GAMMA_E'] = sim.gamma_e +d['GAMMA_P'] = sim.gamma_p +d['BETAE_UNIT'] = sim.betae_unit with open('json.cgyro.localdump','w') as f: json.dump(d,f,indent=2,sort_keys=True) #-------------------------------------------------------------- +# json.cgyro.imas lref=sim.rmaj vthref = np.sqrt(2.0) +bref = sim.b_gs2 d = {} d['r_minor_norm'] = sim.rmin/lref @@ -35,7 +46,21 @@ d['density_norm'] = sim.dens[:].tolist() d['temperature_norm'] = sim.temp[:].tolist() d['density_log_gradient_norm'] = (lref*sim.dlnndr[:]).tolist() d['temperature_log_gradient_norm'] = (lref*sim.dlntdr[:]).tolist() -d['velocity_tor_norm'] = + +# Rotation parameters +d['velocity_tor_norm'] = sim.mach/vthref +# -L/v 1/B (r/q Bu) (-dw/dr) = L/v Bu/B (r/q dw/dr) = L/v Bu/B (-GAMMA_E) +d['shearing_rate_norm'] = -(lref/vthref)/bref*sim.gamma_e +# -L^2/v dw/dr = -L/v (L dw/dr) = -L/v (-GAMMA_P) +d['velocity_tor_gradient_norm'] = lref/vthref*sim.gamma_p + +d['beta_reference'] = sim.betae_unit/bref**2 + +d['dgeometric_axis_r_dr_minor'] = sim.shift +d['dgeometric_axis_z_dr_minor'] = sim.dzmag + +d['elongation'] = sim.kappa +d['delongation_dr_minor_norm'] = sim.s_kappa*sim.kappa*lref/sim.rmin with open('json.cgyro.imas','w') as f: json.dump(d,f,indent=2,sort_keys=True)