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

Update stress12T calculation for C-grid #802

Merged
merged 2 commits into from
Dec 7, 2022

Conversation

apcraig
Copy link
Contributor

@apcraig apcraig commented Dec 4, 2022

PR checklist

  • Short (1 sentence) summary of your PR:
    Update stress12T calculation for C-grid
  • Developer(s):
    apcraig
  • Suggest PR reviewers from list in the column to the right.
  • Please copy the PR test results link or provide a summary of testing completed below.
    All bit-for-bit on cheyenne full test suites, https://github.com/CICE-Consortium/Test-Results/wiki/cice_by_hash_forks#8a45b97c1d4bb49fe7cdad98ecb7ea39dbc4b30c
  • How much do the PR code changes differ from the unmodified code?
    • bit for bit
    • different at roundoff level
    • more substantial
  • Does this PR create or have dependencies on Icepack or any other models?
    • Yes
    • No
  • Does this PR update the Icepack submodule? If so, the Icepack submodule must point to a hash on Icepack's main branch.
    • Yes
    • No
  • Does this PR add any new test cases?
    • Yes
    • No
  • Is the documentation being updated? ("Documentation" includes information on the wiki or in the .rst files from doc/source/, which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/. A test build of the technical docs will be performed as part of the PR testing.)
    • Yes
    • No, does the documentation need to be updated at a later time?
      • Yes
      • No
  • Please provide any additional information or relevant details below:

stress12T was zero. Compute stress12T in subroutine stressC_T after computing estimate of shearT by averaging shearU. See #707 for additional discussion and results. This is just a diagnostic.

minor updates to some indentation and variable names.

closes #707

stress12T was zero.  Compute stress12T in subroutine stressC_T after computing estimate of shearT by averaging shearU.

minor updates to some indentation and variable names.
@apcraig
Copy link
Contributor Author

apcraig commented Dec 4, 2022

FYI, the main changes are in stressC_T at line 1814 and 1841 and passing stress12T into the subroutine. Everything else is just formatting.

+ shearU(i ,j-1) * uarea(i ,j-1) &
+ shearU(i-1,j-1) * uarea(i-1,j-1) &
+ shearU(i-1,j ) * uarea(i-1,j )) &
/ (uarea(i,j)+uarea(i,j-1)+uarea(i-1,j-1)+uarea(i-1,j))
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't terribly important, but to reduce the number of flops and potentially also paging associated with strides, I'd save the denominator in a temporary scalar and reuse it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The compiler may do this for us, but I'll update it just to make sure.

@apcraig
Copy link
Contributor Author

apcraig commented Dec 5, 2022

So, pulling the denominator out of the equation changes answers because it affects both shearT (diagnostic) and shearTsqr (not diagnostic). It changes answers for most C-grid cases, B and CD cases are bit-for-bit, as expected. Answer differences seem to be roundoff at first then grow. Should I commit/push the change? I'm fine doing that and think it's a good time to do so, just wanted to check.

@eclare108213
Copy link
Contributor

Yes, I recommend doing it now.

@apcraig apcraig merged commit 48cf07a into CICE-Consortium:main Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Principal stress calculation does not work for C grid
2 participants