Piping a .cfg into SU2 | Hot-Swapping .cfg option in general #1165
Unanswered
TobiKattmann
asked this question in
Q&A
Replies: 1 comment
-
You can use the FADO framework for that kind of parametric sweep, I do it as part of my optimization all the time. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I want to add a config option to an existing .cfg file and pipe that into SU2 without explicitly creating the concatenated file. So the naive approach would be (with Quickstart):
cat inv_NACA0012.cfg <(echo "SCREEN_WRT_FREQ_INNER= 10") | SU2_CFD
The cat part does its job. The follwoing also works as intended:
cat inv_NACA0012.cfg <(echo "SCREEN_WRT_FREQ_INNER= 10") | grep SCREEN
that is, finding the append option without permanently adding it to
inv_NACA0012.cfg
.I guess that is currently not possible as SU2 only reads the filename from stdin and not the file content. If we were to
SU2_CFD < inv_NACA0012.cfg
then the above shown method would prob work.Now one could create a temporary file and delete later like so:
cat inv_NACA0012.cfg <(echo "SCREEN_WRT_FREQ_INNER= 10") > tmp.cfg && SU2_CFD tmp.cfg && rm tmp.cfg
which does the job but is not exactly pretty.
Is there another easy elegant way to do so?
Another thing is Hot-Swapping 🔥 options using e.g. sed (e.g
SCREEN_WRT_FREQ_INNER=10
added to Quickstart prior to this command):sed "s/SCREEN_WRT_FREQ_INNER.*/SCREEN_WRT_FREQ_INNER= 20/g" inv_NACA0012.cfg
and then piping the whole thing to SU2. So instead adding options changing them in-place. Again without creating a new file.
Why
Testing different values for config options is s.th. that we all do regularly and often enough one creates a new folder for each change because I want to compare results, right... and then foldernames happen:
test
->test_ROE
test_JST
->test_ROE_CFL5
test_ROE_CFL15
test_ROE_CFL50
->test_ROE_CFL15_noLimiter
->test_ROE_CFL15_noLimiter_SA
... you know the drill (I hope so at least). All these changes are incremental (1 option at a time because you want to know when things blow up... or work for the first time 😄 ).Here it would be awesome to just create an
addtions.cfg
orchanges.cfg
(for hot-swapping) and call that with the original cfg with the above desired logic. The original file could be symlinked still in the folder in question. I checked countless time in these kind of situations using diff/meld what I changed and if I changed maybe more than the folder-title suggests... Because I know me ... and past-me can't be trusted.Now one can surely write chunky python stuff but I am sure there is a lightweight solution in bash making use of all those juicy command line tools and techniques.
I hope my rough goal is understandable and feel free to hit me with different solutions for this "incremental-option-change" problem.
Beta Was this translation helpful? Give feedback.
All reactions