4 SUBROUTINE med_initialdata_input_ptr ( grid , config_flags )
8 TYPE (domain) , POINTER :: grid
9 TYPE (grid_config_rec_type) , INTENT(IN) :: config_flags
11 SUBROUTINE med_initialdata_input ( grid , config_flags )
15 TYPE (grid_config_rec_type) , INTENT(IN) :: config_flags
16 END SUBROUTINE med_initialdata_input
18 CALL med_initialdata_input ( grid , config_flags )
21 END SUBROUTINE med_initialdata_input_ptr
23 SUBROUTINE med_initialdata_input ( grid , config_flags )
31 USE module_bc_time_utilities
38 SUBROUTINE start_domain ( grid , allowed_to_read ) ! comes from module_start in appropriate dyn_ directory
41 LOGICAL, INTENT(IN) :: allowed_to_read
42 END SUBROUTINE start_domain
47 TYPE (grid_config_rec_type) , INTENT(IN) :: config_flags
49 INTEGER :: fid , ierr , myproc
50 CHARACTER (LEN=80) :: inpname , rstname, timestr
51 CHARACTER (LEN=80) :: message
54 CALL nl_get_restart( 1, restart )
55 IF ( .NOT. restart ) THEN
56 ! Initialize the mother domain.
57 grid%input_from_file = .true.
58 IF ( grid%input_from_file ) THEN
60 CALL wrf_debug ( 1 , 'wrf main: calling open_r_dataset for wrfinput' )
62 ! typically <date> will not be part of input_inname but allow for it
63 CALL domain_clock_get( grid, current_timestr=timestr )
64 CALL construct_filename2a ( inpname , config_flags%input_inname , grid%id , 2 , timestr )
66 CALL open_r_dataset ( fid, TRIM(inpname) , grid , config_flags , "DATASET=INPUT", ierr )
67 IF ( ierr .NE. 0 ) THEN
68 WRITE( wrf_err_message , * ) 'program wrf: error opening ',TRIM(inpname),' for reading ierr=',ierr
69 CALL WRF_ERROR_FATAL ( wrf_err_message )
71 IF ( ( grid%id .EQ. 1 ) .OR. ( config_flags%fine_input_stream .EQ. 0 ) ) THEN
72 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_model_input' )
73 CALL input_model_input ( fid , grid , config_flags , ierr )
74 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_model_input' )
75 ELSE IF ( config_flags%fine_input_stream .EQ. 1 ) THEN
76 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input1' )
77 CALL input_aux_model_input1 ( fid , grid , config_flags , ierr )
78 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input1' )
79 ELSE IF ( config_flags%fine_input_stream .EQ. 2 ) THEN
80 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input2' )
81 CALL input_aux_model_input2 ( fid , grid , config_flags , ierr )
82 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input2' )
83 ELSE IF ( config_flags%fine_input_stream .EQ. 3 ) THEN
84 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input3' )
85 CALL input_aux_model_input3 ( fid , grid , config_flags , ierr )
86 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input3' )
87 ELSE IF ( config_flags%fine_input_stream .EQ. 4 ) THEN
88 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input4' )
89 CALL input_aux_model_input4 ( fid , grid , config_flags , ierr )
90 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input4' )
91 ELSE IF ( config_flags%fine_input_stream .EQ. 5 ) THEN
92 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input5' )
93 CALL input_aux_model_input5 ( fid , grid , config_flags , ierr )
94 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input5' )
95 ELSE IF ( config_flags%fine_input_stream .EQ. 6 ) THEN
96 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input6' )
97 CALL input_aux_model_input6 ( fid , grid , config_flags , ierr )
98 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input6' )
99 ELSE IF ( config_flags%fine_input_stream .EQ. 7 ) THEN
100 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input7' )
101 CALL input_aux_model_input7 ( fid , grid , config_flags , ierr )
102 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input7' )
103 ELSE IF ( config_flags%fine_input_stream .EQ. 8 ) THEN
104 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input8' )
105 CALL input_aux_model_input8 ( fid , grid , config_flags , ierr )
106 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input8' )
107 ELSE IF ( config_flags%fine_input_stream .EQ. 9 ) THEN
108 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input9' )
109 CALL input_aux_model_input9 ( fid , grid , config_flags , ierr )
110 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input9' )
111 ELSE IF ( config_flags%fine_input_stream .EQ. 10 ) THEN
112 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input10' )
113 CALL input_aux_model_input10 ( fid , grid , config_flags , ierr )
114 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input10' )
115 ELSE IF ( config_flags%fine_input_stream .EQ. 11 ) THEN
116 CALL wrf_debug ( 0 , 'med_initialdata_input: calling input_aux_model_input11' )
117 CALL input_aux_model_input11 ( fid , grid , config_flags , ierr )
118 CALL wrf_debug ( 100 , 'med_initialdata_input: back from input_aux_model_input11' )
120 WRITE( message , '("med_initialdata_input: bad fine_input_stream = ",I4)') config_flags%fine_input_stream
121 CALL WRF_ERROR_FATAL ( message )
123 CALL close_dataset ( fid , config_flags , "DATASET=INPUT" )
125 grid%nest_pos = grid%ht
126 where ( grid%nest_pos .gt. 0 ) grid%nest_pos = grid%nest_pos + 500. ! make a cliff
129 grid%imask_nostag = 1
132 grid%imask_xystag = 1
134 grid%press_adj = .FALSE.
136 CALL start_domain ( grid , .TRUE. )
138 CALL domain_clock_get( grid, current_timestr=timestr )
139 CALL construct_filename2a ( rstname , config_flags%rst_inname , grid%id , 2 , timestr )
141 WRITE(message,*)'RESTART run: opening ',TRIM(rstname),' for reading'
142 CALL wrf_message ( message )
143 CALL open_r_dataset ( fid , TRIM(rstname) , grid , config_flags , "DATASET=RESTART", ierr )
144 IF ( ierr .NE. 0 ) THEN
145 WRITE( message , '("program wrf: error opening ",A32," for reading")') TRIM(rstname)
146 CALL WRF_ERROR_FATAL ( message )
148 CALL input_restart ( fid, grid , config_flags , ierr )
149 CALL close_dataset ( fid , config_flags , "DATASET=RESTART" )
150 grid%imask_nostag = 1
153 grid%imask_xystag = 1
155 grid%press_adj = .FALSE.
157 CALL start_domain ( grid , .TRUE. )
161 END SUBROUTINE med_initialdata_input
163 SUBROUTINE med_shutdown_io ( grid , config_flags )
174 TYPE (grid_config_rec_type) , INTENT(IN) :: config_flags
176 CHARACTER (LEN=80) :: message
179 IF ( grid%oid > 0 ) CALL close_dataset ( grid%oid , config_flags , "DATASET=HISTORY" )
180 IF ( grid%auxhist1_oid > 0 ) CALL close_dataset ( grid%auxhist1_oid , config_flags , "DATASET=AUXHIST1" )
181 IF ( grid%auxhist2_oid > 0 ) CALL close_dataset ( grid%auxhist2_oid , config_flags , "DATASET=AUXHIST2" )
182 IF ( grid%auxhist3_oid > 0 ) CALL close_dataset ( grid%auxhist3_oid , config_flags , "DATASET=AUXHIST3" )
183 IF ( grid%auxhist4_oid > 0 ) CALL close_dataset ( grid%auxhist4_oid , config_flags , "DATASET=AUXHIST4" )
184 IF ( grid%auxhist5_oid > 0 ) CALL close_dataset ( grid%auxhist5_oid , config_flags , "DATASET=AUXHIST5" )
186 IF ( grid%auxhist6_oid > 0 ) CALL close_dataset ( grid%auxhist6_oid , config_flags , "DATASET=AUXHIST6" )
187 IF ( grid%auxhist7_oid > 0 ) CALL close_dataset ( grid%auxhist7_oid , config_flags , "DATASET=AUXHIST7" )
188 IF ( grid%auxhist8_oid > 0 ) CALL close_dataset ( grid%auxhist8_oid , config_flags , "DATASET=AUXHIST8" )
189 IF ( grid%auxhist9_oid > 0 ) CALL close_dataset ( grid%auxhist9_oid , config_flags , "DATASET=AUXHIST9" )
190 IF ( grid%auxhist10_oid > 0 ) CALL close_dataset ( grid%auxhist10_oid , config_flags , "DATASET=AUXHIST10" )
191 IF ( grid%auxhist11_oid > 0 ) CALL close_dataset ( grid%auxhist11_oid , config_flags , "DATASET=AUXHIST11" )
194 IF ( grid%lbc_fid > 0 ) CALL close_dataset ( grid%lbc_fid , config_flags , "DATASET=BOUNDARY" )
196 CALL wrf_ioexit( ierr ) ! shut down the quilt I/O
200 END SUBROUTINE med_shutdown_io
202 SUBROUTINE med_add_config_info_to_grid ( grid )
211 TYPE(domain) , TARGET :: grid
213 #define SOURCE_RECORD model_config_rec %
214 #define SOURCE_REC_DEX (grid%id)
215 #define DEST_RECORD grid %
216 #include <config_assigns.inc>
220 END SUBROUTINE med_add_config_info_to_grid