Skip to content

Commit

Permalink
Remove double temperature inputs to the YOG scheme. Use only value re…
Browse files Browse the repository at this point in the history
…interpolated to CAM space.
  • Loading branch information
jatkinson1000 committed Jan 10, 2025
1 parent c4b4993 commit 89eec7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
15 changes: 5 additions & 10 deletions src/physics/cam/nn_convection_flux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ end subroutine nn_convection_flux_init


subroutine nn_convection_flux(tabs_i, q_i, &
tabs, &
t, q, &
rho, adz, dz, dtn, &
precsfc)
Expand All @@ -71,9 +70,9 @@ subroutine nn_convection_flux(tabs_i, q_i, &
! ---------------------
! Fields from beginning of time step used as NN inputs
! ---------------------
!= unit s :: tabs_i
!= unit K :: tabs_i
real(8), intent(in) :: tabs_i(:, :)
!! Temperature
!! Absolute Temperature

!= unit 1 :: q_i
real(8), intent(in) :: q_i(:, :)
Expand All @@ -82,10 +81,6 @@ subroutine nn_convection_flux(tabs_i, q_i, &
! ---------------------
! Other fields from SAM
! ---------------------
!= unit K :: tabs
real(8), intent(in) :: tabs(:, :)
!! absolute temperature

!= unit (J / kg) :: t
real(8), intent(inout) :: t(:, :)
!! Liquid Ice static energy (cp*T + g*z − L(qliq + qice) − Lf*qice)
Expand Down Expand Up @@ -206,8 +201,8 @@ subroutine nn_convection_flux(tabs_i, q_i, &
! if (rf_uses_rh) then
! ! If using generalised relative humidity convert non-precip. water content to rel. hum
! do k=1,nzm
! omn = omegan(tabs(i,j,k))
! rsat(k) = omn * rsatw(tabs(i,j,k),pres(k)) + (1.-omn) * rsati(tabs(i,j,k),pres(k))
! omn = omegan(tabs_i(i,j,k))
! qsat(k) = omn * qsatw(tabs_i(i,j,k),pres(k)) + (1.-omn) * qsati(tabs_i(i,j,k),pres(k))
! end do
! features(dim_counter+1:dim_counter+input_ver_dim) = real(q_i(i,j,1:input_ver_dim)/rsat(1:input_ver_dim),4)
! dim_counter = dim_counter + input_ver_dim
Expand Down Expand Up @@ -291,7 +286,7 @@ subroutine nn_convection_flux(tabs_i, q_i, &

! ensure autoconversion tendency won't reduce q below 0
do k=1,nrf
omp(k) = max(0.,min(1.,(tabs(i,k)-tprmin)*a_pr))
omp(k) = max(0.,min(1.,(tabs_i(i,k)-tprmin)*a_pr))
fac(k) = (fac_cond + fac_fus * (1.0 - omp(k)))
if (q_tend_auto(k) < 0) then
q_delta_auto(i,k) = - min(-q_tend_auto(k) * dtn, q(i,k))
Expand Down
9 changes: 2 additions & 7 deletions src/physics/cam/nn_interface_cam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ subroutine nn_convection_flux_CAM(pres_cam, pres_int_cam, pres_sfc_cam, &
! These are calculated following a conversion of the "new" SAM variables back
! CAM-space to reduce numerical errors (e.g. tendency is zero).
call SAM_var_conversion(t_sam, r_sam, tabs0_sam, qv0_sam, qc0_sam, qi0_sam)

! TODO Decide whether the 'reconverted' tabs or the interpolated from CAM tabs
! is best here. Consider also plotting to check.
! tabs0_sam = tabs_sam
r0_sam = r_sam

!-----------------------------------------------------
Expand All @@ -186,9 +182,8 @@ subroutine nn_convection_flux_CAM(pres_cam, pres_int_cam, pres_sfc_cam, &
! advective, autoconversion (dt = -dq*(latent_heat/cp)),
! sedimentation (dt = -dq*(latent_heat/cp)),
! radiation rest tendency (multiply by dtn to get dt)
call nn_convection_flux(tabs0_sam, r0_sam, &
tabs_sam, &
t_sam, r_sam, &
call nn_convection_flux(tabs0_sam(:,1:nrf), r0_sam(:,1:nrf), &
t_sam(:,1:nrf), r_sam(:,1:nrf), &
rho, adz, dz, dtn, &
precsfc_i)
! Update precsfc with prec from this timestep
Expand Down

0 comments on commit 89eec7e

Please sign in to comment.