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 the calculation of uvel and vvel in evp dynamics #953

Merged
merged 5 commits into from
May 14, 2024

Conversation

apcraig
Copy link
Contributor

@apcraig apcraig commented May 13, 2024

For detailed information about submitting Pull Requests (PRs) to the CICE-Consortium,
please refer to: https://github.com/CICE-Consortium/About-Us/wiki/Resource-Index#information-for-developers

PR checklist

  • Short (1 sentence) summary of your PR:
    Update the calculation of uvel and vvel in evp to reduce flops, bit-for-bit.
  • Developer(s):
    apcraig, jflemiuex, eclare
  • 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.
    Full test suites run on derecho with intel, gnu, cray. All testing passes as expected, https://github.com/CICE-Consortium/Test-Results/wiki/cice_by_hash_forks#c5b390ec0507633c319e6c7d1cb2a6850924dc59
  • 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 document the changes in detail, including why the changes are made. This will become part of the PR commit log.

Update the calculation of uvel and vvel in subroutine evp in file ice_dyn_evp.F90. Do an unmasked grid_average_X2Y when averaging from uvelE to uvel and from vvelN to vvel instead of a masked average. The masking is handled separately. This change is bit-for-bit and saves a few flops. Closes #952.

Update the documentation to add the hemispheric sign dependence in the water stress terms in the dynamics equations. Closes #951.

ice_dyn_evp.F90.  Do an unmasked grid_average_X2Y when averaging
from uvelE to uvel and from vvelN to vvel instead of a masked average.
The masking is handled separately.  This change is bit-for-bit and
saves a few flops.  Closes CICE-Consortium#952.

Update the documentation to add the hemispheric sign dependence in the
water stress terms in the dynamics equations.  Closes CICE-Consortium#951.
@apcraig
Copy link
Contributor Author

apcraig commented May 13, 2024

I'm doing a full test suite to make sure answers haven't changed.

@JFLemieux73 @eclare108213 Please review code changes and documentation, let me know if I've done something wrong.

@@ -35,11 +35,11 @@ For clarity, the two components of Equation :eq:`vpmom` are
\begin{aligned}
m{\partial u\over\partial t} &= {\partial\sigma_{1j}\over\partial x_j} + \tau_{ax} +
a_i c_w \rho_w
\left|{\bf U}_w - {\bf u}\right| \left[\left(U_w-u\right)\cos\theta - \left(V_w-v\right)\sin\theta\right]
\left|{\bf U}_w - {\bf u}\right| \left[ + \left(U_w-u\right)\cos\theta \mp \left(V_w-v\right)\sin\theta\right]
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure I would add the + sign before \left(U_w...

:label: vmom

where :math:`{\tt vrel}\ \cdot\ {\tt waterx(y)}= {\tt taux(y)}` and the definitions of :math:`u^{l}` and :math:`v^{l}` vary depending on the grid.

As :math:`u` and :math:`v` are collocated on the B grid, :math:`u^{l}` and :math:`v^{l}` are respectively :math:`u^{k+1}` and :math:`v^{k+1}` such that this system of equations can be solved as follows. Define

.. math::
\hat{u} = F_u + \tau_{ax} - mg{\partial H_\circ\over\partial x} + {\tt vrel} \left(U_w\cos\theta - V_w\sin\theta\right) + {m\over\Delta t_e}u^k
\hat{u} = F_u + \tau_{ax} - mg{\partial H_\circ\over\partial x} + {\tt vrel} \left(+ U_w\cos\theta \mp V_w\sin\theta\right) + {m\over\Delta t_e}u^k
Copy link
Contributor

@JFLemieux73 JFLemieux73 May 14, 2024

Choose a reason for hiding this comment

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

same comment here not sure I would add the + sign before U_w

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was done just to keep the equations aligned a bit in the text. I'll remove them again, wasn't sure what was better.

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 extra plus signs are out, feel free to have another look. Can revert if you prefer the prior version. If I don't hear anything, will merge later today.

Copy link
Contributor

@JFLemieux73 JFLemieux73 left a comment

Choose a reason for hiding this comment

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

looks good!

@apcraig
Copy link
Contributor Author

apcraig commented May 14, 2024

@apcraig apcraig marked this pull request as ready for review May 14, 2024 15:54
@apcraig apcraig merged commit 53cdc70 into CICE-Consortium:main May 14, 2024
2 checks passed
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.

Unnecessary calculations for uvel, vvel for the C-grid Minor modifications required in documentation
3 participants