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

Move some parts of btstep() into subroutines #845

Open
wants to merge 1 commit into
base: dev/gfdl
Choose a base branch
from

Conversation

theresa-cordero
Copy link

Modularize btstep

This PR moves some parts of btstep() into subroutines:

  • btstep_ubt_from_layer
  • btstep_find_Cor
  • btloop_setup
  • btloop_setup_eta
  • btloop_setup_OBCs
  • btloop_update_v
  • btloop_update_u
  • btstep_layer_accel

This eliminates the duplication of the u and v update code in the bt loop, but preserves the BT_USE_OLD_CORIOLIS_BRACKET_BUG in the update when v is done second.

The creation of these subroutines should not change answers. I have tested it in the Baltic OM4 0.25 case with BT_USE_OLD_CORIOLIS_BRACKET_BUG both True and False.

Each routine has many arguments and I have tried to correctly label them intent(in) or intent(inout) as appropriate. Some variables did not have clear comments describing them in this module (ex. use_BT_cont or jsvf), so I have not put doxygen comments describing them in this commit. These can be added when I address the review.

The short description of each routine is:

btstep_ubt_from_layer: Calculate the zonal and meridional velocity from the 3-D velocity.
btstep_find_Cor: Find the Coriolis force terms _zon and _mer.
btloop_setup: Set ubt, vbt, eta, find face areas, and set valid array size at the beginning of each barotropic loop.
btloop_setup_eta: A routine to set eta_pred and the running time integral of uhbt and vhbt.
btloop_setup_OBCs: Setup old or previous ubt, vbt, vbt, and vhbt for different OBC options before the next step in the btstep loop.
btloop_update_v: Update meridional velocity.
btloop_update_u: Update zonal velocity.
btstep_layer_accel: Calculate the zonal and meridional acceleration of each layer due to the barotropic calculation.

The short description of each routine is:
btstep_ubt_from_layer: Calculate the zonal and meridional velocity from the 3-D velocity.
btstep_find_Cor: Find the Coriolis force terms _zon and _mer.
btloop_setup: Set ubt, vbt, eta, find face areas, and set valid array size at the beginning of each barotropic loop.
btloop_setup_eta: A routine to set eta_pred and the running time integral of uhbt and vhbt.
btloop_setup_OBCs: Setup old or previous ubt, vbt, vbt, and vhbt for different OBC options before the next step in the btstep loop.
btloop_update_v:  Update meridional velocity.
btloop_update_u: Update zonal velocity.
btstep_layer_accel:  Calculate the zonal and meridional acceleration of each layer due to the barotropic calculation.
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.

1 participant