diff --git a/cicecore/cicedynB/analysis/ice_history.F90 b/cicecore/cicedynB/analysis/ice_history.F90 index 38a4cf9d8..11498d9e4 100644 --- a/cicecore/cicedynB/analysis/ice_history.F90 +++ b/cicecore/cicedynB/analysis/ice_history.F90 @@ -30,8 +30,8 @@ module ice_history use ice_kinds_mod - use ice_constants, only: c0, c1, c2, c100, p001, p25, p5, & - mps_to_cmpdy, kg_to_g, spval + use ice_constants, only: c0, c1, c2, c100, c360, c180, & + p001, p25, p5, mps_to_cmpdy, kg_to_g, spval use ice_fileunits, only: nu_nml, nml_filename, nu_diag, & get_fileunit, release_fileunit use ice_exit, only: abort_ice @@ -81,7 +81,7 @@ subroutine init_hist (dt) ! local variables - real (kind=dbl_kind) :: rhofresh, Tffresh, secday + real (kind=dbl_kind) :: rhofresh, Tffresh, secday, rad_to_deg logical (kind=log_kind) :: formdrag logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond, tr_aero, tr_brine logical (kind=log_kind) :: skl_bgc, solve_zsal, solve_zbgc, z_tracers @@ -96,7 +96,7 @@ subroutine init_hist (dt) !----------------------------------------------------------------- call icepack_query_parameters(rhofresh_out=rhofresh, Tffresh_out=Tffresh, & - secday_out=secday) + secday_out=secday, rad_to_deg_out=rad_to_deg) call icepack_query_parameters(formdrag_out=formdrag, skl_bgc_out=skl_bgc, & solve_zsal_out=solve_zsal, solve_zbgc_out=solve_zbgc, z_tracers_out=z_tracers) call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & @@ -302,6 +302,8 @@ subroutine init_hist (dt) call broadcast_scalar (f_vvel, master_task) call broadcast_scalar (f_uatm, master_task) call broadcast_scalar (f_vatm, master_task) + call broadcast_scalar (f_atmspd, master_task) + call broadcast_scalar (f_atmdir, master_task) call broadcast_scalar (f_sice, master_task) call broadcast_scalar (f_fswup, master_task) call broadcast_scalar (f_fswdn, master_task) @@ -314,6 +316,8 @@ subroutine init_hist (dt) call broadcast_scalar (f_sss, master_task) call broadcast_scalar (f_uocn, master_task) call broadcast_scalar (f_vocn, master_task) + call broadcast_scalar (f_ocnspd, master_task) + call broadcast_scalar (f_ocndir, master_task) call broadcast_scalar (f_frzmlt, master_task) call broadcast_scalar (f_fswfac, master_task) call broadcast_scalar (f_fswint_ai, master_task) @@ -404,6 +408,7 @@ subroutine init_hist (dt) call broadcast_scalar (f_sistryubot, master_task) call broadcast_scalar (f_sicompstren, master_task) call broadcast_scalar (f_sispeed, master_task) + call broadcast_scalar (f_sidir, master_task) call broadcast_scalar (f_sialb, master_task) call broadcast_scalar (f_sihc, master_task) call broadcast_scalar (f_sisnhc, master_task) @@ -540,6 +545,16 @@ subroutine init_hist (dt) "atm velocity (y)", & "positive is y direction on U grid", c1, c0, & ns1, f_vatm) + + call define_hist_field(n_atmspd,"atmspd","m/s",ustr2D, ucstr, & + "atmosphere wind speed", & + "vector magnitude", c1, c0, & + ns1, f_atmspd) + + call define_hist_field(n_atmdir,"atmdir","deg",ustr2D, ucstr, & + "atmosphere wind direction", & + "vector direction - coming from", c1, c0, & + ns1, f_atmdir) call define_hist_field(n_sice,"sice","ppt",tstr2D, tcstr, & "bulk ice salinity", & @@ -600,6 +615,16 @@ subroutine init_hist (dt) "ocean current (y)", & "positive is y direction on U grid", c1, c0, & ns1, f_vocn) + + call define_hist_field(n_ocnspd,"ocnspd","m/s",ustr2D, ucstr, & + "ocean current speed", & + "vector magnitude", c1, c0, & + ns1, f_ocnspd) + + call define_hist_field(n_ocndir,"ocndir","deg",ustr2D, ucstr, & + "ocean current direction", & + "vector direction - going to", c1, c0, & + ns1, f_ocndir) call define_hist_field(n_frzmlt,"frzmlt","W/m^2",tstr2D, tcstr, & "freeze/melt potential", & @@ -1148,6 +1173,11 @@ subroutine init_hist (dt) "ice speed", & "none", c1, c0, & ns1, f_sispeed) + + call define_hist_field(n_sidir,"sidir","deg",ustr2D, ucstr, & + "ice direction", & + "vector direction - going to", c1, c0, & + ns1, f_sidir) call define_hist_field(n_sialb,"sialb","1",tstr2D, tcstr, & "sea ice albedo", & @@ -1692,7 +1722,7 @@ subroutine accum_hist (dt) real (kind=dbl_kind), dimension (nx_block,ny_block,ncat_hist) :: & ravgipn, worka3 - real (kind=dbl_kind) :: awtvdr, awtidr, awtvdf, awtidf, puny, secday + real (kind=dbl_kind) :: awtvdr, awtidr, awtvdf, awtidf, puny, secday, rad_to_deg real (kind=dbl_kind) :: Tffresh, rhoi, rhos, rhow, ice_ref_salinity real (kind=dbl_kind) :: rho_ice, rho_ocn, Tice, Sbr, phi, rhob, dfresh, dfsalt logical (kind=log_kind) :: formdrag, skl_bgc @@ -1706,7 +1736,8 @@ subroutine accum_hist (dt) character(len=*), parameter :: subname = '(accum_hist)' call icepack_query_parameters(awtvdr_out=awtvdr, awtidr_out=awtidr, & - awtvdf_out=awtvdf, awtidf_out=awtidf, puny_out=puny, secday_out=secday) + awtvdf_out=awtvdf, awtidf_out=awtidf, puny_out=puny, secday_out=secday, & + rad_to_deg_out=rad_to_deg) call icepack_query_parameters(Tffresh_out=Tffresh, rhoi_out=rhoi, rhos_out=rhos, & rhow_out=rhow, ice_ref_salinity_out=ice_ref_salinity) call icepack_query_parameters(formdrag_out=formdrag, skl_bgc_out=skl_bgc, ktherm_out=ktherm) @@ -1814,7 +1845,21 @@ subroutine accum_hist (dt) call accum_hist_field(n_uatm, iblk, uatm(:,:,iblk), a2D) if (f_vatm (1:1) /= 'x') & call accum_hist_field(n_vatm, iblk, vatm(:,:,iblk), a2D) - + if (f_atmspd (1:1) /= 'x') & + call accum_hist_field(n_atmspd, iblk, sqrt( & + (uatm(:,:,iblk)*uatm(:,:,iblk)) + & + (vatm(:,:,iblk)*vatm(:,:,iblk))), a2D) + if (f_atmdir(1:1) /= 'x') then + worka(:,:) = c0 + do j = jlo, jhi + do i = ilo, ihi + if (abs(uatm(i,j,iblk)) > puny .or. abs(vatm(i,j,iblk)) > puny) & + worka(i,j) = atan2(uatm(i,j,iblk),vatm(i,j,iblk))*rad_to_deg + worka(i,j) = worka(i,j) + c180 + enddo + enddo + call accum_hist_field(n_atmdir, iblk, worka(:,:), a2D) + endif if (f_sice (1:1) /= 'x') then do j = jlo, jhi do i = ilo, ihi @@ -1852,6 +1897,25 @@ subroutine accum_hist (dt) call accum_hist_field(n_uocn, iblk, uocn(:,:,iblk), a2D) if (f_vocn (1:1) /= 'x') & call accum_hist_field(n_vocn, iblk, vocn(:,:,iblk), a2D) + if (f_ocnspd (1:1) /= 'x') & + call accum_hist_field(n_ocnspd, iblk, sqrt( & + (uocn(:,:,iblk)*uocn(:,:,iblk)) + & + (vocn(:,:,iblk)*vocn(:,:,iblk))), a2D) + if (f_ocndir(1:1) /= 'x') then + worka(:,:) = c0 + do j = jlo, jhi + do i = ilo, ihi + if (abs(uocn(i,j,iblk)) > puny .or. abs(vocn(i,j,iblk)) > puny) & + worka(i,j) = atan2(uocn(i,j,iblk),vocn(i,j,iblk))*rad_to_deg + if (worka(i,j) < 0.0 ) then + worka(i,j) = worka(i,j) + c360 + else + worka(i,j) = worka(i,j) * c1 + endif + enddo + enddo + call accum_hist_field(n_ocndir, iblk, worka(:,:), a2D) + endif if (f_frzmlt (1:1) /= 'x') & call accum_hist_field(n_frzmlt, iblk, frzmlt_init(:,:,iblk), a2D) @@ -2128,7 +2192,21 @@ subroutine accum_hist (dt) enddo call accum_hist_field(n_sispeed, iblk, worka(:,:), a2D) endif - + if (f_sidir(1:1) /= 'x') then + worka(:,:) = c0 + do j = jlo, jhi + do i = ilo, ihi + if (abs(uvel(i,j,iblk)) > puny .or. abs(vvel(i,j,iblk)) > puny) & + worka(i,j) = atan2(uvel(i,j,iblk),vvel(i,j,iblk))*rad_to_deg + if (worka(i,j) < 0.0 ) then + worka(i,j) = worka(i,j) + c360 + else + worka(i,j) = worka(i,j) * c1 + endif + enddo + enddo + call accum_hist_field(n_sidir, iblk, worka(:,:), a2D) + endif if (f_sidmasstranx(1:1) /= 'x') then worka(:,:) = c0 do j = jlo, jhi diff --git a/cicecore/cicedynB/analysis/ice_history_shared.F90 b/cicecore/cicedynB/analysis/ice_history_shared.F90 index 8cf3ef0e5..d950cabdc 100644 --- a/cicecore/cicedynB/analysis/ice_history_shared.F90 +++ b/cicecore/cicedynB/analysis/ice_history_shared.F90 @@ -56,7 +56,7 @@ module ice_history_shared ! (1) Add to frequency flags (f_) ! (2) Add to namelist (here and also in ice_in) ! (3) Add to index list - ! In init_hist: + ! In init_hist (in ice_history.F90): ! (4) Add define_hist_field call with vname, vdesc, vunit, ! and vcomment, vcellmeas, and conversion factor if necessary. ! (5) Add flag to broadcast list @@ -188,12 +188,14 @@ module ice_history_shared f_Tsfc = 'm', f_aice = 'm', & f_uvel = 'm', f_vvel = 'm', & f_uatm = 'm', f_vatm = 'm', & + f_atmspd = 'm', f_atmdir = 'm', & f_fswup = 'm', & f_fswdn = 'm', f_flwdn = 'm', & f_snow = 'm', f_snow_ai = 'm', & f_rain = 'm', f_rain_ai = 'm', & f_sst = 'm', f_sss = 'm', & f_uocn = 'm', f_vocn = 'm', & + f_ocnspd = 'm', f_ocndir = 'm', & f_sice = 'm', f_frzmlt = 'm', & f_fswfac = 'm', f_fswint_ai = 'x', & f_fswabs = 'm', f_fswabs_ai = 'm', & @@ -235,11 +237,12 @@ module ice_history_shared f_mlt_onset = 'm', f_frz_onset = 'm', & f_iage = 'm', f_FY = 'm', & f_hisnap = 'm', f_aisnap = 'm', & - f_CMIP = 'x', & + f_CMIP = 'x' , & f_sithick = 'x', f_sisnthick = 'x', & - f_siage = 'x', & + f_siage = 'x', & f_sitemptop = 'x', f_sitempsnic = 'x', & - f_sitempbot = 'x', f_sispeed = 'x', & + f_sitempbot = 'x', & + f_sispeed = 'x', f_sidir = 'x', & f_siu = 'x', f_siv = 'x', & f_sidmasstranx = 'x', f_sidmasstrany = 'x', & f_sistrxdtop = 'x', f_sistrydtop = 'x', & @@ -328,12 +331,14 @@ module ice_history_shared f_Tsfc, f_aice , & f_uvel, f_vvel , & f_uatm, f_vatm , & + f_atmspd, f_atmdir , & f_fswup, & f_fswdn, f_flwdn , & f_snow, f_snow_ai , & f_rain, f_rain_ai , & f_sst, f_sss , & f_uocn, f_vocn , & + f_ocnspd, f_ocndir , & f_sice, f_frzmlt , & f_fswfac, f_fswint_ai, & f_fswabs, f_fswabs_ai, & @@ -379,7 +384,8 @@ module ice_history_shared f_sithick, f_sisnthick, & f_siage, & f_sitemptop, f_sitempsnic,& - f_sitempbot, f_sispeed, & + f_sitempbot, & + f_sispeed, f_sidir, & f_siu, f_siv, & f_sidmasstranx, f_sidmasstrany, & f_sistrxdtop, f_sistrydtop, & @@ -484,6 +490,7 @@ module ice_history_shared n_Tsfc , n_aice , & n_uvel , n_vvel , & n_uatm , n_vatm , & + n_atmspd , n_atmdir , & n_sice , & n_fswup , & n_fswdn , n_flwdn , & @@ -491,6 +498,7 @@ module ice_history_shared n_rain , n_rain_ai , & n_sst , n_sss , & n_uocn , n_vocn , & + n_ocnspd , n_ocndir , & n_frzmlt , n_fswfac , & n_fswint_ai , & n_fswabs , n_fswabs_ai , & @@ -535,7 +543,8 @@ module ice_history_shared n_sithick , n_sisnthick , & n_siage, & n_sitemptop , n_sitempsnic , & - n_sitempbot , n_sispeed, & + n_sitempbot , & + n_sispeed , n_sidir , & n_siu, n_siv, & n_sidmasstranx, n_sidmasstrany, & n_sistrxdtop, n_sistrydtop, &