diff --git a/configuration/driver/icedrv_init.F90 b/configuration/driver/icedrv_init.F90 index d4f1e75e1..c4a2c7a17 100644 --- a/configuration/driver/icedrv_init.F90 +++ b/configuration/driver/icedrv_init.F90 @@ -294,55 +294,111 @@ subroutine input_data open (nu_nml, file=nml_filename, status='old',iostat=nml_error) if (nml_error /= 0) then - nml_error = -1 - else - nml_error = 1 + write(ice_stdout,*) 'error opening namelist file '//trim(nml_filename) + call icedrv_system_abort(file=__FILE__,line=__LINE__) endif + close(nu_nml) - do while (nml_error > 0) - print*,'Reading namelist file ',nml_filename + print*,'Reading namelist file ',nml_filename - print*,'Reading setup_nml' + open (nu_nml, file=nml_filename, status='old',iostat=nml_error) + nml_error = 1 + print*,'Reading setup_nml' + do while (nml_error > 0) read(nu_nml, nml=setup_nml,iostat=nml_error) - if (nml_error /= 0) exit + end do + if (nml_error /= 0) then + write(ice_stdout,*) 'error reading namelist' + call icedrv_system_abort(file=__FILE__,line=__LINE__) + endif + close(nu_nml) - print*,'Reading grid_nml' + open (nu_nml, file=nml_filename, status='old',iostat=nml_error) + nml_error = 1 + print*,'Reading grid_nml' + do while (nml_error > 0) read(nu_nml, nml=grid_nml,iostat=nml_error) - if (nml_error /= 0) exit + end do + if (nml_error /= 0) then + write(ice_stdout,*) 'error reading namelist' + call icedrv_system_abort(file=__FILE__,line=__LINE__) + endif + close(nu_nml) - print*,'Reading tracer_nml' + open (nu_nml, file=nml_filename, status='old',iostat=nml_error) + nml_error = 1 + print*,'Reading tracer_nml' + do while (nml_error > 0) read(nu_nml, nml=tracer_nml,iostat=nml_error) - if (nml_error /= 0) exit + end do + if (nml_error /= 0) then + write(ice_stdout,*) 'error reading namelist' + call icedrv_system_abort(file=__FILE__,line=__LINE__) + endif + close(nu_nml) - print*,'Reading thermo_nml' + open (nu_nml, file=nml_filename, status='old',iostat=nml_error) + nml_error = 1 + print*,'Reading thermo_nml' + do while (nml_error > 0) read(nu_nml, nml=thermo_nml,iostat=nml_error) - if (nml_error /= 0) exit + end do + if (nml_error /= 0) then + write(ice_stdout,*) 'error reading namelist' + call icedrv_system_abort(file=__FILE__,line=__LINE__) + endif + close(nu_nml) - print*,'Reading shortwave_nml' + open (nu_nml, file=nml_filename, status='old',iostat=nml_error) + nml_error = 1 + print*,'Reading shortwave_nml' + do while (nml_error > 0) read(nu_nml, nml=shortwave_nml,iostat=nml_error) - if (nml_error /= 0) exit + end do + if (nml_error /= 0) then + write(ice_stdout,*) 'error reading namelist' + call icedrv_system_abort(file=__FILE__,line=__LINE__) + endif + close(nu_nml) - print*,'Reading ponds_nml' + open (nu_nml, file=nml_filename, status='old',iostat=nml_error) + nml_error = 1 + print*,'Reading ponds_nml' + do while (nml_error > 0) read(nu_nml, nml=ponds_nml,iostat=nml_error) - if (nml_error /= 0) exit + end do + if (nml_error /= 0) then + write(ice_stdout,*) 'error reading namelist' + call icedrv_system_abort(file=__FILE__,line=__LINE__) + endif + close(nu_nml) - if (tr_snow) then - print*,'Reading snow_nml' + if (tr_snow) then + open (nu_nml, file=nml_filename, status='old',iostat=nml_error) + nml_error = 1 + print*,'Reading snow_nml' + do while (nml_error > 0) read(nu_nml, nml=snow_nml,iostat=nml_error) - if (nml_error /= 0) exit + end do + if (nml_error /= 0) then + write(ice_stdout,*) 'error reading namelist' + call icedrv_system_abort(file=__FILE__,line=__LINE__) endif + close(nu_nml) + endif - print*,'Reading forcing_nml' + open (nu_nml, file=nml_filename, status='old',iostat=nml_error) + nml_error = 1 + print*,'Reading forcing_nml' + do while (nml_error > 0) read(nu_nml, nml=forcing_nml,iostat=nml_error) - if (nml_error /= 0) exit end do - if (nml_error == 0) close(nu_nml) if (nml_error /= 0) then write(ice_stdout,*) 'error reading namelist' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif close(nu_nml) - + !----------------------------------------------------------------- ! set up diagnostics output and resolve conflicts !----------------------------------------------------------------- diff --git a/configuration/driver/icedrv_init_column.F90 b/configuration/driver/icedrv_init_column.F90 index 1d90281f4..dfd2a59e1 100644 --- a/configuration/driver/icedrv_init_column.F90 +++ b/configuration/driver/icedrv_init_column.F90 @@ -1008,20 +1008,20 @@ subroutine init_zbgc open (nu_nml, file=trim(nml_filename), status='old',iostat=nml_error) if (nml_error /= 0) then - nml_error = -1 - else - nml_error = 1 + print*,'error opening zbgc namelist file '//trim(nml_filename) + call icedrv_system_abort(file=__FILE__,line=__LINE__) endif + nml_error = 1 print*,'Reading zbgc_nml' do while (nml_error > 0) read(nu_nml, nml=zbgc_nml,iostat=nml_error) end do - if (nml_error == 0) close(nu_nml) if (nml_error /= 0) then print*,'error reading zbgc namelist' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif + close(nu_nml) !----------------------------------------------------------------- ! resolve conflicts