SUBROUTINE average_3d_data !------------------------------------------------------------------------------! ! Actual revisions: ! ----------------- ! Added calculation of shf* and qsws* ! ! Former revisions: ! ----------------- ! $Id: average_3d_data.f90 367 2009-08-25 08:35:52Z heinze $ ! ! 96 2007-06-04 08:07:41Z raasch ! Averaging of density and salinity ! ! 72 2007-03-19 08:20:46Z raasch ! Averaging the precipitation rate and roughness length (prr*, z0*) ! ! RCS Log replace by Id keyword, revision history cleaned up ! ! Revision 1.1 2006/02/23 09:48:58 raasch ! Initial revision ! ! ! Description: ! ------------ ! Time-averaging of 3d-data-arrays. !------------------------------------------------------------------------------! USE arrays_3d USE averaging USE cloud_parameters USE control_parameters USE cpulog USE indices USE interfaces IMPLICIT NONE INTEGER :: i, ii, j, k CALL cpu_log (log_point(35),'average_3d_data','start') ! !-- Check, if averaging is necessary IF ( average_count_3d <= 1 ) RETURN ! !-- Loop of all variables to be averaged. DO ii = 1, doav_n ! !-- Store the array chosen on the temporary array. SELECT CASE ( TRIM( doav(ii) ) ) CASE ( 'e' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 e_av(k,j,i) = e_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'qsws*' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 qsws_av(j,i) = qsws_av(j,i) / REAL( average_count_3d ) ENDDO ENDDO CASE ( 'lwp*' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 lwp_av(j,i) = lwp_av(j,i) / REAL( average_count_3d ) ENDDO ENDDO CASE ( 'p' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 p_av(k,j,i) = p_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'pc' ) DO i = nxl, nxr DO j = nys, nyn DO k = nzb, nzt+1 pc_av(k,j,i) = pc_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'pr' ) DO i = nxl, nxr DO j = nys, nyn DO k = nzb, nzt+1 pr_av(k,j,i) = pr_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'prr*' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 precipitation_rate_av(j,i) = precipitation_rate_av(j,i) / & REAL( average_count_3d ) ENDDO ENDDO CASE ( 'pt' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 pt_av(k,j,i) = pt_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'q' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 q_av(k,j,i) = q_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'ql' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'ql_c' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 ql_c_av(k,j,i) = ql_c_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'ql_v' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 ql_v_av(k,j,i) = ql_v_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'ql_vp' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 ql_vp_av(k,j,i) = ql_vp_av(k,j,i) / & REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'qv' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 qv_av(k,j,i) = qv_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'rho' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 rho_av(k,j,i) = rho_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 's' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 s_av(k,j,i) = s_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'sa' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 sa_av(k,j,i) = sa_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'shf*' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 shf_av(j,i) = shf_av(j,i) / REAL( average_count_3d ) ENDDO ENDDO CASE ( 't*' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 ts_av(j,i) = ts_av(j,i) / REAL( average_count_3d ) ENDDO ENDDO CASE ( 'u' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 u_av(k,j,i) = u_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'u*' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 us_av(j,i) = us_av(j,i) / REAL( average_count_3d ) ENDDO ENDDO CASE ( 'v' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 v_av(k,j,i) = v_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'vpt' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 vpt_av(k,j,i) = vpt_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'w' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 DO k = nzb, nzt+1 w_av(k,j,i) = w_av(k,j,i) / REAL( average_count_3d ) ENDDO ENDDO ENDDO CASE ( 'z0*' ) DO i = nxl-1, nxr+1 DO j = nys-1, nyn+1 z0_av(j,i) = z0_av(j,i) / REAL( average_count_3d ) ENDDO ENDDO CASE DEFAULT ! !-- User-defined quantity CALL user_3d_data_averaging( 'average', doav(ii) ) END SELECT ENDDO ! !-- Reset the counter average_count_3d = 0.0 CALL cpu_log (log_point(35),'average_3d_data','stop','nobarrier') END SUBROUTINE average_3d_data