Changeset 2984 for palm


Ignore:
Timestamp:
Apr 18, 2018 11:51:30 AM (6 years ago)
Author:
hellstea
Message:

Bugfix in the log-law correction initialization and removal of the nest mass-conservation correction

Location:
palm/trunk/SOURCE
Files:
2 edited

Legend:

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

    r2967 r2984  
    2525! -----------------
    2626! $Id$
     27! Bugfix in the log-law correction initialization. Pivot node cannot any more be
     28! selected from outside the subdomain in order to prevent array under/overflows.
     29!
     30! 2967 2018-04-13 11:22:08Z raasch
    2731! bugfix: missing parallel cpp-directives added
    2832!
     
    21162120                           k, j, inc, wall_index, z0_topo, kb, direction,      &
    21172121                           ncorr )
    2118 !
    2119 !--                   The direction of the wall-normal index is stored as the
    2120 !--                   sign of the logc-element.
    2121                       logc_u_l(2,k,j) = inc * lc
    2122                       logc_ratio_u_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2122                      IF ( lc == -99 )  THEN
     2123!                         
     2124!--                      The pivot point is out of subdomain, skip the correction.
     2125                         logc_u_l(2,k,j) = 0
     2126                         logc_ratio_u_l(2,0:ncorr-1,k,j) = 1.0_wp
     2127                      ELSE
     2128!
     2129!--                      The direction of the wall-normal index is stored as the
     2130!--                      sign of the logc-element.
     2131                         logc_u_l(2,k,j) = inc * lc
     2132                         logc_ratio_u_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2133                      ENDIF
    21232134                      lcr(0:ncorr-1) = 1.0_wp
    21242135                   ENDDO
     
    21382149                           k, j, inc, wall_index, z0_topo, kb, direction,      &
    21392150                           ncorr )
    2140 !
    2141 !--                   The direction of the wall-normal index is stored as the
    2142 !--                   sign of the logc-element.
    2143                       logc_u_l(2,k,j) = inc * lc
    2144                       logc_ratio_u_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2151                      IF ( lc == -99 )  THEN
     2152!                         
     2153!--                      The pivot point is out of subdomain, skip the correction.
     2154                         logc_u_l(2,k,j) = 0
     2155                         logc_ratio_u_l(2,0:ncorr-1,k,j) = 1.0_wp
     2156                      ELSE
     2157!
     2158!--                      The direction of the wall-normal index is stored as the
     2159!--                      sign of the logc-element.
     2160                         logc_u_l(2,k,j) = inc * lc
     2161                         logc_ratio_u_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2162                      ENDIF
    21452163                      lcr(0:ncorr-1) = 1.0_wp
    21462164                   ENDDO
     
    21662184                           k, j, inc, wall_index, z0_topo, kb, direction,      &
    21672185                           ncorr )
    2168 !
    2169 !--                   The direction of the wall-normal index is stored as the
    2170 !--                   sign of the logc-element.
    2171                       logc_w_l(2,k,j) = inc * lc
    2172                       logc_ratio_w_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2186                      IF ( lc == -99 )  THEN
     2187!                         
     2188!--                      The pivot point is out of subdomain, skip the correction.
     2189                         logc_w_l(2,k,j) = 0
     2190                         logc_ratio_w_l(2,0:ncorr-1,k,j) = 1.0_wp
     2191                      ELSE
     2192!
     2193!--                      The direction of the wall-normal index is stored as the
     2194!--                      sign of the logc-element.
     2195                         logc_w_l(2,k,j) = inc * lc
     2196                         logc_ratio_w_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2197                      ENDIF
    21732198                      lcr(0:ncorr-1) = 1.0_wp
    21742199                   ENDDO
     
    21882213                           k, j, inc, wall_index, z0_topo, kb, direction,      &
    21892214                           ncorr )
    2190 !
    2191 !--                   The direction of the wall-normal index is stored as the
    2192 !--                   sign of the logc-element.
    2193                       logc_w_l(2,k,j) = inc * lc
    2194                       logc_ratio_w_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2215                      IF ( lc == -99 )  THEN
     2216!                         
     2217!--                      The pivot point is out of subdomain, skip the correction.
     2218                         logc_w_l(2,k,j) = 0
     2219                         logc_ratio_w_l(2,0:ncorr-1,k,j) = 1.0_wp
     2220                      ELSE
     2221!
     2222!--                      The direction of the wall-normal index is stored as the
     2223!--                      sign of the logc-element.
     2224                         logc_w_l(2,k,j) = inc * lc
     2225                         logc_ratio_w_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2226                      ENDIF
    21952227                      lcr(0:ncorr-1) = 1.0_wp
    21962228                   ENDDO
     
    22292261                      CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
    22302262                           k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
    2231 !
    2232 !--                   The direction of the wall-normal index is stored as the
    2233 !--                   sign of the logc-element.
    2234                       logc_u_r(2,k,j) = inc * lc
    2235                       logc_ratio_u_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2263                      IF ( lc == -99 )  THEN
     2264!                         
     2265!--                      The pivot point is out of subdomain, skip the correction.
     2266                         logc_u_r(2,k,j) = 0
     2267                         logc_ratio_u_r(2,0:ncorr-1,k,j) = 1.0_wp
     2268                      ELSE
     2269!
     2270!--                      The direction of the wall-normal index is stored as the
     2271!--                      sign of the logc-element.
     2272                         logc_u_r(2,k,j) = inc * lc
     2273                         logc_ratio_u_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2274                      ENDIF
    22362275                      lcr(0:ncorr-1) = 1.0_wp
    22372276                   ENDDO
     
    22512290                           k, j, inc, wall_index, z0_topo, kb, direction,      &
    22522291                           ncorr )
    2253 !
    2254 !--                   The direction of the wall-normal index is stored as the
    2255 !--                   sign of the logc-element.
    2256                       logc_u_r(2,k,j) = inc * lc
    2257                       logc_ratio_u_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2292                      IF ( lc == -99 )  THEN
     2293!                         
     2294!--                      The pivot point is out of subdomain, skip the correction.
     2295                         logc_u_r(2,k,j) = 0
     2296                         logc_ratio_u_r(2,0:ncorr-1,k,j) = 1.0_wp
     2297                      ELSE
     2298!
     2299!--                      The direction of the wall-normal index is stored as the
     2300!--                      sign of the logc-element.
     2301                         logc_u_r(2,k,j) = inc * lc
     2302                         logc_ratio_u_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2303                      ENDIF
    22582304                      lcr(0:ncorr-1) = 1.0_wp
    22592305                   ENDDO
     
    22782324                           k, j, inc, wall_index, z0_topo, kb, direction,      &
    22792325                           ncorr )
    2280 !
    2281 !--                   The direction of the wall-normal index is stored as the
    2282 !--                   sign of the logc-element.
    2283                       logc_w_r(2,k,j) = inc * lc
    2284                       logc_ratio_w_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2326                      IF ( lc == -99 )  THEN
     2327!                         
     2328!--                      The pivot point is out of subdomain, skip the correction.
     2329                         logc_w_r(2,k,j) = 0
     2330                         logc_ratio_w_r(2,0:ncorr-1,k,j) = 1.0_wp
     2331                      ELSE
     2332!
     2333!--                      The direction of the wall-normal index is stored as the
     2334!--                      sign of the logc-element.
     2335                         logc_w_r(2,k,j) = inc * lc
     2336                         logc_ratio_w_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2337                      ENDIF
    22852338                      lcr(0:ncorr-1) = 1.0_wp
    22862339                   ENDDO
     
    23002353                           k, j, inc, wall_index, z0_topo, kb, direction,      &
    23012354                           ncorr )
    2302 !
    2303 !--                   The direction of the wall-normal index is stored as the
    2304 !--                   sign of the logc-element.
    2305                       logc_w_r(2,k,j) = inc * lc
    2306                       logc_ratio_w_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2355                      IF ( lc == -99 )  THEN
     2356!                         
     2357!--                      The pivot point is out of subdomain, skip the correction.
     2358                         logc_w_r(2,k,j) = 0
     2359                         logc_ratio_w_r(2,0:ncorr-1,k,j) = 1.0_wp
     2360                      ELSE
     2361!
     2362!--                      The direction of the wall-normal index is stored as the
     2363!--                      sign of the logc-element.
     2364                         logc_w_r(2,k,j) = inc * lc
     2365                         logc_ratio_w_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
     2366                      ENDIF
    23072367                      lcr(0:ncorr-1) = 1.0_wp
    23082368                   ENDDO
     
    23422402                           k, i, inc, wall_index, z0_topo, kb, direction,      &
    23432403                           ncorr )
    2344 !
    2345 !--                   The direction of the wall-normal index is stored as the
    2346 !--                   sign of the logc-element.
    2347                       logc_v_s(2,k,i) = inc * lc
    2348                       logc_ratio_v_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2404                      IF ( lc == -99 )  THEN
     2405!                         
     2406!--                      The pivot point is out of subdomain, skip the correction.
     2407                         logc_v_s(2,k,i) = 0
     2408                         logc_ratio_v_s(2,0:ncorr-1,k,i) = 1.0_wp
     2409                      ELSE
     2410!
     2411!--                      The direction of the wall-normal index is stored as the
     2412!--                      sign of the logc-element.
     2413                         logc_v_s(2,k,i) = inc * lc
     2414                         logc_ratio_v_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2415                      ENDIF
    23492416                      lcr(0:ncorr-1) = 1.0_wp
    23502417                   ENDDO
     
    23642431                           k, i, inc, wall_index, z0_topo, kb, direction,      &
    23652432                           ncorr )
    2366 !
    2367 !--                   The direction of the wall-normal index is stored as the
    2368 !--                   sign of the logc-element.
    2369                       logc_v_s(2,k,i) = inc * lc
    2370                       logc_ratio_v_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2433                      IF ( lc == -99 )  THEN
     2434!                         
     2435!--                      The pivot point is out of subdomain, skip the correction.
     2436                         logc_v_s(2,k,i) = 0
     2437                         logc_ratio_v_s(2,0:ncorr-1,k,i) = 1.0_wp
     2438                      ELSE
     2439!
     2440!--                      The direction of the wall-normal index is stored as the
     2441!--                      sign of the logc-element.
     2442                         logc_v_s(2,k,i) = inc * lc
     2443                         logc_ratio_v_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2444                      ENDIF
    23712445                      lcr(0:ncorr-1) = 1.0_wp
    23722446                   ENDDO
     
    23922466                           k, i, inc, wall_index, z0_topo, kb, direction,      &
    23932467                           ncorr )
    2394 !
    2395 !--                   The direction of the wall-normal index is stored as the
    2396 !--                   sign of the logc-element.
    2397                       logc_w_s(2,k,i) = inc * lc
    2398                       logc_ratio_w_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2468                      IF ( lc == -99 )  THEN
     2469!                         
     2470!--                      The pivot point is out of subdomain, skip the correction.
     2471                         logc_w_s(2,k,i) = 0
     2472                         logc_ratio_w_s(2,0:ncorr-1,k,i) = 1.0_wp
     2473                      ELSE
     2474!
     2475!--                      The direction of the wall-normal index is stored as the
     2476!--                      sign of the logc-element.
     2477                         logc_w_s(2,k,i) = inc * lc
     2478                         logc_ratio_w_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2479                      ENDIF
    23992480                      lcr(0:ncorr-1) = 1.0_wp
    24002481                   ENDDO
     
    24142495                           k, i, inc, wall_index, z0_topo, kb, direction,      &
    24152496                           ncorr )
    2416 !
    2417 !--                   The direction of the wall-normal index is stored as the
    2418 !--                   sign of the logc-element.
    2419                       logc_w_s(2,k,i) = inc * lc
    2420                       logc_ratio_w_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2497                      IF ( lc == -99 )  THEN
     2498!                         
     2499!--                      The pivot point is out of subdomain, skip the correction.
     2500                         logc_w_s(2,k,i) = 0
     2501                         logc_ratio_w_s(2,0:ncorr-1,k,i) = 1.0_wp
     2502                      ELSE
     2503!
     2504!--                      The direction of the wall-normal index is stored as the
     2505!--                      sign of the logc-element.
     2506                         logc_w_s(2,k,i) = inc * lc
     2507                         logc_ratio_w_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2508                      ENDIF
    24212509                      lcr(0:ncorr-1) = 1.0_wp
    24222510                   ENDDO
     
    24562544                           k, i, inc, wall_index, z0_topo, kb, direction,      &
    24572545                           ncorr )
    2458 !
    2459 !--                   The direction of the wall-normal index is stored as the
    2460 !--                   sign of the logc-element.
    2461                       logc_v_n(2,k,i) = inc * lc
    2462                       logc_ratio_v_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2546                      IF ( lc == -99 )  THEN
     2547!                         
     2548!--                      The pivot point is out of subdomain, skip the correction.
     2549                         logc_v_n(2,k,i) = 0
     2550                         logc_ratio_v_n(2,0:ncorr-1,k,i) = 1.0_wp
     2551                      ELSE
     2552!
     2553!--                      The direction of the wall-normal index is stored as the
     2554!--                      sign of the logc-element.
     2555                         logc_v_n(2,k,i) = inc * lc
     2556                         logc_ratio_v_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2557                      ENDIF
    24632558                      lcr(0:ncorr-1) = 1.0_wp
    24642559                   ENDDO
     
    24782573                           k, i, inc, wall_index, z0_topo, kb, direction,      &
    24792574                           ncorr )
    2480 !
    2481 !--                   The direction of the wall-normal index is stored as the
    2482 !--                   sign of the logc-element.
    2483                       logc_v_n(2,k,i) = inc * lc
    2484                       logc_ratio_v_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2575                      IF ( lc == -99 )  THEN
     2576!                         
     2577!--                      The pivot point is out of subdomain, skip the correction.
     2578                         logc_v_n(2,k,i) = 0
     2579                         logc_ratio_v_n(2,0:ncorr-1,k,i) = 1.0_wp
     2580                      ELSE
     2581!
     2582!--                      The direction of the wall-normal index is stored as the
     2583!--                      sign of the logc-element.
     2584                         logc_v_n(2,k,i) = inc * lc
     2585                         logc_ratio_v_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2586                      ENDIF
    24852587                      lcr(0:ncorr-1) = 1.0_wp
    24862588                   ENDDO
     
    25052607                           k, i, inc, wall_index, z0_topo, kb, direction,      &
    25062608                           ncorr )
    2507 !
    2508 !--                   The direction of the wall-normal index is stored as the
    2509 !--                   sign of the logc-element.
    2510                       logc_w_n(2,k,i) = inc * lc
    2511                       logc_ratio_w_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2609                      IF ( lc == -99 )  THEN
     2610!                         
     2611!--                      The pivot point is out of subdomain, skip the correction.
     2612                         logc_w_n(2,k,i) = 0
     2613                         logc_ratio_w_n(2,0:ncorr-1,k,i) = 1.0_wp
     2614                      ELSE
     2615!
     2616!--                      The direction of the wall-normal index is stored as the
     2617!--                      sign of the logc-element.
     2618                         logc_w_n(2,k,i) = inc * lc
     2619                         logc_ratio_w_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2620                      ENDIF
    25122621                      lcr(0:ncorr-1) = 1.0_wp
    25132622                   ENDDO
     
    25272636                           k, i, inc, wall_index, z0_topo, kb, direction,      &
    25282637                           ncorr )
    2529 !
    2530 !--                   The direction of the wall-normal index is stored as the
    2531 !--                   sign of the logc-element.
    2532                       logc_w_n(2,k,i) = inc * lc
    2533                       logc_ratio_w_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2638                      IF ( lc == -99 )  THEN
     2639!                         
     2640!--                      The pivot point is out of subdomain, skip the correction.
     2641                         logc_w_n(2,k,i) = 0
     2642                         logc_ratio_w_n(2,0:ncorr-1,k,i) = 1.0_wp
     2643                      ELSE
     2644!
     2645!--                      The direction of the wall-normal index is stored as the
     2646!--                      sign of the logc-element.
     2647                         logc_w_n(2,k,i) = inc * lc
     2648                         logc_ratio_w_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
     2649                      ENDIF
    25342650                      lcr(0:ncorr-1) = 1.0_wp
    25352651                   ENDDO
     
    26462762
    26472763       END SELECT
     2764         
     2765       !write(9,"('pmci_define_loglaw_correction_parameters: ', 6(i3,2x))")    &
     2766       !     direction, ij, k, wall_index, inc, lc
    26482767
    26492768    END SUBROUTINE pmci_define_loglaw_correction_parameters
     
    26702789       REAL(wp) ::  zuc1   !<
    26712790
    2672 
     2791!
     2792!--    kbc is the first coarse-grid point above the surface
    26732793       kbc = nzb + 1
    2674 !
    2675 !--    kbc is the first coarse-grid point above the surface
    26762794       DO  WHILE ( cg%zu(kbc) < zu(kb) )
    26772795          kbc = kbc + 1
     
    26912809    SUBROUTINE pmci_find_logc_pivot_j( lc, logyc1, j, jw, z0_l, inc )
    26922810!
    2693 !--    Finds the pivot node and te log-law factor for near-wall nodes for
     2811!--    Finds the pivot node and the log-law factor for near-wall nodes for
    26942812!--    which the wall-parallel velocity components will be log-law corrected
    26952813!--    after interpolation. This subroutine is only for vertical walls on
    2696 !--    south/north sides of the node.
    2697 
     2814!--    south/north sides of the node. If the pivot node is found to be outside
     2815!--    the subdomain, a marker value of -99 is set to lc and this tells
     2816!--    pmci_init_loglaw_correction to not do the correction in this case.
     2817     
    26982818       IMPLICIT NONE
    26992819
     
    27032823       INTEGER(iwp), INTENT(OUT) ::  lc     !<
    27042824
     2825       INTEGER(iwp) ::  jwc      !<
    27052826       INTEGER(iwp) ::  j1       !<
    27062827
     
    27082829
    27092830       REAL(wp) ::  logyc1   !<
     2831       REAL(wp) ::  ycb      !<       
    27102832       REAL(wp) ::  yc1      !<
    27112833       
    27122834!
    27132835!--    yc1 is the y-coordinate of the first coarse-grid u- and w-nodes out from
    2714 !--    the wall
    2715        yc1  = coord_y(jw) + 0.5_wp * inc * cg%dy
    2716 !
    2717 !--    j1 is the first fine-grid index further away from the wall than yc1
    2718        j1 = j
    2719 !
    2720 !--    Important: must be <, not <=
    2721        DO  WHILE ( inc * ( coord_y(j1) + 0.5_wp * dy ) < inc * yc1 )
    2722           j1 = j1 + inc
    2723        ENDDO
    2724 
    2725        logyc1 = LOG( ABS( coord_y(j1) + 0.5_wp * dy - coord_y(jw) ) / z0_l )
    2726        lc = j1
    2727 
     2836!--    the wall. Here we assume that the wall index in the coarse grid is the
     2837!--    closest one if they don't match.
     2838       jwc  = pmci_find_nearest_coarse_grid_index_j( jw )
     2839       yc1  = cg%coord_y(jwc) - lower_left_coord_y + 0.5_wp * inc * cg%dy
     2840!       
     2841!--    Check if yc1 is out of the subdomain y-range. In such case set the marker
     2842!--    value -99 for lc in order to skip the loglaw-correction locally.
     2843       IF ( yc1 < ( REAL( nysg, KIND=wp ) + 0.5_wp ) * dy  )  THEN
     2844          lc = -99
     2845       ELSE IF ( yc1 > ( REAL( nyng, KIND=wp ) + 0.5_wp ) * dy )  THEN
     2846          lc = -99
     2847       ELSE
     2848!
     2849!--       j1 is the first fine-grid index further away from the wall than yc1
     2850          j1 = j
     2851!
     2852!--       Important: the binary relation must be <, not <=
     2853          ycb = 0.5_wp * dy - lower_left_coord_y
     2854          DO  WHILE ( inc * ( coord_y(j1) + ycb ) < inc * yc1 )
     2855             j1 = j1 + inc
     2856          ENDDO
     2857         
     2858          logyc1 = LOG( ABS( coord_y(j1) + 0.5_wp * dy - coord_y(jw) ) / z0_l )
     2859          lc = j1
     2860       ENDIF
     2861       
    27282862    END SUBROUTINE pmci_find_logc_pivot_j
    27292863
     
    27352869!--    which the wall-parallel velocity components will be log-law corrected
    27362870!--    after interpolation. This subroutine is only for vertical walls on
    2737 !--    south/north sides of the node.
     2871!--    left/right sides of the node. If the pivot node is found to be outside
     2872!--    the subdomain, a marker value of -99 is set to lc and this tells
     2873!--    pmci_init_loglaw_correction to not do the correction in this case.
    27382874
    27392875       IMPLICIT NONE
     
    27442880       INTEGER(iwp), INTENT(OUT) ::  lc     !<
    27452881
     2882       INTEGER(iwp) ::  iwc      !<
    27462883       INTEGER(iwp) ::  i1       !<
    27472884
     
    27492886
    27502887       REAL(wp) ::  logxc1   !<
     2888       REAL(wp) ::  xcb      !<
    27512889       REAL(wp) ::  xc1      !<
    27522890
    27532891!
    27542892!--    xc1 is the x-coordinate of the first coarse-grid v- and w-nodes out from
    2755 !--    the wall
    2756        xc1  = coord_x(iw) + 0.5_wp * inc * cg%dx
    2757 !
    2758 !--    i1 is the first fine-grid index futher away from the wall than xc1.
    2759        i1 = i
    2760 !
    2761 !--    Important: must be <, not <=
    2762        DO  WHILE ( inc * ( coord_x(i1) + 0.5_wp *dx ) < inc * xc1 )
    2763           i1 = i1 + inc
    2764        ENDDO
     2893!--    the wall. Here we assume that the wall index in the coarse grid is the
     2894!--    closest one if they don't match.
     2895       iwc  = pmci_find_nearest_coarse_grid_index_i( iw )
     2896       xc1  = cg%coord_x(iwc) - lower_left_coord_x + 0.5_wp * inc * cg%dx
     2897!       
     2898!--    Check if xc1 is out of the subdomain x-range. In such case set the marker
     2899!--    value -99 for lc in order to skip the loglaw-correction locally.       
     2900       IF ( xc1 < ( REAL( nxlg, KIND=wp ) + 0.5_wp ) * dx  )  THEN
     2901          lc = -99
     2902       ELSE IF ( xc1 > ( REAL( nxrg, KIND=wp ) + 0.5_wp ) * dx )  THEN
     2903          lc = -99
     2904       ELSE   
     2905!
     2906!--       i1 is the first fine-grid index futher away from the wall than xc1.
     2907          i1 = i
     2908!
     2909!--       Important: the binary relation must be <, not <=
     2910          xcb = 0.5_wp * dx - lower_left_coord_x
     2911          DO  WHILE ( inc * ( coord_x(i1) + xcb ) < inc * xc1 )
     2912             i1 = i1 + inc
     2913          ENDDO
    27652914     
    2766        logxc1 = LOG( ABS( coord_x(i1) + 0.5_wp*dx - coord_x(iw) ) / z0_l )
    2767        lc = i1
    2768 
     2915          logxc1 = LOG( ABS( coord_x(i1) + 0.5_wp*dx - coord_x(iw) ) / z0_l )
     2916          lc = i1
     2917       ENDIF
     2918       
    27692919    END SUBROUTINE pmci_find_logc_pivot_i
    27702920
    27712921
    2772 
    2773 
     2922   
     2923    FUNCTION pmci_find_nearest_coarse_grid_index_j( jw )
     2924
     2925      IMPLICIT NONE
     2926      INTEGER(iwp) :: jw         !< Fine-grid wall index
     2927
     2928      INTEGER(iwp) :: jc
     2929      INTEGER(iwp) :: pmci_find_nearest_coarse_grid_index_j
     2930      REAL(wp) :: dist
     2931      REAL(wp) :: newdist
     2932
     2933     
     2934      dist = coord_y(nyn) - coord_y(nys)
     2935      DO jc = jcs, jcn
     2936         newdist = ABS( cg%coord_y(jc) - coord_y(jw) )
     2937         IF ( newdist < dist )  THEN
     2938            pmci_find_nearest_coarse_grid_index_j = jc
     2939            dist = newdist
     2940         ENDIF
     2941      ENDDO
     2942     
     2943    END FUNCTION pmci_find_nearest_coarse_grid_index_j
     2944
     2945
     2946   
     2947    FUNCTION pmci_find_nearest_coarse_grid_index_i( iw )
     2948
     2949      IMPLICIT NONE
     2950      INTEGER(iwp) :: iw         !< Fine-grid wall index
     2951
     2952      INTEGER(iwp) :: ic
     2953      INTEGER(iwp) :: pmci_find_nearest_coarse_grid_index_i
     2954      REAL(wp) :: dist
     2955      REAL(wp) :: newdist
     2956
     2957     
     2958      dist = coord_x(nxr) - coord_x(nxl)
     2959      DO ic = icl, icr
     2960         newdist = ABS( cg%coord_x(ic) - coord_x(iw) )
     2961         IF ( newdist < dist )  THEN
     2962            pmci_find_nearest_coarse_grid_index_i = ic
     2963            dist = newdist
     2964         ENDIF
     2965      ENDDO
     2966     
     2967    END FUNCTION pmci_find_nearest_coarse_grid_index_i
     2968
     2969   
     2970     
    27742971    SUBROUTINE pmci_init_anterp_tophat
    27752972!
  • palm/trunk/SOURCE/time_integration.f90

    r2977 r2984  
    2525! -----------------
    2626! $Id$
    27 ! Implement changes from branch radiation (r2948-2971) with minor modifications.
    28 ! (moh.hefny)
    29 ! Fixed bug in if statement
     27! CALL pmci_ensure_nest_mass_conservation is removed (so far only commented out)
     28! as seemingly unnecessary.
    3029!
    3130! 2941 2018-04-03 11:54:58Z kanani
     
    812811!--          This action must never be done for the root domain. Vertical
    813812!--          nesting implies mass conservation.
    814              IF ( nest_domain )  THEN
    815                 CALL pmci_ensure_nest_mass_conservation
    816              ENDIF
     813!--          Commented out April 18, 2018 as seemingly unnecessary.
     814!--          Will later be completely removed.
     815!--             IF ( nest_domain )  THEN
     816!--                CALL pmci_ensure_nest_mass_conservation
     817!--             ENDIF
    817818
    818819             CALL cpu_log( log_point(60), 'nesting', 'stop' )
     
    10391040                CALL cpu_log( log_point(50), 'radiation', 'stop' )
    10401041
    1041                 IF ( ( urban_surface  .OR.  land_surface )  .AND.               &
     1042                IF ( urban_surface  .OR.  land_surface  .AND.                  &
    10421043                     radiation_interactions )  THEN
    10431044                   CALL cpu_log( log_point(75), 'radiation_interaction', 'start' )
Note: See TracChangeset for help on using the changeset viewer.