danieljprice / phantom

Phantom Smoothed Particle Hydrodynamics and Magnetohydrodynamics code
https://phantomsph.github.io
Other
94 stars 223 forks source link

Disabling writing files for use of Phantom as a library #499

Open rieder opened 6 months ago

rieder commented 6 months ago

I am reworking the AMUSE interface to Phantom, since Phantom has progressed since I wrote it initially.

The main change I need to make to Phantom for use with AMUSE is a way to prevent Phantom from writing any files (evfile, dumps, logs...). We would basically use it as a library, and any i/o would be handled through AMUSE. Output to screen is still fine.

Would it be ok to introduce a "dont_write_files" logical of some kind, e.g. in the options module, which is then checked wherever a file would be written?

The main difficulties without this are in functions/subroutines that don't just write files, but that also calculate things that are required later on. I would have to write largely-identical functions without the i/o part, which would be hard to maintain.

danieljprice commented 6 months ago

we should really merge the AMUSE interface stuff into phantom, it's been hanging there for a while... an option in the options module sounds fine in principle, it should not appear in the phantom .in file though, just set to .true. if called via the library and .false. otherwise.

If you can send a pull request that is updated to the latest code I'd be happy to give a code review