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 an option to obtain the cocurrent drag and heat transfer coeffients #113

Merged
merged 7 commits into from
Jun 27, 2024

Conversation

baoqiang80
Copy link
Contributor

For the current model setting, the ocean roughness for momentum, heat and moisture is input variables which are calculated based on the atmospheric condition at the previous time step. We add one option to update the ocean roughness by iterating the monin obukhov function so as to obtain concurrent roughness, drag and heat/moisture coefficients.

Copy link
Member

@thomas-robinson thomas-robinson left a comment

Choose a reason for hiding this comment

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

For new routines, everything needs to be documented in doxygen style.

shared/surface_flux.F90 Outdated Show resolved Hide resolved
shared/surface_flux.F90 Show resolved Hide resolved
Comment on lines 384 to 396
do i = 1, niter
do j = 1, size(avail)
if (avail(j) .and. seawater(j)) then
call iter_monin_obukhov_ocean ( &
z_atm(j), u_atm(j), v_atm(j), w_atm(j), thv_atm(j), q_atm(j), &
u_surf(j), v_surf(j), thv_surf(j), q_surf0(j), &
rough_mom(j), rough_heat(j), rough_moist(j), &
cd_m(j), cd_t(j), cd_q(j), u_star(j), b_star(j) )
endif
enddo
enddo
endif

Copy link
Contributor

Choose a reason for hiding this comment

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

Need to address whether we want to push the j-loop and even the i-loop down into the inter_monin_obukhov_ocean routine. It will make for cleaner code here as well as the constant context switching in and out of the function to calculate a point at a time.

@rem1776
Copy link
Contributor

rem1776 commented Jun 12, 2024

@baoqiang80 Just wanted to follow up since this looks like it needs some updates. This will need the comments above addressed before we can get this merged in and included in a release.

It also looks like its failing the CI testing with these errors:

/__w/FMScoupler/FMScoupler/t/null.NgMaM3/src/coupler/shared/surface_flux.F90:120:26:

  120 | use ocean_rough_mod, only: cal_z0_hwrf17, cal_zt_hwrf17, read_ocean_rough_scheme
      |                          1
Error: Symbol 'cal_z0_hwrf17' referenced at (1) not found in module 'ocean_rough_mod'
/__w/FMScoupler/FMScoupler/t/null.NgMaM3/src/coupler/shared/surface_flux.F90:120:41:

  120 | use ocean_rough_mod, only: cal_z0_hwrf17, cal_zt_hwrf17, read_ocean_rough_scheme
      |                                         1
Error: Symbol 'cal_zt_hwrf17' referenced at (1) not found in module 'ocean_rough_mod'
/__w/FMScoupler/FMScoupler/t/null.NgMaM3/src/coupler/shared/surface_flux.F90:120:56:

  120 | use ocean_rough_mod, only: cal_z0_hwrf17, cal_zt_hwrf17, read_ocean_rough_scheme
      |                                                        1
Error: Symbol 'read_ocean_rough_scheme' referenced at (1) not found in module 'ocean_rough_mod'

Do these changes rely on other component changes? Our simple CI test for this repository just uses the *_null components, but they will need to be updated as well if there are any API changes made to the component modules they are based on.

@baoqiang80
Copy link
Contributor Author

@rem1776 Yes, this relies on another merge request for ice_param update which was just merged into the main branch today with the tag (2024.01.01). Could you please give another try?

Also, I made some further update on this merge request today by moving the do loop into the subroutine following Rusty's suggestion. Thanks

@rem1776
Copy link
Contributor

rem1776 commented Jun 12, 2024

@baoqiang80 Thanks for making those changes. I reran the CI but it failed again, this time it got past the full coupler build but failed with the simple coupler.

I took a look at it and it seems the change we are missing is in simple/flux_exchange.F90 in the surface_flux_2d subroutine. To compile it needs rough_mom, rough_heat, and rough_moist to be changed tointent(inout).

@baoqiang80
Copy link
Contributor Author

@rem1776 I changed simple/surface_exchange.F90. Would you please give another try?

@@ -173,12 +176,17 @@ module surface_flux_mod
!! heat. This option is available for legacy purposes, and is not recommended for
!! new experiments.
logical :: ncar_ocean_flux_multilevel = .false. !< Use NCAR climate model turbulent flux calculation described by Large and Yeager, allows for different reference height for wind, temp and spec. hum.
logical :: do_iter_monin_obukhov = .false. !< If .TRUE, call monin obukhov funtions a couple of times to update
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor typo funtions.

real :: bulk_zu = 10. !< Reference height for wind speed (meters)
real :: bulk_zt = 10. !< Reference height for atm temperature (meters)
real :: bulk_zq = 10. !< Reference height for atm humidity (meters)
logical :: raoult_sat_vap = .false. !< Reduce saturation vapor pressure to account for seawater
logical :: do_simple = .false.

integer :: niter = 5 !< iteration times to call iter_monin_obukhov_ocean. Typically 3-5 times should converge
Copy link
Contributor

Choose a reason for hiding this comment

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

Would like to see this be more descriptive to match the trigger do_iter_monin_obukhov, perhaps niter_monin_obukhov. If updated, please change all instances.

Copy link
Contributor

@bensonr bensonr left a comment

Choose a reason for hiding this comment

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

After this fix, I will approve this for merge.

@@ -272,7 +281,7 @@ subroutine surface_flux_1d ( &
q_atm, q_surf0, dw_atmdu, dw_atmdv, w_gust, &
zu, zt, zq

integer :: i, nbad
integer :: i, j, nbad
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the j declaration since the creation of the iter_monin_obukhov_ocean function removed the need for it here.

bensonr
bensonr previously approved these changes Jun 21, 2024
Comment on lines 1027 to 1036
subroutine iter_monin_obukhov_ocean ( &
z_atm, u_atm, v_atm, w_atm, thv_atm, q_atm, &
u_surf, v_surf, thv_surf, q_surf0, &
rough_mom, rough_heat, rough_moist, &
cd_m, cd_t, cd_q, u_star, b_star, avail, seawater)
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
! Right now, it is only effective when ocean_rough = 'hwrf17', but this
! can be expanded if necessarily to incorporate other roughness schemies
! contact: Kun.Gao@noaa.gov; Baoqiang.Xiang@noaa.gov
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
Copy link
Member

Choose a reason for hiding this comment

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

The documentation for this routine should be in doxygen style and above the subroutine declaration:

!> \brief (description of that this does)
!! \note Right now, it  is only effective when ocean_rough = 'hwrf17', but this
!!  can be expanded if necessarily to incorporate other roughness schemies
!!  contact: Kun.Gao@noaa.gov; Baoqiang.Xiang@noaa.gov
subroutine iter_monin_obukhov_ocean (                      &
           z_atm, u_atm, v_atm, w_atm, thv_atm, q_atm,     &
           u_surf, v_surf, thv_surf, q_surf0,              &
           rough_mom, rough_heat, rough_moist,             &
           cd_m, cd_t, cd_q, u_star, b_star, avail, seawater)

Comment on lines 1038 to 1053
real , intent(in), dimension(:) :: &
z_atm, u_atm, v_atm, w_atm, thv_atm, q_atm, &
u_surf, v_surf, thv_surf, q_surf0

real , intent(inout), dimension(:) :: &
rough_mom, rough_heat, rough_moist, &
cd_m, cd_t, cd_q, u_star, b_star
logical, intent(in), dimension(:) :: &
avail, seawater

! local var
real, dimension(size(z_atm(:))) :: &
flux_q, q_star, &
ref_u, ref_v, u10, del_m, del_h, del_q, &
rough_mom1, rough_heat1, rough_moist1
integer i, j
Copy link
Member

Choose a reason for hiding this comment

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

All of these variables need to be documented in doxygen style because this is a new routine

rough_mom, rough_heat, rough_moist, &
cd_m, cd_t, cd_q, u_star, b_star, avail, seawater)
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
! Right now, it is only effective when ocean_rough = 'hwrf17', but this
Copy link
Member

Choose a reason for hiding this comment

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

You should probably check the roughness scheme and print a note to the screen if it's not hwrf17

@rem1776 rem1776 merged commit 232616d into NOAA-GFDL:main Jun 27, 2024
2 checks passed
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.

6 participants