Changeset 2956 for palm/trunk


Ignore:
Timestamp:
Apr 10, 2018 11:01:03 AM (6 years ago)
Author:
Giersch
Message:

Bugfix of the allocation of spectrum_x and spectrum_y in case of restart runs, spectrum_x and spectrum_y are now treat as global restart data not local

Location:
palm/trunk/SOURCE
Files:
3 edited

Legend:

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

    r2921 r2956  
    2525! -----------------
    2626! $Id$
     27! spectrum_x and spectrum_y have been moved to global data
     28!
     29! 2921 2018-03-22 15:05:23Z Giersch
    2730! spinup_time, day_of_year_init and time_utc_init are also read now
    2831!
     
    117120
    118121       USE spectra_mod,                                                        &
    119            ONLY:  average_count_sp
     122           ONLY:  average_count_sp, spectrum_x, spectrum_y
    120123
    121124       USE statistics,                                                         &
     
    569572             CASE ( 'simulated_time' )
    570573                READ ( 13 )  simulated_time
     574             CASE ( 'spectrum_x' )
     575                IF ( .NOT. ALLOCATED( spectrum_x ) )  THEN
     576                   ALLOCATE( spectrum_x( 1:nx/2, 1:100, 1:10 ) )
     577                ENDIF
     578                READ ( 13 )  spectrum_x
     579             CASE ( 'spectrum_y' )
     580                IF ( .NOT. ALLOCATED( spectrum_y ) )  THEN
     581                   ALLOCATE( spectrum_y( 1:ny/2, 1:100, 1:10 ) )
     582                ENDIF
     583                READ ( 13 )  spectrum_y
    571584             CASE ( 'spinup_time' )
    572585                READ ( 13 )  spinup_time
     
    10521065        ONLY:  id_random_array, seq_random_array
    10531066
    1054     USE spectra_mod,                                                           &
    1055         ONLY:  spectrum_x, spectrum_y
    1056 
    10571067    USE surface_mod,                                                           &
    10581068        ONLY :  surface_rrd_local
     
    16901700                   shf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =          &
    16911701                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
    1692 
    1693                 CASE ( 'spectrum_x' )
    1694                    IF ( k == 1 )  THEN
    1695                       IF ( nx_on_file /= nx )  THEN
    1696                          message_string = 'rrd_local: spectrum_x ' //          &
    1697                                      'on restart file ignored because' //      &
    1698                                      '&total numbers of grid points (nx) ' //  &
    1699                                      'do not match'
    1700                          CALL message( 'rrd_local', 'PA0293',                  &
    1701                                        0, 1, 0, 6, 0 )
    1702                          READ ( 13 )  rdummy
    1703                       ELSE
    1704                          READ ( 13 )  spectrum_x
    1705                       ENDIF
    1706                    ENDIF
    1707 
    1708                 CASE ( 'spectrum_y' )
    1709                    IF ( k == 1 )  THEN
    1710                       IF ( ny_on_file /= ny )  THEN
    1711                          message_string = 'rrd_local: spectrum_y ' //          &
    1712                                      'on restart file ignored because' //      &
    1713                                      '&total numbers of grid points (ny) '//   &
    1714                                      'do not match'
    1715                          CALL message( 'rrd_local', 'PA0294',                  &
    1716                                        0, 1, 0, 6, 0 )
    1717                          READ ( 13 )  rdummy
    1718                       ELSE
    1719                          READ ( 13 )  spectrum_y
    1720                       ENDIF
    1721                    ENDIF
    17221702                   
    17231703                CASE ( 'ssws_av' )
  • palm/trunk/SOURCE/spectra_mod.f90

    r2932 r2956  
    2525! -----------------
    2626! $Id$
     27! spectrum_x and spectrum_y will only be allocated if they are not allocated
     28! before (e.g. in case of restart runs)
     29!
     30! 2932 2018-03-26 09:39:22Z maronga
    2731! renamed spectra_par to spectra_parameters
    2832!
     
    291295
    292296       IF ( dt_dosp /= 9999999.9_wp )  THEN
    293           ALLOCATE( spectrum_x( 1:nx/2, 1:100, 1:10 ),                         &
    294                     spectrum_y( 1:ny/2, 1:100, 1:10 ) )
    295           spectrum_x = 0.0_wp
    296           spectrum_y = 0.0_wp
     297
     298          IF ( .NOT. ALLOCATED( spectrum_x ) )  THEN
     299             ALLOCATE( spectrum_x( 1:nx/2, 1:100, 1:10 ) )
     300             spectrum_x = 0.0_wp
     301          ENDIF
     302
     303          IF ( .NOT. ALLOCATED( spectrum_y ) )  THEN
     304             ALLOCATE( spectrum_y( 1:ny/2, 1:100, 1:10 ) )
     305             spectrum_y = 0.0_wp
     306          ENDIF
    297307
    298308          ALLOCATE( var_d(nzb:nzt+1) )
  • palm/trunk/SOURCE/write_restart_data_mod.f90

    r2921 r2956  
    2525! -----------------
    2626! $Id$
     27! spectrum_x and spectrum_y have been moved to global data
     28!
     29! 2921 2018-03-22 15:05:23Z Giersch
    2730! spinup_time, day_of_year_init and time_utc_init are also written out now
    2831!
     
    9396
    9497       USE indices,                                                            &
    95            ONLY:  nz, nx, ny
     98           ONLY:  nx, ny, nz
    9699
    97100       USE microphysics_mod,                                                   &
     
    116119
    117120       USE spectra_mod,                                                        &
    118            ONLY:  average_count_sp
     121           ONLY:  average_count_sp, spectrum_x, spectrum_y
    119122
    120123       USE synthetic_turbulence_generator_mod,                                 &
     
    640643       CALL wrd_write_string( 'simulated_time' )
    641644       WRITE ( 14 )  simulated_time
     645
     646       IF ( ALLOCATED( spectrum_x ) )  THEN
     647          CALL wrd_write_string( 'spectrum_x' )
     648          WRITE ( 14 )  spectrum_x
     649          CALL wrd_write_string( 'spectrum_y' )
     650          WRITE ( 14 )  spectrum_y
     651       ENDIF
    642652
    643653       CALL wrd_write_string( 'spinup_time ' )
     
    958968       USE random_generator_parallel,                                          &
    959969           ONLY:  id_random_array, seq_random_array
    960        
    961        USE spectra_mod,                                                        &
    962            ONLY:  spectrum_x, spectrum_y
    963970
    964971       USE surface_mod,                                                        &
     
    12201227       ENDIF
    12211228
    1222        IF ( ALLOCATED( spectrum_x ) )  THEN
    1223           CALL wrd_write_string( 'spectrum_x' )
    1224           WRITE ( 14 )  spectrum_x
    1225           CALL wrd_write_string( 'spectrum_y' )
    1226           WRITE ( 14 )  spectrum_y
    1227        ENDIF
    1228 
    12291229       IF ( ALLOCATED( ts_av ) )  THEN
    12301230          CALL wrd_write_string( 'ts_av' )
Note: See TracChangeset for help on using the changeset viewer.