Skip to content

Commit 0d81f21

Browse files
committed
Merge branch 'development' into develop/mpas-dycore-refactor
2 parents 6cb6097 + 403f1a3 commit 0d81f21

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/cpl/nuopc/atm_import_export.F90

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
469469
use physconst , only : mwco2
470470
use time_manager , only : is_first_step, get_nstep
471471
use physics_grid , only : columns_on_task
472+
use runtime_obj , only : wv_stdname
473+
use ccpp_scheme_utils , only : ccpp_constituent_index
472474

473475
! input/output variabes
474476
type(ESMF_GridComp) :: gcomp
@@ -479,12 +481,15 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
479481
! local variables
480482
type(ESMF_State) :: importState
481483
integer :: i,n ! loop indices
484+
integer :: ierr
482485
integer :: nstep
486+
integer :: wv_const_index
483487
logical :: overwrite_flds
484488
logical :: exists
485489
logical :: exists_fco2_ocn
486490
logical :: exists_fco2_lnd
487491
character(len=128) :: fldname
492+
character(len=512) :: errmsg
488493
real(r8), pointer :: fldptr2d(:,:)
489494
real(r8), pointer :: fldptr1d(:)
490495
real(r8), pointer :: fldptr_lat(:)
@@ -522,6 +527,14 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
522527
overwrite_flds = .true.
523528
if (present(restart_init)) overwrite_flds = .not. restart_init
524529

530+
! Find CCPP constituents index for water vapor,
531+
! as it is needed to properly pass evaporation into
532+
! the constituent fluxes array:
533+
call ccpp_constituent_index(wv_stdname, wv_const_index, ierr, errmsg)
534+
if (ierr /= 0) then
535+
call shr_sys_abort(subname//':: Failed to get water vapor CCPP constituent index with the following error: '//errmsg)
536+
end if
537+
525538
!--------------------------
526539
! Required atmosphere input fields
527540
!--------------------------
@@ -536,10 +549,13 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
536549
call state_getfldptr(importState, 'Faxx_evap', fldptr=fldptr_evap, rc=rc)
537550
if (ChkErr(rc,__LINE__,u_FILE_u)) return
538551
do i = 1, columns_on_task
539-
cam_in%wsx(i) = -fldptr_taux(i) * med2mod_areacor(i)
540-
cam_in%wsy(i) = -fldptr_tauy(i) * med2mod_areacor(i)
541-
cam_in%shf(i) = -fldptr_sen(i) * med2mod_areacor(i)
542-
cam_in%cflx(i,1) = -fldptr_evap(i) * med2mod_areacor(i)
552+
cam_in%wsx(i) = -fldptr_taux(i) * med2mod_areacor(i)
553+
cam_in%wsy(i) = -fldptr_tauy(i) * med2mod_areacor(i)
554+
cam_in%shf(i) = -fldptr_sen(i) * med2mod_areacor(i)
555+
!Add water vapor to constituent fluxes array if present:
556+
if (wv_const_index > 0) then
557+
cam_in%cflx(i, wv_const_index) = -fldptr_evap(i) * med2mod_areacor(i)
558+
end if
543559
end do
544560
end if ! end of overwrite_flds
545561

@@ -678,7 +694,7 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
678694
#endif
679695

680696
#if 0
681-
! Ignoring depvel for now as it has a problematic second dimension (number of dry deposited species)
697+
! Ignoring depvel for now as it has a problematic second dimension (number of dry deposited species)
682698
! and it was determined that it probably will not be used in CAM-SIMA for some time
683699
! dry dep velocities
684700
call state_getfldptr(importState, 'Sl_ddvel', fldptr2d=fldptr2d, exists=exists, rc=rc)

0 commit comments

Comments
 (0)