@@ -1539,6 +1539,7 @@ subroutine tphysac (ztodt, cam_in, &
15391539 real (r8 ) :: tmp_trac (pcols,pver,pcnst) ! tmp space
15401540 real (r8 ) :: tmp_pdel (pcols,pver) ! tmp space
15411541 real (r8 ) :: tmp_ps (pcols) ! tmp space
1542+ real (r8 ) :: tmp_cpcv (pcols,pver) ! tmp space
15421543 real (r8 ) :: scaling(pcols,pver)
15431544 logical :: moist_mixing_ratio_dycore
15441545
@@ -2497,12 +2498,6 @@ subroutine tphysac (ztodt, cam_in, &
24972498 ! FV: convert dry-type mixing ratios to moist here because physics_dme_adjust
24982499 ! assumes moist. This is done in p_d_coupling for other dynamics. Bundy, Feb 2004.
24992500 moist_mixing_ratio_dycore = dycore_is(' LR' ).or. dycore_is(' FV3' )
2500- !
2501- ! update cp/cv for energy computation based in updated water variables
2502- !
2503- call cam_thermo_water_update(state% q(:ncol,:,:), lchnk, ncol, vc_dycore,&
2504- to_dry_factor= state% pdel(:ncol,:)/ state% pdeldry(:ncol,:))
2505-
25062501 ! for dry mixing ratio dycore, physics_dme_adjust is called for energy diagnostic purposes only.
25072502 ! So, save off tracers
25082503 if (.not. moist_mixing_ratio_dycore) then
@@ -2515,10 +2510,17 @@ subroutine tphysac (ztodt, cam_in, &
25152510 tmp_trac(:ncol,:pver,:pcnst) = state% q(:ncol,:pver,:pcnst)
25162511 tmp_pdel(:ncol,:pver) = state% pdel(:ncol,:pver)
25172512 tmp_ps(:ncol) = state% ps(:ncol)
2513+ tmp_cpcv(:ncol,:pver) = cp_or_cv_dycore(:ncol,:pver,lchnk)
25182514 if (trim (cam_take_snapshot_before) == " physics_dme_adjust" ) then
25192515 call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,&
25202516 fh2o, surfric, obklen, flx_heat, cmfmc, dlf, det_s, det_ice, net_flx)
25212517 end if
2518+ !
2519+ ! update cp/cv for energy computation based in updated water variables
2520+ !
2521+ call cam_thermo_water_update(state% q(:ncol,:,:), lchnk, ncol, vc_dycore,&
2522+ to_dry_factor= state% pdel(:ncol,:)/ state% pdeldry(:ncol,:))
2523+
25222524 call physics_dme_adjust(state, tend, qini, totliqini, toticeini, ztodt)
25232525 if (trim (cam_take_snapshot_after) == " physics_dme_adjust" ) then
25242526 call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,&
@@ -2530,6 +2532,7 @@ subroutine tphysac (ztodt, cam_in, &
25302532 state% q(:ncol,:pver,:pcnst) = tmp_trac(:ncol,:pver,:pcnst)
25312533 state% pdel(:ncol,:pver) = tmp_pdel(:ncol,:pver)
25322534 state% ps(:ncol) = tmp_ps(:ncol)
2535+ cp_or_cv_dycore(:ncol,:pver,lchnk) = tmp_cpcv(:ncol,:pver)
25332536 end if
25342537 else
25352538 !
0 commit comments