Skip to content

Commit

Permalink
Combined integer declarations and some code formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbn committed Sep 24, 2024
1 parent bfc225e commit b083df8
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 118 deletions.
173 changes: 84 additions & 89 deletions ben02/mod_ben02.F90
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,10 @@ subroutine initai
real, dimension(0:atm_nwgt) :: r_wgt
real :: piloc,min_d,d,r,l2
integer :: atm_idm_t,atm_jdm_t,idm_t,jdm_t,atm_nwgt_t,nw_2,is,js,it, &
jt,iso,jso,m,n,i,j,iii,ism1,isp1,jsm1,jsp1,itm1,itp1,jtm1, &
jtp1
jt,iso,jso,m,n,i,j,iii,ism1,isp1,jsm1,jsp1,itm1,itp1,jtm1, &
jtp1,nfu
logical :: dimok,exists
character :: filename*120
integer :: nfu

! --- Get global coordinates of p-points.
call xcaget(tmp2da,plat,1)
Expand All @@ -689,12 +688,12 @@ subroutine initai

! --- - Allocate memory for the atmospheric interpolation.
allocate(atm_lon(atm_idm,atm_jdm), &
atm_lat(atm_idm,atm_jdm), &
atm_mask(atm_idm,atm_jdm), &
atm_topo(atm_idm,atm_jdm), &
atm_wgt(atm_nwgt,itdm,jtdm), &
atm_iwgt(atm_nwgt,itdm,jtdm), &
atm_jwgt(atm_nwgt,itdm,jtdm))
atm_lat(atm_idm,atm_jdm), &
atm_mask(atm_idm,atm_jdm), &
atm_topo(atm_idm,atm_jdm), &
atm_wgt(atm_nwgt,itdm,jtdm), &
atm_iwgt(atm_nwgt,itdm,jtdm), &
atm_jwgt(atm_nwgt,itdm,jtdm))

! --- - Read atmospheric lon/lat coordinates and land mask.
filename = atm_path(1:atm_path_len)//'land.sfc.gauss.nc'
Expand Down Expand Up @@ -881,12 +880,12 @@ subroutine fnlzai

if (mnproc == 1) then
deallocate(atm_lon, &
atm_lat, &
atm_mask, &
atm_topo, &
atm_wgt, &
atm_iwgt, &
atm_jwgt)
atm_lat, &
atm_mask, &
atm_topo, &
atm_wgt, &
atm_iwgt, &
atm_jwgt)
end if

end subroutine fnlzai
Expand Down Expand Up @@ -1936,8 +1935,7 @@ subroutine rdcsic
real, dimension(atm_idm,atm_jdm) :: atm_field
real*4, dimension(atm_idm,atm_jdm) :: atm_field_r4
real, dimension(itdm,jtdm) :: tmp2d
integer :: i,j,k
integer :: nfu
integer :: i,j,k,nfu

if (mnproc == 1) then
write (lp,*) 'reading atm. climatological ice concentration...'
Expand Down Expand Up @@ -1991,8 +1989,7 @@ subroutine rdctsf
real, dimension(itdm,jtdm) :: tmp2d
real :: dx2,dy2
integer, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) :: smtmsk
integer :: i,j,k,l
integer :: nfu
integer :: i,j,k,l,nfu

if (mnproc == 1) then
write (lp,*) &
Expand Down Expand Up @@ -2105,53 +2102,52 @@ subroutine inifrc_ben02clim
sht_sum,fwf_fac,dangle,garea,le,albedo,fac,swa_ave,lwa_ave, &
lht_ave,sht_ave,crnf,cswa,A_cgs2mks
real*4 :: rw4
integer :: i,j,k,l,il,jl
integer :: i,j,k,l,il,jl,nfu
integer*2 :: rn2,ri2,rj2
integer :: nfu

A_cgs2mks = 1./(L_mks2cgs**2)

! --- Allocate memory for additional monthly forcing fields.
allocate(taud (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
tauxd (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
tauyd (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
dswrfl(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
nlwrfs(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
shtflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
lhtflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
precip(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
clouds(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
slpres(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
runoff(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12))
tauxd (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
tauyd (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
dswrfl(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
nlwrfs(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
shtflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
lhtflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
precip(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
clouds(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
slpres(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12), &
runoff(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,12))

! --- Allocate memory for transfer coefficients, gustiness squared, and
! --- air density
allocate(cd_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ch_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ce_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
wg2_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
cd_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ch_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ce_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
wg2_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rhoa(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))
ch_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ce_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
wg2_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
cd_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ch_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ce_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
wg2_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rhoa(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))

! --- Allocate memory for accumulation variables
allocate(tsi_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
tml_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
sml_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
alb_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
fice_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
tsi(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))
tml_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
sml_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
alb_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
fice_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
tsi(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))

! --- Allocate memory for derivative of non-solar heat flux by surface
! --- temperature, albedos and instantaneous runoff flux and runoff
! --- reservoar
allocate(dfl(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
albw(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
alb(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rnfins(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rnfres(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))
albw(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
alb(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rnfins(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rnfres(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))

! --- number of iteration in the computation of transfer coefficients.
tciter = 5
Expand All @@ -2171,8 +2167,8 @@ subroutine inifrc_ben02clim
! --- Allocate memory for temporary fields
if (mnproc == 1) then
allocate(atm_sktclm(atm_idm,atm_jdm,12), &
atm_field(atm_idm,atm_jdm), &
atm_field_r4(atm_idm,atm_jdm))
atm_field(atm_idm,atm_jdm), &
atm_field_r4(atm_idm,atm_jdm))
end if

! --- Compute smoothing weights atm_ice_swgt and atm_rnf_swgt. For
Expand Down Expand Up @@ -2658,8 +2654,8 @@ subroutine inifrc_ben02clim
! --- - areas

allocate(rnf_wgt (atm_abdm,atm_idm,atm_jdm), &
rnf_ocdpi(atm_abdm,atm_idm,atm_jdm), &
rnf_ocdpj(atm_abdm,atm_idm,atm_jdm))
rnf_ocdpi(atm_abdm,atm_idm,atm_jdm), &
rnf_ocdpj(atm_abdm,atm_idm,atm_jdm))

if (expcnf == 'single_column') then
rnf_wgt = 0.
Expand Down Expand Up @@ -2752,17 +2748,17 @@ subroutine inifrc_ben02clim
if (mnproc == 1) then
close (unit = nfu)
deallocate(rnf_wgt, &
rnf_ocdpi, &
rnf_ocdpj)
rnf_ocdpi, &
rnf_ocdpj)
end if

call xctilr(runoff, 1,12, nbdy,nbdy, halo_ps)

! --- Deallocate memory used for interpolation of surface fields.
if (mnproc == 1) then
deallocate(atm_sktclm, &
atm_field, &
atm_field_r4)
atm_field, &
atm_field_r4)
end if
call fnlzai

Expand Down Expand Up @@ -2935,53 +2931,52 @@ subroutine inifrc_ben02syn

real :: dx2,dy2
real*4 :: rw4
integer :: errstat,i,j,k,l
integer :: errstat,i,j,k,l,nfu
integer*2 :: rn2,ri2,rj2
integer :: nfu

! --- Allocate memory for daily forcing fields.
allocate(taud (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
tauxd (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
tauyd (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
dswrfl(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
nlwrfs(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
shtflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
lhtflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
precip(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
clouds(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
slpres(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
runoff(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
tmpsfc(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
ricec (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5))
tauxd (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
tauyd (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
dswrfl(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
nlwrfs(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
shtflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
lhtflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
precip(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
clouds(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
slpres(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
runoff(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
tmpsfc(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5), &
ricec (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,5))

! --- Allocate memory for transfer coefficients, gustiness squared, and
! --- air density
allocate(cd_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ch_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ce_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
wg2_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
cd_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ch_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ce_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
wg2_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rhoa(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))
ch_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ce_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
wg2_d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
cd_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ch_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
ce_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
wg2_m(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rhoa(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))

! --- Allocate memory for accumulation variables
allocate(tsi_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
tml_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
sml_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
alb_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
fice_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
tsi(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))
tml_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
sml_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
alb_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
fice_tda(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
tsi(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))

! --- Allocate memory for derivative of non-solar heat flux by surface
! --- temperature, albedos and instantaneous runoff flux and runoff
! --- reservoar
allocate(dfl(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
albw(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
alb(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rnfins(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rnfres(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))
albw(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
alb(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rnfins(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), &
rnfres(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy))

! --- Number of iteration in the computation of transfer coefficients.
tciter = 1
Expand Down Expand Up @@ -3067,8 +3062,8 @@ subroutine inifrc_ben02syn
! --- - areas

allocate(rnf_wgt (atm_abdm,atm_idm,atm_jdm), &
rnf_ocdpi(atm_abdm,atm_idm,atm_jdm), &
rnf_ocdpj(atm_abdm,atm_idm,atm_jdm))
rnf_ocdpi(atm_abdm,atm_idm,atm_jdm), &
rnf_ocdpj(atm_abdm,atm_idm,atm_jdm))

open (newunit=nfu,file = 'runoffweights.uf', &
form='unformatted',status='old',action = 'read')
Expand Down
9 changes: 3 additions & 6 deletions channel/mod_channel.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ subroutine geoenv_channel
real(r8), dimension(itdm,jtdm) :: rtmp
real(r8) :: sldepth,sfdepth,rdepth,cwidth,swidth,scxy, &
corio0, beta0, d_corru, r
integer :: i,j,l,ios
integer :: nfu,i,j,l,ios
integer, dimension(:), allocatable :: seed
logical :: fexist
integer :: nfu

! Read parameters from the namelist
namelist /idlgeo/ sldepth,sfdepth,rdepth,acorru,wlcorru, &
Expand Down Expand Up @@ -217,9 +216,8 @@ subroutine ictsz_channel
1 - nbdy:jdm + nbdy, kdm) :: dz
real(r8), dimension(kdm) :: sigmr0, dz0
real(r8) :: S0,sig0,sig0dz,sigdz,sigscl,dztop,dzmax,dzscl
integer i,j,k,l,ios
integer :: nfu,i,j,k,l,ios
logical :: fexist
integer :: nfu

namelist /idlini/ S0,sig0,sig0dz,sigdz,sigscl,dztop,dzmax,dzscl

Expand Down Expand Up @@ -334,9 +332,8 @@ subroutine inifrc_channel
intrinsic tanh

real(r8) :: ztx0,mty0,sst0,sss0
integer :: i,j,l,k,ios
integer :: nfu,i,j,l,k,ios
logical :: fexist
integer :: nfu

namelist /idlfor/ ztx0,mty0,sst0,sss0

Expand Down
3 changes: 1 addition & 2 deletions drivers/noforc/blom.F
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ program blom
# include "mpif.h"
#endif
c
integer i
integer nfu
integer :: nfu, i
c
#ifdef MPI
call mpi_init
Expand Down
3 changes: 1 addition & 2 deletions phy/mod_budget.F90
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ subroutine budget_output(m)

integer, intent(in) :: m

integer :: i, j,l
integer :: nfu
integer :: nfu, i, j, l

if (.not.cnsvdi) return

Expand Down
7 changes: 2 additions & 5 deletions phy/mod_dia.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3355,8 +3355,7 @@ subroutine diasec(iogrp)
integer :: iogrp

! Local variables
integer :: n,i,j,k,s,l
integer :: iostatus
integer :: nfu,iostatus,n,i,j,k,s,l
integer, save :: nsi(max_sec)
integer, save :: isi(max_sec,sdm)
integer, save :: jsi(max_sec,sdm)
Expand All @@ -3370,7 +3369,6 @@ subroutine diasec(iogrp)
real, dimension(itdm,jtdm) :: &
uflx_cumt,vflx_cumt,uflx_cum350t,vflx_cum350t
real(8) :: volu,volv
integer :: nfu

!---------------------------------------------------------------
! read section information
Expand Down Expand Up @@ -3505,7 +3503,7 @@ subroutine diamer(iogrp)
integer, intent(in) :: iogrp

! Local variables
integer :: ncid,dimid,varid,i,j,k,l,m,n,o,s,ocn_nreg,iostatus
integer :: ncid,dimid,varid,i,j,k,l,m,n,o,s,ocn_nreg,nfu,iostatus
integer :: istat,iind1,jind1,uflg1,vflg1,nind1
integer :: nfld,ACC_UIND,ACC_VIND,nind(ldm),iind(sdm,ldm),jind(sdm,ldm)
integer :: kmxl(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy)
Expand All @@ -3517,7 +3515,6 @@ subroutine diamer(iogrp)
real :: r
character :: c20*20
logical :: iniflg = .true.
integer :: nfu

save nind,iind,jind,oflg,uflg,vflg,depthst,iniflg,ocn_nreg

Expand Down
3 changes: 1 addition & 2 deletions phy/mod_diffusion.F90
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,8 @@ subroutine readnml_diffusion

! Local variables
character(len = 80) :: nml_fname
integer :: ios
integer :: nfu, ios
logical :: fexist
integer :: nfu

namelist /diffusion/ &
egc, eggam, eglsmn, egmndf, egmxdf, egidfq, rhiscf, ri0, &
Expand Down
Loading

0 comments on commit b083df8

Please sign in to comment.