CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Overwriting files with PyFluent/TUI commands (https://www.cfd-online.com/Forums/fluent/250637-overwriting-files-pyfluent-tui-commands.html)

dgnidovec July 1, 2023 03:25

Overwriting files with PyFluent/TUI commands
 
Hello everybody!

I am dealing with multi-scale-modelling as a project for my master thesis. I already have a fluent journal file scripts written and then running these scripts though terminal with python. Since the nature of the modelling is such that there is a lot of iterating through the same case (same .cas file), the method with running the journal file code provided below sequentially is kind of slow:
```
pwd
/file/confirm-overwrite yes
/file/read-case TransientUDF.cas.h5
/file/read-data transient_state_5.dat.h5
/solve/set/time-step 0.02
/solve/dual-time-iterate 1 150
no # answers no to the question "Create new file?"
yes # answers yes to the question "Confirm overwrite?"
/file/write-data "transient_state_6.dat.h5"
yes
/exit ok

```
In order to make my model faster, I discovered pyansys package, more exactly ansys.fluent.core. I managed to convert basically the whole journal file in your function calls, except, I really can’t find how to deal with overwriting output files. By default, it creates new file if there already exists one, but I want my files to be overwritten. In journal file I simply input “no” or “yes” statements as the answer to the prompts that are raised in fluent. I tried pyfluent journaling in order to store python commands of my TUI input, but it stored everything, but answers to prompts raised... Therefore I still don't know how to tell fluent with ansys.fluent.core to overwrite existing files when executing the "solve" command.

Sicne the nature of using ansys.fluent.core python package is quite similar to writing TUI commands, there migght be someone that knows how to deal with overwriting files in the other way than just answering "no" and "yes".

I kindly ask for your feedback; it would help a lot in the progress of my master thesis! Thanks in advance.

Best regards


All times are GMT -4. The time now is 08:30.