Ignore:
Timestamp:
Apr 16, 2014 3:17:48 PM (10 years ago)
Author:
hoffmann
Message:

improved version of two-moment cloud physics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/prandtl_fluxes.f90

    r1341 r1361  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! Bugfix: calculation of turbulent fluxes of rain water content (qrsws) and rain
     23! drop concentration (nrsws) added
    2324!
    2425! Former revisions:
     
    6465
    6566    USE arrays_3d,                                                             &
    66         ONLY:  e, pt, q, qs, qsws, rif, shf, ts, u, us, usws, v, vpt, vsws,    &
    67                zu, zw, z0, z0h
     67        ONLY:  e, nr, nrs, nrsws, pt, q, qr, qrs, qrsws, qs, qsws, rif, shf,   &
     68               ts, u, us, usws, v, vpt, vsws, zu, zw, z0, z0h
    6869
    6970    USE control_parameters,                                                    &
    70         ONLY:  constant_heatflux, constant_waterflux, coupling_mode, g,        &
    71                humidity, ibc_e_b, kappa, large_scale_forcing, lsf_surf,        &
    72                passive_scalar, pt_surface, q_surface, rif_max, rif_min,        &
    73                run_coupled, surface_pressure
     71        ONLY:  cloud_physics, constant_heatflux, constant_waterflux,           &
     72               coupling_mode, g, humidity, ibc_e_b, icloud_scheme, kappa,      &
     73               large_scale_forcing, lsf_surf, passive_scalar, precipitation,   &
     74               pt_surface, q_surface, rif_max, rif_min, run_coupled,           &
     75               surface_pressure
    7476
    7577    USE indices,                                                               &
     
    9698!
    9799!-- Data information for accelerators
    98     !$acc data present( e, nzb_u_inner, nzb_v_inner, nzb_s_inner, pt, q, qs ) &
    99     !$acc      present( qsws, rif, shf, ts, u, us, usws, v, vpt, vsws, zu, zw, z0, z0h )
     100    !$acc data present( e, nrsws, nzb_u_inner, nzb_v_inner, nzb_s_inner, pt )  &
     101    !$acc      present( q, qs, qsws, qrsws, rif, shf, ts, u, us, usws, v )     &
     102    !$acc      present( vpt, vsws, zu, zw, z0, z0h )
    100103!
    101104!-- Compute theta*
     
    383386          ENDDO
    384387       ENDIF
     388
     389       IF ( cloud_physics  .AND.  icloud_scheme == 0  &
     390            .AND.  precipitation )  THEN
     391
     392          !$OMP PARALLEL DO PRIVATE( a, b, k, z_p )
     393          !$acc kernels loop independent
     394          DO  i = nxlg, nxrg
     395             !$acc loop independent
     396             DO  j = nysg, nyng
     397
     398                k   = nzb_s_inner(j,i)
     399                z_p = zu(k+1) - zw(k)
     400
     401                IF ( rif(j,i) >= 0.0 )  THEN
     402!
     403!--                Stable stratification
     404                   qrs(j,i) = kappa * ( qr(k+1,j,i) - qr(k,j,i) ) / (          &
     405                                  LOG( z_p / z0h(j,i) ) +                      &
     406                                  5.0 * rif(j,i) * ( z_p - z0h(j,i) ) / z_p )
     407                   nrs(j,i) = kappa * ( nr(k+1,j,i) - nr(k,j,i) ) / (          &
     408                                  LOG( z_p / z0h(j,i) ) +                      &
     409                                  5.0 * rif(j,i) * ( z_p - z0h(j,i) ) / z_p )
     410
     411                ELSE
     412!
     413!--                Unstable stratification
     414                   a = SQRT( 1.0 - 16.0 * rif(j,i) )
     415                   b = SQRT( 1.0 - 16.0 * rif(j,i) * z0h(j,i) / z_p )
     416 
     417                   qrs(j,i) = kappa * ( qr(k+1,j,i) - qr(k,j,i) ) /   (        &
     418                             LOG( z_p / z0h(j,i) ) -                           &
     419                             2.0 * LOG( (1.0 + a ) / ( 1.0 + b ) ) )
     420                   nrs(j,i) = kappa * ( nr(k+1,j,i) - nr(k,j,i) ) /   (        &
     421                             LOG( z_p / z0h(j,i) ) -                           &
     422                             2.0 * LOG( (1.0 + a ) / ( 1.0 + b ) ) )
     423
     424                ENDIF
     425
     426             ENDDO
     427          ENDDO
     428
     429       ENDIF
     430
    385431    ENDIF
    386432
     
    396442       CALL exchange_horiz_2d( qsws )
    397443       !$acc update device( qsws )
     444       IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
     445            precipitation )  THEN
     446          !$acc update host( qrsws, nrsws )
     447          CALL exchange_horiz_2d( qrsws )
     448          CALL exchange_horiz_2d( nrsws )
     449          !$acc update device( qrsws, nrsws )
     450       ENDIF
    398451    ENDIF
    399452
     
    425478
    426479!
     480!-- Compute (turbulent) fluxes of rain water content and rain drop concentartion
     481    IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  precipitation )  THEN
     482       !$OMP PARALLEL DO
     483       !$acc kernels loop independent
     484       DO  i = nxlg, nxrg
     485          !$acc loop independent
     486          DO  j = nysg, nyng
     487             qrsws(j,i) = -qrs(j,i) * us(j,i)
     488             nrsws(j,i) = -nrs(j,i) * us(j,i)
     489          ENDDO
     490       ENDDO
     491    ENDIF
     492
     493!
    427494!-- Bottom boundary condition for the TKE
    428495    IF ( ibc_e_b == 2 )  THEN
Note: See TracChangeset for help on using the changeset viewer.