From 4af0f8c32930f50a0ea45532506991afc247bd8f Mon Sep 17 00:00:00 2001 From: Joseph Zhang Date: Fri, 10 May 2024 09:01:31 -0400 Subject: [PATCH] Add checks for source/sink inputs --- src/Hydro/schism_init.F90 | 8 ++++++++ src/Readme.beta_notes | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Hydro/schism_init.F90 b/src/Hydro/schism_init.F90 index c954398de..3ec314ba4 100644 --- a/src/Hydro/schism_init.F90 +++ b/src/Hydro/schism_init.F90 @@ -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 @@ -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 @@ -2882,6 +2886,8 @@ 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 @@ -2889,6 +2895,8 @@ subroutine schism_init(iorder,indir,iths,ntime) 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) diff --git a/src/Readme.beta_notes b/src/Readme.beta_notes index bb1d8e285..d53f5224b 100644 --- a/src/Readme.beta_notes +++ b/src/Readme.beta_notes @@ -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'