Skip to content

Refactored construction of Laplacian viscosity#797

Merged
Hallberg-NOAA merged 3 commits into
mom-ocean:dev/gfdlfrom
adcroft:hor-visc-refactor2
Jun 25, 2018
Merged

Refactored construction of Laplacian viscosity#797
Hallberg-NOAA merged 3 commits into
mom-ocean:dev/gfdlfrom
adcroft:hor-visc-refactor2

Conversation

@adcroft
Copy link
Copy Markdown
Collaborator

@adcroft adcroft commented Jun 21, 2018

This PR builds on #795 (i.e. requires #795 to be accepted).

From the commit message:

  • The logic for constructing viscosity involved nested if's and
    alternate pathways.
  • This refactor avoids large pathway branches and has not nested
    if's, thereby simplifying the logic:
    • The only case where extra steps occur are when Smagorinsky and
      Leith are both disabled and better_bound is enabled. In this case
      more conditionals are encountered sequentially.
  • Added comments to:
    • indicate contributions that are resolution scaled or not;
    • indicate contributions that are additive rather than maxed.

adcroft added 3 commits June 16, 2018 18:14
- Moved setting of (constant) mod_Leith to outside of loops
- Moved calculation of div_xx to after calculation of h_u,h_v
- Used h_u,h_v in div_xx (avoids repeated computations)
- Put calculation of div_xx, vort_xy into a conditional block
- Aligned comments with code
- The logic for constructing viscosity involved nested if's and
  alternate pathways.
- This refactor avoids large pathway branches and has not nested
  if's, thereby simplifying the logic:
  - The only case where extra steps occur are when Smagorinsky and
    Leith are both disabled and better_bound is enabled. In this case
    more conditionals are encountered sequentially.
- Added comments to:
  - indicate contributions that are resolution scaled or not;
  - indicate contributions that are additive rather than maxed.
@adcroft
Copy link
Copy Markdown
Collaborator Author

adcroft commented Jun 21, 2018

@Hallberg-NOAA Hallberg-NOAA merged commit 91399f0 into mom-ocean:dev/gfdl Jun 25, 2018
@adcroft adcroft deleted the hor-visc-refactor2 branch June 25, 2018 20:07
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

Successfully merging this pull request may close these issues.

2 participants