PrincetonUniversity / athena

Athena++ radiation GRMHD code and adaptive mesh refinement (AMR) framework
https://www.athena-astro.app
BSD 3-Clause "New" or "Revised" License
226 stars 122 forks source link

Setting initial conditions in restart files #615

Closed liangwang0734 closed 1 month ago

liangwang0734 commented 1 month ago

Hi Athena++ community, how I can set the state variable values in a restart file using an external data source (with B field also on Yee mesh)?

msbc commented 1 month ago

What you want to do here is to make sure to dump out data in double precision (-h5double) and dump both the conservative variables (cons) and face centered B-fields (b). Then you basically just use the code from https://github.com/PrincetonUniversity/athena/blob/master/src/pgen/from_array.cpp in your pgen to read those hdf5 files and set the corresponding mesh block data.

liangwang0734 commented 1 month ago

Thank you @msbc , I will try that.

msbc commented 1 month ago

@liangwang0734 I just realized that I forgot to mention that the -h5double flag is a configuration time option, so you'll have to recompile your athena executable.