-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add ability to read increment files on native cubed sphere grid #342
Merged
laurenchilutti
merged 24 commits into
NOAA-GFDL:dev/emc
from
DavidNew-NOAA:feature/cubed_sphere_inc
Aug 27, 2024
Merged
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
af48b75
Initial commit
DavidNew-NOAA 5be98f9
Polishing up
DavidNew-NOAA a0cca09
Debugging
DavidNew-NOAA 0ffe8b3
multiple updates
DavidNew-NOAA 7262f54
Clean up
DavidNew-NOAA 3ea6348
Final updates (I hope)
DavidNew-NOAA b294c8f
Merge remote-tracking branch 'fork/dev/emc' into feature/cubed_sphere…
DavidNew-NOAA 3891c65
Spelling fix
DavidNew-NOAA 953d582
Merge remote-tracking branch 'origin/dev/emc' into feature/cubed_sphe…
DavidNew-NOAA 866ac57
Deleted accidentally undeleted files
DavidNew-NOAA c9be394
Fix bug in GCC compilation related to float conversion
DavidNew-NOAA 92113c7
Merge branch 'dev/emc' into feature/cubed_sphere_inc
DavidNew-NOAA 2ccb113
Merge remote-tracking branch 'origin/dev/emc' into feature/cubed_sphe…
DavidNew-NOAA ff741fd
Initial commit
DavidNew-NOAA 2335f8e
revert sim_nc_mod
DavidNew-NOAA 3950802
Implement FMS increment reads
DavidNew-NOAA 3865ccc
Merge branch 'dev/emc' into feature/cubed_sphere_inc
DavidNew-NOAA 4d6e8d1
Fix filename issues
DavidNew-NOAA c257cd2
Merge branch 'dev/emc' into feature/cubed_sphere_inc
DavidNew-NOAA 409eca8
Make sure to register axes
DavidNew-NOAA b7c4d90
Update x and y-axis names for increment to match restart axis names
DavidNew-NOAA cdc230d
Merge branch 'dev/emc' into feature/cubed_sphere_inc
DavidNew-NOAA 67b411c
Merge branch 'dev/emc' into feature/cubed_sphere_inc
DavidNew-NOAA 04b336f
Last minute update of y-axis name
DavidNew-NOAA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
module cubed_sphere_inc_mod | ||
|
||
use tracer_manager_mod, only: get_tracer_index, get_number_tracers, get_tracer_names | ||
use field_manager_mod, only: MODEL_ATMOS | ||
use fv_arrays_mod, only: fv_atmos_type | ||
use sim_nc_mod, only: open_ncfile, get_var5_r4, check_var_exists, close_ncfile | ||
|
||
implicit none | ||
type increment_data_type | ||
real, allocatable :: ua_inc(:,:,:) | ||
real, allocatable :: va_inc(:,:,:) | ||
real, allocatable :: temp_inc(:,:,:) | ||
real, allocatable :: delp_inc(:,:,:) | ||
real, allocatable :: delz_inc(:,:,:) | ||
real, allocatable :: tracer_inc(:,:,:,:) | ||
end type increment_data_type | ||
|
||
public read_cubed_sphere_inc, increment_data_type | ||
|
||
contains | ||
|
||
!---------------------------------------------------------------------------------------- | ||
|
||
subroutine read_cubed_sphere_inc(filename, increment_data, Atm) | ||
character(*), intent(in) :: filename | ||
type(increment_data_type), intent(inout) :: increment_data | ||
type(fv_atmos_type), intent(in) :: Atm | ||
|
||
integer :: isc, iec, jsc, jec, npz, itracer, ntracers, itile | ||
character(len=64) :: tracer_name | ||
integer :: ncid, ncerr | ||
|
||
! Get various dimensions | ||
call get_number_tracers(MODEL_ATMOS, num_tracers=ntracers) | ||
isc = Atm%bd%isc | ||
iec = Atm%bd%iec | ||
jsc = Atm%bd%jsc | ||
jec = Atm%bd%jec | ||
npz = Atm%npz | ||
itile = Atm%tile_of_mosaic | ||
|
||
! Open increment file | ||
call open_ncfile( trim(filename), ncid ) | ||
|
||
! Read increments | ||
call get_var5_r4( ncid, 'u_inc', isc,iec, jsc,jec, 1,npz, itile, 1, increment_data%ua_inc ) | ||
call get_var5_r4( ncid, 'v_inc', isc,iec, jsc,jec, 1,npz, itile, 1, increment_data%va_inc ) | ||
call get_var5_r4( ncid, 'T_inc', isc,iec, jsc,jec, 1,npz, itile, 1, increment_data%temp_inc ) | ||
call get_var5_r4( ncid, 'delp_inc', isc,iec, jsc,jec, 1,npz, itile, 1, increment_data%delp_inc ) | ||
if ( .not. Atm%flagstruct%hydrostatic ) then | ||
call get_var5_r4( ncid, 'delz_inc', isc,iec, jsc,jec, 1,npz, itile, 1, increment_data%delz_inc ) | ||
end if | ||
|
||
! Read tracer increments | ||
do itracer = 1,ntracers | ||
call get_tracer_names(MODEL_ATMOS, itracer, tracer_name) | ||
call check_var_exists(ncid, trim(tracer_name)//'_inc', ncerr) | ||
if ( ncerr == 0 ) then | ||
call get_var5_r4( ncid, trim(tracer_name)//'_inc', isc,iec, jsc,jec, 1,npz, itile, 1, increment_data%tracer_inc(:,:,:,itracer) ) | ||
end if | ||
end do | ||
|
||
! Close increment file | ||
call close_ncfile(ncid) | ||
|
||
end subroutine read_cubed_sphere_inc | ||
|
||
!---------------------------------------------------------------------------------------- | ||
end module cubed_sphere_inc_mod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may get a complaint from operations that this is too disruptive to the filesystem, especially for large numbers of mpi-ranks. You have every core opening the file, performing reads and then closing the file. While I know you are using these embedded I/O routines from the dycore, they were originally put in as hacks a long time ago and generally won't play nice now that we've scaled up to thousands or cores on distributed filesystems.
You'd be better off using the fms2_io routines which are already domain aware (suited for native grid) and will read in the correct increment for a given mpi-rank. The fms2_io routines have recently been modified by UFS contributors to use MPI-IO for reads of NetCDF4 files (FMS PR#1477).