@@ -197,20 +197,15 @@ def run(
197197 Note: running with onlyThermal will result in a input.gacode.new that has 0.0 in the columns of the fast particles
198198 """
199199 onlyThermal = TGYRO_physics_options .get ("onlyThermal" , False )
200- limitSpecies = TGYRO_physics_options .get (
201- "limitSpecies" , 100
202- ) # limitSpecies is not to consider the last ions. In there are 6 ions in input.gacode, and limitSpecies=4, the last 2 won't be considered
200+ limitSpecies = TGYRO_physics_options .get ("limitSpecies" , 100 ) # limitSpecies is not to consider the last ions. In there are 6 ions in input.gacode, and limitSpecies=4, the last 2 won't be considered
203201 quasineutrality = TGYRO_physics_options .get ("quasineutrality" , [])
204202
205203 if (
206204 (iterations == 0 )
207205 and ("tgyro_method" in TGYRO_solver_options )
208206 and (TGYRO_solver_options ["tgyro_method" ] != 1 )
209207 ):
210- print (
211- f"\t - Zero iteration must be run with method 1, changing it from { TGYRO_solver_options ['tgyro_method' ]} to 1" ,
212- typeMsg = "w" ,
213- )
208+ print (f"\t - Zero iteration must be run with method 1, changing it from { TGYRO_solver_options ['tgyro_method' ]} to 1" ,typeMsg = "w" ,)
214209 TGYRO_solver_options ["tgyro_method" ] = 1
215210
216211 # ------------------------------------------------------------------------
@@ -231,10 +226,7 @@ def run(
231226
232227 if vectorRange [2 ] == 1 :
233228 extra_add = vectorRange [0 ] + 1e-3
234- print (
235- f" -> TGYRO cannot run with only one point ({ vectorRange [0 ]} ), adding { extra_add } " ,
236- typeMsg = "w" ,
237- )
229+ print (f" -> TGYRO cannot run with only one point ({ vectorRange [0 ]} ), adding { extra_add } " ,typeMsg = "w" ,)
238230 vectorRange [2 ], vectorRange [1 ] = 2 , extra_add
239231 if special_radii_mod is not None :
240232 special_radii_mod = np .append (special_radii_mod , [extra_add ])
@@ -280,26 +272,14 @@ def run(
280272
281273 if onlyThermal :
282274 if len (quasineutrality ) < 1 :
283- print (
284- "\t - TGYRO will be run by removing fast particles (only thermal ones), without correcting for quasineutrality" ,
285- typeMsg = "i" ,
286- )
275+ print ("\t - TGYRO will be run by removing fast particles (only thermal ones), without correcting for quasineutrality" ,typeMsg = "i" ,)
287276 else :
288- print (
289- f"\t - TGYRO will be run by removing fast particles (only thermal ones), with quasineutrality={ quasineutrality } " ,
290- typeMsg = "i" ,
291- )
277+ print (f"\t - TGYRO will be run by removing fast particles (only thermal ones), with quasineutrality={ quasineutrality } " ,typeMsg = "i" ,)
292278 else :
293279 if len (quasineutrality ) < 1 :
294- print (
295- "\t - TGYRO will be run with all species (fast and thermal), without correcting for quasineutrality" ,
296- typeMsg = "i" ,
297- )
280+ print ("\t - TGYRO will be run with all species (fast and thermal), without correcting for quasineutrality" ,typeMsg = "i" ,)
298281 else :
299- print (
300- f"\t - TGYRO will be run with all species (fast and thermal), with quasineutrality={ quasineutrality } " ,
301- typeMsg = "i" ,
302- )
282+ print (f"\t - TGYRO will be run with all species (fast and thermal), with quasineutrality={ quasineutrality } " ,typeMsg = "i" ,)
303283
304284 # -----------------------------------
305285 # ------ Complete required outputs
@@ -362,9 +342,7 @@ def run(
362342 if not self .FolderTGYRO_tmp .exists ():
363343 IOtools .askNewFolder (self .FolderTGYRO_tmp )
364344
365- print (
366- f"\t \t - Creating only-controls input.tglf file in { IOtools .clipstr (str (self .FolderTGYRO_tmp .resolve ()))} input.tglf"
367- )
345+ print (f"\t \t - Creating only-controls input.tglf file in { IOtools .clipstr (str (self .FolderTGYRO_tmp .resolve ()))} input.tglf" )
368346 inputclass_TGLF = TGLFtools .TGLFinput ()
369347 inputclass_TGLF = GACODErun .modifyInputs (
370348 inputclass_TGLF ,
@@ -424,9 +402,7 @@ def run(
424402
425403 minn_true = []
426404 for i in minn :
427- if (self .profiles .Species [i ]["S" ] != "fast" ) or (
428- not TGYRO_physics_options .get ("onlyThermal" , False )
429- ):
405+ if (self .profiles .Species [i ]["S" ] != "fast" ) or (not TGYRO_physics_options .get ("onlyThermal" , False )):
430406 minn_true .append (i )
431407
432408 if len (minn_true ) > 0 :
@@ -436,6 +412,8 @@ def run(
436412 # ------ Run
437413 # -----------------------------------
438414
415+ nparallel = len (self .rhosToSimulate )
416+
439417 if not exists :
440418 # Run TGYRO and store data in self.FolderTGYRO_tmp (this folder will also have all the inputs, that's why I'm keeping it)
441419 GACODErun .runTGYRO (
@@ -445,7 +423,7 @@ def run(
445423 inputFiles = inputFiles_TGYRO ,
446424 launchSlurm = launchSlurm ,
447425 nameJob = nameJob ,
448- nparallel = len ( self . rhosToSimulate ) ,
426+ nparallel = nparallel ,
449427 minutes = minutesJob ,
450428 )
451429
@@ -459,14 +437,9 @@ def run(
459437 ------------------------------------------------------------------------------------------------------------------------
460438 """
461439 if modify_inputgacodenew :
462- print (
463- "\t - It was requested that input.gacode.new is modified according to what TypeTarget was" ,
464- typeMsg = "i" ,
465- )
440+ print ("\t - It was requested that input.gacode.new is modified according to what TypeTarget was" ,typeMsg = "i" ,)
466441
467- inputgacode_new = PROFILEStools .PROFILES_GACODE (
468- self .FolderTGYRO_tmp / "input.gacode.new"
469- )
442+ inputgacode_new = PROFILEStools .PROFILES_GACODE (self .FolderTGYRO_tmp / "input.gacode.new" )
470443
471444 if TGYRO_physics_options ["TypeTarget" ] < 3 :
472445 for ikey in [
@@ -476,31 +449,19 @@ def run(
476449 "qfuse(MW/m^3)" ,
477450 "qfusi(MW/m^3)" ,
478451 ]:
479- print (
480- f"\t - Replacing { ikey } from input.gacode.new to have the same as input.gacode"
481- )
452+ print (f"\t - Replacing { ikey } from input.gacode.new to have the same as input.gacode" )
482453 if ikey in self .profiles .profiles :
483- inputgacode_new .profiles [ikey ] = self .profiles .profiles [
484- ikey
485- ]
454+ inputgacode_new .profiles [ikey ] = self .profiles .profiles [ikey ]
486455 else :
487- inputgacode_new .profiles [ikey ] = (
488- inputgacode_new .profiles ["rho(-)" ] * 0.0
489- )
456+ inputgacode_new .profiles [ikey ] = inputgacode_new .profiles ["rho(-)" ] * 0.0
490457
491458 if TGYRO_physics_options ["TypeTarget" ] < 2 :
492459 for ikey in ["qei(MW/m^3)" ]:
493- print (
494- f"\t - Replacing { ikey } from input.gacode.new to have the same as input.gacode"
495- )
460+ print (f"\t - Replacing { ikey } from input.gacode.new to have the same as input.gacode" )
496461 if ikey in self .profiles .profiles :
497- inputgacode_new .profiles [ikey ] = self .profiles .profiles [
498- ikey
499- ]
462+ inputgacode_new .profiles [ikey ] = self .profiles .profiles [ikey ]
500463 else :
501- inputgacode_new .profiles [ikey ] = (
502- inputgacode_new .profiles ["rho(-)" ] * 0.0
503- )
464+ inputgacode_new .profiles [ikey ] = inputgacode_new .profiles ["rho(-)" ] * 0.0
504465
505466 inputgacode_new .writeCurrentStatus ()
506467 # ------------------------------------------------------------------------------------------------------------------------
0 commit comments