Skip to content

Commit 12e1aca

Browse files
Theresa MorrisonTheresa Morrison
Theresa Morrison
authored and
Theresa Morrison
committed
Add error to check if file exists.
Add a check if the OBC file exists and give a fatal error if not.
1 parent e63f2bd commit 12e1aca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/MOM_open_boundary.F90

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module MOM_open_boundary
1919
use MOM_interface_heights, only : thickness_to_dz
2020
use MOM_interpolate, only : init_external_field, time_interp_external, time_interp_external_init
2121
use MOM_interpolate, only : external_field
22-
use MOM_io, only : slasher, field_size, SINGLE_FILE
22+
use MOM_io, only : slasher, field_size, file_exists, SINGLE_FILE
2323
use MOM_io, only : vardesc, query_vardesc, var_desc
2424
use MOM_obsolete_params, only : obsolete_logical, obsolete_int, obsolete_real, obsolete_char
2525
use MOM_regridding, only : regridding_CS
@@ -913,12 +913,13 @@ subroutine initialize_segment_data(G, GV, US, OBC, PF)
913913
fieldname = trim(fieldname)//trim(suffix)
914914
call field_size(filename,fieldname,siz,no_domain=.true.)
915915
! if (siz(4) == 1) segment%values_needed = .false.
916+
if (.not.file_exists(filename)) &
917+
call MOM_error(FATAL," Unable to open OBC file " // trim(filename))
916918
if (segment%on_pe) then
917919
if (OBC%brushcutter_mode .and. (modulo(siz(1),2) == 0 .or. modulo(siz(2),2) == 0)) then
918920
write(mesg,'("Brushcutter mode sizes ", I6, I6)') siz(1), siz(2)
919921
call MOM_error(WARNING, mesg // " " // trim(filename) // " " // trim(fieldname))
920-
call MOM_error(FATAL,'segment data are not on the supergrid. Your OBC file name may '//&
921-
'not match the name in MOM_input or be missing.')
922+
call MOM_error(FATAL,'segment data are not on the supergrid.')
922923
endif
923924
siz2(1) = 1
924925

0 commit comments

Comments
 (0)