diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 0b1d2ce538..9f63646b32 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -65,7 +65,7 @@ required = True [oslo_aero] protocol = git -hash = 87f76b3 +hash = 2414f85 repo_url = https://github.com/NorESMhub/OSLO_AERO local_path = src/chemistry/oslo_aero required = True diff --git a/src/control/camsrfexch.F90 b/src/control/camsrfexch.F90 index 280774ae51..44812d67ff 100644 --- a/src/control/camsrfexch.F90 +++ b/src/control/camsrfexch.F90 @@ -44,6 +44,7 @@ module camsrfexch real(r8) :: topo(pcols) ! surface topographic height (m) real(r8) :: ubot(pcols) ! bot level u wind real(r8) :: vbot(pcols) ! bot level v wind + real(r8) :: wind_dir(pcols) ! direction of bottom level wind real(r8) :: qbot(pcols,pcnst) ! bot level specific humidity real(r8) :: pbot(pcols) ! bot level pressure real(r8) :: rho(pcols) ! bot level density @@ -296,6 +297,7 @@ subroutine atm2hub_alloc( cam_out ) cam_out(c)%topo(:) = 0._r8 cam_out(c)%ubot(:) = 0._r8 cam_out(c)%vbot(:) = 0._r8 + cam_out(c)%wind_dir(:) = 0._r8 cam_out(c)%qbot(:,:) = 0._r8 cam_out(c)%pbot(:) = 0._r8 cam_out(c)%rho(:) = 0._r8 @@ -436,6 +438,7 @@ subroutine cam_export(state,cam_out,pbuf) integer :: prec_dp_idx, snow_dp_idx, prec_sh_idx, snow_sh_idx integer :: prec_sed_idx,snow_sed_idx,prec_pcw_idx,snow_pcw_idx integer :: srf_ozone_idx, lightning_idx + real(r8):: ubot, vbot real(r8), pointer :: psl(:) @@ -503,6 +506,15 @@ subroutine cam_export(state,cam_out,pbuf) cam_out%pbot(i) = state%pmid(i,pver) cam_out%psl(i) = psl(i) cam_out%rho(i) = cam_out%pbot(i)/(rair*cam_out%tbot(i)) + + ! Direction of bottom level wind + ubot = state%u(i,pver) + vbot = state%v(i,pver) + if ((ubot == 0.0_r8) .and. (vbot == 0.0_r8)) then + cam_out%wind_dir(i) = 0.0_r8 ! Default to U for zero wind + else + cam_out%wind_dir(i) = atan2(vbot,ubot) + end if end do do m = 1, pcnst do i = 1, ncol diff --git a/src/cpl/nuopc/atm_comp_nuopc.F90 b/src/cpl/nuopc/atm_comp_nuopc.F90 index 8b2ba903d0..0fb6a22c68 100644 --- a/src/cpl/nuopc/atm_comp_nuopc.F90 +++ b/src/cpl/nuopc/atm_comp_nuopc.F90 @@ -241,8 +241,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call set_component_logging(gcomp, localpet==0, iulog, shrlogunit, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_log_setLogUnit (iulog) - !---------------------------------------------------------------------------- ! advertise import/export fields !---------------------------------------------------------------------------- @@ -316,6 +314,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_sys_abort(subname//'Need to set attribute mediator_present') endif + ! reset shr logging to original values + call shr_log_setLogUnit (shrlogunit) if (dbug_flag > 5) then call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) end if diff --git a/src/cpl/nuopc/atm_import_export.F90 b/src/cpl/nuopc/atm_import_export.F90 index 7eeec9a523..07b7f46ae3 100644 --- a/src/cpl/nuopc/atm_import_export.F90 +++ b/src/cpl/nuopc/atm_import_export.F90 @@ -13,7 +13,9 @@ module atm_import_export use shr_mpi_mod , only : shr_mpi_min, shr_mpi_max use nuopc_shr_methods , only : chkerr 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 @@ -155,6 +157,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, rc) dms_from_ocn = .false. end if if (masterproc) write(iulog,'(a,l)') trim(subname)//'dms_from_ocn = ',dms_from_ocn + write(6,'(a,l)')trim(subname)//'dms_from_ocn = ',dms_from_ocn call NUOPC_CompAttributeGet(gcomp, name='flds_brf', value=cvalue, ispresent=ispresent, isset=isset, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -194,6 +197,8 @@ subroutine advertise_fields(gcomp, flds_scalar_name, rc) call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_z' ) call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_u' ) call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_v' ) + call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_u10m' ) + call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_v10m' ) call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_tbot' ) call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_ptem' ) call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_shum' ) @@ -578,6 +583,7 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc) real(r8), pointer :: fldptr_tauy(:) real(r8), pointer :: fldptr_sen(:) real(r8), pointer :: fldptr_evap(:) + integer :: pndx_fdms ! DMS surface flux physics index logical, save :: first_time = .true. character(len=*), parameter :: subname='(atm_import_export:import_fields)' !--------------------------------------------------------------------------- @@ -886,12 +892,16 @@ 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.) g = 1 do c = begchunk,endchunk do i = 1,get_ncols_p(c) cam_in(c)%fdms(i) = -fldptr1d(g) * med2mod_areacor(g) + cam_in(c)%cflx(i,pndx_fdms) = cam_in(c)%fdms(i) g = g + 1 end do + ncols = get_ncols_p(c) + call outfld( sflxnam(pndx_fdms), cam_in(c)%cflx(:ncols,pndx_fdms), ncols, c) end do end if @@ -1025,17 +1035,19 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc) ! local variables type(ESMF_State) :: exportState + 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 - ! 2d pointers + real(r8) :: wind_dir + ! 2d output pointers real(r8), pointer :: fldptr_ndep(:,:) real(r8), pointer :: fldptr_bcph(:,:) , fldptr_ocph(:,:) real(r8), pointer :: fldptr_dstwet(:,:), fldptr_dstdry(:,:) - ! 1d pointers + ! 1d output pointers real(r8), pointer :: fldptr_soll(:) , fldptr_sols(:) real(r8), pointer :: fldptr_solld(:) , fldptr_solsd(:) real(r8), pointer :: fldptr_snowc(:) , fldptr_snowl(:) @@ -1049,13 +1061,17 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc) real(r8), pointer :: fldptr_co2prog(:) , fldptr_co2diag(:) real(r8), pointer :: fldptr_ozone(:) real(r8), pointer :: fldptr_lght(:) + real(r8), pointer :: fldptr_u10m(:) + real(r8), pointer :: fldptr_v10m(:) + ! import state pointer + real(r8), pointer :: fldptr_wind10m(:) character(len=*), parameter :: subname='(atm_import_export:export_fields)' !--------------------------------------------------------------------------- rc = ESMF_SUCCESS ! Get export state - call NUOPC_ModelGet(gcomp, exportState=exportState, rc=rc) + call NUOPC_ModelGet(gcomp, exportState=exportState, importState=importState, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! required export state variables @@ -1079,6 +1095,19 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getfldptr(exportState, 'Sa_pslv', fldptr=fldptr_pslv, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getfldptr(exportState, 'Sa_u10m', fldptr=fldptr_u10m, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getfldptr(exportState, 'Sa_v10m', fldptr=fldptr_v10m, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getfldptr(importState, 'Sx_u10' , fldptr=fldptr_wind10m, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! The 10m wind speed over ocean obtained from the atm/ocn flux computation in the mediator + ! and is merged with the 10m wind speed obtained from the land ice ice components + ! This computation for 10m wind speed will have used the bottom level winds from cam sent + ! at the previous time + ! The decomposition of the 10m wind into its zonal and meridional components is done using + ! the bottom level u and v fields from cam (at the current time) g = 1 do c = begchunk,endchunk do i = 1,get_ncols_p(c) @@ -1092,6 +1121,9 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc) fldptr_dens(g) = cam_out(c)%rho(i) fldptr_ptem(g) = cam_out(c)%thbot(i) fldptr_pslv(g) = cam_out(c)%psl(i) + wind_dir = cam_out(c)%wind_dir(i) + fldptr_u10m(g) = fldptr_wind10m(g)*cos(wind_dir) + fldptr_v10m(g) = fldptr_wind10m(g)*sin(wind_dir) g = g + 1 end do end do diff --git a/src/physics/cam/phys_control.F90 b/src/physics/cam/phys_control.F90 index 92ccac1335..bd723cacf2 100644 --- a/src/physics/cam/phys_control.F90 +++ b/src/physics/cam/phys_control.F90 @@ -10,10 +10,10 @@ module phys_control ! Add vars to indicate physics version and chemistry type. !----------------------------------------------------------------------- -use spmd_utils, only: masterproc -use cam_logfile, only: iulog -use cam_abortutils, only: endrun -use shr_kind_mod, only: r8 => shr_kind_r8, cl=>shr_kind_cl +use spmd_utils, only: masterproc +use cam_logfile, only: iulog +use cam_abortutils, only: endrun +use shr_kind_mod, only: r8 => shr_kind_r8, cl=>shr_kind_cl implicit none private @@ -56,7 +56,7 @@ module phys_control logical :: history_aerosol = .false. ! output the MAM aerosol variables and tendencies logical :: history_aero_optics = .false. ! output the aerosol logical :: history_eddy = .false. ! output the eddy variables -logical :: history_budget = .false. ! output tendencies and state variables for T, water vapor, +logical :: history_budget = .false. ! output tendencies and state variables for T, water vapor, ! cloud ice and cloud liquid budgets logical :: convproc_do_aer = .false. ! switch for new convective scavenging treatment for modal aerosols