Skip to content

Commit

Permalink
Merge branch 'master' into dmd
Browse files Browse the repository at this point in the history
  • Loading branch information
jcandy committed Dec 5, 2024
2 parents 44f68a4 + 5088beb commit 22cf6ba
Show file tree
Hide file tree
Showing 25 changed files with 405 additions and 399 deletions.
10 changes: 5 additions & 5 deletions cgyro/bin/cgyro_json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ def opts():
description="CGYRO localdump utility",
epilog=textwrap.dedent(mytext))

parser.add_argument('-dir',
parser.add_argument('-e',
help="working directory (default: cwd)",
type=str,
default='.')

args=parser.parse_args()

return args.dir
return args.e

mydir = opts()

Expand Down Expand Up @@ -130,7 +130,7 @@ d['DLNNDR'] = sim.dlnndr[:].tolist()
d['DLNTDR'] = sim.dlntdr[:].tolist()

# JSON output
with open('json.cgyro.localdump','w') as f:
with open(mydir+'json.cgyro.localdump','w') as f:
json.dump(d,f,indent=2,sort_keys=True)
print('cgyro_json: wrote json.cgyro.localdump')
#==================================================================
Expand All @@ -139,7 +139,7 @@ with open('json.cgyro.localdump','w') as f:
# standard localdump output
#
nmax = 0
with open('out.cgyro.localdump','w') as f:
with open(mydir+'out.cgyro.localdump','w') as f:
for key in d:
x = d[key]
if 'SHAPE' in key:
Expand Down Expand Up @@ -231,7 +231,7 @@ d['ds_dr_minor_norm'][1] = sim.s_delta*lref/sim.rmin/np.cos(np.arcsin(sim.delta)
d['ds_dr_minor_norm'][2] = -sim.s_zeta*lref/sim.rmin
#-----------------------------------------------------------------------

with open('json.cgyro.imas','w') as f:
with open(mydir+'json.cgyro.imas','w') as f:
json.dump(d,f,indent=2,sort_keys=True)
print('cgyro_json: wrote json.cgyro.imas')
#==================================================================
Expand Down
52 changes: 36 additions & 16 deletions cgyro/bin/cgyrodb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ from cgyro.data import cgyrodata

pd.set_option('display.max_rows', None)

ignore = 'eslshared'

# Command line option parser
def opts():

Expand All @@ -27,20 +29,32 @@ def opts():
description="CGYRO database utility",
epilog=textwrap.dedent(mytext))

parser.add_argument('-mode',
help='Mode switch (data,update)',
type=str,
default='data')
parser.add_argument('-ref',
help='Refresh directories',
action='store_true')
parser.add_argument('-json',
help='Generate IMAS and localdump files',
action='store_true')
parser.add_argument('-db',
help='Load the DB and print',
action='store_true')
parser.add_argument('-flux',
help='Add flux to DB',
action='store_true')

args=parser.parse_args()

return args.mode
return args.ref,args.json,args.db,args.flux

mode = opts()
ref,json,db,doflux = opts()

meta = {}

def gendict(sim,mode):
if (not ref) and (not json) and (not db):
print('Type "cgyrodb -h" for help')
sys.exit()

def gendict(sim,doflux):

mydict = {}

Expand All @@ -60,9 +74,9 @@ def gendict(sim,mode):
mydict['a/Ln1'] = 0.0
mydict['a/Lt1'] = 0.0

if mode == 'flux':
if doflux:
sim.getflux()
y = np.sum(sim.ky_flux,axis=(2,3))
y = np.sum(sim.ky_flux,axis=(2,3))
for ispec in range(sim.n_species):
g = average(y[ispec,0,:],sim.t,0.5,0.0)
q = average(y[ispec,1,:],sim.t,0.5,0.0)
Expand All @@ -73,25 +87,31 @@ def gendict(sim,mode):

return mydict

ignore = 'eslshared'

# First locate all directories
y = []
for root,xd,xf in os.walk('./'):
if xd == []:
if ignore not in root:
y.append(root)

if mode == 'update':
if ref:
# Run through directories and update
for mdir in y:
print('Updating '+mdir)
os.system('cgyro -t '+mdir)
else:
print('Refreshing '+mdir)
os.system('cd '+mdir+' ; python $GACODE_ROOT/cgyro/bin/cgyro_parse.py')
os.system('cd '+mdir+' ; $GACODE_ROOT/cgyro/src/cgyro ')

if json:
# Run through directories and update
for mdir in y:
print('Dumping '+mdir)
os.system('cgyro_json -e '+mdir)

if db:
# Create master dictionary "meta"
for mdir in tqdm(y):
sim = cgyrodata(mdir+'/',silent=True)
meta[mdir]=gendict(sim,mode)
meta[mdir]=gendict(sim,doflux)

df = pd.DataFrame(meta)
dfpart = df.T[['n_n','n_radial','n_theta','q','s','kappa','a/Ln0','a/Lt0','a/Ln1','a/Lt1','nuee']]
Expand Down
2 changes: 0 additions & 2 deletions cgyro/install/make.ext.AZURE_GPU

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.CI_GPU

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.CLOUD_GPU

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.CRUSHER

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.CSD3_AMPERE_GPU

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.DAINT_PGI

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.FRONTIER

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.GASUMMIT_GPU

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.LUMI

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.MARCONI_LEONARDO

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.NEURON

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.PERLMUTTER_GPU

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.PERLMUTTER_GPU_80G

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.STAMPEDE3_GPU_IFX

This file was deleted.

2 changes: 0 additions & 2 deletions cgyro/install/make.ext.SUMMIT

This file was deleted.

3 changes: 1 addition & 2 deletions cgyro/src/cgyro_init_arrays.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ subroutine cgyro_init_arrays
integer :: ir,it,is,ie,ix
integer :: itm,itl,itor,mytor,itf
integer :: it_loc
integer :: jr,jt,id
integer :: i_field
integer :: jt
integer :: l,ll
integer :: iltheta_min
complex :: carg
Expand Down
Loading

0 comments on commit 22cf6ba

Please sign in to comment.