Skip to content

Commit 59983e9

Browse files
committed
misc
1 parent 77c3be6 commit 59983e9

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

src/mitim_tools/gacode_tools/CGYROtools.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def run_full(
178178
minutes = 5,
179179
n = 16,
180180
nomp = 1,
181-
submit_via_qsub=True,
181+
submit_via_qsub=True, #TODO fix this, works only at NERSC? no scans?
182182
clean_folder_going_in=True, # Make sure the scratch folder is removed before running (unless I want a restart!)
183183
):
184184

@@ -205,13 +205,31 @@ def run_full(
205205
launchSlurm=False,
206206
)
207207

208-
CGYROcommand = f'gacode_qsub -e . -n {n} -nomp {nomp} -queue {self.cgyro_job.machineSettings['slurm']['partition']} -w 0:{minutes}:00 -s'
208+
subfolder = "scan0"
209+
210+
CGYROcommand = f'gacode_qsub -e {subfolder} -n {n} -nomp {nomp} -queue {self.cgyro_job.machineSettings['slurm']['partition']} -w 0:{minutes}:00 -s'
209211

210212
if "account" in self.cgyro_job.machineSettings["slurm"] and self.cgyro_job.machineSettings["slurm"]["account"] is not None:
211213
CGYROcommand += f" -repo {self.cgyro_job.machineSettings['slurm']['account']}"
212214

213215
self.slurm_output = "batch.out"
214216

217+
# ---
218+
folder_run = self.folderCGYRO / subfolder
219+
folder_run.mkdir(parents=True, exist_ok=True)
220+
221+
# Copy the input.cgyro in the subfolder
222+
input_cgyro_file_this = folder_run / "input.cgyro"
223+
shutil.copy2(input_cgyro_file, input_cgyro_file_this)
224+
225+
# Copy the input.gacode file in the subfolder
226+
inputgacode_file_this = folder_run / "input.gacode"
227+
shutil.copy2(self.inputgacode_file, inputgacode_file_this)
228+
229+
# Prepare the input and output folders
230+
input_folders = [folder_run]
231+
output_folders = [subfolder]
232+
215233
else:
216234

217235
if scan_param is None:

tests/CGYRO_workflow.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
cold_start = True
66

77
gacode_file = __mitimroot__ / "tests" / "data" / "input.gacode"
8-
folder = __mitimroot__ / "tests" / "scratch" / "cgyro_test"
8+
folder = __mitimroot__ / "tests" / "scratch" / "cgyro_test2"
99

1010
if cold_start and folder.exists():
1111
os.system(f"rm -r {folder}")
@@ -21,28 +21,17 @@
2121
roa = 0.55,
2222
CGYROsettings=0,
2323
extraOptions={
24-
'KY':0.3
25-
})
26-
cgyro.read(label="cgyro1")
24+
'KY':0.3,
25+
'MAX_TIME': 1E1, # Short, I just want to test the run
26+
},
27+
submit_via_qsub=True # NERSC: True #TODO change this
28+
)
2729

28-
cgyro.run(
29-
'linear',
30-
roa = 0.55,
31-
CGYROsettings=0,
32-
extraOptions={
33-
'KY':0.5
34-
})
35-
cgyro.read(label="cgyro2")
36-
37-
cgyro.run(
38-
'linear',
39-
roa = 0.55,
40-
CGYROsettings=0,
41-
extraOptions={
42-
'KY':0.7
43-
})
44-
cgyro.read(label="cgyro3")
30+
cgyro.check(every_n_minutes=1)
31+
cgyro.fetch()
32+
cgyro.delete()
4533

34+
cgyro.read(label="cgyro1")
4635

4736
cgyro.plotLS()
48-
cgyro.fnLS.show()
37+
cgyro.fn.show()

0 commit comments

Comments
 (0)