Skip to content

Commit

Permalink
Add checks for source/sink inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
josephzhang8 committed May 10, 2024
1 parent a75e109 commit 4af0f8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Hydro/schism_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2810,6 +2810,8 @@ subroutine schism_init(iorder,indir,iths,ntime)
if(myrank==0) then
do i=1,nsources
read(31,*)ieg_source(i) !global elem. #
if(ieg_source(i)<=0.or.ieg_source(i)>ne_global) &
&call parallel_abort('INIT: source elem over')
enddo !i
read(31,*) !blank line
read(31,*)nsinks
Expand All @@ -2825,6 +2827,8 @@ subroutine schism_init(iorder,indir,iths,ntime)
if(myrank==0) then
do i=1,nsinks
read(31,*)ieg_sink(i)
if(ieg_sink(i)<=0.or.ieg_sink(i)>ne_global) &
&call parallel_abort('INIT: sink elem over')
enddo !i
close(31)
endif !myrank
Expand Down Expand Up @@ -2882,13 +2886,17 @@ subroutine schism_init(iorder,indir,iths,ntime)
if(j/=NF90_NOERR) call parallel_abort('init: source_elem')
j=nf90_get_var(ncid_source,mm,ieg_source(1:nsources),(/1/),(/nsources/))
if(j/=NF90_NOERR) call parallel_abort('init: source_elem(2)')
if(maxval(ieg_source)>ne_global.or.minval(ieg_source)<=0) &
& call parallel_abort('init: check source elem')
endif !nsources

if(nsinks>0) then
j=nf90_inq_varid(ncid_source, "sink_elem",mm)
if(j/=NF90_NOERR) call parallel_abort('init: sink_elem')
j=nf90_get_var(ncid_source,mm,ieg_sink(1:nsinks),(/1/),(/nsinks/))
if(j/=NF90_NOERR) call parallel_abort('init: sink_elem(2)')
if(maxval(ieg_sink)>ne_global.or.minval(ieg_sink)<=0) &
& call parallel_abort('init: check sink elem')
endif !nsinks
endif !myrank=0
call mpi_bcast(ieg_source,max(1,nsources),itype,0,comm,istat)
Expand Down
2 changes: 1 addition & 1 deletion src/Readme.beta_notes
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This beta notes are divided into 5 part:

Github versions:

- `e66f1b3` (3 May 2024): renamed sav_*.gr3 as veg_*.gr3;
- `e66f1b3` (3 May 2024): renamed sav_*.gr3 as veg_*.gr3; also MARSH module now requires iveg/=0;
- `ca44ba0` (1 May 2024): removed isav and replaced it with iveg
- `4fb6228` (9 Feb 2024): add cmake CPP 'BLD_STANDALONE' to accommodate UFS
- `9bee0f5` (8 Feb 2024): removed IMPOSE_NET_FLUX and 'meth_sink'
Expand Down

0 comments on commit 4af0f8c

Please sign in to comment.