Index: palm/trunk/SOURCE/ocean_mod.f90
===================================================================
--- palm/trunk/SOURCE/ocean_mod.f90	(revision 3767)
+++ palm/trunk/SOURCE/ocean_mod.f90	(revision 3873)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! implemented ocean_actions
+! 
+! 3767 2019-02-27 08:18:02Z raasch
 ! unused variable for file index and tmp_2d removed from rrd-subroutine parameter
 ! list
@@ -77,12 +80,18 @@
     USE arrays_3d,                                                             &
         ONLY:  prho, prho_1, rho_ocean, rho_1, sa, sa_init, sa_1, sa_2, sa_3,  &
-               sa_p, tsa_m
+               sa_p, tsa_m, flux_l_sa, flux_s_sa, diss_l_sa, diss_s_sa
 
     USE control_parameters,                                                    &
         ONLY:  atmos_ocean_sign, bottom_salinityflux,                          &
                constant_top_salinityflux, ocean_mode, top_salinityflux,        &
-               wall_salinityflux
+               wall_salinityflux, loop_optimization, ws_scheme_sca
 
     USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  threads_per_task
+
+    USE statistics,                                                            &
+        ONLY:  sums_wssas_ws_l
 
 
@@ -187,4 +196,9 @@
     END INTERFACE ocean_parin
 
+    INTERFACE ocean_actions
+       MODULE PROCEDURE ocean_actions
+       MODULE PROCEDURE ocean_actions_ij
+    END INTERFACE ocean_actions
+
     INTERFACE ocean_prognostic_equations
        MODULE PROCEDURE ocean_prognostic_equations
@@ -229,5 +243,5 @@
 !
 !-- Add INTERFACES that must be available to other modules (alphabetical order)
-    PUBLIC eqn_state_seawater, ocean_check_data_output,                        &
+    PUBLIC eqn_state_seawater, ocean_actions, ocean_check_data_output,         &
            ocean_check_data_output_pr, ocean_check_parameters,                 &
            ocean_data_output_2d, ocean_data_output_3d,                         &
@@ -1177,5 +1191,5 @@
 
     USE indices,                                                               &
-        ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
+        ONLY:  nxlg, nxrg, nyn, nyng, nys, nysg, nzb, nzt
 
     IMPLICIT NONE
@@ -1188,4 +1202,20 @@
     IF (  salinity )  THEN
        ALLOCATE( sa_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+    ENDIF
+
+    IF ( ws_scheme_sca )  THEN
+       ALLOCATE( sums_wssas_ws_l(nzb:nzt+1,0:threads_per_task-1) )
+       sums_wssas_ws_l = 0.0_wp
+    ENDIF
+
+    IF ( loop_optimization /= 'vector' )  THEN
+
+       IF ( ws_scheme_sca )  THEN
+          ALLOCATE( flux_s_sa(nzb+1:nzt,0:threads_per_task-1) )
+          ALLOCATE( diss_s_sa(nzb+1:nzt,0:threads_per_task-1) )
+          ALLOCATE( flux_l_sa(nzb+1:nzt,nys:nyn,0:threads_per_task-1) )
+          ALLOCATE( diss_l_sa(nzb+1:nzt,nys:nyn,0:threads_per_task-1) )
+       ENDIF
+
     ENDIF
 
@@ -1469,4 +1499,61 @@
 
  END SUBROUTINE ocean_init
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Call for all grid points
+!------------------------------------------------------------------------------!
+ SUBROUTINE ocean_actions( location )
+
+
+    CHARACTER (LEN=*), INTENT(IN) ::  location !< call location string
+
+    SELECT CASE ( location )
+
+       CASE ( 'before_timestep' )
+
+          IF ( ws_scheme_sca )  THEN
+             sums_wssas_ws_l = 0.0_wp
+          ENDIF
+
+       CASE DEFAULT
+          CONTINUE
+
+    END SELECT
+
+ END SUBROUTINE ocean_actions
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Call for grid points i,j
+!------------------------------------------------------------------------------!
+ SUBROUTINE ocean_actions_ij( i, j, location )
+
+
+    INTEGER(iwp),      INTENT(IN) ::  i         !< grid index in x-direction
+    INTEGER(iwp),      INTENT(IN) ::  j         !< grid index in y-direction
+    CHARACTER (LEN=*), INTENT(IN) ::  location  !< call location string
+    INTEGER(iwp)  ::  dummy  !< call location string
+
+    IF ( ocean_mode )   dummy = i + j
+
+    SELECT CASE ( location )
+
+       CASE ( 'before_timestep' )
+
+          IF ( ws_scheme_sca )  THEN
+             sums_wssas_ws_l = 0.0_wp
+          ENDIF
+
+       CASE DEFAULT
+          CONTINUE
+
+    END SELECT
+
+ END SUBROUTINE ocean_actions_ij
 
 
