-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to read increment files on native cubed sphere grid (#342)
* Initial commit * Polishing up * Debugging * multiple updates * Clean up * Final updates (I hope) * Spelling fix * Deleted accidentally undeleted files * Fix bug in GCC compilation related to float conversion * Initial commit * revert sim_nc_mod * Implement FMS increment reads * Fix filename issues * Make sure to register axes * Update x and y-axis names for increment to match restart axis names * Last minute update of y-axis name
- Loading branch information
1 parent
3f81533
commit ac3055e
Showing
7 changed files
with
306 additions
and
31 deletions.
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,66 @@ | ||
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 fms2_io_mod, only: open_file, close_file, read_data, variable_exists, & | ||
FmsNetcdfDomainFile_t, register_axis | ||
|
||
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(fname, increment_data, Atm) | ||
character(*), intent(in) :: fname | ||
type(increment_data_type), intent(inout) :: increment_data | ||
type(fv_atmos_type), intent(in) :: Atm | ||
|
||
type(FmsNetcdfDomainFile_t) :: fileobj | ||
integer :: itracer, ntracers | ||
character(len=64) :: tracer_name | ||
|
||
! Get various dimensions | ||
call get_number_tracers(MODEL_ATMOS, num_tracers=ntracers) | ||
|
||
! Open file | ||
if ( open_file(fileobj, trim(fname), 'read', Atm%domain) ) then | ||
! Register axes | ||
call register_axis(fileobj, 'xaxis_1', 'x') | ||
call register_axis(fileobj, 'yaxis_1', 'y') | ||
|
||
! Read increments | ||
call read_data(fileobj, 'u_inc', increment_data%ua_inc) | ||
call read_data(fileobj, 'v_inc', increment_data%va_inc) | ||
call read_data(fileobj, 'T_inc', increment_data%temp_inc) | ||
call read_data(fileobj, 'delp_inc', increment_data%delp_inc) | ||
if ( .not. Atm%flagstruct%hydrostatic ) then | ||
call read_data(fileobj, 'delz_inc', increment_data%delz_inc) | ||
end if | ||
|
||
! Read tracer increments | ||
do itracer = 1,ntracers | ||
call get_tracer_names(MODEL_ATMOS, itracer, tracer_name) | ||
if ( variable_exists(fileobj, trim(tracer_name)//'_inc') ) then | ||
call read_data(fileobj, trim(tracer_name)//'_inc', increment_data%tracer_inc(:,:,:,itracer)) | ||
end if | ||
end do | ||
|
||
call close_file(fileobj) | ||
end if | ||
|
||
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.