Index: palm/trunk/SOURCE/eqn_state_seawater.f90
===================================================================
--- palm/trunk/SOURCE/eqn_state_seawater.f90	(revision 1310)
+++ palm/trunk/SOURCE/eqn_state_seawater.f90	(revision 1320)
@@ -1,5 +1,5 @@
  MODULE eqn_state_seawater_mod
 
-!--------------------------------------------------------------------------------!
+!------------------------------------------------------------------------------!
 ! This file is part of PALM.
 !
@@ -16,9 +16,15 @@
 !
 ! Copyright 1997-2014 Leibniz Universitaet Hannover
-!--------------------------------------------------------------------------------!
+!------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -28,8 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 388 2009-09-23 09:40:33Z raasch
-! Potential density is additionally calculated in eqn_state_seawater,
-! first constant in array den also defined as type double.
 !
 ! 97 2007-06-21 08:23:15Z raasch
@@ -45,4 +47,6 @@
 ! eqn_state_seawater_func calculates density.
 !------------------------------------------------------------------------------!
+    
+    USE kinds
 
     IMPLICIT NONE
@@ -51,20 +55,22 @@
     PUBLIC eqn_state_seawater, eqn_state_seawater_func
 
-    REAL, DIMENSION(12), PARAMETER ::  nom =                             &
-                      (/ 9.9984085444849347D2,   7.3471625860981584D0,   &
-                        -5.3211231792841769D-2,  3.6492439109814549D-4,  &
-                         2.5880571023991390D0,  -6.7168282786692354D-3,  &
-                         1.9203202055760151D-3,  1.1798263740430364D-2,  &
-                         9.8920219266399117D-8,  4.6996642771754730D-6,  &
-                        -2.5862187075154352D-8, -3.2921414007960662D-12 /)
-
-    REAL, DIMENSION(13), PARAMETER ::  den =                             &
-                      (/ 1.0D0,                  7.2815210113327091D-3,  &
-                        -4.4787265461983921D-5,  3.3851002965802430D-7,  &
-                         1.3651202389758572D-10, 1.7632126669040377D-3,  &
-                        -8.8066583251206474D-6, -1.8832689434804897D-10, &
-                         5.7463776745432097D-6,  1.4716275472242334D-9,  &
-                         6.7103246285651894D-6, -2.4461698007024582D-17, &
-                        -9.1534417604289062D-18 /)
+    REAL(wp), DIMENSION(12), PARAMETER ::  nom =                               &
+                          (/ 9.9984085444849347D2,   7.3471625860981584D0,     &
+                            -5.3211231792841769D-2,  3.6492439109814549D-4,    &
+                             2.5880571023991390D0,  -6.7168282786692354D-3,    &
+                             1.9203202055760151D-3,  1.1798263740430364D-2,    &
+                             9.8920219266399117D-8,  4.6996642771754730D-6,    &
+                            -2.5862187075154352D-8, -3.2921414007960662D-12 /)
+                          !:
+
+    REAL(wp), DIMENSION(13), PARAMETER ::  den =                               &
+                          (/ 1.0D0,                  7.2815210113327091D-3,    &
+                            -4.4787265461983921D-5,  3.3851002965802430D-7,    &
+                             1.3651202389758572D-10, 1.7632126669040377D-3,    &
+                            -8.8066583251206474D-6, -1.8832689434804897D-10,   &
+                             5.7463776745432097D-6,  1.4716275472242334D-9,    &
+                             6.7103246285651894D-6, -2.4461698007024582D-17,   &
+                            -9.1534417604289062D-18 /)
+                          !:
 
     INTERFACE eqn_state_seawater
@@ -85,12 +91,29 @@
     SUBROUTINE eqn_state_seawater
 
-       USE arrays_3d
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  hyp, prho, pt_p, rho, sa_p
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_s_inner, nzt
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL ::  pden, pnom, p1, p2, p3, pt1, pt2, pt3, pt4, sa1, sa15, sa2
+       INTEGER(iwp) ::  i  !:
+       INTEGER(iwp) ::  j  !:
+       INTEGER(iwp) ::  k  !:
+
+       REAL(wp) ::  pden  !:
+       REAL(wp) ::  pnom  !:
+       REAL(wp) ::  p1    !:
+       REAL(wp) ::  p2    !:
+       REAL(wp) ::  p3    !:
+       REAL(wp) ::  pt1   !:
+       REAL(wp) ::  pt2   !:
+       REAL(wp) ::  pt3   !:
+       REAL(wp) ::  pt4   !:
+       REAL(wp) ::  sa1   !:
+       REAL(wp) ::  sa15  !:
+       REAL(wp) ::  sa2   !:
+       
+                       
 
        DO  i = nxl, nxr
@@ -114,11 +137,11 @@
                 sa2  = sa1 * sa1
 
-                pnom = nom(1)           + nom(2)*pt1     + nom(3)*pt2     + &
-                       nom(4)*pt3       + nom(5)*sa1     + nom(6)*sa1*pt1 + &
+                pnom = nom(1)           + nom(2)*pt1     + nom(3)*pt2     +    &
+                       nom(4)*pt3       + nom(5)*sa1     + nom(6)*sa1*pt1 +    &
                        nom(7)*sa2
 
-                pden = den(1)           + den(2)*pt1     + den(3)*pt2     + &
-                       den(4)*pt3       + den(5)*pt4     + den(6)*sa1     + &
-                       den(7)*sa1*pt1   + den(8)*sa1*pt3 + den(9)*sa15    + &
+                pden = den(1)           + den(2)*pt1     + den(3)*pt2     +    &
+                       den(4)*pt3       + den(5)*pt4     + den(6)*sa1     +    &
+                       den(7)*sa1*pt1   + den(8)*sa1*pt3 + den(9)*sa15    +    &
                        den(10)*sa15*pt2
 
@@ -127,8 +150,8 @@
                 prho(k,j,i) = pnom / pden
 
-                pnom = pnom +             nom(8)*p1      + nom(9)*p1*pt2  + &
+                pnom = pnom +             nom(8)*p1      + nom(9)*p1*pt2  +    &
                        nom(10)*p1*sa1   + nom(11)*p2     + nom(12)*p2*pt2
 
-                pden = pden +             den(11)*p1     + den(12)*p2*pt3 + &
+                pden = pden +             den(11)*p1     + den(12)*p2*pt3 +    &
                        den(13)*p3*pt1
 
@@ -156,12 +179,16 @@
     SUBROUTINE eqn_state_seawater_ij( i, j )
 
-       USE arrays_3d
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  hyp, prho, pt_p, rho, sa_p
+           
+       USE indices,                                                            &
+           ONLY:  nzb_s_inner, nzt
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL ::  pden, pnom, p1, p2, p3, pt1, pt2, pt3, pt4, sa1, sa15, sa2
+       INTEGER(iwp) ::  i, j, k
+
+       REAL(wp)     ::  pden, pnom, p1, p2, p3, pt1, pt2, pt3, pt4, sa1, sa15, &
+                        sa2
 
        DO  k = nzb_s_inner(j,i)+1, nzt
@@ -183,11 +210,11 @@
           sa2  = sa1 * sa1
 
-          pnom = nom(1)           + nom(2)*pt1     + nom(3)*pt2     + &
-                 nom(4)*pt3       + nom(5)*sa1     + nom(6)*sa1*pt1 + &
+          pnom = nom(1)           + nom(2)*pt1     + nom(3)*pt2     +          &
+                 nom(4)*pt3       + nom(5)*sa1     + nom(6)*sa1*pt1 +          &
                  nom(7)*sa2
 
-          pden = den(1)           + den(2)*pt1     + den(3)*pt2     + &
-                 den(4)*pt3       + den(5)*pt4     + den(6)*sa1     + &
-                 den(7)*sa1*pt1   + den(8)*sa1*pt3 + den(9)*sa15    + &
+          pden = den(1)           + den(2)*pt1     + den(3)*pt2     +          &
+                 den(4)*pt3       + den(5)*pt4     + den(6)*sa1     +          &
+                 den(7)*sa1*pt1   + den(8)*sa1*pt3 + den(9)*sa15    +          &
                  den(10)*sa15*pt2
 
@@ -196,7 +223,7 @@
           prho(k,j,i) = pnom / pden
 
-          pnom = pnom +             nom(8)*p1      + nom(9)*p1*pt2  + &
+          pnom = pnom +             nom(8)*p1      + nom(9)*p1*pt2  +          &
                  nom(10)*p1*sa1   + nom(11)*p2     + nom(12)*p2*pt2
-          pden = pden +             den(11)*p1     + den(12)*p2*pt3 + &
+          pden = pden +             den(11)*p1     + den(12)*p2*pt3 +          &
                  den(13)*p3*pt1
 
@@ -221,9 +248,20 @@
 ! Equation of state as a function
 !------------------------------------------------------------------------------!
-    REAL FUNCTION eqn_state_seawater_func( p, pt, sa )
+    REAL(wp) FUNCTION eqn_state_seawater_func( p, pt, sa )
 
        IMPLICIT NONE
 
-       REAL ::  p, p1, p2, p3, pt, pt1, pt2, pt3, pt4, sa, sa15, sa2
+       REAL(wp) ::  p      !:
+       REAL(wp) ::  p1     !:
+       REAL(wp) ::  p2     !:
+       REAL(wp) ::  p3     !:
+       REAL(wp) ::  pt     !:
+       REAL(wp) ::  pt1    !:
+       REAL(wp) ::  pt2    !:
+       REAL(wp) ::  pt3    !:
+       REAL(wp) ::  pt4    !:
+       REAL(wp) ::  sa     !:
+       REAL(wp) ::  sa15   !:
+       REAL(wp) ::  sa2    !:
 
 !
