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

Reading/Writing? data in case of restart runs revised

File:
1 edited

Legend:

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

    r2836 r2894  
    2626! -----------------
    2727! $Id$
     28! variable named found has been introduced for checking if restart data was
     29! found, reading of restart strings has been moved completely to
     30! read_restart_data_mod, wind_turbine_prerun flag has been removed, redundant
     31! skipping function has been removed, wtm_read/write_restart_data have been
     32! renamed to wtm_r/wrd_global, wtm_rrd_global is called in
     33! read_restart_data_mod now, marker *** end wtm *** was removed, strings and
     34! their respective lengths are written out and read now in case of restart
     35! runs to get rid of prescribed character lengths, CASE DEFAULT was added if
     36! restart data is read
     37!
     38! 2885 2018-03-14 11:02:46Z Giersch
    2839! Bugfix in interpolation of lift and drag coefficients on fine grid of radius
    2940! segments and angles of attack, speed-up of the initialization of the wind
     
    4960!
    5061! 2576 2017-10-24 13:49:46Z Giersch
    51 ! Definition of a new function called wtm_skip_var_list to skip module
     62! Definition of a new function called wtm_skip_global to skip module
    5263! parameters during reading restart data
    5364!
     
    137148    USE control_parameters,                                                    &
    138149        ONLY:  coupling_char, dt_3d, dz, message_string, simulated_time,       &
    139                wind_turbine, wind_turbine_prerun, initializing_actions
     150               wind_turbine, initializing_actions
    140151
    141152    USE cpulog,                                                                &
     
    404415    END INTERFACE wtm_parin
    405416
    406     INTERFACE wtm_skip_var_list
    407        MODULE PROCEDURE wtm_skip_var_list
    408     END INTERFACE wtm_skip_var_list
    409 
    410     INTERFACE wtm_write_restart_data
    411        MODULE PROCEDURE wtm_write_restart_data
    412     END INTERFACE wtm_write_restart_data
    413 
    414     INTERFACE wtm_read_restart_data
    415        MODULE PROCEDURE wtm_read_restart_data
    416     END INTERFACE wtm_read_restart_data
     417    INTERFACE wtm_wrd_global
     418       MODULE PROCEDURE wtm_wrd_global
     419    END INTERFACE wtm_wrd_global
     420
     421    INTERFACE wtm_rrd_global
     422       MODULE PROCEDURE wtm_rrd_global
     423    END INTERFACE wtm_rrd_global
    417424   
    418425    INTERFACE wtm_check_parameters
     
    456463   
    457464    PUBLIC wtm_check_parameters, wtm_forces, wtm_init, wtm_init_arrays,        &
    458            wtm_parin, wtm_write_restart_data, wtm_tendencies, wtm_skip_var_list
     465           wtm_parin, wtm_wrd_global, wtm_rrd_global, wtm_tendencies
    459466
    460467
     
    514521       wind_turbine = .TRUE.
    515522
    516        IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN
    517           CALL wtm_read_restart_data
    518        ENDIF
    519523
    520524 10    CONTINUE   ! TBD Change from continue, mit ierrn machen
     
    522526
    523527    END SUBROUTINE wtm_parin
    524 
    525 
    526 !------------------------------------------------------------------------------!
    527 ! Description:
    528 ! ------------
    529 !> Skipping the wind turbine module variables from restart-file (binary format).
    530 !------------------------------------------------------------------------------!
    531    SUBROUTINE wtm_skip_var_list
    532        
    533       IMPLICIT NONE
    534            
    535       CHARACTER (LEN=1)  ::  cdum
    536       CHARACTER (LEN=30) ::  variable_chr
    537            
    538       READ ( 13 )  variable_chr
    539 
    540       DO  WHILE ( TRIM( variable_chr ) /= '*** end wtm ***' )
    541 
    542          READ ( 13 )  cdum
    543          READ ( 13 )  variable_chr
    544 
    545       ENDDO   
    546            
    547    END SUBROUTINE wtm_skip_var_list
    548528
    549529
     
    553533!> This routine writes the respective restart data.
    554534!------------------------------------------------------------------------------!
    555     SUBROUTINE wtm_write_restart_data 
     535    SUBROUTINE wtm_wrd_global 
     536
    556537
    557538       IMPLICIT NONE
    558539
    559        wind_turbine_prerun = .TRUE.
    560        
    561        WRITE ( 14 )  'omega_gen                     '
     540       
     541       CALL wrd_write_string( 'omega_gen' )
    562542       WRITE ( 14 )  omega_gen
    563        WRITE ( 14 )  'omega_gen_f                   '
     543
     544       CALL wrd_write_string( 'omega_gen_f' )
    564545       WRITE ( 14 )  omega_gen_f
    565        WRITE ( 14 )  'omega_gen_f_old               '
     546
     547       CALL wrd_write_string( 'omega_gen_f_old' )
    566548       WRITE ( 14 )  omega_gen_f_old
    567        WRITE ( 14 )  'omega_gen_old                 '
     549
     550       CALL wrd_write_string( 'omega_gen_old' )
    568551       WRITE ( 14 )  omega_gen_old
    569        WRITE ( 14 )  'omega_rot                     '
     552
     553       CALL wrd_write_string( 'omega_rot' )
    570554       WRITE ( 14 )  omega_rot
    571        WRITE ( 14 )  'phi_yaw                       '
    572        WRITE ( 14 )  phi_yaw(:)
    573        WRITE ( 14 )  'pitch_add                     '
     555
     556       CALL wrd_write_string( 'phi_yaw' )
     557       WRITE ( 14 )  phi_yaw
     558
     559       CALL wrd_write_string( 'pitch_add' )
    574560       WRITE ( 14 )  pitch_add
    575        WRITE ( 14 )  'pitch_add_old                 '
     561
     562       CALL wrd_write_string( 'pitch_add_old' )
    576563       WRITE ( 14 )  pitch_add_old
    577        WRITE ( 14 )  'torque_gen                    '
     564
     565       CALL wrd_write_string( 'torque_gen' )
    578566       WRITE ( 14 )  torque_gen
    579        WRITE ( 14 )  'torque_gen_old                '
     567
     568       CALL wrd_write_string( 'torque_gen_old' )
    580569       WRITE ( 14 )  torque_gen_old
    581        WRITE ( 14 )  'wind_turbine_prerun           '
    582        WRITE ( 14 )  wind_turbine_prerun
    583      
    584        WRITE ( 14 )  '*** end wtm ***               '
    585        
    586     END SUBROUTINE wtm_write_restart_data   
     570
     571       
     572    END SUBROUTINE wtm_wrd_global   
    587573
    588574
     
    592578!> This routine reads the respective restart data.
    593579!------------------------------------------------------------------------------!
    594  SUBROUTINE wtm_read_restart_data
     580 SUBROUTINE wtm_rrd_global( found )
     581
     582
     583    USE control_parameters,                                                    &
     584        ONLY: length, restart_string
    595585
    596586
    597587    IMPLICIT NONE
    598588
    599     CHARACTER (LEN=30) ::  variable_chr  !< dummy variable to read string
    600 
    601 
    602     READ ( 13 )  variable_chr
    603     DO  WHILE ( TRIM( variable_chr ) /= '*** end wtm ***' )
    604 
    605        SELECT CASE ( TRIM( variable_chr ) )
    606 
    607           CASE ( 'omega_gen' )
    608              READ ( 13 )  omega_gen
    609           CASE ( 'omega_gen_f' )
    610              READ ( 13 )  omega_gen_f
    611           CASE ( 'omega_gen_f_old' )
    612              READ ( 13 )  omega_gen_f_old
    613           CASE ( 'omega_gen_old' )
    614              READ ( 13 )  omega_gen_old
    615           CASE ( 'omega_rot' )
    616              READ ( 13 )  omega_rot
    617           CASE ( 'phi_yaw' )
    618              READ ( 13 )  phi_yaw
    619           CASE ( 'pitch_add' )
    620              READ ( 13 )  pitch_add
    621           CASE ( 'pitch_add_old' )
    622              READ ( 13 )  pitch_add_old
    623           CASE ( 'torque_gen' )
    624              READ ( 13 )  torque_gen
    625           CASE ( 'torque_gen_old' )
    626              READ ( 13 )  torque_gen_old
    627           CASE ( 'wind_turbine_prerun' )
    628              READ ( 13 )  wind_turbine_prerun
    629 
    630        END SELECT
    631        
    632        READ ( 13 )  variable_chr
    633 
    634     ENDDO
    635 
    636  END SUBROUTINE wtm_read_restart_data
     589    LOGICAL, INTENT(OUT)  ::  found
     590
     591
     592    found = .TRUE.
     593
     594
     595    SELECT CASE ( restart_string(1:length) )
     596
     597       CASE ( 'omega_gen' )
     598          READ ( 13 )  omega_gen
     599       CASE ( 'omega_gen_f' )
     600          READ ( 13 )  omega_gen_f
     601       CASE ( 'omega_gen_f_old' )
     602          READ ( 13 )  omega_gen_f_old
     603       CASE ( 'omega_gen_old' )
     604          READ ( 13 )  omega_gen_old
     605       CASE ( 'omega_rot' )
     606          READ ( 13 )  omega_rot
     607       CASE ( 'phi_yaw' )
     608          READ ( 13 )  phi_yaw
     609       CASE ( 'pitch_add' )
     610          READ ( 13 )  pitch_add
     611       CASE ( 'pitch_add_old' )
     612          READ ( 13 )  pitch_add_old
     613       CASE ( 'torque_gen' )
     614          READ ( 13 )  torque_gen
     615       CASE ( 'torque_gen_old' )
     616          READ ( 13 )  torque_gen_old
     617
     618       CASE DEFAULT
     619
     620          found = .FALSE.
     621
     622    END SELECT
     623   
     624
     625 END SUBROUTINE wtm_rrd_global
    637626
    638627
     
    20662055                     turb_cl(rseg)  = tl_factor * turb_cl(rseg)                                 
    20672056                                 
    2068                    END IF               
     2057                   ENDIF               
    20692058!
    20702059!--                !-----------------------------------------------------!
     
    23712360             ENDDO ! End of loop over turbines
    23722361                           
    2373           END IF  ! end of yaw control
     2362          ENDIF  ! end of yaw control
    23742363         
    23752364          IF ( speed_control )  THEN
Note: See TracChangeset for help on using the changeset viewer.