Changeset 1056 for palm


Ignore:
Timestamp:
Nov 16, 2012 3:28:04 PM (12 years ago)
Author:
raasch
Message:

bugfix for mg-solver

Location:
palm/trunk/SOURCE
Files:
2 edited

Legend:

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

    r1042 r1056  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! Indices for arrays n.._mg start from zero due to definition of arrays f2 and
     23! p2 as automatic arrays in recursive subroutine next_mg_level
    2324!
    2425! Former revisions:
     
    860861       ENDIF
    861862
    862        ALLOCATE( grid_level_count(maximum_grid_level),                   &
    863                  nxl_mg(maximum_grid_level), nxr_mg(maximum_grid_level), &
    864                  nyn_mg(maximum_grid_level), nys_mg(maximum_grid_level), &
    865                  nzt_mg(maximum_grid_level) )
     863       ALLOCATE( grid_level_count(maximum_grid_level),                       &
     864                 nxl_mg(0:maximum_grid_level), nxr_mg(0:maximum_grid_level), &
     865                 nyn_mg(0:maximum_grid_level), nys_mg(0:maximum_grid_level), &
     866                 nzt_mg(0:maximum_grid_level) )
    866867
    867868       grid_level_count = 0
     869!
     870!--    Index zero required as dummy due to definition of arrays f2 and p2 in
     871!--    recursive subroutine next_mg_level
     872       nxl_mg(0) = 0; nxr_mg(0) = 0; nyn_mg(0) = 0; nys_mg(0) = 0; nzt_mg(0) = 0
    868873
    869874       nxl_l = nxl; nxr_l = nxr; nys_l = nys; nyn_l = nyn; nzt_l = nzt
  • palm/trunk/SOURCE/poismg.f90

    r1037 r1056  
    2323! Current revisions:
    2424! -----------------
    25 !
     25! Bugfix: all ghost points have to be used for allocating p3
     26! arrays p2, f2, and f2_l changed from allocatable to automatic
    2627!
    2728! Former revisions:
     
    125126                    mg_switch_to_pe0_level)+1) )
    126127    ELSE
    127        ALLOCATE ( p3(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    128     ENDIF
     128       ALLOCATE ( p3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
     129    ENDIF
     130
     131    p3 = 0.0
    129132 
    130133!
     
    618621                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,                &
    619622                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f_mg, p_mg
    620 
    621623
    622624    l = grid_level
     
    10021004       ENDDO
    10031005    ENDDO
    1004 !$OMP END PARALLEL 
     1006!$OMP END PARALLEL
    10051007
    10061008!
     
    10271029    REAL, DIMENSION(nzb:nzt_mg(grid_level)+1,                            &
    10281030                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,           &
    1029                     nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f2
     1031                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f2, f2_l
    10301032
    10311033    REAL, DIMENSION(nzb:mg_loc_ind(5,myid)+1,                            &
     
    10331035                    mg_loc_ind(1,myid)-1:mg_loc_ind(2,myid)+1) ::  f2_sub
    10341036
    1035     REAL, DIMENSION(:,:,:), ALLOCATABLE ::  f2_l
    1036 
    1037     ALLOCATE( f2_l(nzb:nzt_mg(grid_level)+1,                            &
    1038                     nys_mg(grid_level)-1:nyn_mg(grid_level)+1,          &
    1039                     nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) )
    10401037
    10411038#if defined( __parallel )
     
    10731070                        nwords, MPI_REAL, MPI_SUM, comm2d, ierr )
    10741071
    1075     DEALLOCATE( f2_l )
    1076 
    10771072    CALL cpu_log( log_point_s(34), 'mg_gather', 'stop' )
    10781073#endif
     
    11501145                 nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) :: f_mg, p_mg, p3, r
    11511146
    1152     REAL, DIMENSION(:,:,:), ALLOCATABLE ::  f2, f2_sub, p2, p2_sub
    1153 
     1147    REAL, DIMENSION(nzb:nzt_mg(grid_level-1)+1,                                &
     1148                    nys_mg(grid_level-1)-1:nyn_mg(grid_level-1)+1,             &
     1149                    nxl_mg(grid_level-1)-1:nxr_mg(grid_level-1)+1) ::  f2, p2
     1150
     1151    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  f2_sub, p2_sub
    11541152
    11551153!
     
    11901188       nyn = nyn_mg(grid_level)
    11911189       nzt = nzt_mg(grid_level)
    1192 
    1193        ALLOCATE( f2(nzb:nzt_mg(grid_level)+1,                    &
    1194                     nys_mg(grid_level)-1:nyn_mg(grid_level)+1,   &
    1195                     nxl_mg(grid_level)-1:nxr_mg(grid_level)+1),  &
    1196                  p2(nzb:nzt_mg(grid_level)+1,                    &
    1197                     nys_mg(grid_level)-1:nyn_mg(grid_level)+1,   &
    1198                     nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) )
    11991190
    12001191       IF ( grid_level == mg_switch_to_pe0_level )  THEN
     
    12811272
    12821273       ELSE
     1274
    12831275          CALL restrict( f2, r )
    12841276
     
    13921384
    13931385!
    1394 !--    Temporary arrays for the actual grid are not needed any more
    1395        DEALLOCATE( p2, f2 )
    1396 
    1397 !
    13981386!--    Computation of the new pressure correction. Therefore,
    13991387!--    values from prior grids are added up automatically stage by stage.
Note: See TracChangeset for help on using the changeset viewer.