Index: palm/trunk/SOURCE/advec_s_pw.f90
===================================================================
--- palm/trunk/SOURCE/advec_s_pw.f90	(revision 2718)
+++ palm/trunk/SOURCE/advec_s_pw.f90	(revision 3302)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Stokes drift velocity added
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -104,5 +107,5 @@
 
        USE arrays_3d,                                                          &
-           ONLY:  dd2zu, tend, u, v, w
+           ONLY:  dd2zu, tend, u, u_stokes_zu, v, v_stokes_zu, w
 
        USE control_parameters,                                                 &
@@ -124,4 +127,7 @@
        INTEGER(iwp) ::  j !<
        INTEGER(iwp) ::  k !<
+
+       REAL(wp)     ::  gu  !< local additional advective velocity
+       REAL(wp)     ::  gv  !< local additional advective velocity
 
 #if defined( __nopointer )
@@ -135,15 +141,28 @@
           DO  j = nys, nyn
              DO  k = nzb+1, nzt
-                tend(k,j,i) = tend(k,j,i) +                                       &
-            ( -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
-                        - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
-                        ) * ddx                                                   &
-              -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
-                        - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
-                        ) * ddy                                                   &
-              -         (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
-                        -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
-                        ) * dd2zu(k)                                              &
-            ) * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+
+!
+!--             Galilean transformation + Stokes drift velocity (ocean only)
+                gu = u_gtrans - u_stokes_zu(k)
+                gv = v_gtrans - v_stokes_zu(k)
+
+                tend(k,j,i) = tend(k,j,i) +                                    &
+                                     ( -0.5_wp * ( ( u(k,j,i+1) - gu       ) * &
+                                                   ( sk(k,j,i+1) - sk(k,j,i) ) &
+                                                 - ( u(k,j,i)   - gu       ) * &
+                                                   ( sk(k,j,i-1) - sk(k,j,i) ) &
+                                                 ) * ddx                       &
+                                       -0.5_wp * ( ( v(k,j+1,i) - gv       ) * &
+                                                   ( sk(k,j+1,i) - sk(k,j,i) ) &
+                                                 - ( v(k,j,i)   - gv       ) * &
+                                                   ( sk(k,j-1,i) - sk(k,j,i) ) &
+                                                 ) * ddy                       &
+                                       -         (   w(k,j,i)                * &
+                                                   ( sk(k+1,j,i) - sk(k,j,i) ) &
+                                                 -   w(k-1,j,i)              * &
+                                                   ( sk(k-1,j,i) - sk(k,j,i) ) &
+                                                 ) * dd2zu(k)                  &
+                                      ) * MERGE( 1.0_wp, 0.0_wp,               &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
              ENDDO
           ENDDO
@@ -161,5 +180,5 @@
 
        USE arrays_3d,                                                          &
-           ONLY:  dd2zu, tend, u, v, w
+           ONLY:  dd2zu, tend, u, u_stokes_zu, v, v_stokes_zu, w
 
        USE control_parameters,                                                 &
@@ -180,4 +199,7 @@
        INTEGER(iwp) ::  j !<
        INTEGER(iwp) ::  k !<
+
+       REAL(wp)     ::  gu  !< local additional advective velocity
+       REAL(wp)     ::  gv  !< local additional advective velocity
 
 #if defined( __nopointer )
@@ -189,15 +211,28 @@
 
        DO  k = nzb+1, nzt
-          tend(k,j,i) = tend(k,j,i) +                                             &
-            ( -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
-                        - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
-                        ) * ddx                                                   &
-              -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
-                        - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
-                        ) * ddy                                                   &
-              -         (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
-                        -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
-                        ) * dd2zu(k)                                              &
-            ) * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+
+!
+!--       Galilean transformation + Stokes drift velocity (ocean only)
+          gu = u_gtrans - u_stokes_zu(k)
+          gv = v_gtrans - v_stokes_zu(k)
+
+          tend(k,j,i) = tend(k,j,i) +                                          &
+                                    ( -0.5_wp * ( ( u(k,j,i+1) - gu        ) * &
+                                                  ( sk(k,j,i+1) - sk(k,j,i) )  &
+                                                - ( u(k,j,i)   - gu        ) * &
+                                                  ( sk(k,j,i-1) - sk(k,j,i) )  &
+                                                ) * ddx                        &
+                                      -0.5_wp * ( ( v(k,j+1,i) - gv       ) *  &
+                                                  ( sk(k,j+1,i) - sk(k,j,i) )  &
+                                                - ( v(k,j,i)   - gv       ) *  &
+                                                  ( sk(k,j-1,i) - sk(k,j,i) )  &
+                                                ) * ddy                        &
+                                      -         (   w(k,j,i)                *  &
+                                                  ( sk(k+1,j,i) - sk(k,j,i) )  &
+                                                -   w(k-1,j,i)              *  &
+                                                  ( sk(k-1,j,i) - sk(k,j,i) )  &
+                                                ) * dd2zu(k)                   &
+                                    ) * MERGE( 1.0_wp, 0.0_wp,                 &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
        ENDDO
 
