Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortening timestep causes duplicate outputs #431

Open
n-beech opened this issue Mar 1, 2023 · 0 comments
Open

Shortening timestep causes duplicate outputs #431

n-beech opened this issue Mar 1, 2023 · 0 comments
Milestone

Comments

@n-beech
Copy link

n-beech commented Mar 1, 2023

Rerunning a simulation with a shortened timestep creates a duplicate output of the first timestep after the restart.

I think this is because the i/o counter is defined by finding the last record in the output file with a timestamp earlier than the current time and adding 1. If you need to rerun part of a simulation with a shorter timestep than was previously used (for example, after a blowup), the first timestep after the restart will not be overwritten because it will have a slightly earlier timestamp than the first output of the restarted run (old timestep - new timestep). You then have two near-duplicate records.

From io_meandata.F90:

               !_______________________________________________________________
                ! if the time rtime at the rec_count is larger than ctime we
                ! look for the closest record with the timestamp less than ctime
                do k=entry%rec_count, 1, -1
                    !PS if (partit%flag_debug)  print *, achar(27)//'[33m'//' -I/O-> call assert_nf B'//achar(27)//'[0m'//',  k=',k, ', rootpart=', entry%root_rank
                    ! determine rtime from exiting file
                    call assert_nf( nf_get_vara_double(entry%ncid, entry%tID, k, 1, rtime, 1), __LINE__)
                    if (ctime > rtime) then
                        entry%rec_count=k+1
                        exit ! a proper rec_count detected, exit the loop
                    end if
                    if (k==1) then
                        write(*,*) 'I/O '//trim(entry%name)//' WARNING: the existing output file will be overwritten'//'; ', entry%rec_count, ' records in the file;'
                        entry%rec_count=1
                        exit ! no appropriate rec_count detected
                    end if
                end do

Could the i/o counter be initialized by finding the number of records in the output file with timestamps earlier than the restart time and updated by 1 after each output?

@JanStreffing JanStreffing added this to the FESOM 2.6.1 milestone Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants