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 7698 for trunk/NEMOGCM/NEMO/OPA_SRC/LDF/ldfdyn.F90 – NEMO

Ignore:
Timestamp:
2017-02-18T10:02:03+01:00 (7 years ago)
Author:
mocavero
Message:

update trunk with OpenMP parallelization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/LDF/ldfdyn.F90

    r7646 r7698  
    155155      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'ldf_dyn_init: failed to allocate arrays') 
    156156      ! 
    157       ahmt(:,:,jpk) = 0._wp                           ! last level always 0   
    158       ahmf(:,:,jpk) = 0._wp 
     157!$OMP PARALLEL DO schedule(static) private(jj, ji) 
     158      DO jj = 1, jpj 
     159         DO ji = 1, jpi 
     160            ahmt(ji,jj,jpk) = 0._wp                           ! last level always 0   
     161            ahmf(ji,jj,jpk) = 0._wp 
     162         END DO 
     163      END DO 
    159164      ! 
    160165      !                                               ! value of eddy mixing coef. 
     
    173178         CASE(   0  )      !==  constant  ==! 
    174179            IF(lwp) WRITE(numout,*) '          momentum mixing coef. = constant ' 
    175             ahmt(:,:,:) = zah0 * tmask(:,:,:) 
    176             ahmf(:,:,:) = zah0 * fmask(:,:,:) 
     180!$OMP PARALLEL DO schedule(static) private(jk,jj,ji) 
     181            DO jk = 1, jpk 
     182               DO jj = 1, jpj 
     183                  DO ji = 1, jpi 
     184                     ahmt(ji,jj,jk) = zah0 * tmask(ji,jj,jk) 
     185                     ahmf(ji,jj,jk) = zah0 * fmask(ji,jj,jk) 
     186                  END DO 
     187               END DO 
     188            END DO 
    177189            ! 
    178190         CASE(  10  )      !==  fixed profile  ==! 
    179191            IF(lwp) WRITE(numout,*) '          momentum mixing coef. = F( depth )' 
    180             ahmt(:,:,1) = zah0 * tmask(:,:,1)                      ! constant surface value 
    181             ahmf(:,:,1) = zah0 * fmask(:,:,1) 
     192!$OMP PARALLEL DO schedule(static) private(jj, ji) 
     193            DO jj = 1, jpj 
     194               DO ji = 1, jpi 
     195                  ahmt(ji,jj,1) = zah0 * tmask(ji,jj,1)            ! constant surface value 
     196                  ahmf(ji,jj,1) = zah0 * fmask(ji,jj,1) 
     197               END DO 
     198            END DO 
    182199            CALL ldf_c1d( 'DYN', r1_4, ahmt(:,:,1), ahmf(:,:,1), ahmt, ahmf ) 
    183200            ! 
     
    191208!!              do we introduce a scaling by the max value of the array, and then multiply by zah0 ???? 
    192209!!              better:  check that the max is <=1  i.e. it is a shape from 0 to 1, not a coef that has physical dimension 
     210!$OMP PARALLEL DO schedule(static) private(jk,jj,ji) 
    193211            DO jk = 2, jpkm1 
    194                ahmt(:,:,jk) = ahmt(:,:,1) * tmask(:,:,jk) 
    195                ahmf(:,:,jk) = ahmf(:,:,1) * fmask(:,:,jk) 
     212               DO jj = 1, jpj 
     213                  DO ji = 1, jpi 
     214                     ahmt(ji,jj,jk) = ahmt(ji,jj,1) * tmask(ji,jj,jk) 
     215                     ahmf(ji,jj,jk) = ahmf(ji,jj,1) * fmask(ji,jj,jk) 
     216                  END DO 
     217               END DO 
    196218            END DO 
    197219            ! 
     
    209231!!gm Question : info for LAP or BLP case  to take into account the SQRT in the bilaplacian case ???? 
    210232!!              do we introduce a scaling by the max value of the array, and then multiply by zah0 ???? 
     233!$OMP PARALLEL DO schedule(static) private(jk,jj,ji) 
    211234            DO jk = 1, jpkm1 
    212                ahmt(:,:,jk) = ahmt(:,:,jk) * tmask(:,:,jk) 
    213                ahmf(:,:,jk) = ahmf(:,:,jk) * fmask(:,:,jk) 
     235               DO jj = 1, jpj 
     236                  DO ji = 1, jpi 
     237                     ahmt(ji,jj,jk) = ahmt(ji,jj,jk) * tmask(ji,jj,jk) 
     238                     ahmf(ji,jj,jk) = ahmf(ji,jj,jk) * fmask(ji,jj,jk) 
     239                  END DO 
     240               END DO 
    214241            END DO 
    215242            ! 
     
    239266            ! 
    240267            ! Set local gridscale values 
     268!$OMP PARALLEL DO schedule(static) private(jj,ji) 
    241269            DO jj = 2, jpjm1 
    242270               DO ji = fs_2, fs_jpim1 
     
    251279         ! 
    252280         IF( ln_dynldf_blp .AND. .NOT. l_ldfdyn_time ) THEN       ! bilapcian and no time variation: 
    253             ahmt(:,:,:) = SQRT( ahmt(:,:,:) )                     ! take the square root of the coefficient 
    254             ahmf(:,:,:) = SQRT( ahmf(:,:,:) ) 
     281!$OMP PARALLEL DO schedule(static) private(jk,jj,ji) 
     282            DO jk = 1, jpk 
     283               DO jj = 1, jpj 
     284                  DO ji = 1, jpi 
     285                     ahmt(ji,jj,jk) = SQRT( ahmt(ji,jj,jk) )      ! take the square root of the coefficient 
     286                     ahmf(ji,jj,jk) = SQRT( ahmf(ji,jj,jk) ) 
     287                  END DO 
     288               END DO 
     289            END DO 
    255290         ENDIF 
    256291         ! 
Note: See TracChangeset for help on using the changeset viewer.