diff --git a/src/cpl/nuopc/atm_import_export.F90 b/src/cpl/nuopc/atm_import_export.F90 index cc2dd626a3..eea2b5b3b2 100644 --- a/src/cpl/nuopc/atm_import_export.F90 +++ b/src/cpl/nuopc/atm_import_export.F90 @@ -15,7 +15,6 @@ module atm_import_export use cam_logfile , only : iulog use cam_history , only: outfld use spmd_utils , only : masterproc, mpicom - use constituents , only : cnst_get_ind, sflxnam use srf_field_check , only : set_active_Sl_ram1 use srf_field_check , only : set_active_Sl_fv use srf_field_check , only : set_active_Sl_soilw @@ -555,7 +554,6 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc) ! local variables type(ESMF_State) :: importState integer :: i,n,c,g, num ! indices - integer :: ncols ! number of columns integer :: nstep logical :: overwrite_flds logical :: exists @@ -893,7 +891,6 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc) call state_getfldptr(importState, 'Faoo_fdms_ocn', fldptr=fldptr1d, exists=exists, rc=rc) if (exists) then - call cnst_get_ind('DMS', pndx_fdms, abort=.true.) ! Ideally what should happen below is that ! cam_in%cflx(icol,pndx_fdms) should be set directly from ! fldptr1d. However, the code initializes the chemistry @@ -908,8 +905,6 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc) cam_in(c)%fdms(i) = -fldptr1d(g) * med2mod_areacor(g) g = g + 1 end do - ncols = get_ncols_p(c) - call outfld( sflxnam(pndx_fdms), cam_in(c)%fdms, ncols, c) end do end if @@ -1046,7 +1041,6 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc) type(ESMF_State) :: importState type(ESMF_Clock) :: clock integer :: i,m,c,n,g ! indices - integer :: ncols ! Number of columns integer :: nstep logical :: exists real(r8) :: scale_ndep diff --git a/src/physics/cam/restart_physics.F90 b/src/physics/cam/restart_physics.F90 index 2793e26b6e..63abd6eb8b 100644 --- a/src/physics/cam/restart_physics.F90 +++ b/src/physics/cam/restart_physics.F90 @@ -46,6 +46,11 @@ module restart_physics type(var_desc_t) :: wsy_desc type(var_desc_t) :: shf_desc + type(var_desc_t) :: fdms_desc + type(var_desc_t) :: fbrf_desc + type(var_desc_t) :: fn2o_ocn_desc + type(var_desc_t) :: fnh3_ocn_desc + CONTAINS subroutine init_restart_physics ( File, pbuf2d) @@ -128,6 +133,11 @@ subroutine init_restart_physics ( File, pbuf2d) ierr = pio_def_var(File, 'wsy', pio_double, hdimids, wsy_desc) ierr = pio_def_var(File, 'shf', pio_double, hdimids, shf_desc) + ierr = pio_def_var(File, 'fdms', pio_double, hdimids, fdms_desc) + ierr = pio_def_var(File, 'fbrf', pio_double, hdimids, fbrf_desc) + ierr = pio_def_var(File, 'fn2o_ocn', pio_double, hdimids, fn2o_ocn_desc) + ierr = pio_def_var(File, 'fnh3_ocn', pio_double, hdimids, fnh3_ocn_desc) + call radiation_define_restart(file) if (is_subcol_on()) then @@ -328,6 +338,30 @@ subroutine write_restart_physics (File, cam_in, cam_out, pbuf2d) end do call pio_write_darray(File, shf_desc, iodesc, tmpfield, ierr) + do i = begchunk, endchunk + ncol = cam_in(i)%ncol + tmpfield(:ncol,i) = cam_in(i)%fdms(:ncol) + end do + call pio_write_darray(File, fdms_desc, iodesc, tmpfield, ierr) + + do i = begchunk, endchunk + ncol = cam_in(i)%ncol + tmpfield(:ncol,i) = cam_in(i)%fbrf(:ncol) + end do + call pio_write_darray(File, fbrf_desc, iodesc, tmpfield, ierr) + + do i = begchunk, endchunk + ncol = cam_in(i)%ncol + tmpfield(:ncol,i) = cam_in(i)%fn2o_ocn(:ncol) + end do + call pio_write_darray(File, fn2o_ocn_desc, iodesc, tmpfield, ierr) + + do i = begchunk, endchunk + ncol = cam_in(i)%ncol + tmpfield(:ncol,i) = cam_in(i)%fnh3_ocn(:ncol) + end do + call pio_write_darray(File, fnh3_ocn_desc, iodesc, tmpfield, ierr) + call radiation_write_restart(file) end subroutine write_restart_physics @@ -583,7 +617,43 @@ subroutine read_restart_physics(File, cam_in, cam_out, pbuf2d) cam_in(c)%shf(i) = tmpfield2(i, c) end do end do - endif + end if + ierr = pio_inq_varid(File, 'fdms', vardesc) + if (ierr == PIO_NOERR) then ! variable found on restart file + call pio_read_darray(File, vardesc, iodesc, tmpfield2, ierr) + do c= begchunk, endchunk + do i = 1, pcols + cam_in(c)%fdms(i) = tmpfield2(i, c) + end do + end do + end if + ierr = pio_inq_varid(File, 'fbrf', vardesc) + if (ierr == PIO_NOERR) then ! variable found on restart file + call pio_read_darray(File, vardesc, iodesc, tmpfield2, ierr) + do c= begchunk, endchunk + do i = 1, pcols + cam_in(c)%fbrf(i) = tmpfield2(i, c) + end do + end do + end if + ierr = pio_inq_varid(File, 'fn2o_ocn', vardesc) + if (ierr == PIO_NOERR) then ! variable found on restart file + call pio_read_darray(File, vardesc, iodesc, tmpfield2, ierr) + do c= begchunk, endchunk + do i = 1, pcols + cam_in(c)%fn2o_ocn(i) = tmpfield2(i, c) + end do + end do + end if + ierr = pio_inq_varid(File, 'fnh3_ocn', vardesc) + if (ierr == PIO_NOERR) then ! variable found on restart file + call pio_read_darray(File, vardesc, iodesc, tmpfield2, ierr) + do c= begchunk, endchunk + do i = 1, pcols + cam_in(c)%fnh3_ocn(i) = tmpfield2(i, c) + end do + end do + end if call pio_seterrorhandling(File, err_handling) deallocate(tmpfield2)