diff --git a/Makefile b/Makefile index 77a938b..8752b31 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# See the INSTALL.md notes on how to use this Makefile +# See the README.md notes on how to use this Makefile # SHELL = /bin/bash @@ -15,13 +15,17 @@ GIT_DIRS = athena athenak # URLs that we'll need +URL0 = https://github.com/teuben/Athena-Cversion URL1 = https://github.com/PrincetonUniversity/athena URL2 = https://gitlab.com/theias/hpc/jmstone/athena-parthenon/athenak +URL2 = https://gitlab.com/theias/hpc/jmstone/athena-parthenon/athena-mini-k +URL2 = https://github.com/teuben/Athena-miniK URL3 = https://github.com/teuben/nemo URL4 = https://github.com/teuben/tkrun URL5a = https://github.com/teuben/agui URL5b = https://github.com/anhhcao/agui URL5c = https://github.com/KylieGong/agui +URL6 = https://github.com/teuben/pyThena # the ATHENA executable (from athena or athenak) # ATHENA = athena/bin/athena @@ -60,84 +64,100 @@ branch: -@for dir in $(GIT_DIRS); do\ (echo -n "$$dir: " ;cd $$dir; git branch --show-current); done +athenac: + git clone $(URL0) -b teuben1 athenac + $(MAKE) build_athenac athena: git clone $(URL1) + $(MAKE) build_athena athenak: - git clone --recursive $(URL2) + git clone --recursive $(URL2) athenak nemo: git clone $(URL3) +python: nemo anaconda3 + +anaconda3: + nemo/src/scripts/install_anaconda3 + tkrun: git clone $(URL4) -## build: build athenak -build: athenak - (mkdir -p athenak/build; cd athenak/build; cmake ..; make -j 4) +## build_athenak: build athenak +build_athenak: athenak + (mkdir -p athenak/build; cd athenak/build; cmake ..; make -j 8) + +# See also: https://kokkos.github.io/kokkos-core-wiki/keywords.html#keywords-arch +B_ARM = -D CMAKE_CXX_COMPILER=clang++-mp-15 -D CMAKE_C_COMPILER=clang-mp-15 -D Kokkos_ARCH_ARMV81=On +arm: athenak + (mkdir -p athenak/build; cd athenak/build; cmake $(B_ARM) ..; make -j 8) + +#PJT = -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_C_COMPILER=clang -D Kokkos_ARCH_INTEL_DG1=On +#PJT = -D Kokkos_ARCH_INTEL_DG1=On +PJT = -D Kokkos_ENABLE_OPENMP=On +#PJT = -D Athena_ENABLE_MPI=ON +pjt: athenak + (mkdir -p athenak/build; cd athenak/build; cmake $(PJT) ..; make -j 8) -## build_athena build athena++ for the linear_wave problem +## build_athena build athena++ for the linear_wave problem build_athena: athena (cd athena; ./configure.py --prob linear_wave; make clean; make -j) -## build_nemo: build nemo -build_nemo: nemo - (cd nemo; ./configure ; make build check bench5) +## build_athenac build AthenaC for the linear_wave problem +build_athenac: athenac + (cd athenac; autoconf; ./configure; make all) + +## build_nemo: build nemo - will also build classic tkrun +build_nemo: nemo + (cd nemo; ./configure ; make build check) + +## build_python: build your private anaconda3 +build_python: python # a few sample runs -## run1: example linear_wave_hydro +## + +## run1: example 1D linear_wave_hydro (athenak) [ < 1sec 1069 cycles] run1: - $(ATHENA) -i athenak/inputs/tests/linear_wave_hydro.athinput -d run1 + $(TIME) $(ATHENA) -i linear_wave_hydro.athinput -d run1 @echo ./animate1 base=run1/tab/LinWave xcol=x1v ycol=velx - # -> LinWave.hydro_w.00000.tab -## run1: example advect_hyd +## run2: example 2D orszag_tang (athenak) [ ~109" 1403 cycles] run2: - $(ATHENA) -i athenak/inputs/tests/advect_hyd.athinput -d run2 + $(TIME) $(ATHENA) -i orszag_tang.athinput -d run2 @echo ./animate1 base=run2/tab/Advect xcol=x1v ycol=dens - # -> Advect.hydro_u.00000.tab -run3: - $(ATHENA) -i athenak/inputs/tests/advect_mhd.athinput -d run3 - # -> Advect.mhd_u.00000.tab -run4: - $(ATHENA) -i athenak/inputs/tests/hohlraum_1d.athinput -d run4 - # -> hohlraum_1d.rad_coord.00000.tab -run5: - $(ATHENA) -i athenak/inputs/tests/rad_linwave.athinput -d run5 - # -> rad_linwave.hydro_w.*.tab - # -> rad_linwave.rad_coord.*.tab +# We use past tense for old versions of athena :-) +## ran1 and ran2 are made by ATHENA++ +## ran3 by good old AthenaC +## ran1: example athena++ linear_wave1d in vtk format +ran1: athena + athena/bin/athena -i inputs/hydro/athinput.linear_wave1d -d ran1 + @echo Results in ran1 -run6: - $(ATHENA) -i athenak/inputs/hydro/sod.athinput -d run6 - # -> Sod.hydro_w.00000.tab - # base=run6/tab/Sod xcol=3 ycol=4 - # base=run6/tab/Sod xcol=3 ycol=5 - # base=run6/tab/Sod xcol=3 ycol=6 +## ran2: example athena++ linear_wave1d needed by some tests - will also build athena++ +ran2: athena + athena/bin/athena -i inputs/hydro/athinput.linear_wave1d -d ran2 output2/file_type=tab + @echo Results in ran2 -run7: - $(ATHENA) -i athenak/inputs/hydro/shu_osher.athinput -d run7 - # THIS IS A KNOWN ERROR +## ran3: example AthenaC linear_wave1d needed by some tests - will also build athenac +ran3: athenac + athenac/bin/athena -i athenac/tst/1D-hydro/athinput.linear_wave1d -d ran3 -run8: - $(ATHENA) -i athenak/inputs/hydro/viscosity.athinput -d run8 - # ViscTest.hydro_w.00000.tab - # base=run8/tab/ViscTest xcol=3 ycol=6 -ran1: athena - (cd athena; bin/athena -i inputs/hydro/athinput.linear_wave1d -d ran1) - @echo Results in athena/ran1 - -ran2: athena - (cd athena; bin/athena -i inputs/hydro/athinput.linear_wave1d -d ran2 output2/file_type=tab) - @echo Results in athena/ran2 +## +test0: + ./z1.sh +## test1: old tkrun via arun1 test1: ./arun1.py athinput.linear_wave1d > test1.sh tkrun test1.sh @@ -153,7 +173,8 @@ test3: test4: python pysimplegui.py -#bash format + +## test5: native pyqt, tkrun style test5: python pyqt.py testfile.sh @@ -169,6 +190,43 @@ test7: test8: python pyqt.py testfile4.csh +## test7: qooey, athena style +test7: + ./gooey_run2.py linear_wave_hydro.athinput + +# will try Qt first, else fall back to tkinter +test8: + ./pysg_run.py athinput.linear_wave1d + +test9: ran2 + ./plot1d.py -d ran2 + +test10: + ./pysg_run.py test.athinput + +test11: + ./pyqt_run.py test.athinput + +# will run the plot when run is clicked +## test12: pyqt native, athena style +test12: + ./pyqt_run.py athinput.linear_wave1d + +## test13: pysg, athena style +test13: athena_problems.json + ./pysg_menu.py + +## test14: pyqt, athena style +test14: athena_problems.json + ./pyqt_menu.py + +## test15: miniki version +test15: + ./pythena.py + +athena_problems.json: + ./write_problems.py + # collaborations agui_t: git clone $(URL5a) agui_t @@ -178,3 +236,10 @@ agui_a: agui_k: git clone $(URL5c) agui_k + +# testing a pyThena from scratch: + +pythena: + rm -rf pyThena + git clone $(URL6) + (cd pyThena; make build_athenak; make run1; make test1) diff --git a/README.md b/README.md index e150435..b98eec4 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,91 @@ -# Testing an Athena* GUI +# Developing an Athena GUI (AGUI) -We show some examples of executing *athena* using a dynamic GUI. In -theory could apply to any of the +This is the development verson of **agui**, not to be confused with +the public version **pyThena** that only works with "*Athena-miniK*" that +was extracted from this code base during the Aug 21-25 week at IAS. + +Here show some examples of executing **athena** using a dynamic GUI. +nIn theory this could apply to any of the [Athena](https://www.athena-astro.app/) family (athena [AC], athena++ [AX], or athenak [AK]). It is easiest to work with **athenak**, since all the problems are compiled into one executable. We cover some examples of athena++ below as well, since at the moment athenak is not -yet public. +yet public. For good historic measure, classic athenaC is also +available. Related and inspired by is NEMO's **tkrun** and **run** frontends, -but we aim to use python based software here. +but we aim to use python based software here. The GUI directive we +are proposing are an updated version of the one that was used in +[tkrun](https://teuben.github.io/nemo/man_html/tkrun.l.html) + +## Quick Start Guide + +This **agui** is a convenience repo that can contain all dependant +repos (athenac, athena, athenak and nemo). First get **agui**: + + git clone https://github.com/teuben/agui + cd agui + +after which any of the components can be built, or pick the one you want to focus on: + + make build_athenac + make build_athena + make build_athenak + make build_nemo + make build_python + +For some systems you may need to install additional software, which are assembled +in the **requirement** files, e.g. + +### for Ubuntu Linux: + + sudo apt install $(grep -v ^# requirements.apt) + +### for Redhat style Linux: + + sudo dnf install $(grep -v ^# requirements.dnf) + +### for a Mac with brew: + + brew install $(grep -v ^# requirements.brew) + +### for python (which should apply to any) + + pip install -r requirements.txt + +How the user sets up python could be covered in a separate document. We do mention +the **build_python** target listed before, which sets up a personal anaconda3 tree +in this directory, but needs an additional + + source anaconda3/python_start.sh + +to be activated in your shell. + + +### Method-1: using pyqt (the preferred method) +Using native Qt is probably our preferred method of using the GUI, viz. -## Example (athenak) + ./pyqt_menu.py + +should show a GUI where to select an athinput file. Everything should guide itself. + +### Method-2: using pysg + +pySimpleGui (pysg) is an alternative method where you can pick the GUI from "qt" or "tkinter", +and actually two more we didn't play with. Here you would start with + + ./pysq_menu.py + +and again, since it's a GUI, things should guide itself. + +## Detailed Example (athenak) Using **athenak** is preferred, as it has *all* problems compiled -into the executable. Some older comments on athena++ can be found below. +into one executable. Examples using **athena++** can be found below. -Again, an example how to compile and run the code +First, an example how to compile and run the code ```bash git clone --recursive https://gitlab.com/theias/hpc/jmstone/athena-parthenon/athenak @@ -28,14 +95,14 @@ Again, an example how to compile and run the code make -j ``` -or if you're lazy, use the Makefile in this directory: +or if you're lazy, use the Makefile in this agui directory: ```bash make build ``` -this takes a bit longer than athena++, -mostly because the kokkos library has to be compiled with). The binary is +this compilation takes a bit longer than athena++, +mostly because the kokkos library has to be compiled first. The binary is now in **athenak/build/src/athena**. ```text @@ -70,7 +137,7 @@ build/src/athena -i inputs/hydro/viscosity.athinput -d run8 ``` -## Example (athena++) using Linear Wave +## Detailed Example (athena++) using Linear Wave First we grab and compile the code for the linear wave problem @@ -90,13 +157,15 @@ After this we can run it bin/athena -i inputs/hydro/athinput.linear_wave1d -d run1 ``` -but the default output from that **athinput** file is the **vtk** data format, which for this demo will +but the default output from that **athinput** file is the **vtk** data format, which for this GUI demo would be too complex to parse. TBD. For now we switch to the ascii table format, viz. ```bash bin/athena -i inputs/hydro/athinput.linear_wave1d -d run2 output2/file_type=tab ``` +which also shows how the GUI will have to deal with command line parameters beyond the -i and -d options. + ### Animations First example is NEMO biased, effectively quickly plotting all **tab** files using tabplot. Noting that the second row @@ -154,45 +223,82 @@ median: 2.50312 0.003125 1 -3.21566e-23 0 0 2.49757e-13 # TKRUN format -Old style V1 (the parameter setting and GUI specifications were separated): +The old style V1 tkrun format separated the parameter setting from the GUI specification: #> RADIO mode=gauss gauss,newton,leibniz -new style V2 will allow us to mix the GUI specifications with +but in the new style V2 will allow us to mix the GUI specifications with the (language dependent) key=val construct that gives it a default value, e.g. -bash/csh: +bash: + + mode=gauss # specify the integration method #> RADIO gauss,newton,leibniz - mode=gauss # specify the integration method #> RADIO gauss,newton,leibniz - set mode = gauss # specify the integration method #> RADIO gauss,newton,leibniz +csh: + + set mode = gauss # specify the integration method #> RADIO gauss,newton,leibniz python: - mode="gauss" # specify the integration method #> RADIO gauss,newton,leibniz + mode="gauss" # specify the integration method #> RADIO gauss,newton,leibniz athinput: - mode = gauss # specify the integration method #> RADIO gauss,newton,leibniz + mode = gauss # specify the integration method #> RADIO gauss,newton,leibniz -but will still leave open the option to build an executionar. +but will still leave open the option to build an executionar. -# Which GUI builder? -We explored gooey and psg (pySimpleGui): +# How to run AGUI - python gooey_run.py linear_wave_hydro.athinput - python gooey_special_run.py linear_wave_hydro.athinput +This is how we envision running **agui**: - python pysg_run.py linear_wave_hydro.athinput - python pysg_special_run.py linear_wave_hydro.athinput +```text + agui [-i athinput] [-x athena] [-s scriptfile] + + -i optional athinput file. If not provided, a filebrowser will let you search for and select one + Default: athinput + -x name (and or location) of the athena executable to use. + Default: athena + -s name of a script file where run commands will be appended to. This can act like a logfile + Default: agui.log +``` + +This will bring up a succession of 3 GUI's: + +1. The (optional) athinput file selector. Here the defaults of all parameters are given + +2. Setting parameters for the run + 1. The "-d" run directory + 2. parameters parsed from the athinput file (with or without the "#> GUI" specifications + + The user can then run the simulation. This should probably detach from this GUI, maybe + bring up a progress bar in a new window, which will then morph into the results browser(s) + as described in the next two steps: +3. History (.hst) file browser. This is a file that as function of simulation time has stored a number + of variables. This GUI will allow you to plot any column vs. any other column using a standard + matplotlib windows embedded in the GUI. This will otherwise be a static plot, as time is one of + the columns in the history table. +3. Results (1D: .tab) browser. This browser is similar to the history file browser, except results + are available for each selected dump time. An animation button will allow you to move through + time, as well as select two variables from the results table. + +This will of course fine for 1D problems, for 2D problems the last GUI ("plot1D") will be a "plot2D" +widget that shows an image with a color-bar instead of a 1D plot. This has not been implemented yet. +Also to be determined is the allowed format? FITS and HDF ? # References 1. athena++ GRMHD code and adaptive mesh refinement (AMR) framework - https://www.athena-astro.app/ 1. pyro: a python hydro code - https://github.com/python-hydro/pyro2 + + +# History + +* summer 2023: UMD students Anh Hoang Cao and Kylie Gong coding pyqt, gooey and pysimplegui examples (test1..9) diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..e427bf9 --- /dev/null +++ b/TODO.md @@ -0,0 +1,83 @@ +# List of issues and todo's + +- python vs. python3 (just a worry if some have no python, but do have python3) + +- better detect what's available (tab, vtk, bin) + - use the -d flag in plot1.py for directory, it should auto-detect *.tab or tab/*.tab [done] + - use vtk reader to grab vtk files (1d and 2d) [no more vtk, we use bin] + - use bin reader (can do AMR, where vtk cannot) - check between + +- for output (run) directory, use basename of the problem set, and then run1, run2, ..... inside of those? + - the startup tool could look inside the problem run directories + - this closes the loop in running and reviewing old runs + +- GUI peculiarities + - when browsing, a cancel does not repopulate with the old entry + - killing parent will not kill the children (could be an advanced option, + because it's nice killing a parent keeps the children alive. + +- option to integrate with a running athena + +- plot1d: bring up multiple plots. issue will be what scaling to use + +- plot2d: allow option of contour with color, or just contour or just color. this would + (like in plot1d) give us option to combine two variables + + + +# Older vis software from athenak + +Awkward to use, but here it is: + + ./plot_tab.py -i tab/LinWave.hydro_w.00000.tab -n 100 -v dens + +and for 2D: + + ./plot_slice.py run2/bin/OrszagTang.mhd_w_bcc.00001.bin dens show --notex + +but this only brings up one plot, no animation. our plot2d should do that + + +# Features + +Stating perhaps the obvious, the different GUIs all have their own issues. Here is the current GUI list + + click_+/- scroll_+/- step<1 run? comments + tkrun (test1) ok not ok - + qtrun (test5) ok ok + gooey (test7) ok ok ? ? + pyqt (test1 ok ok ok ok + pysg-tk (test13) ok not weird not step < 1 not working? + pysg-qt (test13) ok ok ok not + + + +# Python versions + +A recent nuisance is the label_props= and radio_props= arguments to +matplotlib.widgets.RadioButtons(), introduces in matplotlib 3.7.0, but +also with a missing module pyparsing. They can usually be solved by +updating your modules in your python, viz. + + pip install --upgrade matplotlib + +or + + pip install -r requirements.txt + +Here's a summary of older versions of python that gave us trouble. Again, the solution +could we be to just update matplotlib. + + distro: python: mpl: comments + ------------------- ------- ----- -------- + ubuntu 22.04 3.10.12 3.7.2 ok + ubuntu 22.04 3.10.12 3.5.1 unexpected keyword argument 'label_props' + anaconda3 2023.07-2 3.11.4 3.7.1 ok + anaconda3 2023.03-1 3.10.12 No module named 'pyparsing' - broken release? + anaconda3 2022.10 3.9.13 3.5.2 unexpected keyword argument 'label_props' + +where versions can be retrieved as follows: + + python --version + python -c 'import matplotlib as m; print(m.__version__)' + diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..a88289c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.2-dev diff --git a/aparser.py b/aparser.py index 340bb14..a448c38 100644 --- a/aparser.py +++ b/aparser.py @@ -2,18 +2,24 @@ # ^\s*((?:set)\s+)?([^#]+)\s*=([^#]+)(#.*)?#>\s+([^\s]+)(.*=[^\s]*)?(.+)?$ # requires that each line has a #> -def parse_generic(filename): +def parse_generic(filename, silent=False): + with open(filename) as file: + return parse_s(file.readlines(), filename=filename, silent=silent) +def parse_s(lines, filename=None, silent=False): #lines = file.readlines() recognized = ['.sh', '.csh', '.py', '.athinput'] # recognized filetypes - file = open(filename, 'r') data = {} # data from the file info = {} # info about the file (if athinput, then from the comment block usually) - type = '' # the type of the file (sh, csh, etc.) + type = None # the type of the file (sh, csh, etc.) block = '' # keeps track of the current block (athinput files only) + def sprint(s): + if not silent: + print(s) + # check if filename has an extension - m = match('^([^\.]+)(..*)?$', filename) + m = match('^([^\.]+)(..*)?$', filename) if filename else None if m: ext = m.group(2) if m.group(1) == 'athinput': # currently athinput.* is the only prefix file type @@ -21,17 +27,16 @@ def parse_generic(filename): elif ext in recognized: type = ext[1:] # remove the dot else: - print('File type not recognized, trying to determine from file content') + sprint('File type not recognized, trying to determine from file content') - # file.readlines() is only called once (i think) - for line in file.readlines(): + for line in lines: # check for block line m = match('^\s*<(.+)>.*', line) if m: block = m.group(1).strip() + '/' if not type: - print('File type deduced to be athinput') + sprint('File type deduced to be athinput') type = 'athinput' continue @@ -49,7 +54,7 @@ def parse_generic(filename): if not type: # if the set keyword is used, then its a csh file if m.group(1): - print('File type deduced to be csh') + sprint('File type deduced to be csh') type = 'csh' # else still undetermined @@ -62,7 +67,7 @@ def parse_generic(filename): if match('^\'.*\'|\".*\"$', value): # for now, assume that quotes => python, otherwise impossible to deduce python code if not type: - print('File type deduced to be python') + sprint('File type deduced to be python') type = 'python' value = value[1:-1] @@ -85,7 +90,7 @@ def parse_generic(filename): # default to sh if a type was not deduced if not type: - print('Unable to deduce file type from content, defaulting to sh') + sprint('Unable to deduce file type from content, defaulting to sh') type = 'sh' # for athinput files, info should be empty diff --git a/athena_problems.json b/athena_problems.json new file mode 100644 index 0000000..df6073d --- /dev/null +++ b/athena_problems.json @@ -0,0 +1,253 @@ +{ + "athenac": { + "3D driven isothermal hydrodynamical turbulence": "./athenac/apps/athinput.turb", + "Einfeldt's 1-1-2-5 test.": "./athenac/tst/1D-hydro/athinput.einfeldt1125", + "Einfeldt's 1-2-0-3 test.": "./athenac/tst/1D-hydro/athinput.einfeldt1203", + "leveque": "./athenac/tst/1D-hydro/athinput.leveque", + "linear wave convergence": "./athenac/tst/particle/athinput.par_linearwave2d", + "linear wave convergence with 3 level 1 Domains": "./athenac/tst/1D-mhd/athinput.linear_wave1d-3lev1", + "Noh's colliding winds test (uses SHKSET1D problem generator!)": "./athenac/tst/1D-hydro/athinput.noh", + "planar gravitational flow": "./athenac/tst/2D-hydro/athinput.pgflow", + "Mach 3 shock interacting with a sine wave in the density (Example 6)": "./athenac/tst/1D-hydro/athinput.shu-osher", + "LeVeque's slowly moving shock": "./athenac/tst/1D-hydro/athinput.slow-moving-shock", + "Sod's shock tube": "./athenac/tst/3D-hydro/athinput.sod", + "LW variant on Sod's shock tube, adds a jump in transverse velocity": "./athenac/tst/1D-hydro/athinput.sod-lw", + "Toro's variant on Sod's shock tube, adds a sonic point in rarefaction": "./athenac/tst/1D-hydro/athinput.sod-toro", + "Two Interacting Blast Waves": "./athenac/tst/1D-hydro/athinput.twoibw", + "Brio & Wu shock tube": "./athenac/tst/2D-sr-mhd/athinput.brio-wu", + "Circularly Polarized Alfven Waves": "./athenac/tst/1D-mhd/athinput.cpaw1d", + "C-shock test": "./athenac/tst/1D-mhd/athinput.cshock1d", + "Riemann problem from Figure 1a of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj1a", + "Riemann problem from Figure 1b of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj1b", + "Riemann problem from Figure 2a of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj2a", + "Riemann problem from Figure 2b of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj2b", + "Riemann problem from Figure 3a of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj3a", + "Riemann problem from Figure 3b of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj3b", + "Riemann problem from Figure 4a of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj4a", + "Riemann problem from Figure 4b of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj4b", + "Riemann problem from Figure 4c of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj4c", + "Riemann problem from Figure 4d of Ryu & Jones (1995)": "./athenac/tst/1D-mhd/athinput.rj4d", + "Torrihlon shock tube": "./athenac/tst/1D-mhd/athinput.torrilhon", + "SR hydro shocktube problem 1": "./athenac/tst/1D-sr-hydro/athinput.mb4", + "SR hydro shocktube problem 2": "./athenac/tst/1D-sr-hydro/athinput.mb2", + "SR hydro shocktube problem 3": "./athenac/tst/1D-sr-hydro/athinput.mb3", + "Fast Shock 1": "./athenac/tst/1D-sr-mhd/athinput.FastShk1", + "Fast Shock 2": "./athenac/tst/1D-sr-mhd/athinput.FastShk2", + "Fast Shock 3": "./athenac/tst/1D-sr-mhd/athinput.FastShk3", + "SR mhd shocktube 1 from MUB (Brio & Wu)": "./athenac/tst/1D-sr-mhd/athinput.mub1", + "SR mhd shocktube 2 from MUB (Brio & Wu)": "./athenac/tst/1D-sr-mhd/athinput.mub2", + "SR mhd shocktube 3 from MUB (Brio & Wu)": "./athenac/tst/1D-sr-mhd/athinput.mub3", + "SR mhd shocktube 4 from MUB (Brio & Wu)": "./athenac/tst/1D-sr-mhd/athinput.mub4", + "SR mhd isolated contact wave from MUB (Brio & Wu)": "./athenac/tst/1D-sr-mhd/athinput.mubcontact", + "SR mhd isolated rotational wave from MUB (Brio & Wu)": "./athenac/tst/1D-sr-mhd/athinput.mubrot", + "Slow Shock": "./athenac/tst/1D-sr-mhd/athinput.SlowShock", + "Switch Off Fast Rarefaction": "./athenac/tst/1D-sr-mhd/athinput.SWoffFRF", + "Switch On Fast Rarefaction": "./athenac/tst/1D-sr-mhd/athinput.SWonSRF", + "Blast wave": "./athenac/tst/3D-sr-mhd/athinput.blast", + "carbuncle test": "./athenac/tst/3D-hydro/athinput.carbuncle", + "double Mach reflection": "./athenac/tst/2D-hydro/athinput.dmr", + "jeans problem (standing wave; stable or unstable)": "./athenac/tst/2D-hydro/athinput.jeans", + "KH instability of slip surface": "./athenac/tst/2D-hydro/athinput.kh", + "2D implosion from Liska & Wendroff": "./athenac/tst/2D-hydro/athinput.lw_implode", + "non-linear non-axisymmetric shearing wave test": "./athenac/tst/3D-hydro/athinput.nl-shwave", + "Noh's strong shock test in 2D": "./athenac/tst/2D-hydro/athinput.noh", + "RT instability": "./athenac/tst/2D-hydro/athinput.rt", + "shock cloud interaction": "./athenac/tst/3D-hydro/athinput.shk_cloud", + "blast_B1": "./athenac/tst/2D-mhd/athinput.blast_B1", + "blast_B10": "./athenac/tst/3D-mhd/athinput.blast_B10", + "2D Circularly Polarized Alfven Wave": "./athenac/tst/2D-mhd/athinput.cpaw2d", + "field loop advection test": "./athenac/tst/3D-mhd/athinput.field_loop4", + "hall_drift": "./athenac/tst/2D-mhd/athinput.hall_drift", + "2D MRI": "./athenac/tst/2D-mhd/athinput.hb3", + "MHD KH instability": "./athenac/tst/2D-mhd/athinput.kh", + "Orszag-Tang vortex": "./athenac/tst/2D-mhd/athinput.orszag-tang", + "Riemann problem from Figure 2a of Ryu & Jones (1995) in 2D": "./athenac/tst/2D-mhd/athinput.rj2a", + "First rotor test": "./athenac/tst/2D-mhd/athinput.rotor", + "MHD RT instability": "./athenac/tst/3D-mhd/athinput.rt", + "Temperature conduction test": "./athenac/tst/3D-mhd/athinput.Tconduct", + "SR hydro jet": "./athenac/tst/3D-sr-hydro/athinput.jet", + "current-sheet": "./athenac/tst/2D-sr-mhd/athinput.current-sheet", + "SR MHD jet": "./athenac/tst/3D-sr-mhd/athinput.jet", + "FFT test for SMR and MPI": "./athenac/tst/3D-hydro/athinput.fft_test", + "nonlinear density wave test": "./athenac/tst/3D-hydro/athinput.fp-wave", + "Noh's strong shock test in 3D": "./athenac/tst/3D-hydro/athinput.noh", + "planar gravitational flow, runs 2D problem in 3D": "./athenac/tst/3D-hydro/athinput.pgflow", + "3D shearing wave test": "./athenac/tst/3D-hydro/athinput.shwave", + "Thermal Instability Test": "./athenac/tst/3D-hydro/athinput.ti_test", + "3D Circularly Polarized Alfven Wave": "./athenac/tst/3D-mhd/athinput.cpaw3d", + "3D MRI": "./athenac/tst/3D-mhd/athinput.hgb", + "MSA test for 3D using Jeans' swindle": "./athenac/tst/3D-mhd/athinput.msa", + "Riemann problem from Figure 2a of Ryu & Jones (1995) in 3D": "./athenac/tst/3D-mhd/athinput.rj2a", + "Stratified 3D MRI with zero-net vertical flux": "./athenac/tst/3D-mhd/athinput.strat", + "Advection (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cyladvect-3D", + "Hydrodynamic blast wave (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cylblast_B0-3D", + "cylblast_B10-2D": "./athenac/tst/cylindrical/athinput.cylblast_B10-2D", + "cylblast_B10-3D": "./athenac/tst/cylindrical/athinput.cylblast_B10-3D", + "cylblast_B1-2D": "./athenac/tst/cylindrical/athinput.cylblast_B1-2D", + "cylblast_B1-3D": "./athenac/tst/cylindrical/athinput.cylblast_B1-3D", + "Force balance tests, B_phi only (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cylbphi-3D", + "Force balance tests, B_R only (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cylbr-3D", + "diffusion (CYLINDRICAL); integrator must be turned off!": "./athenac/tst/cylindrical/athinput.cyldiff", + "Field Loop Advection (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cylfieldloop-3D", + "Global Newtonian Disk (Unstratified, global, cylindrical)": "./athenac/tst/cylindrical/athinput.cylnewtmri", + "Rayleigh instability test (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cylrayleigh-3D", + "Global spiral arms test (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cylspiral-2D", + "Axisymmetric hydrodynamic wind, no rotation (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cylwind-3D", + "Axisymmetric rotating hydrodynamic wind (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cylwindrot-3D", + "Axisymmetric rotating MHD wind (CYLINDRICAL)": "./athenac/tst/cylindrical/athinput.cylwindrotb-3D", + "HK Accretion Disk, cylindrical coords": "./athenac/tst/cylindrical/athinput.hkdisk-3D", + "particle code test: circular flow": "./athenac/tst/particle/athinput.par_circ", + "particle-gas \"collision\" test": "./athenac/tst/particle/athinput.par_collision", + "particle code test: epicyclic motion": "./athenac/tst/particle/athinput.par_epicycle", + "particle code test: friction test": "./athenac/tst/particle/athinput.par_friction", + "shear wave test with particles": "./athenac/tst/particle/athinput.par_shwave1d", + "shear wave with particles": "./athenac/tst/particle/athinput.par_shwave2d", + "Streaming instability in non-stratified disks": "./athenac/tst/particle/athinput.streaming3d_single" + }, + "athena": { + "cosmic ray diffusion": "./athena/inputs/cosmic_ray/athinput.cr_diffusion", + "poisson's solver test": "./athena/inputs/hydro/athinput.poisson", + "spherical blast wave": "./athena/inputs/hydro/athinput.blast", + "spherical blast wave in cylindrical coordinates": "./athena/inputs/hydro/athinput.blast_cyl", + "spherical blast wave in spherical coordinates": "./athena/inputs/hydro/athinput.blast_sph", + "Protostellar collapse": "./athena/inputs/mhd/athinput.collapse", + "Keplerian disk in cylindrical coordinates": "./athena/inputs/hydro/athinput.disk_cyl", + "Keplerian disk in spherical polar coordinates": "./athena/inputs/hydro/athinput.disk_sph", + "double Mach reflection": "./athena/inputs/hydro/athinput.dmr_amr", + "Einfeldt's 1-1-2-5 test": "./athena/inputs/hydro/athinput.einfeldt1125", + "Einfeldt's 1-2-0-3 test": "./athena/inputs/hydro/athinput.einfeldt1203", + "Testing and debugging the compiled EOS to ensure correct behavior.": "./athena/inputs/hydro/athinput.eos_test", + "FFT test and timing": "./athena/inputs/hydro/athinput.fft", + "Jeans test": "./athena/inputs/hydro/athinput.jeans_3d", + "underdense Mach10 jet": "./athena/inputs/hydro/athinput.jet", + "Kelvin-Helmholtz instability": "./athena/inputs/mhd/athinput.kh-shear-lecoanet", + "1D Hydro linear wave convergence": "./athena/inputs/hydro/athinput.linear_wave1d", + "2D Hydro linear wave convergence": "./athena/inputs/hydro/athinput.linear_wave2d", + "3D Hydro linear wave convergence": "./athena/inputs/hydro/athinput.linear_wave3d", + "2D implosion from Liska & Wendroff": "./athena/inputs/hydro/athinput.lw_implode", + "1D passive scalar advection of Gaussian profile along the meridional coordinate": "./athena/inputs/hydro/athinput.mignone_meridional", + "1D passive scalar advection of Gaussian profile along the radial coordinate": "./athena/inputs/hydro/athinput.mignone_radial", + "Noh's strong shock test in 2D": "./athena/inputs/hydro/athinput.noh2d", + "Quirk's Carbuncle test": "./athena/inputs/hydro/athinput.quirk", + "Rayleigh-Taylor instability": "./athena/inputs/hydro/athinput.rt3d", + "scalar diffusion": "./athena/inputs/hydro/athinput.scalar_diff", + "shock cloud interaction": "./athena/inputs/hydro/athinput.shk_cloud", + "Mach 3 shock interacting with a sine wave in the density (Example 6)": "./athena/inputs/hydro/athinput.shu_osher", + "advection of a 2D slotted cylinder passive scalar profile": "./athena/inputs/hydro/athinput.slotted_cylinder2d", + "advection of a 2D slotted cylinder passive scalar profile (with SMR or AMR)": "./athena/inputs/hydro/athinput.slotted_cylinder2d_refined", + "Slow moving shock causes post-shock oscillations": "./athena/inputs/hydro/athinput.slow_shock", + "Sod's shock tube": "./athena/inputs/hydro/athinput.sod", + "A Sod-like shock tube for testing general EOS; initialize temp not pres": "./athena/inputs/mhd/athinput.sod_general_H", + "HD shwave test": "./athena/inputs/hydro/athinput.ssheet", + "Turbulence with power-law PS": "./athena/inputs/hydro/athinput.turb", + "Two Interacting Blast Waves": "./athena/inputs/hydro/athinput.twoibw", + "viscous diffusion": "./athena/inputs/hydro/athinput.visc", + "GR hydro accretion in radial direction": "./athena/inputs/hydro_gr/athinput.bondi", + "Geodesic infall (Hydro only)": "./athena/inputs/hydro_gr/athinput.geodesic", + "1D linear wave": "./athena/inputs/mhd_sr/athinput.linear_wave", + "SR hydro shocktube problem 1": "./athena/inputs/hydro_sr/athinput.mb_1", + "SR hydro shocktube problem 2": "./athena/inputs/hydro_sr/athinput.mb_2", + "SR hydro shocktube problem 3": "./athena/inputs/hydro_sr/athinput.mb_3", + "SR hydro shocktube problem 4": "./athena/inputs/hydro_sr/athinput.mb_4", + "spherical MHD blast wave": "./athena/inputs/mhd/athinput.blast", + "spherical MHD blast wave in cylindrical coordinates": "./athena/inputs/mhd/athinput.blast_cyl", + "spherical MHD blast wave in spherical coordinates": "./athena/inputs/mhd/athinput.blast_sph", + "Brio & Wu shock tube": "./athena/inputs/mhd/athinput.bw", + "2D Circularly Polarized Alfven Wave": "./athena/inputs/mhd/athinput.cpaw2d", + "field loop advection test": "./athena/inputs/mhd/athinput.field_loop", + "field loop advection test through poles in spherical polar coords": "./athena/inputs/mhd/athinput.field_loop_poles", + "preexisting array": "./athena/inputs/mhd/athinput.from_array", + "2D MRI": "./athena/inputs/mhd/athinput.hb3", + "3D MRI test": "./athena/inputs/mhd/athinput.hgb", + "MHD shwave test": "./athena/inputs/mhd/athinput.jgg", + "1D MHD linear wave convergence": "./athena/inputs/mhd/athinput.linear_wave1d", + "2D MHD linear wave convergence": "./athena/inputs/mhd/athinput.linear_wave2d", + "2D MHD linear wave convergence with AMR": "./athena/inputs/mhd/athinput.linear_wave2d_amr", + "3D MHD linear wave convergence": "./athena/inputs/mhd/athinput.linear_wave3d", + "3D MHD linear wave convergence with AMR": "./athena/inputs/mhd/athinput.linear_wave3d_amr", + "Z-pinch; Magnetized Noh with axial and azimuthal field": "./athena/inputs/mhd/athinput.magnoh3", + "Orszag-Tang vortex": "./athena/inputs/mhd/athinput.orszag-tang", + "resistive diffusion": "./athena/inputs/mhd/athinput.resist", + "Riemann problem from Figure 2a of Ryu & Jones (1995)": "./athena/inputs/mhd/athinput.rj2a", + "MHD Rotor": "./athena/inputs/mhd/athinput.rotor", + "Stratified 3D MRI with zero-net vertical flux": "./athena/inputs/mhd/athinput.strat", + "Test outputs based on Orszag-Tang vortex": "./athena/inputs/mhd/athinput.test_outputs", + "GR MHD spherical blast wave": "./athena/inputs/mhd_gr/athinput.blast", + "Fishbone-Moncrief equilibrium torus": "./athena/inputs/mhd_gr/athinput.fm_torus", + "magnetized_inflow": "./athena/inputs/mhd_gr/athinput.magnetized_inflow", + "SR MHD shocktube problem 1": "./athena/inputs/mhd_sr/athinput.mub_1", + "SR MHD shocktube problem 2": "./athena/inputs/mhd_sr/athinput.mub_2", + "SR MHD shocktube problem 3": "./athena/inputs/mhd_sr/athinput.mub_3", + "SR MHD shocktube problem 4": "./athena/inputs/mhd_sr/athinput.mub_4", + "Radiation linear wave test": "./athena/inputs/radiation/athinput.rad_linearwave_amr", + "Radiation thermal relaxation with multi-group": "./athena/inputs/radiation/athinput.thermal_multigroup", + "Radiation thermal relaxation test": "./athena/inputs/radiation/athinput.thermal_relaxation" + }, + "athenak": { + "gr_fm_torus_sane_uniform": "./athenak/inputs/grhydro/gr_fm_torus_sane_uniform.athinput", + "blast_grmhd_amr": "./athenak/inputs/grmhd/blast_grmhd_amr.athinput", + "gr_chakrabarti_torus_sane_8_4": "./athenak/inputs/grmhd/gr_chakrabarti_torus_sane_8_4.athinput", + "gr_fm_torus_mad_8_4": "./athenak/inputs/grmhd/gr_fm_torus_mad_8_4.athinput", + "gr_fm_torus_sane_8_4": "./athenak/inputs/grmhd/gr_fm_torus_sane_8_4.athinput", + "mub1-gr": "./athenak/inputs/grmhd/mub1-gr.athinput", + "blast_hydro_amr": "./athenak/inputs/hydro/blast_hydro_amr.athinput", + "blast_hydro": "./athenak/inputs/hydro/blast_hydro.athinput", + "kh2d-lecoanet": "./athenak/inputs/hydro/kh2d-lecoanet.athinput", + "lw_implode": "./athenak/inputs/hydro/lw_implode.athinput", + "rt2d": "./athenak/inputs/hydro/rt2d.athinput", + "shock_cloud": "./athenak/inputs/hydro/shock_cloud.athinput", + "shu_osher": "./athenak/inputs/hydro/shu_osher.athinput", + "slotted_cyl": "./athenak/inputs/hydro/slotted_cyl.athinput", + "sod": "./athenak/inputs/hydro/sod.athinput", + "turb": "./athenak/inputs/hydro/turb.athinput", + "viscosity": "./athenak/inputs/hydro/viscosity.athinput", + "blast_2fluid_amr": "./athenak/inputs/ion-neutral/blast_2fluid_amr.athinput", + "blast_2fluid": "./athenak/inputs/ion-neutral/blast_2fluid.athinput", + "blast_mhd_amr": "./athenak/inputs/mhd/blast_mhd_amr.athinput", + "blast_mhd": "./athenak/inputs/mhd/blast_mhd.athinput", + "bw": "./athenak/inputs/mhd/bw.athinput", + "current_sheet": "./athenak/inputs/mhd/current_sheet.athinput", + "kh2d-lecoanet-mhd": "./athenak/inputs/mhd/kh2d-lecoanet-mhd.athinput", + "mri2d": "./athenak/inputs/mhd/mri2d.athinput", + "orszag_tang": "./athenak/inputs/mhd/orszag_tang.athinput", + "resistivity": "./athenak/inputs/mhd/resistivity.athinput", + "rt2d-mhd": "./athenak/inputs/mhd/rt2d-mhd.athinput", + "beam": "./athenak/inputs/radiation/beam.athinput", + "bh_beam": "./athenak/inputs/radiation/bh_beam.athinput", + "hohlraum_2d": "./athenak/inputs/radiation/hohlraum_2d.athinput", + "rad_diffusion": "./athenak/inputs/radiation/rad_diffusion.athinput", + "rad_fm_sane_8_4": "./athenak/inputs/radiation/rad_fm_sane_8_4.athinput", + "relax": "./athenak/inputs/radiation/relax.athinput", + "shadow": "./athenak/inputs/radiation/shadow.athinput", + "snake": "./athenak/inputs/radiation/snake.athinput", + "blast_srhyd": "./athenak/inputs/srhydro/blast_srhyd.athinput", + "kh_srhyd1": "./athenak/inputs/srhydro/kh_srhyd1.athinput", + "mb1": "./athenak/inputs/srhydro/mb1.athinput", + "mb2": "./athenak/inputs/srhydro/mb2.athinput", + "mb3": "./athenak/inputs/srhydro/mb3.athinput", + "mb4": "./athenak/inputs/srhydro/mb4.athinput", + "blast_srmhd": "./athenak/inputs/srmhd/blast_srmhd.athinput", + "mub1": "./athenak/inputs/srmhd/mub1.athinput", + "mub2": "./athenak/inputs/srmhd/mub2.athinput", + "mub3": "./athenak/inputs/srmhd/mub3.athinput", + "mub4": "./athenak/inputs/srmhd/mub4.athinput", + "advect_hyd": "./athenak/inputs/tests/advect_hyd.athinput", + "advect_mhd": "./athenak/inputs/tests/advect_mhd.athinput", + "bondi": "./athenak/inputs/tests/bondi.athinput", + "cpaw3d": "./athenak/inputs/tests/cpaw3d.athinput", + "cpaw3d_smr": "./athenak/inputs/tests/cpaw3d_smr.athinput", + "hohlraum_1d": "./athenak/inputs/tests/hohlraum_1d.athinput", + "linear_wave_hydro_amr": "./athenak/inputs/tests/linear_wave_hydro_amr.athinput", + "linear_wave_hydro": "./athenak/inputs/tests/linear_wave_hydro.athinput", + "linear_wave_hydro_smr": "./athenak/inputs/tests/linear_wave_hydro_smr.athinput", + "linear_wave_mhd_amr": "./athenak/inputs/tests/linear_wave_mhd_amr.athinput", + "linear_wave_mhd": "./athenak/inputs/tests/linear_wave_mhd.athinput", + "linear_wave_mhd_smr": "./athenak/inputs/tests/linear_wave_mhd_smr.athinput", + "linear_wave_z4c": "./athenak/inputs/tests/linear_wave_z4c.athinput", + "monopole": "./athenak/inputs/tests/monopole.athinput", + "rad_linwave": "./athenak/inputs/tests/rad_linwave.athinput", + "tetrad": "./athenak/inputs/tests/tetrad.athinput", + "z4c_onepuncture": "./athenak/inputs/z4c/onepuncture/z4c_onepuncture.athinput", + "z4c_twopuncture": "./athenak/inputs/z4c/twopuncture/z4c_twopuncture.athinput" + } +} \ No newline at end of file diff --git a/example4.py b/example4.py index 4c2eef0..ab4cb42 100755 --- a/example4.py +++ b/example4.py @@ -1,26 +1,30 @@ #! /usr/bin/env python # -# new 2023 style python +# new 2023 style python -file1 = 'foo' # help for input file1 #> IFILE file1= -file2 = 'bar' # help for output file2 #> OFILE file2= -dir3 = 'fum' # help for input dir3 #> IDIR dir3= -dir4 = 'baz' # help for output dir4 #> ODIR dir4= -hello = 'world' # help for text entry hello #> ENTRY hello=world -a = 1 # help for a, between 0 and 2 #> SCALE a=1 0:2:0.1 -b = '2' # help for b, pick 1, 2 or 3 #> RADIO b=2 0,1,2 -c = '3,c' # help for c, check any of 6 #> CHECK c=3 1,2,3,a,b,c - -# import sys + +file1 = "foo" # help for input file1 #> IFILE +file2 = "bar" # help for output file2 #> OFILE +dir3 = "fum" # help for input dir3 #> IDIR +dir4 = "baz" # help for output dir4 #> ODIR +hello = "world" # help for text entry hello #> ENTRY +a = "1" # help for a, between 0 and 2 #> SCALE 0:2:0.1 +b = "2" # help for b, pick 1, 2 or 3 #> RADIO 0,1,2 +c = "3,c" # help for c, check any of 6 #> CHECK 0,1,2,a,b,c + +# parse the key=val command line for _arg in sys.argv[1:]: - exec(_arg) + ie = _arg.find('=') + cmd = '%s="%s"' % (_arg[:ie],_arg[ie+1:]) + exec(cmd) -print('file1=',file1) -print('file2=',file2) -print('dir3=',dir3) -print('dir4=',dir4) -print('hello=',hello) -print('a=',a) -print('b=',b) -print('c=',c) +# print keyword vaues +print('file1',file1) +print('file2',file2) +print('dir3', dir3) +print('dir4', dir4) +print('hello',hello) +print('a', a) +print('b', b) +print('c', c) diff --git a/formats.txt b/formats.txt index ca0054f..223e3f0 100644 --- a/formats.txt +++ b/formats.txt @@ -9,14 +9,14 @@ set rmax = 1 #> SCALE rmax=1 0:2:0.1 set vscale = 0.9 #> SCALE vscale=0.9 -2:2:0.1 set outflow = 0.4 #> SCALE outflow=0.4 0:2:0.1 -# new CSH +# new CSH (but without optional help) set nbody = 10000 #> SCALE 1000:1000000:1000 set rmin = 0.3 #> SCALE 0:1:0.1 set rmax = 1 #> SCALE 0:2:0.1 set vscale = 0.9 #> SCALE -2:2:0.1 set outflow = 0.4 #> SCALE 0:2:0.1 -# new SH +# new SH (but without optional help) nbody=10000 #> SCALE 1000:1000000:1000 rmin=0.3 #> SCALE 0:1:0.1 rmax=1 #> SCALE 0:2:0.1 @@ -24,7 +24,7 @@ set outflow = 0.4 #> SCALE 0:2:0.1 outflow=0.4 #> SCALE 0:2:0.1 file=foobar -# new python +# new python (without optional help) nbody=10000 #> SCALE 1000:1000000:1000 rmin=0.3 #> SCALE 0:1:0.1 @@ -33,3 +33,17 @@ outflow=0.4 #> SCALE 0:2:0.1 outflow=0.4 #> SCALE 0:2:0.1 file="foobar" #> IFILE +# extended (new) format + +This is the proposed new format that should fit (c)sh, python and athinput. athinput is special, since the +'s in the athinput file gets translated to block/key=val for the commandline. + +The help goes between the defaults for key=val and the '#>' GUI directive. + +# +nx1=64 # Number of zones in X1-direction #> SCALE 16:512:16 +nx2=32 # Number of zones in X2-direction #> RADIO 1,16,32,64,128,256 +nx3=32 # Number of zones in X3-direction #> RADIO 1,16,32,64,128,256 +