module ohc_module !version 19.0.2 !process ohc data for ships !Written by Galine Chirokova for JHT project !Modified 2020 Apr 12 (SS): modified ipohc calling argument in ! select_best_ohc !Modified 2023 Dec 27 (MD): write statement modified to remove legacy format (v19.0.2). !thsi module contains 2 subroutines: ! ! select_best_ohc - to select OHC from climo and data ! ! get_appl_ohc - to select OHC to use for a specific model, ! includinh SHIPS. LGEM, Ric20, RII Kaplan, RII Rozof, PrSef ! currently there is only one OHC option, NCODA OHC implicit none private public select_best_ohc,get_model_ohc contains subroutine select_best_ohc(iohc_max_lag_days,& imiss,& iohc,iohc_climo,& iohc_lag_days,mft,& ibest_ohc, ibest_ohc_lag_days, ipohc) !this subroutine selects OHC from data and climo implicit none !input ------------------------- integer :: iohc_max_lag_days integer,dimension(0:mft) :: iohc integer,dimension(0:mft) :: iohc_climo integer :: iohc_lag_days integer :: mft integer :: imiss !output --------------------------- !selected best available ohc integer,dimension(0:mft) :: ibest_ohc integer :: ibest_ohc_lag_days integer :: ipohc !local ------------------------------ !iterator integer :: k ibest_ohc = iohc_climo do k = 0,mft if ( ( iohc(k) .lt. imiss ) & .and. ( iohc_lag_days .lt. iohc_max_lag_days ) ) then ibest_ohc(k) = iohc(k) ibest_ohc_lag_days = iohc_lag_days ipohc = 0 else ibest_ohc(k) = iohc_climo(k) ibest_ohc_lag_days = iohc_max_lag_days if ( k .eq. 0 ) then ipohc = 3 else ipohc = 1 endif endif enddo if ( ( iohc(0) .lt. imiss ) & .and. ( iohc_lag_days .lt. iohc_max_lag_days ) ) ipohc = 0 end subroutine select_best_ohc subroutine get_model_ohc(mft,& cohc_type_model,& rthresh,& iohc_sm,& iohc_final_ncoda, & iohc_model,& iohc_sm_model,& ohc_thresh_model,lulg) ! this subroutine selcts OHC to be used by the model implicit none !input ----------------------------- ! nu,ber of forecast times integer :: mft ! min OHC to use real :: rthresh ! OHC basin sample mean integer :: iohc_sm ! NCODA OHC selected from data and climo integer,dimension(0:mft) :: iohc_final_ncoda ! type of OHC to use - only NCODA OHC for now character(len=4) :: cohc_type_model ! logical unit for log file integer :: lulg !output ----------------------------- ! final OHC for current model integer,dimension(0:mft) :: iohc_model ! OHC threshold for current model real :: ohc_thresh_model ! OHC sample mean for current model integer :: iohc_sm_model ! local -------------- ! iterator integer :: k do k=0,mft !print*, "LOGGING: selecting SHIPS,LGEM, ric2o OHC for ft k = ", k if (cohc_type_model .eq. 'nohc' ) then iohc_model(k) = iohc_final_ncoda(k) ohc_thresh_model = rthresh iohc_sm_model = iohc_sm else write(lulg,*) "ERROR: sst_module.f90: get_model_ohc ",& " Non supported OHC type ", & cohc_type_model, & " Will STOP now " stop endif enddo end subroutine get_model_ohc end module ohc_module