Changeset 1762 for palm/trunk/SOURCE


Ignore:
Timestamp:
Feb 25, 2016 12:31:13 PM (8 years ago)
Author:
hellstea
Message:

Introduction of nested domain system

Location:
palm/trunk/SOURCE
Files:
6 added
15 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/Makefile

    r1748 r1762  
    2020# Current revisions:
    2121# ------------------
    22 #
     22# +pmc_interface, +pmc routines
    2323#
    2424# Former revisions:
     
    245245        ls_forcing.f90 message.f90 microphysics.f90 modules.f90 mod_kinds.f90 \
    246246        mod_particle_attributes.f90 netcdf.f90 nudging.f90 package_parin.f90 \
    247         palm.f90 parin.f90 plant_canopy_model.f90 poisfft.f90 poismg.f90 \
     247        palm.f90 parin.f90 plant_canopy_model.f90 pmc_interface.f90 \
     248        pmc_client.f90 pmc_general.f90 pmc_handle_communicator.f90 pmc_mpi_wrapper.f90 \
     249        pmc_server.f90 \
     250        poisfft.f90 poismg.f90 \
    248251        poismg_fast.f90 pres.f90 print_1d.f90 production_e.f90 \
    249252        prognostic_equations.f90 progress_bar.f90 radiation_model.f90 \
     
    371374init_masks.o: modules.o mod_kinds.o
    372375init_ocean.o: modules.o eqn_state_seawater.o mod_kinds.o
    373 init_pegrid.o: modules.o mod_kinds.o
     376init_pegrid.o: modules.o mod_kinds.o pmc_interface.o
    374377init_pt_anomaly.o: modules.o mod_kinds.o
    375378init_rankine.o: modules.o mod_kinds.o
     
    423426                 plant_canopy_model.o radiation_model.o
    424427palm.o: modules.o cpulog.o ls_forcing.o mod_kinds.o nudging.o\
    425         surface_layer_fluxes.o
     428        pmc_interface.o surface_layer_fluxes.o
    426429parin.o: modules.o cpulog.o mod_kinds.o progress_bar.o
    427430plant_canopy_model.o: modules.o mod_kinds.o
     431pmc_interface.o: modules.o mod_kinds.o pmc_client.o pmc_general.o\
     432        pmc_handle_communicator.o pmc_mpi_wrapper.o pmc_server.o
     433pmc_client.o: pmc_general.o pmc_handle_communicator.o pmc_mpi_wrapper.o
     434pmc_handle_communicator.o: pmc_general.o
     435pmc_mpi_wrapper.o: pmc_handle_communicator.o
     436pmc_server.o: pmc_general.o pmc_handle_communicator.o pmc_mpi_wrapper.o
    428437poisfft.o: modules.o cpulog.o fft_xy.o mod_kinds.o tridia_solver.o
    429438poismg.o: modules.o cpulog.o mod_kinds.o
     
    461470time_integration.o: modules.o advec_ws.o buoyancy.o calc_mean_profile.o \
    462471        cpulog.o interaction_droplets_ptq.o land_surface_model.o \
    463         ls_forcing.o mod_kinds.o nudging.o production_e.o \
     472        ls_forcing.o mod_kinds.o nudging.o pmc_interface.o production_e.o \
    464473        prognostic_equations.o progress_bar.o radiation_model.o \
    465474         user_actions.o surface_layer_fluxes.o
  • palm/trunk/SOURCE/boundary_conds.f90

    r1744 r1762  
    1919! Current revisions:
    2020! -----------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    134134               ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, ibc_sa_t, ibc_uv_b,       &
    135135               ibc_uv_t, icloud_scheme, inflow_l, inflow_n, inflow_r, inflow_s,&
    136                intermediate_timestep_count, large_scale_forcing, ocean,        &
     136               intermediate_timestep_count, large_scale_forcing, nest_domain,  &
     137               nest_bound_l, nest_bound_s, nudging, ocean,                     &
    137138               outflow_l, outflow_n, outflow_r, outflow_s, passive_scalar,     &
    138                precipitation, tsc, use_cmax, &
    139                nudging
     139               precipitation, tsc, use_cmax
    140140
    141141    USE grid_variables,                                                        &
     
    179179
    180180!
    181 !-- Top boundary
     181!-- Top boundary. A nested domain ( ibc_uv_t = 3 ) does not require settings.
    182182    IF ( ibc_uv_t == 0 )  THEN
    183183       !$acc kernels present( u_init, u_p, v_init, v_p )
     
    185185        v_p(nzt+1,:,:) = v_init(nzt+1)
    186186       !$acc end kernels
    187     ELSE
     187    ELSEIF ( ibc_uv_t == 1 )  THEN
    188188       !$acc kernels present( u_p, v_p )
    189189        u_p(nzt+1,:,:) = u_p(nzt,:,:)
     
    191191       !$acc end kernels
    192192    ENDIF
    193     !$acc kernels present( w_p )
    194     w_p(nzt:nzt+1,:,:) = 0.0_wp  ! nzt is not a prognostic level (but cf. pres)
    195     !$acc end kernels
     193
     194    IF ( .NOT. nest_domain )  THEN
     195       !$acc kernels present( w_p )
     196       w_p(nzt:nzt+1,:,:) = 0.0_wp  ! nzt is not a prognostic level (but cf. pres)
     197       !$acc end kernels
     198    ENDIF
    196199
    197200!
     
    255258          ENDDO
    256259       ENDDO
    257        e_p(nzt+1,:,:) = e_p(nzt,:,:)
     260       IF ( .NOT. nest_domain )  THEN
     261          e_p(nzt+1,:,:) = e_p(nzt,:,:)
     262       ENDIF
    258263       !$acc end kernels
    259264    ENDIF
     
    325330    ENDIF
    326331!
    327 !-- In case of inflow at the south boundary the boundary for v is at nys
    328 !-- and in case of inflow at the left boundary the boundary for u is at nxl.
    329 !-- Since in prognostic_equations (cache optimized version) these levels are
    330 !-- handled as a prognostic level, boundary values have to be restored here.
     332!-- In case of inflow or nest boundary at the south boundary the boundary for v
     333!-- is at nys and in case of inflow or nest boundary at the left boundary the
     334!-- boundary for u is at nxl. Since in prognostic_equations (cache optimized
     335!-- version) these levels are handled as a prognostic level, boundary values
     336!-- have to be restored here.
    331337!-- For the SGS-TKE, Neumann boundary conditions are used at the inflow.
    332338    IF ( inflow_s )  THEN
     
    340346    ELSEIF ( inflow_r )  THEN
    341347       IF ( .NOT. constant_diffusion ) e_p(:,:,nxr+1) = e_p(:,:,nxr)
     348    ENDIF
     349
     350!
     351!-- The same restoration for u at i=nxl and v at j=nys as above must be made
     352!-- in case of nest boundaries. Note however, that the above ELSEIF-structure is
     353!-- not appropriate here as there may be more than one nest boundary on a
     354!-- PE-domain. Furthermore Neumann conditions for SGS-TKE are not required here.
     355    IF ( nest_bound_s )  THEN
     356       v_p(:,nys,:) = v_p(:,nys-1,:)
     357    ENDIF
     358    IF ( nest_bound_l )  THEN
     359       u_p(:,:,nxl) = u_p(:,:,nxl-1)
    342360    ENDIF
    343361
  • palm/trunk/SOURCE/check_parameters.f90

    r1759 r1762  
    1919! Current revisions:
    2020! -----------------
    21 ! Previous version restored.
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    17551755!-- Lateral boundary conditions
    17561756    IF ( bc_lr /= 'cyclic'  .AND.  bc_lr /= 'dirichlet/radiation'  .AND. &
    1757          bc_lr /= 'radiation/dirichlet' )  THEN
     1757         bc_lr /= 'radiation/dirichlet'  .AND.  bc_lr /= 'nested' )  THEN
    17581758       message_string = 'unknown boundary condition: bc_lr = "' // &
    17591759                        TRIM( bc_lr ) // '"'
     
    17611761    ENDIF
    17621762    IF ( bc_ns /= 'cyclic'  .AND.  bc_ns /= 'dirichlet/radiation'  .AND. &
    1763          bc_ns /= 'radiation/dirichlet' )  THEN
     1763         bc_ns /= 'radiation/dirichlet'  .AND.  bc_ns /= 'nested' )  THEN
    17641764       message_string = 'unknown boundary condition: bc_ns = "' // &
    17651765                        TRIM( bc_ns ) // '"'
     
    18431843    IF ( bc_p_t == 'dirichlet' )  THEN
    18441844       ibc_p_t = 0
    1845     ELSEIF ( bc_p_t == 'neumann' )  THEN
     1845!-- TO_DO: later set bc_p_t to neumann before, in case of nested domain
     1846    ELSEIF ( bc_p_t == 'neumann' .OR. bc_p_t == 'nested' )  THEN
    18461847       ibc_p_t = 1
    18471848    ELSE
     
    18731874    ELSEIF ( bc_pt_t == 'initial_gradient' )  THEN
    18741875       ibc_pt_t = 2
     1876    ELSEIF ( bc_pt_t == 'nested' )  THEN
     1877       ibc_pt_t = 3
    18751878    ELSE
    18761879       message_string = 'unknown boundary condition: bc_pt_t = "' // &
     
    20152018       ELSEIF ( bc_q_t == 'neumann' )  THEN
    20162019          ibc_q_t = 1
     2020       ELSEIF ( bc_q_t == 'nested' )  THEN
     2021          ibc_q_t = 3
    20172022       ELSE
    20182023          message_string = 'unknown boundary condition: bc_' // TRIM( sq ) // &
     
    20982103       ELSEIF ( bc_uv_t == 'neumann' )  THEN
    20992104          ibc_uv_t = 1
     2105       ELSEIF ( bc_uv_t == 'nested' )  THEN
     2106          ibc_uv_t = 3
    21002107       ELSE
    21012108          message_string = 'unknown boundary condition: bc_uv_t = "' // &
     
    38613868       ntdim_2d_xz(1) = ntdim_3d(1)
    38623869       ntdim_2d_yz(1) = ntdim_3d(1)
    3863              write(9,*) "ntdim_3d(av)=",ntdim_3d(0)
    3864              CALL local_flush(9)
     3870
    38653871    ENDIF
    38663872
  • palm/trunk/SOURCE/exchange_horiz_2d.f90

    r1683 r1762  
    1919! Current revisions:
    2020! -----------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    6262    USE control_parameters,                                                    &
    6363        ONLY :  bc_lr_cyc, bc_ns_cyc, inflow_l, inflow_n, inflow_r, inflow_s,  &
     64                nest_bound_l, nest_bound_n, nest_bound_r, nest_bound_s,        &
    6465                outflow_l, outflow_n, outflow_r, outflow_s
    6566               
     
    153154
    154155!
    155 !-- Neumann-conditions at inflow/outflow in case of non-cyclic boundary
    156 !-- conditions
    157     IF ( inflow_l .OR. outflow_l )  THEN
    158        DO i=nbgp, 1, -1
     156!-- Neumann-conditions at inflow/outflow/nested boundaries
     157    IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
     158       DO  i = nbgp, 1, -1
    159159         ar(:,nxl-i) = ar(:,nxl)
    160        END DO
    161     END IF
    162     IF ( inflow_r .OR. outflow_r )  THEN
    163        DO i=1, nbgp
     160       ENDDO
     161    ENDIF
     162    IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
     163       DO  i = 1, nbgp
    164164          ar(:,nxr+i) = ar(:,nxr)
    165        END DO
    166     END IF
    167     IF ( inflow_s .OR. outflow_s )  THEN
    168        DO i=nbgp, 1, -1
     165       ENDDO
     166    ENDIF
     167    IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
     168       DO  i = nbgp, 1, -1
    169169         ar(nys-i,:) = ar(nys,:)
    170        END DO
    171     END IF
    172     IF ( inflow_n .OR. outflow_n )  THEN
    173        DO i=1, nbgp
     170       ENDDO
     171    ENDIF
     172    IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
     173       DO  i = 1, nbgp
    174174         ar(nyn+i,:) = ar(nyn,:)
    175        END DO
    176     END IF
     175       ENDDO
     176    ENDIF
     177
    177178    CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'stop' )
    178179
     
    193194
    194195    USE control_parameters,                                                    &
    195         ONLY:  bc_lr_cyc, bc_ns_cyc
     196        ONLY:  bc_lr_cyc, bc_ns_cyc, nest_bound_l, nest_bound_n, nest_bound_r, &
     197               nest_bound_s
    196198       
    197199    USE cpulog,                                                                &
     
    207209    IMPLICIT NONE
    208210
     211    INTEGER(iwp) ::  i
    209212    INTEGER(iwp) ::  ar(nysg:nyng,nxlg:nxrg)  !<
    210213
     
    277280
    278281#endif
     282!
     283!-- Neumann-conditions at inflow/outflow/nested boundaries
     284    IF ( nest_bound_l )  THEN
     285       DO  i = nbgp, 1, -1
     286         ar(:,nxl-i) = ar(:,nxl)
     287       ENDDO
     288    ENDIF
     289    IF ( nest_bound_r )  THEN
     290       DO  i = 1, nbgp
     291          ar(:,nxr+i) = ar(:,nxr)
     292       ENDDO
     293    ENDIF
     294    IF ( nest_bound_s )  THEN
     295       DO  i = nbgp, 1, -1
     296         ar(nys-i,:) = ar(nys,:)
     297       ENDDO
     298    ENDIF
     299    IF ( nest_bound_n )  THEN
     300       DO  i = 1, nbgp
     301         ar(nyn+i,:) = ar(nyn,:)
     302       ENDDO
     303    ENDIF
     304
    279305    CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'stop' )
    280306
  • palm/trunk/SOURCE/init_3d_model.f90

    r1739 r1762  
    1919! Current revisions:
    2020! ------------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    669669!-- is done). Further below the values needed within the timestep scheme
    670670!-- will be set.
     671!-- TO_DO: zeroth element added to weight_pres because in case of nesting
     672!--        pres may need to be called  outside the RK-substeps. Antti will
     673!--        check if this is really required.
    671674    ALLOCATE( weight_substep(1:intermediate_timestep_count_max), &
    672               weight_pres(1:intermediate_timestep_count_max) )
     675              weight_pres(0:intermediate_timestep_count_max) )
    673676    weight_substep = 1.0_wp
    674677    weight_pres    = 1.0_wp
     
    774777
    775778!
     779!--       Inside buildings set velocities back to zero
    776780          IF ( topography /= 'flat' )  THEN
    777              DO  i = nxl-1, nxr+1
    778                 DO  j = nys-1, nyn+1
     781             DO  i = nxlg, nxrg
     782                DO  j = nysg, nyng
    779783                   u(nzb:nzb_u_inner(j,i),j,i) = 0.0_wp
    780784                   v(nzb:nzb_v_inner(j,i),j,i) = 0.0_wp
     
    841845!--       in the limiting formula!). The original values are stored to be later
    842846!--       used for volume flow control.
    843           IF ( ibc_uv_b /= 1 )  THEN   
    844              DO  i = nxlg, nxrg
    845                 DO  j = nysg, nyng
    846                    u(nzb:nzb_u_inner(j,i)+1,j,i) = 0.0_wp
    847                    v(nzb:nzb_v_inner(j,i)+1,j,i) = 0.0_wp
    848                 ENDDO
    849              ENDDO
    850           ENDIF
     847          ! TO_DO:  Antti will check if this is really required
     848          !AH IF ( ibc_uv_b /= 1 )  THEN
     849          !AH    DO  i = nxlg, nxrg
     850          !AH       DO  j = nysg, nyng
     851          !AH          u(nzb:nzb_u_inner(j,i)+1,j,i) = 0.0_wp
     852          !AH          v(nzb:nzb_v_inner(j,i)+1,j,i) = 0.0_wp
     853          !AH       ENDDO
     854          !AH    ENDDO
     855          !AH ENDIF
    851856
    852857          IF ( humidity  .OR.  passive_scalar )  THEN
     
    16691674!
    16701675!-- Setting weighting factors for calculation of perturbation pressure
    1671 !-- and turbulent quantities from the RK substeps               
     1676!-- and turbulent quantities from the RK substeps
     1677!-- TO_DO: zeroth element is added to weight_pres because in nesting pres
     1678!--        may need to be called outside the RK-substeps
     1679    weight_pres(0) = 1.0_wp
    16721680    IF ( TRIM(timestep_scheme) == 'runge-kutta-3' )  THEN      ! for RK3-method
    16731681
  • palm/trunk/SOURCE/init_grid.f90

    r1744 r1762  
    1919! Current revisions:
    2020! -----------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    156156               io_group, inflow_l, inflow_n, inflow_r, inflow_s,               &
    157157               masking_method, maximum_grid_level, message_string,             &
    158                momentum_advec, ocean, outflow_l, outflow_n, outflow_r,         &
    159                outflow_s, psolver, scalar_advec, topography,                   &
     158               momentum_advec, nest_domain, nest_bound_l, nest_bound_n,        &
     159               nest_bound_r, nest_bound_s, ocean, outflow_l, outflow_n,        &
     160               outflow_r, outflow_s, psolver, scalar_advec, topography,        &
    160161               topography_grid_convention, use_surface_fluxes, use_top_fluxes, &
    161162               wall_adjustment_factor
     
    734735    nzb_max = MAXVAL( nzb_local ) + 1
    735736    IF ( inflow_l .OR. outflow_l .OR. inflow_r .OR. outflow_r .OR.             &
    736          inflow_n .OR. outflow_n .OR. inflow_s .OR. outflow_s )  THEN
    737          nzb_max = nzt
     737         inflow_n .OR. outflow_n .OR. inflow_s .OR. outflow_s .OR.             &
     738         nest_domain )                                                         &
     739    THEN
     740       nzb_max = nzt
    738741    ENDIF
    739742
     
    12211224!--             scalar - x-direction
    12221225!--             WS1 (0), WS3 (1), WS5 (2)
    1223                 IF ( k <= nzb_s_inner(j,i+1) .OR. ( ( inflow_l .OR. outflow_l )&
    1224                      .AND. i == nxl ) .OR. ( ( inflow_r .OR. outflow_r )       &
    1225                      .AND. i == nxr ) )  THEN
     1226                IF ( k <= nzb_s_inner(j,i+1) .OR.                              &
     1227                         ( ( inflow_l .OR. outflow_l .OR. nest_bound_l )       &
     1228                           .AND. i == nxl   )    .OR.                          &
     1229                         ( ( inflow_r .OR. outflow_r .OR. nest_bound_r )       &
     1230                           .AND. i == nxr   ) )                                &
     1231                THEN
    12261232                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 0 )
    12271233                ELSEIF ( k <= nzb_s_inner(j,i+2) .OR. k <= nzb_s_inner(j,i-1)  &
    1228                          .OR. ( ( inflow_r .OR. outflow_r ) .AND. i == nxr-1 ) &
    1229                          .OR. ( ( inflow_l .OR. outflow_l ) .AND. i == nxlu  ) &
    1230                        )  THEN
     1234                                                 .OR.                          &
     1235                         ( ( inflow_r .OR. outflow_r .OR. nest_bound_r )       &
     1236                           .AND. i == nxr-1 )    .OR.                          &
     1237                         ( ( inflow_l .OR. outflow_l .OR. nest_bound_l )       &
     1238                           .AND. i == nxlu  ) )                                &
     1239                THEN
    12311240                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 1 )
    12321241                ELSE
     
    12361245!--             scalar - y-direction
    12371246!--             WS1 (3), WS3 (4), WS5 (5)
    1238                 IF ( k <= nzb_s_inner(j+1,i) .OR. ( ( inflow_s .OR. outflow_s )&
    1239                      .AND. j == nys ) .OR. ( ( inflow_n .OR. outflow_n )       &
    1240                      .AND. j == nyn ) )  THEN
     1247                IF ( k <= nzb_s_inner(j+1,i) .OR.                              &
     1248                         ( ( inflow_s .OR. outflow_s .OR. nest_bound_s )       &
     1249                           .AND. j == nys   )    .OR.                          &
     1250                         ( ( inflow_n .OR. outflow_n .OR. nest_bound_n )       &
     1251                           .AND. j == nyn   ) )                                &
     1252                THEN
    12411253                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 3 )
     1254!
    12421255!--             WS3
    12431256                ELSEIF ( k <= nzb_s_inner(j+2,i) .OR. k <= nzb_s_inner(j-1,i)  &
    1244                          .OR. ( ( inflow_s .OR. outflow_s ) .AND. j == nysv  ) &
    1245                          .OR. ( ( inflow_n .OR. outflow_n ) .AND. j == nyn-1 ) &
    1246                        )  THEN
     1257                                                 .OR.                          &
     1258                         ( ( inflow_s .OR. outflow_s .OR. nest_bound_s )       &
     1259                           .AND. j == nysv  )    .OR.                          &
     1260                         ( ( inflow_n .OR. outflow_n .OR. nest_bound_n )       &
     1261                           .AND. j == nyn-1 ) )                                &
     1262                THEN
    12471263                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 4 )
     1264!
    12481265!--             WS5
    12491266                ELSE
     
    12871304!--             u component - x-direction
    12881305!--             WS1 (9), WS3 (10), WS5 (11)
    1289                 IF ( k <= nzb_u_inner(j,i+1)                                  &
    1290                      .OR. ( ( inflow_l .OR. outflow_l ) .AND. i <= nxlu )     &
    1291                      .OR. ( ( inflow_r .OR. outflow_r ) .AND. i == nxr  )     &
    1292                    )  THEN
     1306                IF ( k <= nzb_u_inner(j,i+1) .OR.                              &
     1307                         ( ( inflow_l .OR. outflow_l .OR. nest_bound_l )       &
     1308                           .AND. i <= nxlu  )    .OR.                          &
     1309                         ( ( inflow_r .OR. outflow_r .OR. nest_bound_r )       &
     1310                           .AND. i == nxr   ) )                                &
     1311                THEN
    12931312                    wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 9 )
    1294                 ELSEIF ( k <= nzb_u_inner(j,i+2) .OR. k <= nzb_u_inner(j,i-1) &
    1295                          .OR. ( ( inflow_r .OR. outflow_r ) .AND. i == nxr-1 )&
    1296                          .OR. ( ( inflow_l .OR. outflow_l ) .AND. i == nxlu+1)&
    1297                        )  THEN
     1313                ELSEIF ( k <= nzb_u_inner(j,i+2) .OR. k <= nzb_u_inner(j,i-1)  &
     1314                                                 .OR.                          &
     1315                         ( ( inflow_r .OR. outflow_r .OR. nest_bound_r )       &
     1316                           .AND. i == nxr-1 )    .OR.                          &
     1317                         ( ( inflow_l .OR. outflow_l .OR. nest_bound_l )       &
     1318                           .AND. i == nxlu+1) )                                &
     1319                THEN
    12981320                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 10 )
    12991321!
     
    13091331!--             u component - y-direction
    13101332!--             WS1 (12), WS3 (13), WS5 (14)
    1311                 IF ( k <= nzb_u_inner(j+1,i) .OR. ( ( inflow_s .OR. outflow_s )&
    1312                      .AND. j == nys ) .OR. ( ( inflow_n .OR. outflow_n )       &
    1313                      .AND. j == nyn ) )  THEN
    1314                     wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 12 )
     1333                IF ( k <= nzb_u_inner(j+1,i) .OR.                              &
     1334                         ( ( inflow_s .OR. outflow_s .OR. nest_bound_s )       &
     1335                           .AND. j == nys   )    .OR.                          &
     1336                         ( ( inflow_n .OR. outflow_n .OR. nest_bound_n )       &
     1337                           .AND. j == nyn   ) )                                &
     1338                THEN
     1339                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 12 )
    13151340                ELSEIF ( k <= nzb_u_inner(j+2,i) .OR. k <= nzb_u_inner(j-1,i)  &
    1316                          .OR. ( ( inflow_s .OR. outflow_s ) .AND. j == nysv  ) &
    1317                          .OR. ( ( inflow_n .OR. outflow_n ) .AND. j == nyn-1 ) &
    1318                        )  THEN
     1341                                                 .OR.                          &
     1342                         ( ( inflow_s .OR. outflow_s .OR. nest_bound_s )       &
     1343                           .AND. j == nysv  )    .OR.                          &
     1344                         ( ( inflow_n .OR. outflow_n .OR. nest_bound_n )       &
     1345                           .AND. j == nyn-1 ) )                                &
     1346                THEN
    13191347                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 13 )
    13201348!
     
    13571385!--             v component - x-direction
    13581386!--             WS1 (18), WS3 (19), WS5 (20)
    1359                 IF ( k <= nzb_v_inner(j,i+1) .OR. ( ( inflow_l .OR. outflow_l )&
    1360                      .AND. i == nxl ) .OR. (( inflow_r .OR. outflow_r )        &
    1361                      .AND. i == nxr ) )  THEN
    1362                      wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 18 )
     1387                IF ( k <= nzb_v_inner(j,i+1) .OR.                              &
     1388                         ( ( inflow_l .OR. outflow_l .OR. nest_bound_l )       &
     1389                           .AND. i == nxl   )    .OR.                          &
     1390                         ( ( inflow_r .OR. outflow_r .OR. nest_bound_r )       &
     1391                           .AND. i == nxr   ) )                                &
     1392                THEN
     1393                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 18 )
     1394!
    13631395!--             WS3
    13641396                ELSEIF ( k <= nzb_v_inner(j,i+2) .OR. k <= nzb_v_inner(j,i-1)  &
    1365                          .OR. ( ( inflow_r .OR. outflow_r ) .AND. i == nxr-1 ) &
    1366                          .OR. ( ( inflow_l .OR. outflow_l ) .AND. i == nxlu  ) &
    1367                        )  THEN
     1397                                                 .OR.                          &
     1398                         ( ( inflow_r .OR. outflow_r .OR. nest_bound_r )       &
     1399                           .AND. i == nxr-1 )    .OR.                          &
     1400                         ( ( inflow_l .OR. outflow_l .OR. nest_bound_l )       &
     1401                           .AND. i == nxlu  ) )                                &
     1402                THEN
    13681403                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 19 )
    13691404!
     
    13791414!--             v component - y-direction
    13801415!--             WS1 (21), WS3 (22), WS5 (23)
    1381                 IF ( k <= nzb_v_inner(j+1,i)                                   &
    1382                      .OR. ( ( inflow_s .OR. outflow_s ) .AND. j <= nysv )      &
    1383                      .OR. ( ( inflow_n .OR. outflow_n ) .AND. j == nyn  )      &
    1384                    )  THEN
    1385                     wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 21 )
     1416                IF ( k <= nzb_v_inner(j+1,i) .OR.                              &
     1417                         ( ( inflow_s .OR. outflow_s .OR. nest_bound_s )       &
     1418                           .AND. j <= nysv  )    .OR.                          &
     1419                         ( ( inflow_n .OR. outflow_n .OR. nest_bound_n )       &
     1420                           .AND. j == nyn   ) )                                &
     1421                THEN
     1422                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 21 )
    13861423                ELSEIF ( k <= nzb_v_inner(j+2,i) .OR. k <= nzb_v_inner(j-1,i)  &
    1387                          .OR. ( ( inflow_s .OR. outflow_s ) .AND. j == nysv+1 )&
    1388                          .OR. ( ( inflow_n .OR. outflow_n ) .AND. j == nyn-1  )&
    1389                        )  THEN
     1424                                                 .OR.                          &
     1425                         ( ( inflow_s .OR. outflow_s .OR. nest_bound_s )       &
     1426                           .AND. j == nysv+1)    .OR.                          &
     1427                         ( ( inflow_n .OR. outflow_n .OR. nest_bound_n )       &
     1428                           .AND. j == nyn-1 ) )                                &
     1429                THEN
    13901430                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 22 )
    13911431!
     
    14271467!--             w component - x-direction
    14281468!--             WS1 (27), WS3 (28), WS5 (29)
    1429                 IF ( k <= nzb_w_inner(j,i+1) .OR. ( ( inflow_l .OR. outflow_l )&
    1430                      .AND. i == nxl ) .OR. ( ( inflow_r .OR. outflow_r )       &
    1431                      .AND. i == nxr ) )  THEN
    1432                     wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 27 )
     1469                IF ( k <= nzb_w_inner(j,i+1) .OR.                              &
     1470                         ( ( inflow_l .OR. outflow_l .OR. nest_bound_l )       &
     1471                           .AND. i == nxl   )    .OR.                          &
     1472                         ( ( inflow_r .OR. outflow_r .OR. nest_bound_r )       &
     1473                           .AND. i == nxr   ) )                                &
     1474                THEN
     1475                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 27 )
    14331476                ELSEIF ( k <= nzb_w_inner(j,i+2) .OR. k <= nzb_w_inner(j,i-1)  &
    1434                          .OR. ( ( inflow_r .OR. outflow_r ) .AND. i == nxr-1 ) &
    1435                          .OR. ( ( inflow_l .OR. outflow_l ) .AND. i == nxlu  ) &
    1436                        )  THEN
     1477                                                 .OR.                          &
     1478                         ( ( inflow_r .OR. outflow_r .OR. nest_bound_r )       &
     1479                           .AND. i == nxr-1 )    .OR.                          &
     1480                         ( ( inflow_l .OR. outflow_l .OR. nest_bound_l )       &
     1481                           .AND. i == nxlu  ) )                                &
     1482                THEN
    14371483                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 28 )
    14381484!
     
    14481494!--             w component - y-direction
    14491495!--             WS1 (30), WS3 (31), WS5 (32)
    1450                 IF ( k <= nzb_w_inner(j+1,i) .OR. ( ( inflow_s .OR. outflow_s )&
    1451                      .AND. j == nys ) .OR. ( ( inflow_n .OR. outflow_n )       &
    1452                      .AND. j == nyn ) )  THEN
    1453                     wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 30 )
     1496                IF ( k <= nzb_w_inner(j+1,i) .OR.                              &
     1497                         ( ( inflow_s .OR. outflow_s .OR. nest_bound_s )       &
     1498                           .AND. j == nys   )    .OR.                          &
     1499                         ( ( inflow_n .OR. outflow_n .OR. nest_bound_n )       &
     1500                           .AND. j == nyn   ) )                                &
     1501                THEN
     1502                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 30 )
    14541503                ELSEIF ( k <= nzb_w_inner(j+2,i) .OR. k <= nzb_w_inner(j-1,i)  &
    1455                          .OR. ( ( inflow_s .OR. outflow_s ) .AND. j == nysv  ) &
    1456                          .OR. ( ( inflow_n .OR. outflow_n ) .AND. j == nyn-1 ) &
    1457                        )  THEN
     1504                                                 .OR.                          &
     1505                         ( ( inflow_s .OR. outflow_s .OR. nest_bound_s )       &
     1506                           .AND. j == nysv  )    .OR.                          &
     1507                         ( ( inflow_n .OR. outflow_n .OR. nest_bound_n )       &
     1508                           .AND. j == nyn-1 ) )                                &
     1509                THEN
    14581510                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 31 )
    14591511!
     
    15041556!--    Set boundary flags at inflow and outflow boundary in case of
    15051557!--    non-cyclic boundary conditions.
    1506        IF ( inflow_l .OR. outflow_l )  THEN
     1558       IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
    15071559          wall_flags_0(:,:,nxl-1)  = wall_flags_0(:,:,nxl)
    15081560          wall_flags_00(:,:,nxl-1) = wall_flags_00(:,:,nxl)
    15091561       ENDIF
    15101562
    1511        IF ( inflow_r .OR. outflow_r )  THEN
     1563       IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
    15121564          wall_flags_0(:,:,nxr+1)  = wall_flags_0(:,:,nxr)
    15131565          wall_flags_00(:,:,nxr+1) = wall_flags_00(:,:,nxr)
    15141566       ENDIF
    15151567
    1516        IF ( inflow_n .OR. outflow_n )  THEN
     1568       IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
    15171569          wall_flags_0(:,nyn+1,:)  = wall_flags_0(:,nyn,:)
    15181570          wall_flags_00(:,nyn+1,:) = wall_flags_00(:,nyn,:)
    15191571       ENDIF
    15201572
    1521        IF ( inflow_s .OR. outflow_s )  THEN
     1573       IF ( inflow_s .OR. outflow_s  .OR. nest_bound_s )  THEN
    15221574          wall_flags_0(:,nys-1,:)  = wall_flags_0(:,nys,:)
    15231575          wall_flags_00(:,nys-1,:) = wall_flags_00(:,nys,:)
  • palm/trunk/SOURCE/init_pegrid.f90

    r1683 r1762  
    1919! Current revisions:
    2020! ------------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    129129               io_blocks, io_group, maximum_grid_level,                        &
    130130               maximum_parallel_io_streams, message_string,                    &
    131                mg_switch_to_pe0_level, momentum_advec, neutral, psolver,       &
     131               mg_switch_to_pe0_level, momentum_advec, nest_bound_l,           &
     132               nest_bound_n, nest_bound_r, nest_bound_s, neutral, psolver,     &
    132133               outflow_l, outflow_n, outflow_r, outflow_s, recycling_width,    &
    133134               scalar_advec, subdomain_size
     
    147148    USE pegrid
    148149 
     150#if defined( PMC_ACTIVE )
     151    USE pmc_interface,                                                         &
     152        ONLY:  cpl_npex,cpl_npey
     153#endif
     154
    149155    USE transpose_indices,                                                     &
    150156        ONLY:  nxl_y, nxl_yd, nxl_z, nxr_y, nxr_yd, nxr_z, nyn_x, nyn_z, nys_x,&
     
    206212    CALL location_message( 'creating virtual PE grids + MPI derived data types', &
    207213                           .FALSE. )
     214#if defined( PMC_ACTIVE )
     215!
     216!-- In case of nested-domain runs, the processor grid is explicitly given
     217!-- by the user in the nestpar-NAMELIST
     218    pdims(1) = cpl_npex
     219    pdims(2) = cpl_npey
     220#else
    208221!
    209222!-- Determine the processor topology or check it, if prescribed by the user
     
    243256
    244257    ENDIF
     258#endif
    245259
    246260!
     
    10581072#if defined( __parallel ) && ! defined ( __check )
    10591073!
    1060 !-- Setting of flags for inflow/outflow conditions in case of non-cyclic
     1074!-- Setting of flags for inflow/outflow/nesting conditions in case of non-cyclic
    10611075!-- horizontal boundary conditions.
    10621076    IF ( pleft == MPI_PROC_NULL )  THEN
     
    10651079       ELSEIF ( bc_lr == 'radiation/dirichlet' )  THEN
    10661080          outflow_l = .TRUE.
     1081#if defined( PMC_ACTIVE )
     1082       ELSEIF ( bc_lr == 'nested' )  THEN
     1083          nest_bound_l = .TRUE.
     1084#endif
    10671085       ENDIF
    10681086    ENDIF
     
    10731091       ELSEIF ( bc_lr == 'radiation/dirichlet' )  THEN
    10741092          inflow_r  = .TRUE.
     1093#if defined( PMC_ACTIVE )
     1094       ELSEIF ( bc_lr == 'nested' )  THEN
     1095          nest_bound_r = .TRUE.
     1096#endif
    10751097       ENDIF
    10761098    ENDIF
     
    10811103       ELSEIF ( bc_ns == 'radiation/dirichlet' )  THEN
    10821104          inflow_s  = .TRUE.
     1105#if defined( PMC_ACTIVE )
     1106       ELSEIF ( bc_ns == 'nested' )  THEN
     1107          nest_bound_s = .TRUE.
     1108#endif
    10831109       ENDIF
    10841110    ENDIF
     
    10891115       ELSEIF ( bc_ns == 'radiation/dirichlet' )  THEN
    10901116          outflow_n = .TRUE.
     1117#if defined( PMC_ACTIVE )
     1118       ELSEIF ( bc_ns == 'nested' )  THEN
     1119          nest_bound_n = .TRUE.
     1120#endif
    10911121       ENDIF
    10921122    ENDIF
     
    11391169!-- At the inflow or outflow, u or v, respectively, have to be calculated for
    11401170!-- one more grid point.
    1141     IF ( inflow_l .OR. outflow_l )  THEN
     1171    IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
    11421172       nxlu = nxl + 1
    11431173    ELSE
    11441174       nxlu = nxl
    11451175    ENDIF
    1146     IF ( inflow_s .OR. outflow_s )  THEN
     1176    IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
    11471177       nysv = nys + 1
    11481178    ELSE
  • palm/trunk/SOURCE/modules.f90

    r1739 r1762  
    1919! Current revisions:
    2020! ------------------
    21 !
     21! +nest_* variables, size of volume_flow arrays increased by one element
    2222!
    2323! Former revisions:
     
    711711                masking_method = .FALSE., mg_switch_to_pe0 = .FALSE., &
    712712                monotonic_adjustment = .FALSE., &
     713                nest_bound_l = .FALSE., nest_bound_n = .FALSE., &
     714                nest_bound_r = .FALSE., nest_bound_s = .FALSE., &
     715                nest_domain = .FALSE., &
    713716                neutral = .FALSE., nudging = .FALSE., &
    714717                ocean = .FALSE., on_device = .FALSE., &
     
    828831                 vg_vertical_gradient(10) = 0.0_wp, &
    829832                 vg_vertical_gradient_level(10) = -9999999.9_wp, &
    830                  volume_flow(1:2) = 0.0_wp, volume_flow_area(1:2) = 0.0_wp, &
    831                  volume_flow_initial(1:2) = 0.0_wp, wall_heatflux(0:4) = 0.0_wp, &
     833                 volume_flow(1:3) = 0.0_wp, volume_flow_area(1:3) = 0.0_wp, &
     834                 volume_flow_initial(1:3) = 0.0_wp, wall_heatflux(0:4) = 0.0_wp, &
    832835                 wall_humidityflux(0:4) = 0.0_wp, wall_nrflux(0:4) = 0.0_wp, &
    833836                 wall_qflux(0:4) = 0.0_wp, wall_qrflux(0:4) = 0.0_wp, &
  • palm/trunk/SOURCE/palm.f90

    r1748 r1762  
    1919! Current revisions:
    2020! -----------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    113113        ONLY:  coupling_char, coupling_mode, do2d_at_begin, do3d_at_begin,     &
    114114               io_blocks, io_group, large_scale_forcing, message_string,       &
    115                nudging, simulated_time, simulated_time_chr,                    &
     115               nest_domain, nudging, simulated_time, simulated_time_chr,       &
    116116               user_interface_current_revision,                                &
    117117               user_interface_required_revision, version, wall_heatflux,       &
     
    144144
    145145    USE pegrid
     146
     147#if defined( PMC_ACTIVE )
     148    USE pmc_interface,                                                         &
     149        ONLY:  cpl_id, pmci_init, pmci_modelconfiguration
     150#endif
    146151
    147152    USE statistics,                                                            &
     
    176181!-- it will be defined in init_pegrid but is used before in cpu_log.
    177182    CALL MPI_INIT( ierr )
     183
     184#if defined( PMC_ACTIVE )
     185!
     186!-- Initialize the coupling for nested-domain runs
     187    CALL pmci_init( comm_palm )
     188    comm2d = comm_palm
     189
     190    IF ( cpl_id >= 2 )  THEN
     191       nest_domain = .TRUE.
     192       WRITE( coupling_char, '(A1,I1.1)') '_', cpl_id
     193    ENDIF
     194
     195    CALL MPI_COMM_SIZE( comm_palm, numprocs, ierr )
     196    CALL MPI_COMM_RANK( comm_palm, myid, ierr )
     197#else
    178198    CALL MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
    179199    CALL MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
    180200    comm_palm = MPI_COMM_WORLD
    181201    comm2d    = MPI_COMM_WORLD
    182 
    183 !
    184 !-- Initialize PE topology in case of coupled runs
     202!
     203!-- Initialize PE topology in case of coupled atmosphere-ocean runs (comm_palm
     204!-- will be splitted in init_coupling)
    185205    CALL init_coupling
     206#endif
    186207#endif
    187208
     
    291312!-- Initialize all necessary variables
    292313    CALL init_3d_model
     314
     315#if defined( PMC_ACTIVE )
     316!
     317!-- Coupling protocol setup for nested-domain runs
     318    CALL pmci_modelconfiguration
     319#endif
    293320
    294321!
  • palm/trunk/SOURCE/parin.f90

    r1692 r1762  
    1919! Current revisions:
    2020! -----------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    176176               limiter_sedimentation, nc_const, ventilation_effect
    177177
    178     USE control_parameters,                                                    &
    179         ONLY:  alpha_surface, averaging_interval, averaging_interval_pr,       &
    180                bc_e_b, bc_lr, bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t,         &
    181                bc_q_b, bc_q_t,bc_s_b, bc_s_t, bc_sa_t, bc_uv_b, bc_uv_t,       &
    182                bottom_salinityflux, building_height, building_length_x,        &
    183                building_length_y, building_wall_left, building_wall_south,     &
    184                call_microphysics_at_all_substeps, call_psolver_at_all_substeps,&
    185                canyon_height,                                                  &
    186                canyon_width_x, canyon_width_y, canyon_wall_left,               &
    187                canyon_wall_south, cfl_factor,                                  &
    188                cloud_droplets, cloud_physics, cloud_scheme,                    &
    189                cloud_top_radiation, conserve_volume_flow,                      &
    190                conserve_volume_flow_mode, constant_flux_layer,                 &
    191                coupling_start_time,                                            &
    192                create_disturbances, cycle_mg, data_output, data_output_masks,  &
    193                data_output_pr, data_output_2d_on_each_pe,                      &
    194                disturbance_amplitude, disturbance_energy_limit,                &
    195                disturbance_level_b, disturbance_level_t, dissipation_1d,       &
    196                do2d_at_begin, do3d_at_begin,                                   &
    197                dp_external, dp_level_b, dp_smooth, dpdxy,                      &
    198                drizzle, dt, dt_averaging_input, dt_averaging_input_pr,         &
    199                dt_coupling, dt_data_output, dt_data_output_av, dt_disturb,     &
    200                dt_domask, dt_dopr, dt_dopr_listing, dt_dots, dt_do2d_xy,       &
    201                dt_do2d_xz, dt_do2d_yz, dt_do3d, dt_max, dt_restart,            &
    202                dt_run_control, dz, dz_max, dz_stretch_factor, dz_stretch_level,&
    203                end_time, ensemble_member_nr, e_init, e_min, fft_method,        &
    204                force_print_header,                                             &
    205                galilei_transformation, host, humidity, inflow_damping_height,  &
    206                inflow_damping_width, inflow_disturbance_begin,                 &
    207                inflow_disturbance_end,  initializing_actions, io_blocks,       &
    208                io_group, km_constant,                                          &
    209                large_scale_forcing,                                            &
    210                large_scale_subsidence,                                         &
    211                loop_optimization, masking_method, mask_scale_x, mask_scale_y,  &
    212                mask_scale_z, mask_x, mask_y, mask_z, mask_x_loop,              &
    213                mask_y_loop, mask_z_loop, maximum_cpu_time_allowed,             &
    214                maximum_parallel_io_streams, max_pr_user, message_string,       &
    215                mg_cycles, mg_switch_to_pe0_level, mixing_length_1d,            &
    216                momentum_advec, most_method, netcdf_data_format,                &
    217                netcdf_precision, neutral, ngsrb, normalizing_region, nsor,     &
    218                nsor_ini, nudging, ocean,                                       &
    219                omega, omega_sor, passive_scalar, phi, nz_do3d,                 &
    220                prandtl_number, precipitation,                                  &
    221                precipitation_amount_interval, psolver, pt_damping_factor,      &
    222                pt_damping_width, pt_reference, pt_surface,                     &
    223                pt_surface_initial_change, pt_vertical_gradient,                &
    224                pt_vertical_gradient_level, q_surface,                          &
    225                q_surface_initial_change, q_vertical_gradient,                  &
    226                q_vertical_gradient_level, random_generator,                    &
    227                random_heatflux, rayleigh_damping_factor,                       &
    228                rayleigh_damping_height, recycling_width, recycling_yshift,     &
    229                reference_state, residual_limit,                                &
    230                restart_time, return_addres, return_username,                   &
    231                revision, roughness_length, runnr,                              &
    232                run_identifier, sa_surface, sa_vertical_gradient,               &
    233                sa_vertical_gradient_level, scalar_advec,                       &
    234                scalar_rayleigh_damping,                                        &
    235                section_xy, section_xz, section_yz, skip_time_data_output,      &
    236                skip_time_data_output_av, skip_time_dopr, skip_time_do2d_xy,    &
    237                skip_time_do2d_xz, skip_time_do2d_yz, skip_time_do3d,           &
    238                skip_time_domask, subs_vertical_gradient,                       &
    239                subs_vertical_gradient_level, surface_heatflux,                 &
    240                surface_pressure, surface_scalarflux, surface_waterflux,        &
    241                synchronous_exchange,s_surface, s_surface_initial_change,       &
    242                s_vertical_gradient, s_vertical_gradient_level,                 &
    243                termination_time_needed, timestep_scheme, topography,           &
    244                topography_grid_convention, top_heatflux,  top_momentumflux_u,  &
    245                top_momentumflux_v, top_salinityflux,                           &
    246                transpose_compute_overlap, turbulence, turbulent_inflow,        &
    247                ug_surface, ug_vertical_gradient, ug_vertical_gradient_level,   &
    248                use_subsidence_tendencies, use_surface_fluxes, use_cmax,        &
    249                use_top_fluxes, use_ug_for_galilei_tr, use_upstream_for_tke,    &
    250                uv_heights, u_bulk, u_profile, vg_surface, vg_vertical_gradient,&
    251                vg_vertical_gradient_level, v_bulk, v_profile,                  &
    252                wall_adjustment, wall_heatflux, wall_humidityflux,              &
    253                wall_scalarflux, write_binary, zeta_max, zeta_min, z0h_factor,  &
    254                z_max_do2d
     178    USE control_parameters
    255179
    256180    USE cpulog,                                                                &
     
    418342          READ ( 11, inipar, ERR=10, END=11 )
    419343
     344#if defined ( PMC_ACTIVE )
     345!
     346!--       In nested domains, npex or npey must not be given in \$inipar
     347!--       because here the PE-grids are always defined in the nestpar-NAMELIST
     348          IF ( ( npex /= -1 ) .OR. ( npey /= -1 ) )  THEN
     349             message_string = 'npex or npey must not be given in \$inipar ' // &
     350                              'in nested domains'
     351             CALL message( 'parin', 'PAXXXX', 1, 2, 0, 6, 0 )
     352          ENDIF
     353#else
     354!
     355!--       Make sure that no nesting boundary conditions are defined if
     356!--       PMC_ACTIVE is not defined. Otherwise initiate abort.
     357          IF ( ( bc_lr == 'nested' ) .OR. ( bc_ns == 'nested' ) .OR. ( bc_uv_t == 'nested' ) .OR. &
     358               ( bc_pt_t ==  'nested' ) .OR. ( bc_q_t == 'nested') .OR. ( bc_sa_t == 'nested') .OR. &
     359               ( bc_p_t == 'nested' ) ) THEN
     360             message_string = 'Nested boundary conditions are not allowed ' // &
     361                              'since the cpp flag PMC_ACTIVE is not set'
     362             CALL message( 'parin', 'PAXXXX', 1, 2, 0, 6, 0 )
     363          ENDIF
     364#endif
     365
    420366#if defined ( __check )
    421367!
  • palm/trunk/SOURCE/poismg.f90

    r1683 r1762  
    1919! Current revisions:
    2020! -----------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    259259    USE control_parameters,                                                    &
    260260        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,   &
    261                inflow_n, inflow_r, inflow_s, outflow_l, outflow_n, outflow_r,  &
     261               inflow_n, inflow_r, inflow_s, nest_bound_l, nest_bound_n,       &
     262               nest_bound_r, nest_bound_s, outflow_l, outflow_n, outflow_r,    &
    262263               outflow_s
    263264
     
    353354
    354355    IF ( .NOT. bc_lr_cyc )  THEN
    355        IF ( inflow_l .OR. outflow_l )  r(:,:,nxl_mg(l)-1) = r(:,:,nxl_mg(l))
    356        IF ( inflow_r .OR. outflow_r )  r(:,:,nxr_mg(l)+1) = r(:,:,nxr_mg(l))
     356       IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
     357          r(:,:,nxl_mg(l)-1) = r(:,:,nxl_mg(l))
     358       ENDIF
     359       IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
     360          r(:,:,nxr_mg(l)+1) = r(:,:,nxr_mg(l))
     361       ENDIF
    357362    ENDIF
    358363
    359364    IF ( .NOT. bc_ns_cyc )  THEN
    360        IF ( inflow_n .OR. outflow_n )  r(:,nyn_mg(l)+1,:) = r(:,nyn_mg(l),:)
    361        IF ( inflow_s .OR. outflow_s )  r(:,nys_mg(l)-1,:) = r(:,nys_mg(l),:)
     365       IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
     366          r(:,nyn_mg(l)+1,:) = r(:,nyn_mg(l),:)
     367       ENDIF
     368       IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
     369          r(:,nys_mg(l)-1,:) = r(:,nys_mg(l),:)
     370       ENDIF
    362371    ENDIF
    363372
     
    393402    USE control_parameters,                                                    &
    394403        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,   &
    395                inflow_n, inflow_r, inflow_s, outflow_l, outflow_n, outflow_r,  &
     404               inflow_n, inflow_r, inflow_s, nest_bound_l, nest_bound_n,       &
     405               nest_bound_r, nest_bound_s, outflow_l, outflow_n, outflow_r,    &
    396406               outflow_s
    397407
     
    560570
    561571    IF ( .NOT. bc_lr_cyc )  THEN
    562        IF (inflow_l .OR. outflow_l)  f_mg(:,:,nxl_mg(l)-1) = f_mg(:,:,nxl_mg(l))
    563        IF (inflow_r .OR. outflow_r)  f_mg(:,:,nxr_mg(l)+1) = f_mg(:,:,nxr_mg(l))
     572       IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
     573          f_mg(:,:,nxl_mg(l)-1) = f_mg(:,:,nxl_mg(l))
     574       ENDIF
     575       IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
     576          f_mg(:,:,nxr_mg(l)+1) = f_mg(:,:,nxr_mg(l))
     577       ENDIF
    564578    ENDIF
    565579
    566580    IF ( .NOT. bc_ns_cyc )  THEN
    567        IF (inflow_n .OR. outflow_n)  f_mg(:,nyn_mg(l)+1,:) = f_mg(:,nyn_mg(l),:)
    568        IF (inflow_s .OR. outflow_s)  f_mg(:,nys_mg(l)-1,:) = f_mg(:,nys_mg(l),:)
     581       IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
     582          f_mg(:,nyn_mg(l)+1,:) = f_mg(:,nyn_mg(l),:)
     583       ENDIF
     584       IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
     585          f_mg(:,nys_mg(l)-1,:) = f_mg(:,nys_mg(l),:)
     586       ENDIF
    569587    ENDIF
    570588
     
    600618    USE control_parameters,                                                    &
    601619        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,   &
    602                inflow_n, inflow_r, inflow_s, outflow_l, outflow_n, outflow_r,  &
     620               inflow_n, inflow_r, inflow_s, nest_bound_l, nest_bound_n,       &
     621               nest_bound_r, nest_bound_s, outflow_l, outflow_n, outflow_r,    &
    603622               outflow_s
    604623
     
    668687
    669688    IF ( .NOT. bc_lr_cyc )  THEN
    670        IF (inflow_l .OR. outflow_l)  temp(:,:,nxl_mg(l)-1) = temp(:,:,nxl_mg(l))
    671        IF (inflow_r .OR. outflow_r)  temp(:,:,nxr_mg(l)+1) = temp(:,:,nxr_mg(l))
     689       IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
     690          temp(:,:,nxl_mg(l)-1) = temp(:,:,nxl_mg(l))
     691       ENDIF
     692       IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
     693          temp(:,:,nxr_mg(l)+1) = temp(:,:,nxr_mg(l))
     694       ENDIF
    672695    ENDIF
    673696
    674697    IF ( .NOT. bc_ns_cyc )  THEN
    675        IF (inflow_n .OR. outflow_n)  temp(:,nyn_mg(l)+1,:) = temp(:,nyn_mg(l),:)
    676        IF (inflow_s .OR. outflow_s)  temp(:,nys_mg(l)-1,:) = temp(:,nys_mg(l),:)
     698       IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
     699          temp(:,nyn_mg(l)+1,:) = temp(:,nyn_mg(l),:)
     700       ENDIF
     701       IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
     702          temp(:,nys_mg(l)-1,:) = temp(:,nys_mg(l),:)
     703       ENDIF
    677704    ENDIF
    678705
     
    709736    USE control_parameters,                                                    &
    710737        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,   &
    711                inflow_n, inflow_r, inflow_s, ngsrb, outflow_l, outflow_n,      &
     738               inflow_n, inflow_r, inflow_s, ngsrb, nest_bound_l,              &
     739               nest_bound_n, nest_bound_r, nest_bound_s, outflow_l, outflow_n, &
    712740               outflow_r, outflow_s
    713741
     
    10681096
    10691097          IF ( .NOT. bc_lr_cyc )  THEN
    1070              IF ( inflow_l .OR. outflow_l )  THEN
     1098             IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
    10711099                p_mg(:,:,nxl_mg(l)-1) = p_mg(:,:,nxl_mg(l))
    10721100             ENDIF
    1073              IF ( inflow_r .OR. outflow_r )  THEN
     1101             IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
    10741102                p_mg(:,:,nxr_mg(l)+1) = p_mg(:,:,nxr_mg(l))
    10751103             ENDIF
     
    10771105
    10781106          IF ( .NOT. bc_ns_cyc )  THEN
    1079              IF ( inflow_n .OR. outflow_n )  THEN
     1107             IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
    10801108                p_mg(:,nyn_mg(l)+1,:) = p_mg(:,nyn_mg(l),:)
    10811109             ENDIF
    1082              IF ( inflow_s .OR. outflow_s )  THEN
     1110             IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
    10831111                p_mg(:,nys_mg(l)-1,:) = p_mg(:,nys_mg(l),:)
    10841112             ENDIF
     
    12961324               gamma_mg, grid_level, grid_level_count, ibc_p_b, ibc_p_t,       &
    12971325               inflow_l, inflow_n, inflow_r, inflow_s, maximum_grid_level,     &
    1298                mg_switch_to_pe0_level, mg_switch_to_pe0, ngsrb, outflow_l,     &
    1299                outflow_n, outflow_r, outflow_s
     1326               mg_switch_to_pe0_level, mg_switch_to_pe0, nest_domain,          &
     1327               nest_bound_l, nest_bound_n, nest_bound_r, nest_bound_s, ngsrb,  &
     1328               outflow_l, outflow_n, outflow_r, outflow_s
    13001329
    13011330
     
    14461475             outflow_l = .TRUE.
    14471476             outflow_r = .FALSE.
     1477          ELSEIF ( nest_domain )  THEN
     1478             nest_bound_l = .TRUE.
     1479             nest_bound_r = .TRUE.
    14481480          ENDIF
    14491481
     
    14581490             outflow_n = .TRUE.
    14591491             outflow_s = .FALSE.
     1492          ELSEIF ( nest_domain )  THEN
     1493             nest_bound_s = .TRUE.
     1494             nest_bound_n = .TRUE.
    14601495          ENDIF
    14611496
     
    15281563             ELSEIF ( bc_lr_raddir )  THEN
    15291564                outflow_l = .TRUE.
     1565             ELSEIF ( nest_domain )  THEN
     1566                nest_bound_l = .TRUE.
    15301567             ENDIF
    15311568          ENDIF
     
    15361573             ELSEIF ( bc_lr_raddir )  THEN
    15371574                inflow_r  = .TRUE.
     1575             ELSEIF ( nest_domain )  THEN
     1576                nest_bound_r = .TRUE.
    15381577             ENDIF
    15391578          ENDIF
     
    15441583             ELSEIF ( bc_ns_raddir )  THEN
    15451584                inflow_s  = .TRUE.
     1585             ELSEIF ( nest_domain )  THEN
     1586                nest_bound_s = .TRUE.
    15461587             ENDIF
    15471588          ENDIF
     
    15521593             ELSEIF ( bc_ns_raddir )  THEN
    15531594                outflow_n = .TRUE.
     1595             ELSEIF ( nest_domain )  THEN
     1596                nest_bound_n = .TRUE.
    15541597             ENDIF
    15551598          ENDIF
  • palm/trunk/SOURCE/poismg_fast.f90

    r1683 r1762  
    1919! Current revisions:
    2020! -----------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    240240       USE control_parameters,                                                 &
    241241           ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,&
    242                   inflow_n, inflow_r, inflow_s, masking_method, outflow_l,     &
     242                  inflow_n, inflow_r, inflow_s, masking_method, nest_bound_l,  &
     243                  nest_bound_n, nest_bound_r, nest_bound_s, outflow_l,         &
    243244                  outflow_n, outflow_r, outflow_s, topography
    244245
     
    393394
    394395       IF ( .NOT. bc_lr_cyc )  THEN
    395           IF ( inflow_l .OR. outflow_l )  r(:,:,nxl_mg(l)-1) = r(:,:,nxl_mg(l))
    396           IF ( inflow_r .OR. outflow_r )  r(:,:,nxr_mg(l)+1) = r(:,:,nxr_mg(l))
     396          IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
     397             r(:,:,nxl_mg(l)-1) = r(:,:,nxl_mg(l))
     398          ENDIF
     399          IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
     400             r(:,:,nxr_mg(l)+1) = r(:,:,nxr_mg(l))
     401          ENDIF
    397402       ENDIF
    398403
    399404       IF ( .NOT. bc_ns_cyc )  THEN
    400           IF ( inflow_n .OR. outflow_n )  r(:,nyn_mg(l)+1,:) = r(:,nyn_mg(l),:)
    401           IF ( inflow_s .OR. outflow_s )  r(:,nys_mg(l)-1,:) = r(:,nys_mg(l),:)
     405          IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
     406             r(:,nyn_mg(l)+1,:) = r(:,nyn_mg(l),:)
     407          ENDIF
     408          IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
     409             r(:,nys_mg(l)-1,:) = r(:,nys_mg(l),:)
     410          ENDIF
    402411       ENDIF
    403412
     
    434443       USE control_parameters,                                                 &
    435444           ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,&
    436                   inflow_n, inflow_r, inflow_s, masking_method, outflow_l,     &
     445                  inflow_n, inflow_r, inflow_s, masking_method, nest_bound_l,  &
     446                  nest_bound_n, nest_bound_r, nest_bound_s, outflow_l,         &
    437447                  outflow_n, outflow_r, outflow_s, topography
    438448
     
    635645
    636646       IF ( .NOT. bc_lr_cyc )  THEN
    637           IF (inflow_l .OR. outflow_l)  f_mg(:,:,nxl_mg(l)-1) = f_mg(:,:,nxl_mg(l))
    638           IF (inflow_r .OR. outflow_r)  f_mg(:,:,nxr_mg(l)+1) = f_mg(:,:,nxr_mg(l))
     647          IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
     648             f_mg(:,:,nxl_mg(l)-1) = f_mg(:,:,nxl_mg(l))
     649          ENDIF
     650          IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
     651             f_mg(:,:,nxr_mg(l)+1) = f_mg(:,:,nxr_mg(l))
     652          ENDIF
    639653       ENDIF
    640654
    641655       IF ( .NOT. bc_ns_cyc )  THEN
    642           IF (inflow_n .OR. outflow_n)  f_mg(:,nyn_mg(l)+1,:) = f_mg(:,nyn_mg(l),:)
    643           IF (inflow_s .OR. outflow_s)  f_mg(:,nys_mg(l)-1,:) = f_mg(:,nys_mg(l),:)
     656          IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
     657             f_mg(:,nyn_mg(l)+1,:) = f_mg(:,nyn_mg(l),:)
     658          ENDIF
     659          IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
     660             f_mg(:,nys_mg(l)-1,:) = f_mg(:,nys_mg(l),:)
     661          ENDIF
    644662       ENDIF
    645663
     
    679697       USE control_parameters,                                                 &
    680698           ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,&
    681                   inflow_n, inflow_r, inflow_s, outflow_l, outflow_n,          &
     699                  inflow_n, inflow_r, inflow_s, nest_bound_l, nest_bound_n,    &
     700                  nest_bound_r, nest_bound_s, outflow_l, outflow_n,            &
    682701                  outflow_r, outflow_s
    683702
     
    790809
    791810       IF ( .NOT. bc_lr_cyc )  THEN
    792           IF (inflow_l .OR. outflow_l)  temp(:,:,nxl_mg(l)-1) = temp(:,:,nxl_mg(l))
    793           IF (inflow_r .OR. outflow_r)  temp(:,:,nxr_mg(l)+1) = temp(:,:,nxr_mg(l))
     811          IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
     812             temp(:,:,nxl_mg(l)-1) = temp(:,:,nxl_mg(l))
     813          ENDIF
     814          IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
     815             temp(:,:,nxr_mg(l)+1) = temp(:,:,nxr_mg(l))
     816          ENDIF
    794817       ENDIF
    795818
    796819       IF ( .NOT. bc_ns_cyc )  THEN
    797           IF (inflow_n .OR. outflow_n)  temp(:,nyn_mg(l)+1,:) = temp(:,nyn_mg(l),:)
    798           IF (inflow_s .OR. outflow_s)  temp(:,nys_mg(l)-1,:) = temp(:,nys_mg(l),:)
     820          IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
     821             temp(:,nyn_mg(l)+1,:) = temp(:,nyn_mg(l),:)
     822          ENDIF
     823          IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
     824             temp(:,nys_mg(l)-1,:) = temp(:,nys_mg(l),:)
     825          ENDIF
    799826       ENDIF
    800827
     
    832859       USE control_parameters,                                                 &
    833860           ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,&
    834                   inflow_n, inflow_r, inflow_s, masking_method, ngsrb,         &
     861                  inflow_n, inflow_r, inflow_s, masking_method, nest_bound_l,  &
     862                  nest_bound_n, nest_bound_r, nest_bound_s, ngsrb,             &
    835863                  outflow_l, outflow_n, outflow_r, outflow_s, topography
    836864
     
    14111439             CALL special_exchange_horiz( p_mg, color )
    14121440
    1413               IF ( .NOT. bc_lr_cyc )  THEN
    1414                 IF ( inflow_l .OR. outflow_l )  THEN
     1441             IF ( .NOT. bc_lr_cyc )  THEN
     1442                IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  THEN
    14151443                   p_mg(:,:,nxl_mg(l)-1) = p_mg(:,:,nxl_mg(l))
    14161444                ENDIF
    1417                 IF ( inflow_r .OR. outflow_r )  THEN
     1445                IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  THEN
    14181446                   p_mg(:,:,nxr_mg(l)+1) = p_mg(:,:,nxr_mg(l))
    14191447                ENDIF
     
    14211449
    14221450             IF ( .NOT. bc_ns_cyc )  THEN
    1423                 IF ( inflow_n .OR. outflow_n )  THEN
     1451                IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  THEN
    14241452                   p_mg(:,nyn_mg(l)+1,:) = p_mg(:,nyn_mg(l),:)
    14251453                ENDIF
    1426                 IF ( inflow_s .OR. outflow_s )  THEN
     1454                IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  THEN
    14271455                   p_mg(:,nys_mg(l)-1,:) = p_mg(:,nys_mg(l),:)
    14281456                ENDIF
     
    19131941                  gamma_mg, grid_level, grid_level_count, ibc_p_b, ibc_p_t,    &
    19141942                  inflow_l, inflow_n, inflow_r, inflow_s, maximum_grid_level,  &
    1915                   mg_switch_to_pe0_level, mg_switch_to_pe0, ngsrb, outflow_l,  &
    1916                   outflow_n, outflow_r, outflow_s
     1943                  mg_switch_to_pe0_level, mg_switch_to_pe0, nest_domain,       &
     1944                  nest_bound_l, nest_bound_n, nest_bound_r, nest_bound_s,      &
     1945                  ngsrb, outflow_l, outflow_n, outflow_r, outflow_s
    19171946
    19181947       USE indices,                                                            &
     
    20622091                outflow_l = .TRUE.
    20632092                outflow_r = .FALSE.
     2093             ELSEIF ( nest_domain )  THEN
     2094                nest_bound_l = .TRUE.
     2095                nest_bound_r = .TRUE.
    20642096             ENDIF
    20652097
     
    20742106                outflow_n = .TRUE.
    20752107                outflow_s = .FALSE.
     2108             ELSEIF ( nest_domain )  THEN
     2109                nest_bound_s = .TRUE.
     2110                nest_bound_n = .TRUE.
    20762111             ENDIF
    20772112
     
    21462181                ELSEIF ( bc_lr_raddir )  THEN
    21472182                   outflow_l = .TRUE.
     2183                ELSEIF ( nest_domain )  THEN
     2184                   nest_bound_l = .TRUE.
    21482185                ENDIF
    21492186             ENDIF
     
    21542191                ELSEIF ( bc_lr_raddir )  THEN
    21552192                   inflow_r  = .TRUE.
     2193                ELSEIF ( nest_domain )  THEN
     2194                   nest_bound_r = .TRUE.
    21562195                ENDIF
    21572196             ENDIF
     
    21622201                ELSEIF ( bc_ns_raddir )  THEN
    21632202                   inflow_s  = .TRUE.
     2203                ELSEIF ( nest_domain )  THEN
     2204                   nest_bound_s = .TRUE.
    21642205                ENDIF
    21652206             ENDIF
     
    21702211                ELSEIF ( bc_ns_raddir )  THEN
    21712212                   outflow_n = .TRUE.
     2213                ELSEIF ( nest_domain )  THEN
     2214                   nest_bound_n = .TRUE.
    21722215                ENDIF
    21732216             ENDIF
  • palm/trunk/SOURCE/pres.f90

    r1683 r1762  
    1919! Current revisions:
    2020! ------------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    9898        ONLY:  bc_lr_cyc, bc_ns_cyc, conserve_volume_flow, dt_3d,              &
    9999               gathered_size, ibc_p_b, ibc_p_t, intermediate_timestep_count,   &
    100                mg_switch_to_pe0_level, on_device, outflow_l, outflow_n,        &
    101                outflow_r, outflow_s, psolver, simulated_time, subdomain_size,  &
    102                topography, volume_flow, volume_flow_area, volume_flow_initial
     100               mg_switch_to_pe0_level, nest_domain, nest_bound_l,              &
     101               nest_bound_n, nest_bound_r, nest_bound_s, on_device, outflow_l, &
     102               outflow_n, outflow_r, outflow_s, psolver, simulated_time,       &
     103               subdomain_size, topography, volume_flow, volume_flow_area,      &
     104               volume_flow_initial
    103105
    104106    USE cpulog,                                                                &
     
    138140    REAL(wp)     ::  d_weight_pres  !<
    139141
    140     REAL(wp), DIMENSION(1:2)   ::  volume_flow_l       !<
    141     REAL(wp), DIMENSION(1:2)   ::  volume_flow_offset  !<
     142    REAL(wp), DIMENSION(1:3)   ::  volume_flow_l       !<
     143    REAL(wp), DIMENSION(1:3)   ::  volume_flow_offset  !<
    142144    REAL(wp), DIMENSION(1:nzt) ::  w_l                 !<
    143145    REAL(wp), DIMENSION(1:nzt) ::  w_l_l               !<
     
    162164!--    cannot be used in the iterative solver. Therefore, its initial value is
    163165!--    stored on p_loc, which is then iteratively advanced in every substep.
    164        IF ( intermediate_timestep_count == 1 )  THEN
     166       IF ( intermediate_timestep_count <= 1 )  THEN
    165167          DO  i = nxl-1, nxr+1
    166168             DO  j = nys-1, nyn+1
     
    267269
    268270!
    269 !-- Remove mean vertical velocity
    270     IF ( ibc_p_b == 1  .AND.  ibc_p_t == 1 )  THEN
     271!-- Remove mean vertical velocity in case that Neumann conditions are
     272!-- used both at bottom and top boundary, and if not a nested domain
     273    IF ( ibc_p_b == 1  .AND.  ibc_p_t == 1  .AND.  .NOT. nest_domain)  THEN
    271274       IF ( simulated_time > 0.0_wp )  THEN ! otherwise nzb_w_inner not yet known
    272275          w_l = 0.0_wp;  w_l_l = 0.0_wp
     
    561564       !$OMP END PARALLEL
    562565
    563     ELSE 
     566    ELSEIF ( intermediate_timestep_count > 1 )  THEN
    564567       !$OMP PARALLEL PRIVATE (i,j,k)
    565568       !$OMP DO
  • palm/trunk/SOURCE/sor.f90

    r1683 r1762  
    1919! Current revisions:
    2020! -----------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    6464    USE control_parameters,                                                    &
    6565        ONLY:  bc_lr_cyc, bc_ns_cyc, ibc_p_b, ibc_p_t, inflow_l, inflow_n,     &
    66                inflow_r, inflow_s, n_sor, omega_sor, outflow_l, outflow_n,     &
     66               inflow_r, inflow_s, nest_bound_l, nest_bound_n, nest_bound_r,   &
     67               nest_bound_s, n_sor, omega_sor, outflow_l, outflow_n,           &
    6768               outflow_r, outflow_s
    6869
     
    154155!--    Horizontal (Neumann) boundary conditions in case of non-cyclic boundaries
    155156       IF ( .NOT. bc_lr_cyc )  THEN
    156           IF ( inflow_l .OR. outflow_l )  p(:,:,nxl-1) = p(:,:,nxl)
    157           IF ( inflow_r .OR. outflow_r )  p(:,:,nxr+1) = p(:,:,nxr)
     157          IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  p(:,:,nxl-1) = p(:,:,nxl)
     158          IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  p(:,:,nxr+1) = p(:,:,nxr)
    158159       ENDIF
    159160       IF ( .NOT. bc_ns_cyc )  THEN
    160           IF ( inflow_n .OR. outflow_n )  p(:,nyn+1,:) = p(:,nyn,:)
    161           IF ( inflow_s .OR. outflow_s )  p(:,nys-1,:) = p(:,nys,:)
     161          IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  p(:,nyn+1,:) = p(:,nyn,:)
     162          IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  p(:,nys-1,:) = p(:,nys,:)
    162163       ENDIF
    163164
     
    216217!--    Horizontal (Neumann) boundary conditions in case of non-cyclic boundaries
    217218       IF ( .NOT. bc_lr_cyc )  THEN
    218           IF ( inflow_l .OR. outflow_l )  p(:,:,nxl-1) = p(:,:,nxl)
    219           IF ( inflow_r .OR. outflow_r )  p(:,:,nxr+1) = p(:,:,nxr)
     219          IF ( inflow_l .OR. outflow_l .OR. nest_bound_l )  p(:,:,nxl-1) = p(:,:,nxl)
     220          IF ( inflow_r .OR. outflow_r .OR. nest_bound_r )  p(:,:,nxr+1) = p(:,:,nxr)
    220221       ENDIF
    221222       IF ( .NOT. bc_ns_cyc )  THEN
    222           IF ( inflow_n .OR. outflow_n )  p(:,nyn+1,:) = p(:,nyn,:)
    223           IF ( inflow_s .OR. outflow_s )  p(:,nys-1,:) = p(:,nys,:)
     223          IF ( inflow_n .OR. outflow_n .OR. nest_bound_n )  p(:,nyn+1,:) = p(:,nyn,:)
     224          IF ( inflow_s .OR. outflow_s .OR. nest_bound_s )  p(:,nys-1,:) = p(:,nys,:)
    224225       ENDIF
    225226
  • palm/trunk/SOURCE/time_integration.f90

    r1737 r1762  
    1919! Current revisions:
    2020! ------------------
    21 !
     21! Introduction of nested domain feature
    2222!
    2323! Former revisions:
     
    165165
    166166    USE arrays_3d,                                                             &
    167         ONLY:  diss, dzu, e_p, nr_p, prho, pt, pt_p, pt_init, q_init, q, ql,   &
    168                ql_c, ql_v, ql_vp, qr_p, q_p, ref_state, rho, sa_p, tend, u,    &
    169                u_p, v, vpt, v_p, w_p
     167        ONLY:  diss, dzu, e, e_p, nr_p, prho, pt, pt_p, pt_init, q_init, q,    &
     168               ql, ql_c, ql_v, ql_vp, qr_p, q_p, ref_state, rho, sa_p, tend,   &
     169               u, u_p, v, vpt, v_p, w, w_p
    170170
    171171    USE calc_mean_profile_mod,                                                 &
     
    188188               icloud_scheme, intermediate_timestep_count,                     &
    189189               intermediate_timestep_count_max, large_scale_forcing,           &
    190                loop_optimization, lsf_surf, lsf_vert, masks, mid,             &
     190               loop_optimization, lsf_surf, lsf_vert, masks, mid, nest_domain, &
    191191               netcdf_data_format, neutral, nr_timesteps_this_run, nudging,    &
    192192               ocean, on_device, passive_scalar, precipitation,                &
     
    235235    USE pegrid
    236236
     237#if defined( PMC_ACTIVE )
     238    USE pmc_interface,                                                         &
     239        ONLY:  client_to_server, nesting_mode,                                 &
     240               pmci_ensure_nest_mass_conservation, pmci_client_datatrans,      &
     241               pmci_client_initialize, pmci_client_synchronize,                &
     242               pmci_server_datatrans, pmci_server_initialize,                  &
     243               pmci_server_synchronize, pmci_update_new, server_to_client
     244#endif
     245
    237246    USE production_e_mod,                                                      &
    238247        ONLY:  production_e_init
     
    290299    ENDIF
    291300
     301#if defined( PMC_ACTIVE )
     302!
     303!-- TO_DO: try to give more meaningful comments here
     304!-- Domain nesting: From server to client commmunication
     305!-- ( direction=SERVER_TO_CLIENT )
     306!-- Nest initial conditions
     307!
     308!-- Send initial condition data from server to client
     309    CALL pmci_server_initialize
     310!
     311!-- Receive and interpolate initial data on client
     312    CALL pmci_client_initialize
     313!
     314!-- TO_DO, maybe removed
     315!-- Obs. Nesting may be unnecessary at this point.
     316!
     317!-- Nest boundary conditions
     318    CALL pmci_server_datatrans( server_to_client )
     319    CALL pmci_client_datatrans( server_to_client )
     320
     321    IF ( nesting_mode == 'two-way' )  THEN
     322       CALL pmci_server_datatrans( client_to_server )
     323       CALL pmci_client_datatrans( client_to_server )
     324!
     325!--    Exchange_horiz is needed for all server-domains after the anterpolation
     326       CALL exchange_horiz( u, nbgp )
     327       CALL exchange_horiz( v, nbgp )
     328       CALL exchange_horiz( w, nbgp )
     329       CALL exchange_horiz( pt, nbgp )
     330       IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e, nbgp )
     331       intermediate_timestep_count = 0
     332       CALL pres
     333    ENDIF
     334!
     335!-- Correct the w top-BC in nest domains to ensure mass conservation.
     336!-- Copy the interpolated/anterpolated boundary values to the _p
     337!-- arrays, too, to make sure the interpolated/anterpolated boundary
     338!-- values are carried over from one RK inner step to another.
     339!-- These actions must not be done for the root domain.
     340    IF ( nest_domain )  THEN
     341       CALL pmci_ensure_nest_mass_conservation
     342       CALL pmci_update_new
     343    ENDIF
     344#endif
    292345
    293346#if defined( __dvrp_graphics )
     
    309362       IF ( simulated_time /= 0.0_wp )  THEN
    310363          CALL timestep
    311        ENDIF
     364
     365#if defined( PMC_ACTIVE )
     366!
     367!--       TO_DO: try to give more detailed and meaningful comments here
     368!--       Server side must be called first
     369          CALL pmci_server_synchronize
     370          CALL pmci_client_synchronize
     371#endif
     372       ENDIF
     373
    312374
    313375!
     
    628690!--       Swap the time levels in preparation for the next time step.
    629691          CALL swap_timelevel
     692
     693#if defined( PMC_ACTIVE )
     694!
     695!--       TO_DO: try to give more meaningful comments here
     696!--       Domain nesting
     697!--       Note that the nesting operations are omitted intentionally on the
     698!--       first two RK-substeps.
     699          CALL cpu_log( log_point(60), 'nesting', 'start' )
     700!
     701!--       From server to client commmunication ( direction=SERVER_TO_CLIENT )
     702          CALL pmci_server_datatrans( server_to_client )
     703          CALL pmci_client_datatrans( server_to_client )
     704
     705          IF ( nesting_mode == 'two-way' )  THEN
     706!
     707!--          From client to server commmunication ( direction=CLIENT_TO_SERVER )
     708             CALL pmci_server_datatrans( client_to_server )
     709             CALL pmci_client_datatrans( client_to_server )
     710!
     711!--          Exchange_horiz is needed for all server-domains after the
     712!--          anterpolation
     713             CALL exchange_horiz( u, nbgp )
     714             CALL exchange_horiz( v, nbgp )
     715             CALL exchange_horiz( w, nbgp )
     716             CALL exchange_horiz( pt, nbgp )
     717             IF ( humidity  .OR.  passive_scalar )  THEN
     718                CALL exchange_horiz( q, nbgp )
     719             ENDIF
     720             IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e, nbgp )
     721          ENDIF
     722!
     723!--       Correct the w top-BC in nest domains to ensure mass conservation.
     724!--       This action must never be done for the root domain.
     725          IF ( nest_domain )  THEN
     726             CALL pmci_ensure_nest_mass_conservation
     727!
     728!--          pmc_update_new is not necessary if nesting is made at each substep.
     729             CALL pmci_update_new
     730          ENDIF
     731
     732          CALL cpu_log( log_point(60), 'nesting', 'stop' )
     733#endif
    630734
    631735!
     
    10411145!
    10421146!--    Output elapsed simulated time in form of a progress bar on stdout
     1147!--    TO_DO: should be done by root domain later
     1148#if ! defined( PMC_ACTIVE )
    10431149       IF ( myid == 0 )  CALL output_progress_bar
     1150#endif
    10441151
    10451152       CALL cpu_log( log_point_s(10), 'timesteps', 'stop' )
     
    10481155    ENDDO   ! time loop
    10491156
     1157!-- TO_DO: should be done by root domain later
     1158#if ! defined( PMC_ACTIVE )
    10501159    IF ( myid == 0 )  CALL finish_progress_bar
     1160#endif
    10511161
    10521162#if defined( __dvrp_graphics )
Note: See TracChangeset for help on using the changeset viewer.