From f069a7663255abe4b56fa2269b7375d2c82c8e18 Mon Sep 17 00:00:00 2001 From: Dominic Orchard Date: Wed, 26 Mar 2025 15:52:00 +0000 Subject: [PATCH 1/4] fix unit and comment on tabs_i --- src/physics/cam/nn_convection_flux.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/physics/cam/nn_convection_flux.F90 b/src/physics/cam/nn_convection_flux.F90 index ffa7393c92..98bed4c64d 100644 --- a/src/physics/cam/nn_convection_flux.F90 +++ b/src/physics/cam/nn_convection_flux.F90 @@ -71,9 +71,8 @@ subroutine nn_convection_flux(tabs_i, q_i, & ! --------------------- ! Fields from beginning of time step used as NN inputs ! --------------------- - != unit s :: tabs_i real(8), intent(in) :: tabs_i(:, :) - !! Temperature + !! Temperature indices != unit 1 :: q_i real(8), intent(in) :: q_i(:, :) From e434d60d231bbf1ceae3dbfe3afc1bb5050bf908 Mon Sep 17 00:00:00 2001 From: Dominic Orchard Date: Wed, 26 Mar 2025 15:52:12 +0000 Subject: [PATCH 2/4] clarify comment on precsfc --- src/physics/cam/nn_convection_flux.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/nn_convection_flux.F90 b/src/physics/cam/nn_convection_flux.F90 index 98bed4c64d..6b4e7e4c5e 100644 --- a/src/physics/cam/nn_convection_flux.F90 +++ b/src/physics/cam/nn_convection_flux.F90 @@ -129,9 +129,9 @@ subroutine nn_convection_flux(tabs_i, q_i, & t_delta_sed, q_delta_sed !! delta values of t and q generated by the NN - != unit kg / m**2 :: precsfc + != unit (kg / m**2) :: precsfc real(8), intent(out), dimension(:) :: precsfc - !! Surface precipitation rate due to autoconversion and sedimentation + !! Surface precipitation due to autoconversion and sedimentation !! Can be expressed in m by dividing by density of water 1000 kg / m**3 ! ----------------------------------- From 6285d5b7b4138f2839c18c5d58ffc27d92067622 Mon Sep 17 00:00:00 2001 From: Dominic Orchard Date: Wed, 26 Mar 2025 15:52:23 +0000 Subject: [PATCH 3/4] add some more unit specifications --- src/physics/cam/nn_convection_flux.F90 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/physics/cam/nn_convection_flux.F90 b/src/physics/cam/nn_convection_flux.F90 index 6b4e7e4c5e..8f58a5526b 100644 --- a/src/physics/cam/nn_convection_flux.F90 +++ b/src/physics/cam/nn_convection_flux.F90 @@ -148,6 +148,9 @@ subroutine nn_convection_flux(tabs_i, q_i, & ! Other variables real(8), dimension(nrf) :: omp, fac + + != unit s m**3 / kg :: irhoadz + != unit s m**2 / kg :: irhoadzdz real(8), dimension(size(tabs_i, 2)) :: rsat, irhoadz, irhoadzdz ! ----------------------------------- @@ -158,8 +161,13 @@ subroutine nn_convection_flux(tabs_i, q_i, & real(4), dimension(n_outputs) :: outputs !! vector of output features from the NN ! NN outputs + + != unit kg / (s m**2) :: q_sed_flux + ! mass flux of moisture + real(8), dimension(nrf) :: q_sed_flux + != unit j / (kg * s) :: t_rad_rest_tend real(8), dimension(nrf) :: t_flux_adv, q_flux_adv, q_tend_auto, & - q_sed_flux, t_rad_rest_tend + t_rad_rest_tend ncol = size(tabs_i, 1) nzm = size(tabs_i, 2) From 1fe49431bd6163833585ac85c234142f804656c7 Mon Sep 17 00:00:00 2001 From: Dominic Orchard Date: Wed, 26 Mar 2025 15:52:49 +0000 Subject: [PATCH 4/4] add some comments on the temporary change in units for precsfc when calculating surface precip --- src/physics/cam/nn_convection_flux.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/physics/cam/nn_convection_flux.F90 b/src/physics/cam/nn_convection_flux.F90 index 8f58a5526b..b35d4574d4 100644 --- a/src/physics/cam/nn_convection_flux.F90 +++ b/src/physics/cam/nn_convection_flux.F90 @@ -352,12 +352,18 @@ subroutine nn_convection_flux(tabs_i, q_i, & ! Calculate surface precipitation ! Combination of sedimentation at surface, and autoconversion in the column ! Apply sedimenting flux at surface to get rho*dq term + + ! + ! unit(kg / m**3) :: precfsc + ! NB: precsfc should be all 0 here (and thus of any unit) precsfc(i) = precsfc(i) - q_sed_flux(1) * irhoadzdz(1) * rho(1) * adz(1) !! *dtn/dz ! Loop up column for all autoconverted precipitation do k=1,nrf precsfc(i) = precsfc(i) - q_delta_auto(i,k) * rho(k) * adz(k) end do precsfc(i) = precsfc(i) * dz + ! unit(kg / m**2) :: precsfc (as specified at the start of the subroutine) + ! ! As a final check enforce q must be >= 0.0 do k = 1,nrf