Skip to content

[BUG]: Output is called twice when closing GITM #78

@abukowski21

Description

@abukowski21

[BUG]: GITM outputs twice at the final dt

The output subroutine is called both from main, and from finalize. This may or may not be a bug, so is worth discussing whether we want to modify this behavior or leave as-is.

Bug Information

Inside main, GITM calls write_output each dt. And then in finalize_gitm (src/finalize.f90), GITM calls output again.

When the end time of a simulation matched with the output dt, output is called twice.

Other Information

This behavior is somewhat expected, but may be worth discussing further... The reasoning behind it is to force an output file to be created if a user wishes to "cancel" a run. If one were to touch GITM.STOP, the run would be halted and the present state is output.

Couple of options here:

  1. Remove the call to output from finalize. This would mean that if dtOutput & the run's stop time do not align, the final states would not be output. Do not change anything else.
  2. Create a variable didOutputThisDt (and/or doForceWrite) which are used to decide if the present states have already been written. The code would then not write the files a second time. Additionally:
    • Change finalize to call write_output (same as main)
    • Add a check there to see if the file exists or not.
    • Use the aforementioned variables to decide whether or not to write anything.
  3. Do nothing... This is not explicitly a bug, and does not affect runtime performance meaningfully. Just may not be expected behavior.

The advantage of 1 & 2 is that we de-tangle the code. The disadvantages are that it is yet another setting that can be changed (complicates things), and that it changes the behavior of the code - not necessarily bad but maybe not necessary.

My thought is to go with option 2. But this can be discussed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions