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

Defining additional dimension in restart files #773

Open
c2xu opened this issue Dec 10, 2024 · 0 comments
Open

Defining additional dimension in restart files #773

c2xu opened this issue Dec 10, 2024 · 0 comments

Comments

@c2xu
Copy link

c2xu commented Dec 10, 2024

While working on PR #772, I encountered the issue of not able to create additional dimensions in the restart file. It seems to me the issue is related to the save_restart subroutine in MOM_restart.F90. Specifically, the extra_axes to be created in the restart file is generated in lines 1427 to 1429:

      call query_vardesc(CS%restart_field(m)%vars, hor_grid=hor_grid, &
                         z_grid=z_grid, t_grid=t_grid, caller="save_restart", &
                         extra_axes=extra_axes)

However, this call is placed within a loop, such that extra_axes generated for a restart field will be overwritten by the next restart field. As a result, when creating the restarting file in lines 1505 to 1511:

    if (CS%parallel_restartfiles) then 
      call create_MOM_file(IO_handle, trim(restartpath), vars, next_var-start_var, &
          fields, MULTIPLE, G=G, GV=GV, checksums=check_val, extra_axes=extra_axes)
    else 
      call create_MOM_file(IO_handle, trim(restartpath), vars, next_var-start_var, &
          fields, SINGLE_FILE, G=G, GV=GV, checksums=check_val, extra_axes=extra_axes)
    endif

the extra_axes is always the one associated with the last restart field.

In PR #722, I was able to get around of this issue by registering the restart fields of the MOM_streaming_filter module after all other restart fields/pairs are registered, but I think there should be a better solution. I've looked around and see that the MOM_internal_tides module also defines additional axes in the restart file, and I think there could be a problem if both modules are being used in the simulation.

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

1 participant