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

Support for multiple output grids #176

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 20 additions & 2 deletions driver/fvGFS/atmosphere.F90
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ module atmosphere_mod
atmosphere_get_bottom_layer, &
atmosphere_nggps_diag, &
get_bottom_mass, get_bottom_wind, &
get_stock_pe, set_atmosphere_pelist
get_stock_pe, set_atmosphere_pelist, &
get_nth_domain_info

!--- physics/radiation data exchange routines
public :: atmos_phys_driver_statein
Expand Down Expand Up @@ -914,15 +915,30 @@ subroutine set_atmosphere_pelist ()
end subroutine set_atmosphere_pelist


subroutine get_nth_domain_info(n, layout, nx, ny, pelist)
integer, intent(in) :: n
integer, intent(out) :: layout(2)
integer, intent(out) :: nx, ny
integer, pointer, intent(out) :: pelist(:)

layout(1:2) = Atm(n)%layout(1:2)
nx = Atm(n)%npx -1
ny = Atm(n)%npy -1
pelist => Atm(n)%pelist

end subroutine get_nth_domain_info

!>@brief The subroutine 'atmosphere_domain' is an API to return
!! the "domain2d" variable associated with the coupling grid and the
!! decomposition for the current cubed-sphere tile.
!>@detail Coupling is done using the mass/temperature grid with no halos.
subroutine atmosphere_domain ( fv_domain, layout, regional, nested, pelist )
subroutine atmosphere_domain ( fv_domain, layout, regional, nested, ngrids_atmos, mygrid_atmos, pelist )
type(domain2d), intent(out) :: fv_domain
integer, intent(out) :: layout(2)
logical, intent(out) :: regional
logical, intent(out) :: nested
integer, intent(out) :: ngrids_atmos
integer, intent(out) :: mygrid_atmos
integer, pointer, intent(out) :: pelist(:)
! returns the domain2d variable associated with the coupling grid
! note: coupling is done using the mass/temperature grid with no halos
Expand All @@ -931,6 +947,8 @@ subroutine atmosphere_domain ( fv_domain, layout, regional, nested, pelist )
layout(1:2) = Atm(mygrid)%layout(1:2)
regional = Atm(mygrid)%flagstruct%regional
nested = ngrids > 1
ngrids_atmos = ngrids
mygrid_atmos = mygrid
call set_atmosphere_pelist()
pelist => Atm(mygrid)%pelist

Expand Down
3 changes: 3 additions & 0 deletions driver/fvGFS/fv_nggps_diag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ subroutine fv_dyn_bundle_setup(axes, dyn_bundle, fcst_grid, quilting, rc)
line=__LINE__, &
file=__FILE__)) &
return ! bail out
deallocate(axis_name_vert)
endif

do id = 1,num_axes
Expand Down Expand Up @@ -1345,6 +1346,8 @@ subroutine fv_dyn_bundle_setup(axes, dyn_bundle, fcst_grid, quilting, rc)
! name="output_file", value=fld_outfilename, rc=rc)
! print *,'in dyn bundle setup, i=',i,' fieldname=',trim(fieldnamelist(i)),' out filename=',trim(fld_outfilename)
! enddo
deallocate(axis_name)
deallocate(all_axes)

end subroutine fv_dyn_bundle_setup

Expand Down
35 changes: 9 additions & 26 deletions model/fv_regional_bc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -383,18 +383,12 @@ subroutine setup_regional_BC(Atm &
file_name='INPUT/gfs_bndy.tile7.'//int_to_char//'_gsi.nc' !<-- The DA-updated BC file.
endif
!
if (is_master()) then
write(*,20011)trim(file_name)
20011 format(' regional_bc_data file_name=',a)
endif
!-----------------------------------------------------------------------
!*** Open the regional BC file.
!-----------------------------------------------------------------------
!
call check(nf90_open(file_name,nf90_nowrite,ncid)) !<-- Open the BC file; get the file ID.
if (is_master()) then
write(0,*)' opened BC file ',trim(file_name)
endif
call mpp_error(NOTE, 'Opened BC file: '//trim(file_name))
!
!-----------------------------------------------------------------------
!*** Check if the desired number of blending rows are present in
Expand Down Expand Up @@ -1075,7 +1069,7 @@ subroutine read_regional_lon_lat
!
call check(nf90_open(filename,nf90_nowrite,ncid_grid)) !<-- Open the grid data netcdf file; get the file ID.
!
call mpp_error(NOTE,' opened grid file '//trim(filename))
call mpp_error(NOTE, 'Opened grid file: '//trim(filename))
!
!-----------------------------------------------------------------------
!*** The longitude and latitude are on the super grid. We need only
Expand Down Expand Up @@ -1170,12 +1164,9 @@ subroutine read_regional_filtered_topo
!
filename='INPUT/'//trim(oro_data)

if (is_master()) then
write(*,23421)trim(filename)
23421 format(' topo filename=',a)
endif
!
call check(nf90_open(filename,nf90_nowrite,ncid_oro)) !<-- Open the netcdf file; get the file ID.
call mpp_error(NOTE, 'Opened topo file: '//trim(filename))
!
!-----------------------------------------------------------------------
!*** Read in the data including the extra outer row.
Expand Down Expand Up @@ -1661,19 +1652,13 @@ subroutine regional_bc_data(Atm,bc_hour &
file_name='INPUT/gfs_bndy.tile7.'//int_to_char//'_gsi.nc' !<-- The DA-updated BC file.
endif
!
if (is_master()) then
write(*,22211)trim(file_name)
22211 format(' regional_bc_data file_name=',a)
endif
!-----------------------------------------------------------------------
!*** Open the regional BC file.
!*** Find the # of layers (klev_in) in the BC input.
!-----------------------------------------------------------------------
!
call check(nf90_open(file_name,nf90_nowrite,ncid)) !<-- Open the BC file; get the file ID.
if (is_master()) then
write(0,*)' opened BC file ',trim(file_name)
endif
call mpp_error(NOTE, 'Opened BC file: '//trim(file_name))
!
call check(nf90_inq_dimid(ncid,'lev',dimid)) !<-- Get the vertical dimension's NetCDF ID.
call check(nf90_inquire_dimension(ncid,dimid,len=klev_in)) !<-- Get the vertical dimension's value (klev_in).
Expand Down Expand Up @@ -3305,7 +3290,9 @@ subroutine read_regional_bc_file(is_input,ie_input &
call check(status)
endif
if (status /= nf90_noerr) then
if (east_bc.and.is_master()) write(0,*)' WARNING: Tracer ',trim(var_name),' not in input file'
if (east_bc) then
call mpp_error(NOTE, 'Tracer '//trim(var_name)//' not in input file')
endif
array_4d(:,:,:,tlev)=0. !<-- Tracer not in input so set to zero in boundary.
!
blend_this_tracer(tlev)=.false. !<-- Tracer not in input so do not apply blending.
Expand Down Expand Up @@ -3877,7 +3864,6 @@ subroutine remap_scalar_nggps_regional_bc(Atm &
enddo
! call pmaxmn('PS_diff (mb)', wk, is, ie, js, je, 1, 0.01, Atm%gridstruct%area_64, Atm%domain)
deallocate (pe0,qn1,dp2,pe1,qp)
if (is_master()) write(*,*) 'done remap_scalar_nggps_regional_bc'
!---------------------------------------------------------------------

end subroutine remap_scalar_nggps_regional_bc
Expand Down Expand Up @@ -3997,8 +3983,6 @@ subroutine remap_dwinds_regional_bc(Atm &
deallocate(qn1_d)
deallocate(qn1_c)

if (is_master()) write(*,*) 'done remap_dwinds'

end subroutine remap_dwinds_regional_bc

!---------------------------------------------------------------------
Expand Down Expand Up @@ -6741,7 +6725,7 @@ subroutine get_data_source(data_source_fv3gfs,regional)
logical, intent(out):: data_source_fv3gfs

character (len=80) :: source
logical :: lstatus
logical :: lstatus = .false.
type(FmsNetcdfFile_t) :: Gfs_data
integer, allocatable, dimension(:) :: pes !< Array of the pes in the current pelist
!
Expand All @@ -6764,7 +6748,7 @@ subroutine get_data_source(data_source_fv3gfs,regional)
if (mpp_pe() == 0) write(0,*) 'INPUT source not found ',lstatus,' set source=No Source Attribute'
source='No Source Attribute'
endif
if (mpp_pe()==0) write(*,*) 'INPUT gfs_data source string=',source
call mpp_error(NOTE, 'INPUT gfs_data source string: '//trim(source))

! Logical flag for fv3gfs nemsio/netcdf/grib2 --------
if ( trim(source)=='FV3GFS GAUSSIAN NEMSIO FILE' .or. &
Expand All @@ -6774,7 +6758,6 @@ subroutine get_data_source(data_source_fv3gfs,regional)
else
data_source_fv3gfs = .FALSE.
endif
if (mpp_pe()==0) write(*,*) 'data_source_fv3gfs=',data_source_fv3gfs

end subroutine get_data_source

Expand Down