Skip to content

Commit

Permalink
Merge pull request #19 from dustinswales/opt_args
Browse files Browse the repository at this point in the history
Add optional attribute to Fortran files.
  • Loading branch information
climbfuji authored Apr 24, 2024
2 parents eb64212 + 0df24f8 commit c0d52ca
Show file tree
Hide file tree
Showing 82 changed files with 640 additions and 555 deletions.
29 changes: 17 additions & 12 deletions physics/CONV/C3/cu_c3_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,19 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
real (kind=kind_phys), intent(in) :: g,cp,fv,r_d,xlv,r_v,betascu,betamcu,betadcu
logical, intent(in ) :: ldiag3d
logical, intent(in ) :: progsigma
real(kind=kind_phys), intent(inout) :: dtend(:,:,:)
real(kind=kind_phys), intent(inout), optional :: dtend(:,:,:)
!$acc declare copy(dtend)
integer, intent(in) :: dtidx(:,:), &
index_of_x_wind, index_of_y_wind, index_of_temperature, &
index_of_process_scnv, index_of_process_dcnv, ntqv, ntcw, ntiw
!$acc declare copyin(dtidx)
real(kind=kind_phys), dimension( : , : ), intent(in ) :: forcet,forceqv_spechum,w,phil,delp
real(kind=kind_phys), dimension ( : , : ), intent(in ) :: sigmain,qmicro
real(kind=kind_phys), dimension( : , : ), intent(in ), optional :: forcet,forceqv_spechum
real(kind=kind_phys), dimension( : , : ), intent(in ) :: w,phil,delp
real(kind=kind_phys), dimension ( : , : ), intent(in ), optional :: sigmain,qmicro
real(kind=kind_phys), dimension( : , : ), intent(inout ) :: t,us,vs
real(kind=kind_phys), dimension( : , : ), intent(inout ) :: qci_conv
real(kind=kind_phys), dimension( : , : ), intent(inout ), optional :: qci_conv
real(kind=kind_phys), dimension( : , : ), intent(out ) :: cnvw_moist,cnvc
real(kind=kind_phys), dimension ( : , : ), intent(out ) :: sigmaout
real(kind=kind_phys), dimension ( : , : ), intent(out ), optional :: sigmaout
real(kind=kind_phys), dimension( : , : ), intent(inout ) :: cliw, clcw
real(kind=kind_phys), dimension ( : , : , :), intent(in ) :: tmf
!$acc declare copyin(forcet,forceqv_spechum,w,phil)
Expand All @@ -134,27 +135,31 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
integer, intent(in) :: dfi_radar_max_intervals
real(kind=kind_phys), intent(in) :: fhour, fh_dfi_radar(:)
integer, intent(in) :: num_dfi_radar, ix_dfi_radar(:)
real(kind=kind_phys), intent(in) :: cap_suppress(:,:)
real(kind=kind_phys), intent(in), optional :: cap_suppress(:,:)
!$acc declare copyin(fh_dfi_radar,ix_dfi_radar,cap_suppress)

integer, dimension (:), intent(out) :: hbot,htop,kcnv
integer, dimension (:), intent(in) :: xland
real(kind=kind_phys), dimension (:), intent(in) :: pbl,maxMF
real(kind=kind_phys), dimension (:), intent(in) :: pbl
real(kind=kind_phys), dimension (:), intent(in), optional :: maxMF
!$acc declare copyout(hbot,htop,kcnv)
!$acc declare copyin(xland,pbl)
integer, dimension (im) :: tropics
!$acc declare create(tropics)
! ruc variable
real(kind=kind_phys), dimension (:), intent(in) :: hfx2,qfx2,psuri,ca_deep
real(kind=kind_phys), dimension (:,:), intent(out) :: ud_mf,dd_mf,dt_mf
real(kind=kind_phys), dimension (:), intent(out) :: raincv,cld1d,maxupmf,rainevap
real(kind=kind_phys), dimension (:), intent(in) :: hfx2,qfx2,psuri
real(kind=kind_phys), dimension (:), intent(in), optional :: ca_deep
real(kind=kind_phys), dimension (:,:), intent(out), optional :: ud_mf
real(kind=kind_phys), dimension (:,:), intent(out) :: dd_mf,dt_mf
real(kind=kind_phys), dimension (:), intent(out) :: raincv,cld1d,rainevap
real(kind=kind_phys), dimension (:), intent(out), optional :: maxupmf
real(kind=kind_phys), dimension (:,:), intent(in) :: t2di,p2di
!$acc declare copyin(hfx2,qfx2,psuri,t2di,p2di)
!$acc declare copyout(ud_mf,dd_mf,dt_mf,raincv,cld1d)
! Specific humidity from FV3
real(kind=kind_phys), dimension (:,:), intent(in) :: qv2di_spechum
real(kind=kind_phys), dimension (:,:), intent(inout) :: qv_spechum
real(kind=kind_phys), dimension (:), intent(inout) :: aod_gf
real(kind=kind_phys), dimension (:), intent(inout), optional :: aod_gf
!$acc declare copyin(qv2di_spechum) copy(qv_spechum,aod_gf)
! Local water vapor mixing ratios and cloud water mixing ratios
real(kind=kind_phys), dimension (im,km) :: qv2di, qv, forceqv, cnvw
Expand All @@ -165,7 +170,7 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
real(kind=kind_phys), intent(in ) :: dt

integer, intent(in ) :: imfshalcnv
integer, dimension(:), intent(inout) :: cactiv,cactiv_m
integer, dimension(:), intent(inout), optional :: cactiv,cactiv_m
!$acc declare copy(cactiv,cactiv_m)

character(len=*), intent(out) :: errmsg
Expand Down
15 changes: 8 additions & 7 deletions physics/CONV/C3/cu_c3_driver_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ subroutine cu_c3_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
real(kind_phys), intent(in) :: t(:,:)
real(kind_phys), intent(in) :: q(:,:)
real(kind_phys), dimension(:),intent(in) :: garea
real(kind_phys), intent(out) :: prevst(:,:)
real(kind_phys), intent(out) :: prevsq(:,:)
integer, intent(in) :: cactiv(:)
integer, intent(in) :: cactiv_m(:)
real(kind_phys), intent(out) :: conv_act(:)
real(kind_phys), intent(out) :: conv_act_m(:)
real(kind_phys), intent(out), optional :: prevst(:,:)
real(kind_phys), intent(out), optional :: prevsq(:,:)
integer, intent(in), optional :: cactiv(:)
integer, intent(in), optional :: cactiv_m(:)
real(kind_phys), intent(out), optional :: conv_act(:)
real(kind_phys), intent(out), optional :: conv_act_m(:)
! for Radar reflectivity
real(kind_phys), intent(in) :: dt
real(kind_phys), intent(in) :: raincv(:), maxupmf(:)
real(kind_phys), intent(in) :: raincv(:)
real(kind_phys), intent(in), optional :: maxupmf(:)
real(kind_phys), intent(inout) :: refl_10cm(:,:)
character(len=*), intent(out) :: errmsg
!$acc declare copyin(t,q,cactiv,cactiv_m) copyout(prevst,prevsq,conv_act,conv_act_m)
Expand Down
16 changes: 8 additions & 8 deletions physics/CONV/C3/cu_c3_driver_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ subroutine cu_c3_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q,
real(kind_phys), intent(in) :: dtp
real(kind_phys), intent(in) :: t(:,:)
real(kind_phys), intent(in) :: q(:,:)
real(kind_phys), intent(in) :: prevst(:,:)
real(kind_phys), intent(in) :: prevsq(:,:)
real(kind_phys), intent(in), optional :: prevst(:,:)
real(kind_phys), intent(in), optional :: prevsq(:,:)
!$acc declare copyin(t,q,prevst,prevsq)
real(kind_phys), intent(out) :: forcet(:,:)
real(kind_phys), intent(out) :: forceq(:,:)
integer, intent(out) :: cactiv(:)
integer, intent(out) :: cactiv_m(:)
real(kind_phys), intent(out), optional :: forcet(:,:)
real(kind_phys), intent(out), optional :: forceq(:,:)
integer, intent(out), optional :: cactiv(:)
integer, intent(out), optional :: cactiv_m(:)
!$acc declare copyout(forcet,forceq,cactiv,cactiv_m)
real(kind_phys), intent(in) :: conv_act(:)
real(kind_phys), intent(in) :: conv_act_m(:)
real(kind_phys), intent(in), optional :: conv_act(:)
real(kind_phys), intent(in), optional :: conv_act_m(:)
!$acc declare copyin(conv_act,conv_act_m)
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand Down
7 changes: 4 additions & 3 deletions physics/CONV/Chikira_Sugiyama/cs_conv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,19 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, &
!
! modified arguments
!
real(kind_phys), intent(inout) :: CBMFX(:,:) ! cloud base mass flux (kg/m2/s)
real(kind_phys), intent(inout), optional :: CBMFX(:,:) ! cloud base mass flux (kg/m2/s)
!
! output arguments
!
! updraft, downdraft, and detrainment mass flux (kg/m2/s)
real(kind_phys), intent(inout), dimension(:,:) :: ud_mf, dd_mf, dt_mf
real(kind_phys), intent(inout), dimension(:,:), optional :: ud_mf
real(kind_phys), intent(inout), dimension(:,:) :: dd_mf, dt_mf

real(kind_phys), intent(out) :: rain1(:) ! lwe thickness of deep convective precipitation amount (m)
! GJF* These variables are conditionally allocated depending on whether the
! Morrison-Gettelman microphysics is used, so they must be declared
! using assumed shape.
real(kind_phys), intent(out), dimension(:,:) :: qlcn, qicn, w_upi,cnv_mfd, &
real(kind_phys), intent(out), dimension(:,:), optional :: qlcn, qicn, w_upi,cnv_mfd, &
cnv_dqldt, clcn, cnv_fice, &
cnv_ndrop, cnv_nice, cf_upi
! *GJF
Expand Down
4 changes: 2 additions & 2 deletions physics/CONV/Chikira_Sugiyama/cs_conv_aw_adj.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ subroutine cs_conv_aw_adj_run(im, levs, do_cscnv, do_aw, do_shoc, &
real(kind_phys), dimension(:,:), intent(in) :: save_t
real(kind_phys), dimension(:,:,:), intent(in) :: save_q
real(kind_phys), dimension(:,:), intent(in) :: prsi
real(kind_phys), dimension(:,:), intent(inout) :: cldfrac
real(kind_phys), dimension(:,:), intent(inout) :: subcldfrac
real(kind_phys), dimension(:,:), intent(inout), optional :: cldfrac
real(kind_phys), dimension(:,:), intent(inout), optional :: subcldfrac
real(kind_phys), dimension(:), intent(inout) :: prcp
integer, intent(in ) :: imp_physics, imp_physics_mg
character(len=*), intent( out) :: errmsg
Expand Down
28 changes: 16 additions & 12 deletions physics/CONV/Grell_Freitas/cu_gf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
integer :: ichoicem=13 ! 0 2 5 13
integer :: ichoice_s=3 ! 0 1 2 3
integer, intent(in) :: spp_cu_deep ! flag for using SPP perturbations
real(kind_phys), dimension(:,:), intent(in) :: &
real(kind_phys), dimension(:,:), intent(in),optional :: &
& spp_wts_cu_deep
real(kind=kind_phys) :: spp_wts_cu_deep_tmp

Expand All @@ -102,15 +102,16 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
real (kind=kind_phys), intent(in) :: g,cp,xlv,r_v
logical, intent(in ) :: ldiag3d

real(kind=kind_phys), intent(inout) :: dtend(:,:,:)
real(kind=kind_phys), intent(inout), optional :: dtend(:,:,:)
!$acc declare copy(dtend)
integer, intent(in) :: dtidx(:,:), &
index_of_x_wind, index_of_y_wind, index_of_temperature, &
index_of_process_scnv, index_of_process_dcnv, ntqv, ntcw, ntiw
!$acc declare copyin(dtidx)
real(kind=kind_phys), dimension( : , : ), intent(in ) :: forcet,forceqv_spechum,w,phil
real(kind=kind_phys), dimension( : , : ), intent(in ), optional :: forcet,forceqv_spechum
real(kind=kind_phys), dimension( : , : ), intent(in ) :: w,phil
real(kind=kind_phys), dimension( : , : ), intent(inout ) :: t,us,vs
real(kind=kind_phys), dimension( : , : ), intent(inout ) :: qci_conv
real(kind=kind_phys), dimension( : , : ), intent(inout ), optional :: qci_conv
real(kind=kind_phys), dimension( : , : ), intent(out ) :: cnvw_moist,cnvc
real(kind=kind_phys), dimension( : , : ), intent(inout ) :: cliw, clcw
!$acc declare copyin(forcet,forceqv_spechum,w,phil)
Expand All @@ -122,27 +123,30 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
integer, intent(in) :: dfi_radar_max_intervals
real(kind=kind_phys), intent(in) :: fhour, fh_dfi_radar(:)
integer, intent(in) :: num_dfi_radar, ix_dfi_radar(:)
real(kind=kind_phys), intent(in) :: cap_suppress(:,:)
real(kind=kind_phys), intent(in), optional :: cap_suppress(:,:)
!$acc declare copyin(fh_dfi_radar,ix_dfi_radar,cap_suppress)

integer, dimension (:), intent(out) :: hbot,htop,kcnv
integer, dimension (:), intent(in) :: xland
real(kind=kind_phys), dimension (:), intent(in) :: pbl,maxMF
real(kind=kind_phys), dimension (:), intent(in) :: pbl
real(kind=kind_phys), dimension (:), intent(in), optional :: maxMF
!$acc declare copyout(hbot,htop,kcnv)
!$acc declare copyin(xland,pbl)
integer, dimension (im) :: tropics
!$acc declare create(tropics)
! ruc variable
real(kind=kind_phys), dimension (:), intent(in) :: hfx2,qfx2,psuri
real(kind=kind_phys), dimension (:,:), intent(out) :: ud_mf,dd_mf,dt_mf
real(kind=kind_phys), dimension (:), intent(out) :: raincv,cld1d,maxupmf
real(kind=kind_phys), dimension (:,:), intent(out) :: dd_mf,dt_mf
real(kind=kind_phys), dimension (:,:), intent(out), optional :: ud_mf
real(kind=kind_phys), dimension (:), intent(out) :: raincv,cld1d
real(kind=kind_phys), dimension (:), intent(out), optional :: maxupmf
real(kind=kind_phys), dimension (:,:), intent(in) :: t2di,p2di
!$acc declare copyin(hfx2,qfx2,psuri,t2di,p2di)
!$acc declare copyout(ud_mf,dd_mf,dt_mf,raincv,cld1d)
! Specific humidity from FV3
real(kind=kind_phys), dimension (:,:), intent(in) :: qv2di_spechum
real(kind=kind_phys), dimension (:,:), intent(inout) :: qv_spechum
real(kind=kind_phys), dimension (:), intent(inout) :: aod_gf
real(kind=kind_phys), dimension (:), intent(inout), optional :: aod_gf
!$acc declare copyin(qv2di_spechum) copy(qv_spechum,aod_gf)
! Local water vapor mixing ratios and cloud water mixing ratios
real(kind=kind_phys), dimension (im,km) :: qv2di, qv, forceqv, cnvw
Expand All @@ -153,11 +157,11 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
real(kind=kind_phys), intent(in ) :: dt

integer, intent(in ) :: imfshalcnv
integer, dimension(:), intent(inout) :: cactiv,cactiv_m
integer, dimension(:), intent(inout), optional :: cactiv,cactiv_m
real(kind_phys), dimension(:), intent(in) :: fscav
!$acc declare copyin(fscav)
real(kind_phys), dimension(:,:,:), intent(inout) :: chem3d
real(kind_phys), dimension(:,:), intent(inout) :: wetdpc_deep
real(kind_phys), dimension(:,:,:), intent(inout), optional :: chem3d
real(kind_phys), dimension(:,:), intent(inout), optional :: wetdpc_deep
!$acc declare copy(cactiv,cactiv_m,chem3d,wetdpc_deep)

character(len=*), intent(out) :: errmsg
Expand Down
15 changes: 8 additions & 7 deletions physics/CONV/Grell_Freitas/cu_gf_driver_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
integer, intent(in) :: im, km
real(kind_phys), intent(in) :: t(:,:)
real(kind_phys), intent(in) :: q(:,:)
real(kind_phys), intent(out) :: prevst(:,:)
real(kind_phys), intent(out) :: prevsq(:,:)
integer, intent(in) :: cactiv(:)
integer, intent(in) :: cactiv_m(:)
real(kind_phys), intent(out) :: conv_act(:)
real(kind_phys), intent(out) :: conv_act_m(:)
real(kind_phys), intent(out), optional :: prevst(:,:)
real(kind_phys), intent(out), optional :: prevsq(:,:)
integer, intent(in), optional :: cactiv(:)
integer, intent(in), optional :: cactiv_m(:)
real(kind_phys), intent(out), optional :: conv_act(:)
real(kind_phys), intent(out), optional :: conv_act_m(:)
logical, intent(in) :: rrfs_sd
integer, intent(in) :: ntsmoke, ntdust, ntcoarsepm
real(kind_phys), intent(inout) :: chem3d(:,:,:), gq0(:,:,:)
real(kind_phys), intent(inout), optional :: chem3d(:,:,:)
real(kind_phys), intent(inout) :: gq0(:,:,:)
character(len=*), intent(out) :: errmsg
!$acc declare copyin(t,q,cactiv,cactiv_m) copyout(prevst,prevsq,conv_act,conv_act_m,chem3d,gq0)
integer, intent(out) :: errflg
Expand Down
19 changes: 10 additions & 9 deletions physics/CONV/Grell_Freitas/cu_gf_driver_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ subroutine cu_gf_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q,
real(kind_phys), intent(in) :: dtp
real(kind_phys), intent(in) :: t(:,:)
real(kind_phys), intent(in) :: q(:,:)
real(kind_phys), intent(in) :: prevst(:,:)
real(kind_phys), intent(in) :: prevsq(:,:)
real(kind_phys), intent(in), optional :: prevst(:,:)
real(kind_phys), intent(in), optional :: prevsq(:,:)
!$acc declare copyin(t,q,prevst,prevsq)
real(kind_phys), intent(out) :: forcet(:,:)
real(kind_phys), intent(out) :: forceq(:,:)
integer, intent(out) :: cactiv(:)
integer, intent(out) :: cactiv_m(:)
real(kind_phys), intent(out), optional :: forcet(:,:)
real(kind_phys), intent(out), optional :: forceq(:,:)
integer, intent(out), optional :: cactiv(:)
integer, intent(out), optional :: cactiv_m(:)
integer, intent(in) :: ntsmoke, ntdust, ntcoarsepm
!$acc declare copyout(forcet,forceq,cactiv,cactiv_m)
real(kind_phys), intent(in) :: conv_act(:)
real(kind_phys), intent(in) :: conv_act_m(:)
real(kind_phys), intent(inout) :: chem3d(:,:,:), gq0(:,:,:)
real(kind_phys), intent(in), optional :: conv_act(:)
real(kind_phys), intent(in), optional :: conv_act_m(:)
real(kind_phys), intent(inout), optional :: chem3d(:,:,:)
real(kind_phys), intent(inout) :: gq0(:,:,:)
!$acc declare copyin(conv_act,conv_act_m) copy(chem3d,gq0)
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand Down
8 changes: 5 additions & 3 deletions physics/CONV/RAS/rascnv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,16 @@ subroutine rascnv_run(IM, k, itc, ntc, ntr, dt, dtf &
real(kind=kind_phys), dimension(:,:), intent(inout) :: tin, qin, uin, vin
real(kind=kind_phys), dimension(:,:), intent(in) :: prsl, prslk, phil &
&, rhc
real(kind=kind_phys), dimension(:,:), intent(out) :: ud_mf, dd_mf, dt_mf
real(kind=kind_phys), dimension(:,:), intent(inout) :: qlcn, qicn, w_upi &
real(kind=kind_phys), dimension(:,:), intent(out), optional :: ud_mf
real(kind=kind_phys), dimension(:,:), intent(out) :: dd_mf, dt_mf
real(kind=kind_phys), dimension(:,:), intent(inout), optional :: qlcn, qicn, w_upi &
&, cnv_mfd &
&, cnv_dqldt, clcn &
&, cnv_fice, cnv_ndrop &
&, cnv_nice, cf_upi
real(kind=kind_phys), dimension(:) , intent(in) :: area, cdrag
real(kind=kind_phys), dimension(:) , intent(out) :: rainc, ddvel
real(kind=kind_phys), dimension(:) , intent(out) :: rainc
real(kind=kind_phys), dimension(:) , intent(out), optional :: ddvel
real(kind=kind_phys), dimension(:,:), intent(in) :: rannum
real(kind=kind_phys), intent(inout) :: ccin(:,:,:)
real(kind=kind_phys), intent(in) :: dt, dtf
Expand Down
Loading

0 comments on commit c0d52ca

Please sign in to comment.