Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup. Remove used code/variables. Fix minor inconsistencies. #440

Merged
merged 19 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
115a804
Remove unused variables from module_fv3_config.F90
DusanJovic-NOAA Dec 6, 2021
e930a4a
Remove nfhmax, nfhmax_hf from module_fv3_config.F90
DusanJovic-NOAA Dec 6, 2021
475cb2e
Remove trailing whitespace
DusanJovic-NOAA Dec 6, 2021
713a49e
Use various time related variables from atm_int_state%Atm
DusanJovic-NOAA Dec 6, 2021
b7a5d5f
Remove redundant call to fms_init
DusanJovic-NOAA Dec 6, 2021
94a3476
Add few missing ESMF_LogFoundError checks in module_fcst_grid_comp.F90
DusanJovic-NOAA Dec 6, 2021
222d340
Delete time_utils.F90. Unused.
DusanJovic-NOAA Dec 6, 2021
a11d137
More cleanup
DusanJovic-NOAA Dec 7, 2021
ee133bd
Inline wrt_atmres_timestamp
DusanJovic-NOAA Dec 8, 2021
c492b36
Declare Atmos as module variable, and remove atmos_internalstate_wrapper
DusanJovic-NOAA Dec 8, 2021
45f2bc3
Remove even more unused variabes/code
DusanJovic-NOAA Dec 8, 2021
0dcdd2c
Move realizeConnectedCplFields to module_cplfields from module_cap_cpl
DusanJovic-NOAA Dec 8, 2021
db3b04c
Remove unused 'datar42d' from assign_importdata
DusanJovic-NOAA Dec 8, 2021
4d0fa0b
Move code from clock_cplIntval to InitializeAdvertise
DusanJovic-NOAA Dec 9, 2021
e993a56
Merge remote-tracking branch 'origin/develop' into fv3atm_remove_unused
DusanJovic-NOAA Dec 10, 2021
d5409df
Remove INTERNAL_FILE_NML from atmos_model.F90
DusanJovic-NOAA Dec 10, 2021
555615e
Remove unnecessary 'date_init = date' and 'date_end = date'
DusanJovic-NOAA Dec 13, 2021
6bff0a7
Merge remote-tracking branch 'origin/develop' into fv3atm_remove_unused
DusanJovic-NOAA Dec 13, 2021
7845abf
Merge remote-tracking branch 'origin/develop' into fv3atm_remove_unused
DusanJovic-NOAA Dec 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 14 additions & 82 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ module atmos_model_mod
! DYCORE containers
!-------------------
type(DYCORE_data_type), allocatable :: DYCORE_Data(:) ! number of blocks
type(DYCORE_diag_type) :: DYCORE_Diag(25)

!----------------
! GFS containers
Expand Down Expand Up @@ -380,7 +379,7 @@ subroutine update_atmos_radiation_physics (Atmos)
if(GFS_control%print_diff_pgr) then
call atmos_timestep_diagnostics(Atmos)
endif

! Update flag for first time step of time integration
GFS_control%first_time_step = .false.

Expand Down Expand Up @@ -444,7 +443,7 @@ subroutine atmos_timestep_diagnostics(Atmos)
enddo
pcount = pcount+count
enddo

! Sum pgr stats from psum/pcount and convert to hPa/hour global avg:
sendbuf(1:2) = (/ psum, pcount /)
call MPI_Allreduce(sendbuf,recvbuf,2,MPI_DOUBLE_PRECISION,MPI_SUM,GFS_Control%communicator,ierror)
Expand All @@ -454,7 +453,7 @@ subroutine atmos_timestep_diagnostics(Atmos)
sendbuf(1:2) = (/ maxabs, dble(GFS_Control%me) /)
call MPI_Allreduce(sendbuf,recvbuf,1,MPI_2DOUBLE_PRECISION,MPI_MAXLOC,GFS_Control%communicator,ierror)
call MPI_Bcast(pmaxloc,size(pmaxloc),MPI_DOUBLE_PRECISION,nint(recvbuf(2)),GFS_Control%communicator,ierror)

if(GFS_Control%me == GFS_Control%master) then
2933 format('At forecast hour ',F9.3,' mean abs pgr change is ',F16.8,' hPa/hr')
2934 format(' max abs change ',F15.10,' bar at tile=',I0,' i=',I0,' j=',I0)
Expand Down Expand Up @@ -491,23 +490,17 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
type (atmos_data_type), intent(inout) :: Atmos
type (time_type), intent(in) :: Time_init, Time, Time_step
!--- local variables ---
integer :: unit, ntdiag, ntfamily, i, j, k
integer :: mlon, mlat, nlon, nlat, nlev, sec, dt
integer :: unit, i
integer :: mlon, mlat, nlon, nlat, nlev, sec
integer :: ierr, io, logunit
integer :: idx, tile_num
integer :: tile_num
integer :: isc, iec, jsc, jec
integer :: isd, ied, jsd, jed
integer :: blk, ibs, ibe, jbs, jbe
real(kind=GFS_kind_phys) :: dt_phys
real, allocatable :: q(:,:,:,:), p_half(:,:,:)
character(len=80) :: control
character(len=64) :: filename, filename2, pelist_name
character(len=132) :: text
logical :: p_hydro, hydro, fexist
logical :: p_hydro, hydro
logical, save :: block_message = .true.
type(GFS_init_type) :: Init_parm
integer :: bdat(8), cdat(8)
integer :: ntracers, maxhf, maxh
integer :: ntracers
character(len=32), allocatable, target :: tracer_names(:)
integer, allocatable, target :: tracer_types(:)
integer :: nthrds, nb
Expand Down Expand Up @@ -547,7 +540,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
!----------------------------------------------------------------------------------------------
! initialize atmospheric model - must happen AFTER atmosphere_init so that nests work correctly

IF ( file_exists('input.nml')) THEN
if (file_exists('input.nml')) then
read(input_nml_file, nml=atmos_model_nml, iostat=io)
ierr = check_nml_error(io, 'atmos_model_nml')
endif
Expand Down Expand Up @@ -635,19 +628,10 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
Init_parm%restart = Atm(mygrid)%flagstruct%warm_start
Init_parm%hydrostatic = Atm(mygrid)%flagstruct%hydrostatic

#ifdef INTERNAL_FILE_NML
! allocate required to work around GNU compiler bug 100886 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100886
allocate(Init_parm%input_nml_file, mold=input_nml_file)
Init_parm%input_nml_file => input_nml_file
Init_parm%fn_nml='using internal file'
#else
pelist_name=mpp_get_current_pelist_name()
Init_parm%fn_nml='input_'//trim(pelist_name)//'.nml'
inquire(FILE=Init_parm%fn_nml, EXIST=fexist)
if (.not. fexist ) then
Init_parm%fn_nml='input.nml'
endif
#endif

call GFS_initialize (GFS_control, GFS_data%Statein, GFS_data%Stateout, GFS_data%Sfcprop, &
GFS_data%Coupling, GFS_data%Grid, GFS_data%Tbd, GFS_data%Cldprop, GFS_data%Radtend, &
Expand Down Expand Up @@ -964,7 +948,7 @@ subroutine atmos_model_end (Atmos)
use update_ca, only: write_ca_restart
type (atmos_data_type), intent(inout) :: Atmos
!---local variables
integer :: idx, seconds, ierr
integer :: ierr

!-----------------------------------------------------------------------
!---- termination routine for atmospheric model ----
Expand Down Expand Up @@ -993,6 +977,8 @@ subroutine atmos_model_end (Atmos)
call CCPP_step (step="finalize", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP finalize step failed')

call dealloc_atmos_data_type (Atmos)

end subroutine atmos_model_end

! </SUBROUTINE>
Expand Down Expand Up @@ -1541,53 +1527,6 @@ subroutine update_atmos_chemistry(state, rc)
end select

end subroutine update_atmos_chemistry
! </SUBROUTINE>

!#######################################################################
! <SUBROUTINE NAME="atmos_data_type_chksum">
!
! <OVERVIEW>
! Print checksums of the various fields in the atmos_data_type.
! </OVERVIEW>

! <DESCRIPTION>
! Routine to print checksums of the various fields in the atmos_data_type.
! </DESCRIPTION>

! <TEMPLATE>
! call atmos_data_type_chksum(id, timestep, atm)
! </TEMPLATE>

! <IN NAME="Atm" TYPE="type(atmos_data_type)">
! Derived-type variable that contains fields in the atmos_data_type.
! </INOUT>
!
! <IN NAME="id" TYPE="character">
! Label to differentiate where this routine in being called from.
! </IN>
!
! <IN NAME="timestep" TYPE="integer">
! An integer to indicate which timestep this routine is being called for.
! </IN>
!
subroutine atmos_data_type_chksum(id, timestep, atm)
type(atmos_data_type), intent(in) :: atm
character(len=*), intent(in) :: id
integer , intent(in) :: timestep
integer :: n, outunit

100 format("CHECKSUM::",A32," = ",Z20)
101 format("CHECKSUM::",A16,a,'%',a," = ",Z20)

outunit = stdout()
write(outunit,*) 'BEGIN CHECKSUM(Atmos_data_type):: ', id, timestep
write(outunit,100) ' atm%lon_bnd ', mpp_chksum(atm%lon_bnd)
write(outunit,100) ' atm%lat_bnd ', mpp_chksum(atm%lat_bnd)
write(outunit,100) ' atm%lon ', mpp_chksum(atm%lon)
write(outunit,100) ' atm%lat ', mpp_chksum(atm%lat)

end subroutine atmos_data_type_chksum

! </SUBROUTINE>

subroutine alloc_atmos_data_type (nlon, nlat, Atmos)
Expand Down Expand Up @@ -1623,7 +1562,6 @@ subroutine assign_importdata(jdat, rc)
integer :: sphum, liq_wat, ice_wat, o3mr
character(len=128) :: impfield_name, fldname
type(ESMF_TypeKind_Flag) :: datatype
real(kind=ESMF_KIND_R4), dimension(:,:), pointer :: datar42d
real(kind=ESMF_KIND_R8), dimension(:,:), pointer :: datar82d
real(kind=ESMF_KIND_R8), dimension(:,:,:), pointer:: datar83d
real(kind=GFS_kind_phys), dimension(:,:), pointer :: datar8
Expand Down Expand Up @@ -1690,10 +1628,6 @@ subroutine assign_importdata(jdat, rc)
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'in cplIMP,atmos gets ',trim(impfield_name),' datar8=', &
datar8(isc,jsc), maxval(datar8), minval(datar8)
found = .true.
! gfs physics runs with r8
! else
! call ESMF_FieldGet(importFields(n),farrayPtr=datar42d,localDE=0, rc=rc)
! datar8 = datar42d
endif

else if( dimCount == 3) then
Expand Down Expand Up @@ -2560,9 +2494,9 @@ subroutine setup_exportdata(rc)
integer, optional, intent(out) :: rc

!--- local variables
integer :: i, j, k, idx, ix
integer :: i, j, ix
integer :: isc, iec, jsc, jec
integer :: ib, jb, nb, nsb, nk
integer :: nb, nk
integer :: sphum, liq_wat, ice_wat, o3mr
real(GFS_kind_phys) :: rtime, rtimek

Expand All @@ -2586,7 +2520,6 @@ subroutine setup_exportdata(rc)
jsc = Atm_block%jsc
jec = Atm_block%jec
nk = Atm_block%npz
nsb = Atm_block%blkno(isc,jsc)

rtime = one / GFS_control%dtp
rtimek = GFS_control%rho_h2o * rtime
Expand Down Expand Up @@ -2895,7 +2828,6 @@ subroutine addLsmask2grid(fcstGrid, rc)
integer isc, iec, jsc, jec
integer i, j, nb, ix
! integer CLbnd(2), CUbnd(2), CCount(2), TLbnd(2), TUbnd(2), TCount(2)
type(ESMF_StaggerLoc) :: staggerloc
integer, allocatable :: lsmask(:,:)
integer(kind=ESMF_KIND_I4), pointer :: maskPtr(:,:)
!
Expand Down
Loading