Skip to content

Commit

Permalink
Added airt, shum; thx, Saeed M.!
Browse files Browse the repository at this point in the history
  • Loading branch information
josephzhang8 committed Jan 22, 2025
1 parent 0a71d90 commit 756b420
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 21 deletions.
40 changes: 29 additions & 11 deletions src/Hydro/misc_subs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ subroutine other_hot_init(time)
allocate(swild(nsa+nvrt+12+ntracers),stat=istat)
if(istat/=0) call parallel_abort('MISC: swild')
if(nws==4) then
allocate(rwild(7,np_global),stat=istat)
allocate(rwild(9,np_global),stat=istat)
if(istat/=0) call parallel_abort('MISC: failed to alloc. (71)')
endif !nws=4

Expand Down Expand Up @@ -314,42 +314,52 @@ subroutine other_hot_init(time)
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc prmsl')
j=nf90_get_var(ncid_atmos,mm,rwild(3,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc prmsl(2)')
j=nf90_inq_varid(ncid_atmos, "stmp",mm)
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc stmp')
j=nf90_get_var(ncid_atmos,mm,rwild(4,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc stmp(2)')
j=nf90_inq_varid(ncid_atmos, "spfh",mm)
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc spfh')
j=nf90_get_var(ncid_atmos,mm,rwild(5,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc spfh(2)')
if(ihconsv/=0) then
j=nf90_inq_varid(ncid_atmos, "downwardLongWaveFlux",mm)
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc long flux')
j=nf90_get_var(ncid_atmos,mm,rwild(4,:),(/1,ninv+1/),(/np_global,1/))
j=nf90_get_var(ncid_atmos,mm,rwild(6,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc long flux(2)')
j=nf90_inq_varid(ncid_atmos, "solar",mm)
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc solar')
j=nf90_get_var(ncid_atmos,mm,rwild(5,:),(/1,ninv+1/),(/np_global,1/))
j=nf90_get_var(ncid_atmos,mm,rwild(7,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc solar(2)')
endif !'ihconsv/
if(isconsv/=0) then
j=nf90_inq_varid(ncid_atmos, "prate",mm)
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc prate')
j=nf90_get_var(ncid_atmos,mm,rwild(6,:),(/1,ninv+1/),(/np_global,1/))
j=nf90_get_var(ncid_atmos,mm,rwild(8,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc prate(2)')
j=nf90_inq_varid(ncid_atmos, "snow_rate",mm)
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc srate')
j=nf90_get_var(ncid_atmos,mm,rwild(7,:),(/1,ninv+1/),(/np_global,1/))
j=nf90_get_var(ncid_atmos,mm,rwild(9,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc srate(2)')
endif !isconsv/
endif !myrank
call mpi_bcast(rwild,7*np_global,MPI_REAL4,0,comm,istat)
call mpi_bcast(rwild,9*np_global,MPI_REAL4,0,comm,istat)

do i=1,np_global
if(ipgl(i)%rank==myrank) then
nd=ipgl(i)%id
windx1(nd)=rwild(1,i)
windy1(nd)=rwild(2,i)
pr1(nd)=rwild(3,i)
airt1(nd)=rwild(4,i)
shum1(nd)=rwild(5,i)
if(ihconsv/=0) then
hradd(nd)=rwild(4,i)
srad(nd)=rwild(5,i)
hradd(nd)=rwild(6,i)
srad(nd)=rwild(7,i)
endif !ihconsv/
if(isconsv/=0) then
fluxprc(nd)=rwild(6,i)
prec_snow(nd)=rwild(7,i)
fluxprc(nd)=rwild(8,i)
prec_snow(nd)=rwild(9,i)
endif !isconsv/
endif
enddo !i
Expand All @@ -365,15 +375,23 @@ subroutine other_hot_init(time)
j=nf90_inq_varid(ncid_atmos, "prmsl",mm)
j=nf90_get_var(ncid_atmos,mm,rwild(3,:),(/1,ninv+2/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc prmsl(3)')
j=nf90_inq_varid(ncid_atmos, "stmp",mm)
j=nf90_get_var(ncid_atmos,mm,rwild(4,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc stmp(3)')
j=nf90_inq_varid(ncid_atmos, "spfh",mm)
j=nf90_get_var(ncid_atmos,mm,rwild(5,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('MISC: atmos.nc spfh(3)')
endif !'myrank
call mpi_bcast(rwild,7*np_global,MPI_REAL4,0,comm,istat)
call mpi_bcast(rwild,9*np_global,MPI_REAL4,0,comm,istat)

do i=1,np_global
if(ipgl(i)%rank==myrank) then
nd=ipgl(i)%id
windx2(nd)=rwild(1,i)
windy2(nd)=rwild(2,i)
pr2(nd)=rwild(3,i)
airt2(nd)=rwild(4,i)
shum2(nd)=rwild(5,i)
endif
enddo !i
#endif /*USE_ATMOS*/
Expand Down
31 changes: 21 additions & 10 deletions src/Hydro/schism_step.F90
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ subroutine schism_step(it)
endif

if(nws==4) then
allocate(rwild6(7,np_global),stat=istat)
allocate(rwild6(9,np_global),stat=istat)
if(istat/=0) call parallel_abort('MAIN: failed to alloc. (71)')
endif !nws=4

Expand Down Expand Up @@ -599,43 +599,54 @@ subroutine schism_step(it)
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc prmsl')
j=nf90_get_var(ncid_atmos,mm,rwild6(3,:),(/1,itmp2/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc prmsl(2)')
j=nf90_inq_varid(ncid_atmos, "stmp",mm)
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc stmp')
j=nf90_get_var(ncid_atmos,mm,rwild(4,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc stmp(2)')
j=nf90_inq_varid(ncid_atmos, "spfh",mm)
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc spfh')
j=nf90_get_var(ncid_atmos,mm,rwild(5,:),(/1,ninv+1/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc spfh(2)')

if(ihconsv/=0) then
j=nf90_inq_varid(ncid_atmos, "downwardLongWaveFlux",mm)
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc long flux')
j=nf90_get_var(ncid_atmos,mm,rwild6(4,:),(/1,itmp2/),(/np_global,1/))
j=nf90_get_var(ncid_atmos,mm,rwild6(6,:),(/1,itmp2/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc longflux(2)')
j=nf90_inq_varid(ncid_atmos, "solar",mm)
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc solar')
j=nf90_get_var(ncid_atmos,mm,rwild6(5,:),(/1,itmp2/),(/np_global,1/))
j=nf90_get_var(ncid_atmos,mm,rwild6(7,:),(/1,itmp2/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc solar(2)')
endif !ihconsv/
if(isconsv/=0) then
j=nf90_inq_varid(ncid_atmos, "prate",mm)
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc prate')
j=nf90_get_var(ncid_atmos,mm,rwild6(6,:),(/1,itmp2/),(/np_global,1/))
j=nf90_get_var(ncid_atmos,mm,rwild6(8,:),(/1,itmp2/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc prate(2)')
j=nf90_inq_varid(ncid_atmos, "snow_rate",mm)
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc srate')
j=nf90_get_var(ncid_atmos,mm,rwild6(7,:),(/1,itmp2/),(/np_global,1/))
j=nf90_get_var(ncid_atmos,mm,rwild6(9,:),(/1,itmp2/),(/np_global,1/))
if(j/=NF90_NOERR) call parallel_abort('STEP: atmos.nc srate(2)')
endif !isconsv/
endif !myrank=0
call mpi_bcast(rwild6,7*np_global,MPI_REAL4,0,comm,istat)
call mpi_bcast(rwild6,9*np_global,MPI_REAL4,0,comm,istat)

do i=1,np_global
if(ipgl(i)%rank==myrank) then
nd=ipgl(i)%id
windx2(nd)=rwild6(1,i)
windy2(nd)=rwild6(2,i)
pr2(nd)=rwild6(3,i)
airt2(nd)=rwild6(4,i)
shum2(nd)=rwild6(5,i)

if(ihconsv/=0) then
hradd(nd)=rwild6(4,i)
srad(nd)=rwild6(5,i)
hradd(nd)=rwild6(6,i)
srad(nd)=rwild6(7,i)
endif !ihconsv/
if(isconsv/=0) then
fluxprc(nd)=rwild6(6,i)
prec_snow(nd)=rwild6(7,i)
fluxprc(nd)=rwild6(8,i)
prec_snow(nd)=rwild6(9,i)
endif !isconsv/
endif !ipgl
enddo !i
Expand Down

0 comments on commit 756b420

Please sign in to comment.