I am using a scriptable Fortran-based aerodynamic analysis software called AVL (Athena Vortex Lattice) that accepts text file inputs and writes text file outputs. You can run AVL using the system function like so with a text file listing all commands sequentially:
system('avl.exe < input.txt');
When run using the system function, AVL closes once it reaches the end of the input file, whether commanded to or not. To close AVL, you would type "QUIT" from the base menu (for scripting, put QUIT at the end of your input text file). However, when run using the system function, even if "QUIT" is ommitted, AVL will quit anyway once the end of the input file is reached due to the following error (returned by the system function):
At line 145 of file ../src/userio.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
I would like to keep AVL open and continue to feed it new input files because this is significantly faster for sequential runs. There is some first time set up AVL must do when opening that does not need to be repeated for subsequent runs. This can be done easily if running AVL by hand by simply continuing to type commands into the command line instead of closing and reopening AVL for each case.
Unfortunately, I cannot figure out how to emulate this behavior with the system function. The ideal behavior I'm seeking is to be able send new lists of commands to AVL by keeping it open indefinitely through the system function, instead of each call to the system function being a self-contained, where AVL is opened, run, and closed.
Is there any way to achieve this behavior with external scriptable programs like AVL?