@@ -10330,15 +10330,17 @@ subroutine schism_step(it)
1033010330 do j= 1 ,nvar_sta ! excluding zcor
1033110331 if (iof_sta(j)==0.or .mod (it,nspool_sta)/= 0 ) cycle
1033210332
10333+ idry_sta(:)= 0 ! init
1033310334 do i= 1 ,nout_sta
1033410335 ie= iep_sta(i)
1033510336 if (ie== 0 ) then ! no parent in this rank
1033610337 iep_flag(i)= 0 ! for comm. later
1033710338 sta_out(i,j)= 0.d0
1033810339 sta_out3d(:,i,j)= 0.d0
10339- zta_out3d(:,i,j )= 0.d0
10340+ zta_out3d(:,i)= 0.d0 ! same for all j
1034010341 else ! is parent
1034110342 iep_flag(i)= 1
10343+ idry_sta(i)= idry_e(ie) ! save for comm later
1034210344 sta_out(i,j)= 0.d0 ! initialize
1034310345 if (j== 1 ) then ! elev.
1034410346 swild2(1 ,1 :i34(ie))= eta2(elnode(1 :i34(ie),ie))
@@ -10371,7 +10373,7 @@ subroutine schism_step(it)
1037110373 if (idry_e(ie)==1 ) then ! dry
1037210374 sta_out(i,j)=- 1.d7 !- 999.d0
1037310375 sta_out3d(:,i,j)=- 1.d7 !- 999.d0
10374- zta_out3d(:,i,j )=- 1.d7 !- 999.d0
10376+ zta_out3d(:,i)=- 1.d7 ! same for all j
1037510377 else ! wet
1037610378 do m= 1 ,i34(ie) ! wet nodes
1037710379 nd= elnode(m,ie)
@@ -10404,7 +10406,7 @@ subroutine schism_step(it)
1040410406 itmp= minval (kbp(elnode(1 :i34(ie),ie)))
1040510407 do k= 1 ,nvrt
1040610408 if (k< itmp) then
10407- zta_out3d(k,i,j )=- 1.d7
10409+ zta_out3d(k,i)=- 1.d7
1040810410 sta_out3d(k,i,j)=- 1.d7
1040910411 else ! at least 1 node has valid value
1041010412 do m= 1 ,i34(ie)
@@ -10419,7 +10421,7 @@ subroutine schism_step(it)
1041910421! swild4(2,m)=swild2(k,m)
1042010422! endif
1042110423 enddo ! m
10422- zta_out3d(k,i,j )= sum (arco_sta(i,1 :i34(ie))* swild4(1 ,1 :i34(ie)))
10424+ zta_out3d(k,i)= sum (arco_sta(i,1 :i34(ie))* swild4(1 ,1 :i34(ie)))
1042310425 sta_out3d(k,i,j)= sum (arco_sta(i,1 :i34(ie))* swild4(2 ,1 :i34(ie)))
1042410426 endif ! k
1042510427 enddo ! k
@@ -10432,10 +10434,14 @@ subroutine schism_step(it)
1043210434 enddo ! j=1,nvar_sta
1043310435
1043410436! Output by rank 0
10437+ call mpi_reduce(idry_sta,nwild2,nout_sta,itype,MPI_SUM,0 ,comm,ierr)
10438+ ! Save back to idry_sta to free up nwild2; /=0 => dry
10439+ if (myrank== 0 ) idry_sta= nwild2(1 :nout_sta)
10440+
1043510441 call mpi_reduce(iep_flag,nwild2,nout_sta,itype,MPI_SUM,0 ,comm,ierr)
1043610442 call mpi_reduce(sta_out,sta_out_gb,nout_sta* nvar_sta,rtype,MPI_SUM,0 ,comm,ierr)
1043710443 call mpi_reduce(sta_out3d,sta_out3d_gb,nvrt* nout_sta* nvar_sta,rtype,MPI_SUM,0 ,comm,ierr)
10438- call mpi_reduce(zta_out3d,zta_out3d_gb,nvrt* nout_sta* nvar_sta ,rtype,MPI_SUM,0 ,comm,ierr)
10444+ call mpi_reduce(zta_out3d,zta_out3d_gb,nvrt* nout_sta,rtype,MPI_SUM,0 ,comm,ierr)
1043910445
1044010446 if (myrank== 0 ) then
1044110447! write(290,*)nwild2(1:nout_sta)
@@ -10448,30 +10454,30 @@ subroutine schism_step(it)
1044810454 sta_out_gb(j,i)= 1.d7 !- 9999.d0
1044910455 if (i> 4 ) then ! 3D only
1045010456 sta_out3d_gb(:,j,i)= 1.d7 !- 9999.d0
10451- zta_out3d_gb(:,j,i )= 1.d7 !- 9999.d0
10457+ zta_out3d_gb(:,j)= 1.d7 !- 9999.d0
1045210458 endif
1045310459 else
1045410460 sta_out_gb(j,i)= sta_out_gb(j,i)/ dble (nwild2(j))
1045510461 if (i> 4 ) then ! 3D only
1045610462 sta_out3d_gb(:,j,i)= sta_out3d_gb(:,j,i)/ dble (nwild2(j))
10457- zta_out3d_gb(:,j,i )= zta_out3d_gb(:,j,i )/ dble (nwild2(j))
10463+ zta_out3d_gb(:,j)= zta_out3d_gb(:,j)/ dble (nwild2(j))
1045810464 endif
1045910465 endif
1046010466 enddo ! j
10461- write (250 + i,' (e24.16,6000(1x,e14.6 ))' )time,sta_out_gb(:,i)
10467+ write (250 + i,' (e24.16,6000(1x,e15.6e3 ))' )time,sta_out_gb(:,i)
1046210468 if (iout_sta== 2.and .i> 4 ) then
10463- write (250 + i,' (e24.16,300000(1x,e14.6 ))' )time,sta_out3d_gb(:,:,i) ! ,zta_out3d_gb(:,:,i)
10469+ write (250 + i,' (e24.16,300000(1x,e15.6e3 ))' )time,sta_out3d_gb(:,:,i) ! ,zta_out3d_gb(:,:,i)
1046410470 ! Add zcor output: do it only once
1046510471 if (.not. ltmp) then
1046610472 ltmp= .true.
10467- write (250 + nvar_sta+1 ,* ) ! empty line to be in consistent form as other 3D
10468- write (250 + nvar_sta+1 ,' (e24.16,300000(1x,e14.6 ))' )time,zta_out3d_gb(:,:,i )
10473+ write (250 + nvar_sta+1 ,' (300000(1x,i5)) ' )idry_sta(:)
10474+ write (250 + nvar_sta+1 ,' (e24.16,300000(1x,e15.6e3 ))' )time,zta_out3d_gb(:,:)
1046910475 endif !
1047010476 endif ! iout_sta
1047110477 enddo ! i=1,nvar_sta
1047210478
1047310479 write (16 ,* )' done station outputs...'
10474- endif ! myrank
10480+ endif ! myrank==0
1047510481 endif ! iout_sta/=0
1047610482
1047710483#ifdef USE_HA
0 commit comments