New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 3359 for branches/2012/dev_r3337_NOCS10_ICB/NEMOGCM/NEMO/OPA_SRC/ICB/icbclv.F90 – NEMO

Ignore:
Timestamp:
2012-04-18T12:42:56+02:00 (12 years ago)
Author:
sga
Message:

NEMO branch dev_r3337_NOCS10_ICB: make code conform to NEMO coding conventions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_r3337_NOCS10_ICB/NEMOGCM/NEMO/OPA_SRC/ICB/icbclv.F90

    r3339 r3359  
    1414   !!   accumulate_calving      : 
    1515   !!   icb_gen       : generate test icebergs 
    16    !!   icb_nam       : read iceberg namelist 
    1716   !!---------------------------------------------------------------------- 
    1817   USE par_oce        ! NEMO parameters 
     
    2928   PRIVATE 
    3029 
    31    PUBLIC   accumulate_calving  ! routine called in xxx.F90 module 
    32    PUBLIC   calve_icebergs      ! routine called in xxx.F90 module 
     30   PUBLIC   accumulate_calving  ! routine called in icbrun.F90 module 
     31   PUBLIC   calve_icebergs      ! routine called in icbrun.F90 module 
    3332 
    3433CONTAINS 
     
    4342      !!---------------------------------------------------------------------- 
    4443      ! 
    45       INTEGER                         :: kt 
    46       REAL(wp)                        :: calving_used, rdist, ufact 
    47       INTEGER                         :: jn, ji, jj, nmax 
    48       LOGICAL, SAVE                   :: first_call = .TRUE. 
     44      INTEGER, INTENT(in)             :: kt 
     45      ! 
     46      REAL(wp)                        :: zcalving_used, zdist, zfact 
     47      INTEGER                         :: jn, ji, jj                    ! loop counters 
     48      INTEGER                         :: imx                           ! temporary integer for max berg class 
     49      LOGICAL, SAVE                   :: ll_first_call = .TRUE. 
    4950      !!---------------------------------------------------------------------- 
    5051      ! 
     
    5253      ! Use interior mask: so no bergs in overlap areas and convert from km^3/year to kg/s 
    5354      ! this assumes that input is given as equivalent water flux so that pure water density is appropriate 
    54       ufact = ( (1000._wp)**3 / ( NINT(rday) * nyear_len(1) ) ) * 1000._wp 
    55       berg_grid%calving(:,:) = p_calving(:,:) * tmask_i(:,:) * ufact 
     55      zfact = ( (1000._wp)**3 / ( NINT(rday) * nyear_len(1) ) ) * 1000._wp 
     56      berg_grid%calving(:,:) = src_calving(:,:) * tmask_i(:,:) * zfact 
    5657 
    5758      ! Heat in units of W/m2, and mask (just in case) 
    58       berg_grid%calving_hflx(:,:) = p_calving_hflx(:,:) * tmask_i(:,:) 
     59      berg_grid%calving_hflx(:,:) = src_calving_hflx(:,:) * tmask_i(:,:) 
    5960 
    60       IF( first_call .AND. .NOT.restarted_bergs) THEN      ! This is a hack to simplify initialization 
    61          first_call = .FALSE. 
     61      IF( ll_first_call .AND. .NOT. l_restarted_bergs) THEN      ! This is a hack to simplify initialization 
     62         ll_first_call = .FALSE. 
    6263         !do jn=1, nclasses 
    6364         !  where (berg_grid%calving==0.) berg_grid%stored_ice(:,:,jn)=0. 
     
    7778      DO jj = 1,jpj 
    7879         DO ji = 1,jpi 
    79             nmax = berg_grid%maxclass(ji,jj) 
    80             rdist = SUM( rn_distribution(1:nclasses) ) / SUM( rn_distribution(1:nmax) ) 
    81             DO jn = 1, nmax 
     80            imx = berg_grid%maxclass(ji,jj) 
     81            zdist = SUM( rn_distribution(1:nclasses) ) / SUM( rn_distribution(1:imx) ) 
     82            DO jn = 1, imx 
    8283               berg_grid%stored_ice(ji,jj,jn) = berg_grid%stored_ice(ji,jj,jn) + & 
    83                                           berg_dt * berg_grid%calving(ji,jj) * rn_distribution(jn) * rdist 
     84                                          berg_dt * berg_grid%calving(ji,jj) * rn_distribution(jn) * zdist 
    8485            END DO 
    8586         END DO 
     
    8788 
    8889      ! before changing the calving, save the amount we're about to use and do budget 
    89       calving_used = SUM( berg_grid%calving(:,:) ) 
     90      zcalving_used = SUM( berg_grid%calving(:,:) ) 
    9091      berg_grid%tmp(:,:) = berg_dt * berg_grid%calving_hflx(:,:) * e1e2t(:,:) * tmask_i(:,:) 
    9192      berg_grid%stored_heat (:,:) = berg_grid%stored_heat (:,:) + berg_grid%tmp(:,:) 
    92       CALL incoming_budget( kt,  calving_used, berg_grid%tmp ) 
     93      CALL incoming_budget( kt,  zcalving_used, berg_grid%tmp ) 
    9394      ! 
    9495   END SUBROUTINE accumulate_calving 
    95  
    96 ! ############################################################################## 
    9796 
    9897   SUBROUTINE calve_icebergs() 
     
    114113      TYPE(iceberg)                   ::   newberg 
    115114      TYPE(point)                     ::   newpt 
    116       LOGICAL                         ::   lret 
    117       INTEGER                         ::   ji, jj, jn   ! dummy loop indices 
    118       REAL(wp)                        ::   xi, yj, ddt, calved_to_berg, heat_to_berg 
     115      INTEGER                         ::   ji, jj, jn                             ! dummy loop indices 
     116      REAL(wp)                        ::   zddt, zcalved_to_berg, zheat_to_berg 
    119117      !!---------------------------------------------------------------------- 
    120118 
     
    122120 
    123121      DO jn = 1, nclasses 
    124          DO jj = icbdj, icbej 
    125             DO ji = icbdi, icbei 
     122         DO jj = nicbdj, nicbej 
     123            DO ji = nicbdi, nicbei 
    126124               ! 
    127                ddt  = 0._wp 
     125               zddt  = 0._wp 
    128126               icnt = 0 
    129127               ! 
     
    140138                  newpt%mass         = rn_initial_mass     (jn) 
    141139                  newpt%thickness    = rn_initial_thickness(jn) 
    142                   newpt%width        = initial_width    (jn) 
    143                   newpt%length       = initial_length   (jn) 
     140                  newpt%width        = first_width    (jn) 
     141                  newpt%length       = first_length   (jn) 
    144142                  newberg%mass_scaling = rn_mass_scaling     (jn) 
    145143                  newpt%mass_of_bits = 0._wp                          ! no bergy 
    146144                  ! 
    147145                  newpt%year   = current_year 
    148                   newpt%day    = current_yearday + ddt / rday 
     146                  newpt%day    = current_yearday + zddt / rday 
    149147                  newpt%heat_density = berg_grid%stored_heat(ji,jj) / berg_grid%stored_ice(ji,jj,jn)   ! This is in J/kg 
    150148                  ! 
    151149                  CALL increment_kounter() 
    152                   newberg%number(:) = kount_bergs(:) 
     150                  newberg%number(:) = num_bergs(:) 
    153151                  ! 
    154152                  CALL add_new_berg_to_list( newberg, newpt ) 
    155153                  ! 
    156                   calved_to_berg = rn_initial_mass(jn) * rn_mass_scaling(jn)           ! Units of kg 
     154                  zcalved_to_berg = rn_initial_mass(jn) * rn_mass_scaling(jn)           ! Units of kg 
    157155                  !                                ! Heat content 
    158                   heat_to_berg           = calved_to_berg * newpt%heat_density             ! Units of J 
    159                   berg_grid%stored_heat(ji,jj) = berg_grid%stored_heat(ji,jj) - heat_to_berg 
     156                  zheat_to_berg           = zcalved_to_berg * newpt%heat_density             ! Units of J 
     157                  berg_grid%stored_heat(ji,jj) = berg_grid%stored_heat(ji,jj) - zheat_to_berg 
    160158                  !                                ! Stored mass 
    161                   berg_grid%stored_ice(ji,jj,jn)   = berg_grid%stored_ice(ji,jj,jn) - calved_to_berg 
     159                  berg_grid%stored_ice(ji,jj,jn)   = berg_grid%stored_ice(ji,jj,jn) - zcalved_to_berg 
    162160                  ! 
    163                   ddt  = ddt + berg_dt * 2._wp / 17._wp    ! Minor offset to start day    !!gm why??? 
     161                  zddt  = zddt + berg_dt * 2._wp / 17._wp    ! Minor offset to start day    !!gm why??? 
    164162                  icnt = icnt + 1 
    165163                  ! 
    166                   CALL calving_budget(ji, jj, jn,  calved_to_berg, heat_to_berg ) 
     164                  CALL calving_budget(ji, jj, jn,  zcalved_to_berg, zheat_to_berg ) 
    167165               END DO 
    168166               icntmax = MAX( icntmax, icnt ) 
Note: See TracChangeset for help on using the changeset viewer.