Skip to content
Snippets Groups Projects

Star Formation History logger

Merged Folkert Nobels requested to merge SFH_logger into master

Logger that logs the complete star formation of the simulation in a txt file.

Edited by Matthieu Schaller

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Folkert Nobels added 1 commit

    added 1 commit

    • 54821488 - Comment a few lines of empty functions

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    • 01cba001 - Add the star formation logger to the rebuilt part

    Compare with previous version

  • reopened

  • Folkert Nobels added 1 commit

    added 1 commit

    Compare with previous version

  • Folkert Nobels added 65 commits

    added 65 commits

    • ba12b11b...a0f68fd8 - 12 commits from branch master
    • 8fd28af4 - Add star formation logger function file to EAGLE star formation
    • 48636d70 - Add root file for star formation logger
    • 4b52c369 - Add the star formation logger file for none star formation and update the root…
    • 93679458 - Update cell.h
    • 3d1b3d4f - Update the star formation none
    • 342ff543 - First addition to the engine for logger
    • a0d14a75 - Add SFH logger to the runner.c
    • 2434200b - Fix compiler errors by including correct header files
    • fd27787b - Add SFH to the engine logger/printer
    • e0d51913 - Change the initialization of the engine collect end of step
    • da36ce65 - Add a comment to the a logger function
    • ce3ce61b - Work on the get star formation in cell and start initializing stuff in…
    • d6a9d0d7 - Finish the first draft of the star formation logger in the engine_collect_end_of_step_recurse
    • d2d944e5 - Finish first draft of the engine_collect_end_of_step_mapper and add a new…
    • 638623a6 - Remove the cosmo dependence from one function
    • 7ec55799 - Remove two syntax errors
    • 70c32722 - Add star_formation_history struct to collectgroup1 struct
    • 6c4fa73f - Add SFH to the collect group and break the code
    • 69bd0097 - Removing the compilation error and rewrite the star_formation_logger.h with inclusions
    • 332dc827 - First cleanup of the star_formation_logger.h
    • 51b89747 - Change the arguments in a function in the runner and remove a dublicate function…
    • 05a42129 - Remove unnecessary parameters from the initialization
    • 8b44a8c1 - Remove the time from the SFH logger struct because that can be determined after…
    • 4897511f - Remove unnecessary arguments from the starformation_update_SFH
    • ba006f51 - Rename starformation to star_formation in several functions
    • 6222e1ff - Literly print the SFH logger file for the moment, break the code that it no…
    • ef6b264c - Add seperate logger_struct file to prevent cyclic inclusion and rewrite the…
    • db0a9d6b - Add end of line to print statement
    • 00ef8e13 - Add more docmentation to the SFH_logger functions
    • fd4e66a2 - Update the SFH writer to write the values to a file
    • 8c9b243e - Add more documentation, start of fixing star formation none and add initialize file sfh.txt
    • e0d30a08 - Update the star formation logger number of stars part
    • 63d01270 - Add GEAR definition to the logger and logger struct root files
    • d4c0cd66 - Update the EAGLE star formation logger
    • 563a1e4a - Code formattting
    • b52e7121 - Small change to the logger
    • fc3cc1b7 - Give the same precission to the star formation logger as in the snapshots in time
    • 5af10722 - Add the SFR tracer information in the logger file
    • 47fbc2e9 - Add the first draft for the inactive SFR in the logger
    • 921f53e2 - Update the SFH inactive part of the logger
    • e874b660 - Remove the number of star particles from the logger
    • ec209654 - Add more flexibility in the name of the SFH logger
    • fdf70cf7 - Update the name of the written file for the SFH logger
    • 131ac4ce - Update the logger + engine part
    • b2dfa194 - Comment a few lines of empty functions
    • 209fddf7 - Add the star formation logger to the rebuilt part
    • c8812f64 - Remove unnecessary functions
    • ab080a9a - Update the SFH logger such that we also take into account SFR of particles that…
    • 591fc697 - Add comments in the EAGLE star formation logger
    • b9d77318 - Update the star formation logger empty files in GEAR and none
    • 8716333e - Do not forward declare SFH struct anymore
    • 195e4543 - Add replace 0 to 0.f
    • b2b8be7c - Code formatting

    Compare with previous version

  • Author Contributor

    I have rebased the branch on the master and formatted the code, so it is ready to be tested on a cosmology case.

  • Thanks. All looks good. I will read through the code and possibly leave comments. And run the cosmological test.

  • Matthieu Schaller unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Folkert Nobels added 1 commit

    added 1 commit

    • 53f58ea3 - Add 2 extra const quilifiers to function variables

    Compare with previous version

  • added 1 commit

    • 00873211 - Applied code formatting tool.

    Compare with previous version

  • All works well. I only had some stylistic suggestions before merging:

    1. Make the file a field in some structure somewhere. We do not want to close and re-open the file every time-step. Maybe just add the FILE* to the engine structure and pass it to the functions that write.

    2. Merge the function star_formation_init_stellar_mass() into star_formation_init_SFH_inactive() and star_formation_init_SFH_active(). I would also rename the functions:

    3. I'd rename the functions as: star_formation_logger_XXXX(). In detail (to match other names in other code bits): star_formation_init_SFH_active() --> star_formation_logger_log_active_cell() star_formation_init_SFH_inactive() --> star_formation_logger_log_inactive_cell() star_formation_add_progeny_SFH() --> star_formation_logger_log_progeny_cell() star_formation_log_for_active_particles() --> star_formation_logger_log_active_part() star_formation_log_for_inactive_particles() --> star_formation_logger_log_inactive_part() star_formation_update_stellar_mass() --> star_formation_logger_log_new_spart() star_formation_get_total_cell() --> star_formation_logger_add() star_formation_add_to_parent_cell() --> star_formation_logger_assign() star_formation_SFR_rebuilt() --> star_formation_logger_log_part_rebuild()

    4. In star_formation_add_progeny_SFH(), why not use += also for the mass?

    5. Any reason not to use star_formation_add_to_parent_cell() and star_formation_get_total_cell() in the rebuild? Do we need a separate set of functions?

    6. In the file header, could you specify that the quantities are in physical coordinates (i.e. not co-moving) and possibly give the conversion units to cgs?

    7. YYY_rebuild() not YYY_rebuilt()

    8. Do we need all these includes at the top of the none and GEAR logger?

    9. In general, any needs for all the includes? (e.g. cosmology.h)

    10. Only call the writer functions if we are running with the star_formation policy on. The accumulation can stay, but we do not want to create a file and write to it if SF is not on.

  • Folkert Nobels added 6 commits

    added 6 commits

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    • 28db1d55 - Update the names in the logger to be more consistent with the rest of the code

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    Compare with previous version

  • Folkert Nobels added 2 commits

    added 2 commits

    • 1c07b9b0 - Only write to the file when star formation policy is on
    • 1198f8f8 - Store the file pointer in the engine

    Compare with previous version

  • Folkert Nobels added 2 commits

    added 2 commits

    • a15fe7cb - Reverse file pointer part
    • d68b8368 - Update the SFH logger start of the file

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    • 6eac202a - Update the SFH logger file to include the units in CGS and in other astronomy units

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    • 773615bb - First draft of the file pointer in the struct and opening the file before initialization

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    • 361be691 - Finish the file pointer for the SFH logger

    Compare with previous version

  • Folkert Nobels added 2 commits

    added 2 commits

    • b0434307 - Remove a dubblicate function in the logger
    • 9cfa6957 - Remove an other function in the rebuild

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    • 50dbb953 - Improve the documentation of the star formation

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    Compare with previous version

  • Folkert Nobels added 151 commits

    added 151 commits

    • 9a273d1d...64af11ba - 79 commits from branch master
    • 37449db5 - Add star formation logger function file to EAGLE star formation
    • 28da285b - Add root file for star formation logger
    • 4bdebf52 - Add the star formation logger file for none star formation and update the root…
    • 0f202b29 - Update cell.h
    • 03befc9f - Update the star formation none
    • 8e7e5896 - First addition to the engine for logger
    • 365e5204 - Add SFH logger to the runner.c
    • 6418b26d - Fix compiler errors by including correct header files
    • 629478aa - Add SFH to the engine logger/printer
    • a16b5919 - Change the initialization of the engine collect end of step
    • 12aa8c96 - Add a comment to the a logger function
    • 369927c9 - Work on the get star formation in cell and start initializing stuff in…
    • b283fd8a - Finish the first draft of the star formation logger in the engine_collect_end_of_step_recurse
    • 13b4a79a - Finish first draft of the engine_collect_end_of_step_mapper and add a new…
    • 97a94dc5 - Remove the cosmo dependence from one function
    • 93933ac9 - Remove two syntax errors
    • b80e4172 - Add star_formation_history struct to collectgroup1 struct
    • d3d072bf - Add SFH to the collect group and break the code
    • d4d8592e - Removing the compilation error and rewrite the star_formation_logger.h with inclusions
    • 07f13054 - First cleanup of the star_formation_logger.h
    • 2fc1d87d - Change the arguments in a function in the runner and remove a dublicate function…
    • 0fa066d1 - Remove unnecessary parameters from the initialization
    • 6b4566ab - Remove the time from the SFH logger struct because that can be determined after…
    • a84fbdef - Remove unnecessary arguments from the starformation_update_SFH
    • 2b0c0266 - Rename starformation to star_formation in several functions
    • 6cfa597e - Literly print the SFH logger file for the moment, break the code that it no…
    • 9966fb01 - Add seperate logger_struct file to prevent cyclic inclusion and rewrite the…
    • 807a947f - Add end of line to print statement
    • 14157cff - Add more docmentation to the SFH_logger functions
    • 7f2b7dad - Update the SFH writer to write the values to a file
    • 0c4c9abd - Add more documentation, start of fixing star formation none and add initialize file sfh.txt
    • 7718423c - Update the star formation logger number of stars part
    • a1dbdc23 - Add GEAR definition to the logger and logger struct root files
    • e5a39a30 - Update the EAGLE star formation logger
    • babde174 - Code formattting
    • db02b811 - Small change to the logger
    • f72f5cab - Give the same precission to the star formation logger as in the snapshots in time
    • 1e53d1bf - Add the SFR tracer information in the logger file
    • df21d43a - Add the first draft for the inactive SFR in the logger
    • 4ef4d169 - Update the SFH inactive part of the logger
    • 9a82b867 - Remove the number of star particles from the logger
    • cbe332a4 - Add more flexibility in the name of the SFH logger
    • c7022e51 - Update the name of the written file for the SFH logger
    • 6d2847d4 - Update the logger + engine part
    • 77849584 - Comment a few lines of empty functions
    • 870eb95d - Add the star formation logger to the rebuilt part
    • 523b8729 - Remove unnecessary functions
    • 25e8990e - Update the SFH logger such that we also take into account SFR of particles that…
    • 8faa620f - Add comments in the EAGLE star formation logger
    • 2df5ab20 - Update the star formation logger empty files in GEAR and none
    • 587b2186 - Do not forward declare SFH struct anymore
    • d1013cf9 - Add replace 0 to 0.f
    • 61d40de4 - Code formatting
    • a2c149cb - Add 2 extra const quilifiers to function variables
    • 5c359e8e - Applied code formatting tool.
    • 3fe097f5 - remove star_formation_init_stellar_mass() and put it into other function
    • 31080de7 - Remove a = a + b to a+=b in tar_formation_add_progeny_SFH()
    • c5a0979c - Remove too many includes in GEAR and none
    • 39ae2403 - Remove cosmology.h in logger.h
    • 39018fcf - Remove things in runner.c
    • e4444be1 - Vim replace test
    • 253ddd4e - Update the names in the logger to be more consistent with the rest of the code
    • d1d7ce96 - Update 3 more names
    • 88e00a8f - Only write to the file when star formation policy is on
    • bd59642a - Update the SFH logger start of the file
    • 74eadcd6 - Update the SFH logger file to include the units in CGS and in other astronomy units
    • e7e94475 - First draft of the file pointer in the struct and opening the file before initialization
    • 35a0fa94 - Finish the file pointer for the SFH logger
    • 570c4c95 - Remove a dubblicate function in the logger
    • 827aff13 - Remove an other function in the rebuild
    • 34fe8a6f - Improve the documentation of the star formation
    • 29a0e6b3 - Code formatting

    Compare with previous version

  • Author Contributor

    @matthieu, thanks for the suggestions, all the suggestions are put in the code, I also rebased the code. What do you think of the improvements?

  • Have you tested it on a cosmological example? For instance the EAGLE-6 box?

  • I like the file header! Nicely done.

    I have left a few last cosmetic changes and then once you have tested in on the EAGLE6 I'll merge it.

  • I think there is something not quite right going on:

    SFR_evolution

    The blue line is the last column of the file converted to Msun/yr/Mpc^3

    Edited by Matthieu Schaller
  • Folkert Nobels added 101 commits

    added 101 commits

    • 29a0e6b3...434d9fc5 - 23 commits from branch master
    • 56eae647 - Add star formation logger function file to EAGLE star formation
    • dcdab1f3 - Add root file for star formation logger
    • dd3fc9b4 - Add the star formation logger file for none star formation and update the root…
    • 0084fce3 - Update cell.h
    • e7f40435 - Update the star formation none
    • 80217dde - First addition to the engine for logger
    • 6a998bfe - Add SFH logger to the runner.c
    • 27d194d3 - Fix compiler errors by including correct header files
    • 8c068d09 - Add SFH to the engine logger/printer
    • 64245ad8 - Change the initialization of the engine collect end of step
    • 6fb6e274 - Add a comment to the a logger function
    • 17a4db53 - Work on the get star formation in cell and start initializing stuff in…
    • 007fca3c - Finish the first draft of the star formation logger in the engine_collect_end_of_step_recurse
    • 82bc58b6 - Finish first draft of the engine_collect_end_of_step_mapper and add a new…
    • 770cb498 - Remove the cosmo dependence from one function
    • 38dc8d27 - Remove two syntax errors
    • 86c3c330 - Add star_formation_history struct to collectgroup1 struct
    • 05ddb2ed - Add SFH to the collect group and break the code
    • c50fdb69 - Removing the compilation error and rewrite the star_formation_logger.h with inclusions
    • ce94e323 - First cleanup of the star_formation_logger.h
    • b3a67653 - Change the arguments in a function in the runner and remove a dublicate function…
    • c4b2a140 - Remove unnecessary parameters from the initialization
    • 13e7c1d9 - Remove the time from the SFH logger struct because that can be determined after…
    • 6b3083d3 - Remove unnecessary arguments from the starformation_update_SFH
    • ff8d4045 - Rename starformation to star_formation in several functions
    • facc72bf - Literly print the SFH logger file for the moment, break the code that it no…
    • 0421328a - Add seperate logger_struct file to prevent cyclic inclusion and rewrite the…
    • 509c27a5 - Add end of line to print statement
    • 61cc4b49 - Add more docmentation to the SFH_logger functions
    • 87a8f049 - Update the SFH writer to write the values to a file
    • c8bcf3cb - Add more documentation, start of fixing star formation none and add initialize file sfh.txt
    • af8fee47 - Update the star formation logger number of stars part
    • 3a473707 - Add GEAR definition to the logger and logger struct root files
    • cf4e42c8 - Update the EAGLE star formation logger
    • 472ff3ee - Code formattting
    • 22ac2b58 - Small change to the logger
    • eb827942 - Give the same precission to the star formation logger as in the snapshots in time
    • 39c9fb13 - Add the SFR tracer information in the logger file
    • 86bbca98 - Add the first draft for the inactive SFR in the logger
    • 64bc026e - Update the SFH inactive part of the logger
    • 728ef5b8 - Remove the number of star particles from the logger
    • 3ccf76e9 - Add more flexibility in the name of the SFH logger
    • 11fb312a - Update the name of the written file for the SFH logger
    • d254610d - Update the logger + engine part
    • 96b2df81 - Comment a few lines of empty functions
    • a2bb789b - Add the star formation logger to the rebuilt part
    • e24012ad - Remove unnecessary functions
    • 06f7c8a7 - Update the SFH logger such that we also take into account SFR of particles that…
    • 9c01d071 - Add comments in the EAGLE star formation logger
    • a317903b - Update the star formation logger empty files in GEAR and none
    • 878a2307 - Do not forward declare SFH struct anymore
    • c70367fe - Add replace 0 to 0.f
    • f249fd03 - Code formatting
    • 4d6800e3 - Add 2 extra const quilifiers to function variables
    • 982bea58 - Applied code formatting tool.
    • 4dd17be5 - remove star_formation_init_stellar_mass() and put it into other function
    • e328b6ae - Remove a = a + b to a+=b in tar_formation_add_progeny_SFH()
    • 5e428f54 - Remove too many includes in GEAR and none
    • 83299ac6 - Remove cosmology.h in logger.h
    • faf2b62f - Remove things in runner.c
    • 015452a9 - Vim replace test
    • 2be4da32 - Update the names in the logger to be more consistent with the rest of the code
    • d8656f95 - Update 3 more names
    • abc119fa - Only write to the file when star formation policy is on
    • 6ea11b56 - Update the SFH logger start of the file
    • 8ac7c1e3 - Update the SFH logger file to include the units in CGS and in other astronomy units
    • c676f22e - First draft of the file pointer in the struct and opening the file before initialization
    • e96983b0 - Finish the file pointer for the SFH logger
    • 8e50f3af - Remove a dubblicate function in the logger
    • 2479c13c - Remove an other function in the rebuild
    • 917403e3 - Improve the documentation of the star formation
    • 552bac04 - Code formatting
    • 57f60efc - Update the run.sh file such that it is less verbose
    • f6114903 - Cosmetic changes to the header of the SFH log file
    • e6642f40 - Change a = a+b to a+=b
    • fafb9d20 - Change a forward decleration to an include
    • 54818a3c - Change the SFH file such that it is more clear and better comments
    • 2a2e610e - Format SFH.py with black

    Compare with previous version

  • Folkert Nobels resolved all discussions

    resolved all discussions

  • Author Contributor

    So the problem with the cosmological runs remains before I combined the a few functions as suggested by @matthieu. Also I added a Python script that tests the different ways of testing the SFH, this also is a start of a few improvements from issue #558 (closed).

  • Matthieu Schaller resolved all discussions

    resolved all discussions

  • Folkert Nobels added 1 commit

    added 1 commit

    • 940b8fc5 - Remove unnecessary star_formation_logger include from collectgroup.h

    Compare with previous version

  • Ok. I looked at the Isolated galaxy for other reasons and it does rebuild almost every time-step. So maybe the problem is not in the rebuild. But rather in the steps in-between not zeroing things properly.

    Maybe the way out is to use a simpler test. Just use the Sod shock for instance or anything that does not rebuild often. Then set the SFR of particles to 1 or 0 depending on something simple like their density (i.e. not using the full model but setting SFR=1 for rho > 0.1 and SFR=0 for rho < 0.1) and then check what happens.

  • Author Contributor

    Yes, I think you are right. I think the problem has indeed something to do with not properly zeroing things.

    I think using a simpler test will be a good idea. I can try to test it using the sod test.

  • Folkert Nobels added 1 commit

    added 1 commit

    • a2cc99d5 - Update the SFH file such to make tqdm an option

    Compare with previous version

  • Just so that I don't forget:

    todo: Add the step as the first column.

  • Author Contributor

    Actually I already did that locally, so I will push that later today.

  • mentioned in issue #558 (closed)

  • Folkert Nobels added 1 commit

    added 1 commit

    • 5257d811 - Add step to the output of the SFH logger

    Compare with previous version

  • Folkert Nobels added 1 commit

    added 1 commit

    • 2ff52e60 - Also clear the SFH logger in top level cells during the rebuild

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading