From 89eec7e55b7179c19e9b84a629983399739f76ef Mon Sep 17 00:00:00 2001 From: jatkinson1000 Date: Wed, 11 Sep 2024 04:27:45 -0600 Subject: [PATCH] Remove double temperature inputs to the YOG scheme. Use only value reinterpolated to CAM space. --- src/physics/cam/nn_convection_flux.F90 | 15 +++++---------- src/physics/cam/nn_interface_cam.F90 | 9 ++------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/physics/cam/nn_convection_flux.F90 b/src/physics/cam/nn_convection_flux.F90 index e1de45927c..7def2883bb 100644 --- a/src/physics/cam/nn_convection_flux.F90 +++ b/src/physics/cam/nn_convection_flux.F90 @@ -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) @@ -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(:, :) @@ -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) @@ -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 @@ -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)) diff --git a/src/physics/cam/nn_interface_cam.F90 b/src/physics/cam/nn_interface_cam.F90 index 20d4cbbdb3..73961518ac 100644 --- a/src/physics/cam/nn_interface_cam.F90 +++ b/src/physics/cam/nn_interface_cam.F90 @@ -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 !----------------------------------------------------- @@ -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