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

Add zeroing of velocity to ocean init mode #5232

Conversation

mark-petersen
Copy link
Contributor

Explicitly sets normal velocity to zero at the beginning of init mode. Each test case can then overwrite the zeros with initial velocities, but most do not. In the past the unassigned arrays wrote out zeros, but this is not true now, as described in #5230.

This code is used to create MPAS-Ocean initial conditions. It is not compiled in the E3SM code base for simulations.

Fixes #5230
[BFB]

! Initialize normalVelocity to zero for cases that do not specify it.
call mpas_pool_get_subpool(domain % blocklist % structs, 'state', statePool)
call mpas_pool_get_array(statePool, 'normalVelocity', normalVelocity, 1)
normalVelocity(:,:) = 0.0_RKIND
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I did not use a block loop here. Block loops are no longer supported in forward mode, and we never used multiple blocks for init mode anyway, so it seemed silly to add it. We could remove block loops from the rest of the code sometime, but for this PR, I just get the array from the first block. @philipwjones do you agree?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt @philipwjones cares if we break init mode ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I care deeply and passionately ;^). But yeah, this is fine - I've been removing them as I find them (block loops that is, not velocity)

@mark-petersen
Copy link
Contributor Author

mark-petersen commented Oct 12, 2022

This PR fixes the previous problem. Here with SOMA,

compass setup -p $COMPILE_DIR -w $WORKDIR -n 249 
Setting up test cases:
  ocean/soma/32km/default

cd $WORKDIR
cd ocean/soma/32km/default/initial_state
compass run

ncdump -v normalVelocity initial_state.nc |tail -n 3
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;
}

and the forward simulation completes successfully. I tested with both gnu debug and intel debug.

Copy link
Contributor

@xylar xylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did testing on Chrysalis with Intel and Intel-MPI.

I tested the 32 km default SOMA test case with this branch and with master. As expected, I found that the test case fails in forward mode without these changes but was successful with them.

I also verified that the results from the pr test suite are BFB with master. The baroclinic channel decomp test case is failing in both because of #5219

@xylar
Copy link
Contributor

xylar commented Oct 13, 2022

@cbegeman and @sbrus89, this may also fix the dam-break test case.

@sbrus89
Copy link
Contributor

sbrus89 commented Oct 13, 2022

@xylar - unfortunately, I found that the dam break still fails with this commit. Thanks for the suggestion though.

jonbob added a commit that referenced this pull request Oct 17, 2022
…#5232)

Add zeroing of velocity to ocean init mode

Explicitly sets normal velocity to zero at the beginning of init mode.
Each test case can then overwrite the zeros with initial velocities, but
most do not. In the past the unassigned arrays wrote out zeros, but this
is not true now, as described in #5230.

This code is used to create MPAS-Ocean initial conditions. It is not
compiled in the E3SM code base for simulations.

Fixes #5230
[BFB]
@jonbob
Copy link
Contributor

jonbob commented Oct 17, 2022

passes:

  • ERS.ne11_oQU240.WCYCL1850NS.chrysalis_intel
  • SMS_D_Ld3.T62_oQU120.CMPASO-IAF.chrysalis_intel
  • SMS_D_Ld1.ne30pg2_EC30to60E2r2.WCYCL1850.chrysalis_intel.allactive-wcprod

merged to next

@jonbob jonbob merged commit 28dd4d7 into E3SM-Project:master Oct 18, 2022
@jonbob
Copy link
Contributor

jonbob commented Oct 18, 2022

merged to master

@mark-petersen mark-petersen deleted the mark-petersen/ocn/zero-velocity-init-mode branch October 26, 2022 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFB PR leaves answers BFB bug fix PR mpas-ocean
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ocean initial condition velocity is uninitialized for idealized cases
5 participants