Skip to content

Commit 1466c38

Browse files
committed
Fixes and remove state_v stuff that was never used
1 parent 13031b7 commit 1466c38

3 files changed

Lines changed: 23 additions & 36 deletions

File tree

components/eam/src/physics/cam/zm/zm_conv_mcsp.F90

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,19 @@ subroutine zm_conv_mcsp_calculate_shear( pcols, ncol, pver, state_pmid, state_u,
9999
! Local variables
100100
integer :: i
101101
real(r8), dimension(pcols) :: storm_u ! u wind at storm reference level set by MCSP_storm_speed_pref
102-
real(r8), dimension(pcols) :: storm_v ! v wind at storm reference level set by MCSP_storm_speed_pref
103-
real(r8), dimension(pcols) :: storm_u_shear ! u shear at storm reference level set by MCSP_storm_speed_pref
104-
real(r8), dimension(pcols) :: storm_v_shear ! v shear at storm reference level set by MCSP_storm_speed_pref
102+
105103
!----------------------------------------------------------------------------
106104
! Interpolate wind to pressure level specified by MCSP_storm_speed_pref
107105
call vertinterp( ncol, pcols, pver, state_pmid, MCSP_storm_speed_pref, state_u, storm_u )
108-
call vertinterp( ncol, pcols, pver, state_pmid, MCSP_storm_speed_pref, state_v, storm_v )
109106

110107
!----------------------------------------------------------------------------
111108
! calculate low-level shear
112109
do i = 1,ncol
113110
if (state_pmid(i,pver).gt.MCSP_storm_speed_pref) then
114-
storm_u_shear(i) = storm_u(i)-state_u(i,pver)
115-
storm_v_shear(i) = storm_v(i)-state_v(i,pver)
111+
mcsp_shear(i) = storm_u(i)-state_u(i,pver)
116112
else
117-
storm_u_shear(i) = -999
118-
storm_v_shear(i) = -999
113+
mcsp_shear(i) = -999
119114
end if
120-
mcsp_shear(i) = storm_u_shear(i)
121115
end do
122116

123117
!----------------------------------------------------------------------------

components/eamxx/src/physics/zm/fortran_bridge/zm_eamxx_bridge_methods.F90

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ module zm_eamxx_bridge_methods
1919
subroutine cldfrc_fice(ncol, t, fice, fsnow)
2020
!
2121
! Compute the fraction of the total cloud water which is in ice phase.
22-
! The fraction depends on temperature only.
22+
! The fraction depends on temperature only.
2323
! This is the form that was used for radiation, the code came from cldefr originally
24-
!
24+
!
2525
! Author: B. A. Boville Sept 10, 2002
2626
! modified: PJR 3/13/03 (added fsnow to ascribe snow production for convection )
2727
!-----------------------------------------------------------------------
@@ -61,7 +61,7 @@ subroutine cldfrc_fice(ncol, t, fice, fsnow)
6161
else if (t(i,k) < tmin_fice) then
6262
fice(i,k) = 1.0_r8
6363
! Otherwise mixed phase, with ice fraction decreasing linearly from tmin to tmax
64-
else
64+
else
6565
fice(i,k) =(tmax_fice - t(i,k)) / (tmax_fice - tmin_fice)
6666
end if
6767
! snow fraction partitioning
@@ -72,7 +72,7 @@ subroutine cldfrc_fice(ncol, t, fice, fsnow)
7272
else if (t(i,k) < tmin_fsnow) then
7373
fsnow(i,k) = 1.0_r8
7474
! Otherwise mixed phase, with ice fraction decreasing linearly from tmin to tmax
75-
else
75+
else
7676
fsnow(i,k) =(tmax_fsnow - t(i,k)) / (tmax_fsnow - tmin_fsnow)
7777
end if
7878
end do
@@ -142,7 +142,7 @@ subroutine zm_physics_update( ncol, dt, state_phis, state_zm, state_zi, &
142142
state_t(i,k) = state_t(i,k) + ptend_s(i,k)/cpair * dt
143143
end do
144144
end do
145-
145+
146146
call zm_geopotential_t( ncol, state_p_int, state_p_mid, state_p_del, state_t, state_qv, state_zi, state_zm )
147147

148148
! skip DSE update for EAMxx
@@ -152,15 +152,15 @@ subroutine zm_physics_update( ncol, dt, state_phis, state_zm, state_zi, &
152152
! state_dse(i,k) = state_t(i,k)*cpair + gravit*state_zm(i,k) + state_phis(i)
153153
! end do
154154
! end do
155-
155+
156156
end subroutine zm_physics_update
157157

158158
!===================================================================================================
159159

160160
! copied and modified from geopotential.F90
161161
subroutine zm_geopotential_t( ncol, pint, pmid, pdel, t, q, zi, zm )
162162
use zm_eamxx_bridge_physconst, only: zvir, rair, gravit
163-
!-----------------------------------------------------------------------
163+
!-----------------------------------------------------------------------
164164
! Purpose: Compute the geopotential height (above the surface) at the
165165
! midpoints and interfaces using the input temperatures and pressures
166166
!-----------------------------------------------------------------------------
@@ -187,7 +187,7 @@ subroutine zm_geopotential_t( ncol, pint, pmid, pdel, t, q, zi, zm )
187187
end do
188188
! Compute zi, zm from bottom up
189189
do k = pver, 1, -1
190-
! First set hydrostatic elements consistent with dynamics
190+
! First set hydrostatic elements consistent with dynamics
191191
do i = 1,ncol
192192
hkl(i) = pdel(i,k) / pmid(i,k)
193193
hkk(i) = 0.5_r8 * hkl(i)

components/eamxx/src/physics/zm/impl/zm_zm_conv_mcsp_calculate_shear_impl.hpp

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ void Functions<S,D>::zm_conv_mcsp_calculate_shear(
2929

3030
// Local variables
3131
Real storm_u = 0.0; // u wind at storm reference level set by MCSP_storm_speed_pref
32-
Real storm_v = 0.0; // v wind at storm reference level set by MCSP_storm_speed_pref
33-
Real storm_u_shear = 0.0; // u shear at storm reference level set by MCSP_storm_speed_pref
34-
Real storm_v_shear = 0.0; // v shear at storm reference level set by MCSP_storm_speed_pref
3532

3633
//----------------------------------------------------------------------------
3734
// Interpolate wind to pressure level specified by MCSP_storm_speed_pref
@@ -40,7 +37,7 @@ void Functions<S,D>::zm_conv_mcsp_calculate_shear(
4037
Int k_below = pver - 1; // default to lowest level
4138
Kokkos::parallel_reduce(Kokkos::TeamVectorRange(team, pver - 1),
4239
[&] (const Int& k, Int& min_k) {
43-
if (state_pmid(k) >= ZMC::MCSP_storm_speed_pref && state_pmid(k + 1) < ZMC::MCSP_storm_speed_pref) {
40+
if (state_pmid(k) < ZMC::MCSP_storm_speed_pref && state_pmid(k+1) >= ZMC::MCSP_storm_speed_pref) {
4441
if (k < min_k) {
4542
min_k = k;
4643
}
@@ -51,29 +48,25 @@ void Functions<S,D>::zm_conv_mcsp_calculate_shear(
5148

5249
// Linear interpolation
5350
Kokkos::single(Kokkos::PerTeam(team), [&] () {
54-
if (k_below < pver - 1) {
55-
const Real p_above = state_pmid(k_below);
56-
const Real p_below = state_pmid(k_below + 1);
57-
const Real weight = (ZMC::MCSP_storm_speed_pref - p_below) / (p_above - p_below);
58-
59-
storm_u = state_u(k_below + 1) + weight * (state_u(k_below) - state_u(k_below + 1));
60-
storm_v = state_v(k_below + 1) + weight * (state_v(k_below) - state_v(k_below + 1));
61-
} else {
62-
// Target pressure is below all model levels or exact match at lowest level
51+
if (state_pmid(0) >= ZMC::MCSP_storm_speed_pref) {
52+
storm_u = state_u(0);
53+
}
54+
else if (state_pmid(pver - 1) < ZMC::MCSP_storm_speed_pref) {
6355
storm_u = state_u(pver - 1);
64-
storm_v = state_v(pver - 1);
56+
}
57+
else {
58+
const Real dpu = ZMC::MCSP_storm_speed_pref - state_pmid(k_below);
59+
const Real dpl = state_pmid(k_below+1) - ZMC::MCSP_storm_speed_pref;
60+
storm_u = (state_u(k_below)*dpl + state_u(k_below+1)*dpu) / (dpl + dpu);
6561
}
6662

6763
//----------------------------------------------------------------------------
6864
// calculate low-level shear
6965
if (state_pmid(pver - 1) > ZMC::MCSP_storm_speed_pref) {
70-
storm_u_shear = storm_u - state_u(pver - 1);
71-
storm_v_shear = storm_v - state_v(pver - 1);
66+
mcsp_shear = storm_u - state_u(pver - 1);
7267
} else {
73-
storm_u_shear = -999.0;
74-
storm_v_shear = -999.0;
68+
mcsp_shear = -999.0;
7569
}
76-
mcsp_shear = storm_u_shear;
7770
});
7871
}
7972

0 commit comments

Comments
 (0)