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

heterogenous standard deviation for perturbation input from file #628

Merged
merged 6 commits into from
Mar 8, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,26 @@ subroutine get_pert_grid( tile_grid, pert_grid )
! perturbations in tile space from gridded perturbations fields
! (see calls to "grid2tile" in clsm_ensdrv_pert_routines.F90,
! clsm_ensupd_upd_routines.F90, and clsm_adapt_routines.F90)

if(index(tile_grid%gridtype,"c3") ==0) then

! If *not* cube-sphere tile space, then for perturbations use the grid that
! defines the tile space (a.k.a. "tile_grid"). E.g., if in EASE grid tile space,
! the pert grid is the EASE grid.

pert_grid = tile_grid

else ! cubed-sphere grid
!for cubed-sphere grid, global lat_lon grid

! For cubed-sphere tile space, use a global lat_lon pert grid with a resolution
! similar to that of the grid that defines the tile space.

N_x=tile_grid%n_lon


! NOTE: The pert grid specification is hard-wired here.
! If perturbation stddev is heterogeneous input from a file,
! then the input grid must match this hard-wired grid. (sqz 2/2023)

n_lon=4*N_x
n_lat=3*N_x
write(lattmp,'(I6.6)') n_lat
Expand Down Expand Up @@ -1111,9 +1123,13 @@ subroutine get_force_pert_inputs( pert_grid_l, &
call MPI_BCAST(stdfilename_force_pert,300,MPI_CHARACTER,0,mpicomm,mpierr)

nc4_file = stdfilename_force_pert


! NOTE: the input file is in netcdf format, with a group 'std_force_pert',
! and the grid in the netcdf file must be the *global* pert grid
! (see subroutine get_pert_grid())

! --compute-local-shape-first-
! ASSUMPTION: data in file are on the *global* grid (tile_grid_g)
! ASSUMPTION: data in file are on the *global* pert grid
xstart = pert_grid_l%i_offg + 1
xcount = pert_grid_l%N_lon
ystart = pert_grid_l%j_offg + 1
Expand Down Expand Up @@ -1503,9 +1519,13 @@ subroutine get_progn_pert_inputs( pert_grid_l, &
call MPI_BCAST(stdfilename_progn_pert,300,MPI_CHARACTER,0,mpicomm,mpierr)

nc4_file = stdfilename_progn_pert

! NOTE: the input file is in netcdf format, with a group 'std_force_pert',
! and the grid in the netcdf file must be the *global* pert grid
! (see subroutine get_pert_grid())

! --compute-local-shape-first-
! ASSUMPTION: data in file are on the *global* grid (tile_grid_g)
! ASSUMPTION: data in file are on the *global* pert grid
xstart = pert_grid_l%i_offg + 1
xcount = pert_grid_l%N_lon
ystart = pert_grid_l%j_offg + 1
Expand Down Expand Up @@ -1549,10 +1569,10 @@ subroutine get_progn_pert_inputs( pert_grid_l, &
std_progn_pert(ivar,:,:) = 0.
end if
end do
! close file
nc4_stat = nf90_close(nc4_id)
if (nc4_stat /= nf90_noerr) call handle_nc4_stat(nc4_stat)
end if
! close file
nc4_stat = nf90_close(nc4_id)
if (nc4_stat /= nf90_noerr) call handle_nc4_stat(nc4_stat)
end do
call MPI_Barrier(mpicomm, mpierr)
end if
Expand Down