Ignore:
Timestamp:
Mar 15, 2018 9:17:58 AM (3 years ago)
Author:
Giersch
Message:

Reading/Writing? data in case of restart runs revised

File:
1 edited

Legend:

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

    r2841 r2894  
    2525! -----------------
    2626! $Id$
     27! variable named found has been introduced for checking if restart data was found,
     28! reading of restart strings has been moved completely to read_restart_data_mod,
     29! redundant skipping function has been removed, stg_read/write_restart_data
     30! have been renamed to stg_r/wrd_global, stg_rrd_global is called in
     31! read_restart_data_mod now, flag syn_turb_gen_prerun and marker *** end stg
     32! *** have been removed (Giersch), strings and their respective lengths are
     33! written out and read now in case of restart runs to get rid of prescribed
     34! character lengths (Giersch), CASE DEFAULT was added if restart data is read
     35!
     36! 2841 2018-02-27 15:02:57Z suehring
    2737! Bugfix: wrong placement of include 'mpif.h' corrected
    2838!
     
    4454!
    4555! 2576 2017-10-24 13:49:46Z Giersch
    46 ! Definition of a new function called stg_skip_var_list to skip module
     56! Definition of a new function called stg_skip_global to skip module
    4757! parameters during reading restart data
    4858!
     
    92102    USE control_parameters,                                                    &
    93103        ONLY:  initializing_actions, message_string,                           &
    94                syn_turb_gen, syn_turb_gen_prerun
     104               syn_turb_gen
    95105
    96106    USE cpulog,                                                                &
     
    208218
    209219!
    210 !-- Skipping of parameters for restart runs
    211     INTERFACE stg_skip_var_list
    212        MODULE PROCEDURE stg_skip_var_list
    213     END INTERFACE stg_skip_var_list
    214 
    215 !
    216220!-- Reading of parameters for restart runs
    217     INTERFACE stg_read_restart_data
    218        MODULE PROCEDURE stg_read_restart_data
    219     END INTERFACE stg_read_restart_data
     221    INTERFACE stg_rrd_global
     222       MODULE PROCEDURE stg_rrd_global
     223    END INTERFACE stg_rrd_global
    220224
    221225!
    222226!-- Writing of binary output for restart runs
    223     INTERFACE stg_write_restart_data
    224        MODULE PROCEDURE stg_write_restart_data
    225     END INTERFACE stg_write_restart_data
     227    INTERFACE stg_wrd_global
     228       MODULE PROCEDURE stg_wrd_global
     229    END INTERFACE stg_wrd_global
    226230
    227231    SAVE
     
    232236!-- Public interfaces
    233237    PUBLIC  stg_check_parameters, stg_header, stg_init, stg_main, stg_parin,   &
    234             stg_write_restart_data, stg_skip_var_list
     238            stg_wrd_global, stg_rrd_global
    235239
    236240!
     
    702706    syn_turb_gen = .TRUE.
    703707
    704     IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN
    705        CALL stg_read_restart_data
    706     ENDIF
    707708
    708709 10 CONTINUE
    709710
    710711 END SUBROUTINE stg_parin
    711 
    712 
    713 !------------------------------------------------------------------------------!
    714 ! Description:
    715 ! ------------
    716 !> Skipping the stg variables from restart-file (binary format).
    717 !------------------------------------------------------------------------------!
    718    SUBROUTINE stg_skip_var_list
    719        
    720       IMPLICIT NONE
    721            
    722       CHARACTER (LEN=1)  ::  cdum
    723       CHARACTER (LEN=30) ::  variable_chr
    724            
    725       READ ( 13 )  variable_chr
    726 
    727       DO  WHILE ( TRIM( variable_chr ) /= '*** end stg module ***' )
    728 
    729          READ ( 13 )  cdum
    730          READ ( 13 )  variable_chr
    731 
    732       ENDDO   
    733            
    734    END SUBROUTINE stg_skip_var_list
    735712
    736713
     
    740717!> This routine reads the respective restart data.
    741718!------------------------------------------------------------------------------!
    742  SUBROUTINE stg_read_restart_data
     719 SUBROUTINE stg_rrd_global( found )
     720
     721
     722    USE control_parameters,                                                    &
     723        ONLY: length, restart_string
    743724
    744725
    745726    IMPLICIT NONE
    746727
    747     CHARACTER (LEN=30) ::  variable_chr  !< dummy variable to read string
    748 
    749 
    750     READ ( 13 )  variable_chr
    751     DO  WHILE ( TRIM( variable_chr ) /= '*** end stg module ***' )
    752 
    753        SELECT CASE ( TRIM( variable_chr ) )
    754 
    755           CASE ( 'use_syn_turb_gen' )
    756              READ ( 13 )  use_syn_turb_gen
    757           CASE ( 'mc_factor' )
    758              READ ( 13 )  mc_factor
    759           CASE ( 'syn_turb_gen_prerun' )
    760              READ ( 13 )  syn_turb_gen_prerun
    761 
    762        END SELECT
    763 
    764        READ ( 13 )  variable_chr
    765 
    766     ENDDO
    767 
    768  END SUBROUTINE stg_read_restart_data
     728    LOGICAL, INTENT(OUT)  ::  found
     729
     730
     731    found = .TRUE.
     732 
     733
     734    SELECT CASE ( restart_string(1:length) )
     735
     736       CASE ( 'mc_factor' )
     737          READ ( 13 )  mc_factor
     738       CASE ( 'use_syn_turb_gen' )
     739          READ ( 13 )  use_syn_turb_gen
     740
     741       CASE DEFAULT
     742
     743          found = .FALSE.   
     744
     745    END SELECT
     746
     747
     748 END SUBROUTINE stg_rrd_global
    769749
    770750
     
    774754!> This routine writes the respective restart data.
    775755!------------------------------------------------------------------------------!
    776  SUBROUTINE stg_write_restart_data
     756 SUBROUTINE stg_wrd_global
    777757
    778758
    779759    IMPLICIT NONE
    780760
    781     syn_turb_gen_prerun = .TRUE.
    782 
    783     WRITE ( 14 )  'use_syn_turb_gen              '
     761
     762    CALL wrd_write_string( 'mc_factor' )
     763    WRITE ( 14 )  mc_factor
     764
     765    CALL wrd_write_string( 'use_syn_turb_gen' )
    784766    WRITE ( 14 )  use_syn_turb_gen
    785     WRITE ( 14 )  'mc_factor                     '
    786     WRITE ( 14 )  mc_factor
    787     WRITE ( 14 )  'syn_turb_gen_prerun           '
    788     WRITE ( 14 )  syn_turb_gen_prerun
    789 
    790     WRITE ( 14 )  '*** end stg module ***        '
    791 
    792 END SUBROUTINE stg_write_restart_data
     767
     768
     769 END SUBROUTINE stg_wrd_global
    793770
    794771
Note: See TracChangeset for help on using the changeset viewer.