Index: palm/trunk/SOURCE/turbulence_closure_mod.f90
===================================================================
--- palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 4510)
+++ palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 4586)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! -----------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Renamed rif to richardson_number (Richardson Flux Number to Gradient Richardson Number)
+!
+! 4510 2020-04-29 14:19:18Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -4010,5 +4013,5 @@
 
     REAL(wp), DIMENSION(nzb+1:nzt) ::  ml_stratification  !< mixing length according to stratification
-    REAL(wp), DIMENSION(nzb+1:nzt) ::  rif                !< Richardson flux number
+    REAL(wp), DIMENSION(nzb+1:nzt) ::  richardson_number  !< gradient Richardson number
 
     REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg), INTENT(IN) ::  var  !< temperature
@@ -4111,5 +4114,5 @@
 
       !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j) &
-      !$ACC PRIVATE(ml_stratification, duv2_dz2, rif, dvar_dz) &
+      !$ACC PRIVATE(ml_stratification, duv2_dz2, richardson_number, dvar_dz) &
       !$ACC PRESENT(diss, e, u, v, var, wall_flags_total_0) &
       !$ACC PRESENT(dd2zu, ml_blackadar, delta)
@@ -4117,5 +4120,5 @@
           DO  j = nys, nyn
 !
-!--          Calculate Richardson-flux number
+!--          Calculate Richardson number
              IF ( use_single_reference_value )  THEN
 
@@ -4128,5 +4131,7 @@
                             + ( ( v(k+1,j,i) - v(k-1,j,i) ) * dd2zu(k) )**2 + 1E-30_wp
 
-                   rif(k) = MIN( MAX( g / var_reference * dvar_dz / duv2_dz2, -5.0_wp ),  1.0_wp )
+                   richardson_number(k) = MIN( MAX( g / var_reference * dvar_dz / duv2_dz2,        &
+                                                    -5.0_wp ),                                     &
+                                               1.0_wp )
                 ENDDO
              ELSE
@@ -4143,5 +4148,7 @@
                             + ( ( v(k+1,j,i) - v(k-1,j,i) ) * dd2zu(k) )**2 + 1E-30_wp
 
-                   rif(k) = MIN( MAX( g / var(k,j,i) * dvar_dz / duv2_dz2, -5.0_wp ),  1.0_wp )
+                   richardson_number(k) = MIN( MAX( g / var(k,j,i) * dvar_dz / duv2_dz2,           &
+                                                    -5.0_wp ),                                     &
+                                               1.0_wp )
                 ENDDO
              ENDIF
@@ -4150,8 +4157,10 @@
              !$ACC LOOP PRIVATE(k)
              DO  k = nzb+1, nzt
-                IF ( rif(k) >= 0.0_wp )  THEN
-                   ml_stratification(k) = ml_blackadar(k) / ( 1.0_wp + 5.0_wp * rif(k) )
+                IF ( richardson_number(k) >= 0.0_wp )  THEN
+                   ml_stratification(k) = ml_blackadar(k)                                          &
+                                        / ( 1.0_wp + 5.0_wp * richardson_number(k) )
                 ELSE
-                   ml_stratification(k) = ml_blackadar(k) * SQRT( 1.0_wp - 16.0_wp * rif(k) )
+                   ml_stratification(k) = ml_blackadar(k)                                          &
+                                        * SQRT( 1.0_wp - 16.0_wp * richardson_number(k) )
                 ENDIF
              ENDDO
@@ -4274,5 +4283,5 @@
 
     REAL(wp), DIMENSION(nzb+1:nzt) ::  ml_stratification  !< mixing length according to stratification
-    REAL(wp), DIMENSION(nzb+1:nzt) ::  rif                !< Richardson flux number
+    REAL(wp), DIMENSION(nzb+1:nzt) ::  richardson_number  !< gradient Richardson number
 
     REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg), INTENT(IN) ::  var  !< temperature
@@ -4348,5 +4357,5 @@
 
 !
-!--    Calculate Richardson-flux number
+!--    Calculate Richardson number
        IF ( use_single_reference_value )  THEN
           DO  k = nzb+1, nzt
@@ -4356,5 +4365,6 @@
                       + ( ( v(k+1,j,i) - v(k-1,j,i) ) * dd2zu(k) )**2 + 1E-30_wp
 
-             rif(k) = MIN( MAX( g / var_reference * dvar_dz / duv2_dz2, -5.0_wp ),  1.0_wp )
+             richardson_number(k) = MIN( MAX( g / var_reference * dvar_dz / duv2_dz2, -5.0_wp ),   &
+                                         1.0_wp )
           ENDDO
        ELSE
@@ -4365,5 +4375,6 @@
                       + ( ( v(k+1,j,i) - v(k-1,j,i) ) * dd2zu(k) )**2 + 1E-30_wp
 
-             rif(k) = MIN( MAX( g / var(k,j,i) * dvar_dz / duv2_dz2, -5.0_wp ), 1.0_wp )
+             richardson_number(k) = MIN( MAX( g / var(k,j,i) * dvar_dz / duv2_dz2, -5.0_wp ),      &
+                                         1.0_wp )
           ENDDO
        ENDIF
@@ -4371,8 +4382,9 @@
 !--    Calculate diabatic mixing length using Dyer-profile functions
        DO  k = nzb+1, nzt
-          IF ( rif(k) >= 0.0_wp )  THEN
-             ml_stratification(k) = ml_blackadar(k) / ( 1.0_wp + 5.0_wp * rif(k) )
+          IF ( richardson_number(k) >= 0.0_wp )  THEN
+             ml_stratification(k) = ml_blackadar(k) / ( 1.0_wp + 5.0_wp * richardson_number(k) )
           ELSE
-             ml_stratification(k) = ml_blackadar(k) * SQRT( 1.0_wp - 16.0_wp * rif(k) )
+             ml_stratification(k) = ml_blackadar(k)                                                &
+                                  * SQRT( 1.0_wp - 16.0_wp * richardson_number(k) )
           ENDIF
 
@@ -4772,8 +4784,8 @@
     REAL(wp)     ::  var_reference       !< reference temperature
 
-    !DIR$ ATTRIBUTES ALIGN:64:: ml_local_profile, ml_stratification, rif
+    !DIR$ ATTRIBUTES ALIGN:64:: ml_local_profile, ml_stratification, richardson_number
     REAL(wp), DIMENSION(nzb+1:nzt) ::  ml_local_profile   !< mixing length (all heights)
     REAL(wp), DIMENSION(nzb+1:nzt) ::  ml_stratification  !< mixing length according to stratification
-    REAL(wp), DIMENSION(nzb+1:nzt) ::  rif                !< Richardson flux number
+    REAL(wp), DIMENSION(nzb+1:nzt) ::  richardson_number  !< gradient Richardson number
 
     REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg), INTENT(IN) ::  var  !< temperature
@@ -4937,5 +4949,5 @@
        !$OMP DO
        !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j) &
-       !$ACC PRIVATE(dvar_dz, duv2_dz2, ml_stratification, ml_local_profile, rif) &
+       !$ACC PRIVATE(dvar_dz, duv2_dz2, ml_stratification, ml_local_profile, richardson_number) &
        !$ACC PRESENT(wall_flags_total_0, var, dd2zu, e, u, v, delta, ml_blackadar) &
        !$ACC PRESENT(kh, km, sums_l_l, rmask)
@@ -4943,5 +4955,5 @@
           DO  j = nysg, nyng
 !
-!--          Calculate Richardson-flux number
+!--          Calculate Richardson number
              IF ( use_single_reference_value )  THEN
                 !$ACC LOOP PRIVATE(k)
@@ -4953,5 +4965,7 @@
                             + ( ( v(k+1,j,i) - v(k-1,j,i) ) * dd2zu(k) )**2 + 1E-30_wp
 
-                   rif(k) = MIN( MAX( g / var_reference * dvar_dz / duv2_dz2, -5.0_wp ),  1.0_wp )
+                   richardson_number(k) = MIN( MAX( g / var_reference * dvar_dz / duv2_dz2,        &
+                                                    -5.0_wp ),                                     &
+                                               1.0_wp )
                 ENDDO
              ELSE
@@ -4964,5 +4978,7 @@
                             + ( ( v(k+1,j,i) - v(k-1,j,i) ) * dd2zu(k) )**2 + 1E-30_wp
 
-                   rif(k) = MIN( MAX( g / var(k,j,i) * dvar_dz / duv2_dz2, -5.0_wp ),  1.0_wp )
+                   richardson_number(k) = MIN( MAX( g / var(k,j,i) * dvar_dz / duv2_dz2,           &
+                                                    -5.0_wp ),                                     &
+                                               1.0_wp )
                 ENDDO
              ENDIF
@@ -4972,6 +4988,7 @@
              !$ACC LOOP PRIVATE(k)
              DO  k = nzb+1, nzt
-                IF ( rif(k) >= 0.0_wp )  THEN
-                   ml_stratification(k) = ml_blackadar(k) / ( 1.0_wp + 5.0_wp * rif(k) )
+                IF ( richardson_number(k) >= 0.0_wp )  THEN
+                   ml_stratification(k) = ml_blackadar(k)                                          &
+                                        / ( 1.0_wp + 5.0_wp * richardson_number(k) )
                 ELSE
                    ml_stratification(k) = ml_blackadar(k)
