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

Convert real(kind_phys) vegetation, slope and soil type arrays into integer arrays without affecting input/output files #388

Merged
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f7b2157
Update .gitmodules and submodule pointer for ccpp-physics for code re…
climbfuji Sep 15, 2021
1e9f49d
Make real vegetation, slope and soil type integers, remove unnecessar…
climbfuji Sep 15, 2021
f84acd3
Update submodule pointer for ccpp-physics
climbfuji Sep 15, 2021
d7f4c06
Update submodule pointer for ccpp-physics
climbfuji Sep 16, 2021
25ccc89
Add interstitial variables to save and restore vegetation/soil/slope …
climbfuji Sep 16, 2021
dca09e3
Update submodule pointer for ccpp-physics
climbfuji Sep 20, 2021
9d56507
Make vegetation/soil/slope save variables persistent so that they can…
climbfuji Sep 20, 2021
4531ef9
Only allow nearest-neighbor interpolation method for integer data
climbfuji Sep 21, 2021
2bc3648
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into veg…
climbfuji Sep 23, 2021
708c037
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into veg…
climbfuji Sep 24, 2021
3b76de5
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into veg…
climbfuji Sep 27, 2021
141c972
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into veg…
climbfuji Sep 29, 2021
eb95d36
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into veg…
climbfuji Sep 30, 2021
52f8824
Update submodule pointer for ccpp-physics
climbfuji Oct 1, 2021
1aa3d2c
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into veg…
climbfuji Oct 1, 2021
8135242
Remove legacy code from CMakeLists.txt
climbfuji Oct 1, 2021
1b8d32c
Update submodule pointer for ccpp-physics
climbfuji Oct 1, 2021
db63ad9
Revert change to .gitmodules and update submodule pointer for ccpp-ph…
climbfuji Oct 4, 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
6 changes: 4 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
branch = main
[submodule "ccpp/physics"]
path = ccpp/physics
url = https://github.com/NCAR/ccpp-physics
branch = main
#url = https://github.com/NCAR/ccpp-physics
#branch = main
url = https://github.com/climbfuji/ccpp-physics
branch = vegetation_soil_slope_type_integer
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ set_target_properties(fv3atm PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT
target_include_directories(fv3atm INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod>
$<INSTALL_INTERFACE:mod>)

# This should not be necessary once framework and physics targets define BUILD_INTERFACE
target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ccpp/physics)

target_link_libraries(fv3atm PUBLIC fv3
fv3ccpp
stochastic_physics
Expand Down
4 changes: 2 additions & 2 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,7 @@ subroutine assign_importdata(jdat, rc)
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
GFS_data(nb)%Sfcprop%vtype(ix) = datar82d(i-isc+1,j-jsc+1)
GFS_data(nb)%Sfcprop%vtype(ix) = int(datar82d(i-isc+1,j-jsc+1))
enddo
enddo
endif
Expand All @@ -2341,7 +2341,7 @@ subroutine assign_importdata(jdat, rc)
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
GFS_data(nb)%Sfcprop%stype(ix) = datar82d(i-isc+1,j-jsc+1)
GFS_data(nb)%Sfcprop%stype(ix) = int(datar82d(i-isc+1,j-jsc+1))
enddo
enddo
endif
Expand Down
491 changes: 41 additions & 450 deletions ccpp/data/GFS_typedefs.F90

Large diffs are not rendered by default.

51 changes: 24 additions & 27 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -697,12 +697,17 @@
type = real
kind = kind_phys
[slope]
standard_name = surface_slope_classification_real
standard_name = surface_slope_classification
long_name = sfc slope type for lsm
units = index
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
type = integer
[slope_save]
standard_name = surface_slope_classification_save
long_name = sfc slope type for lsm save
units = index
dimensions = (horizontal_loop_extent)
type = integer
[shdmin]
standard_name = min_vegetation_area_fraction
long_name = min fractional coverage of green vegetation
Expand Down Expand Up @@ -732,19 +737,29 @@
type = real
kind = kind_phys
[vtype]
standard_name = vegetation_type_classification_real
standard_name = vegetation_type_classification
long_name = vegetation type for lsm
units = index
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
type = integer
[vtype_save]
standard_name = vegetation_type_classification_save
long_name = vegetation type for lsm save
units = index
dimensions = (horizontal_loop_extent)
type = integer
[stype]
standard_name = soil_type_classification_real
standard_name = soil_type_classification
long_name = soil type for lsm
units = index
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
type = integer
[stype_save]
standard_name = soil_type_classification_save
long_name = soil type for lsm save
units = index
dimensions = (horizontal_loop_extent)
type = integer
[uustar]
standard_name = surface_friction_velocity
long_name = boundary layer parameter
Expand Down Expand Up @@ -9484,12 +9499,6 @@
type = real
kind = kind_phys
active = (control_for_land_surface_scheme == identifier_for_noah_wrfv4_land_surface_scheme)
[slopetype]
standard_name = surface_slope_classification
long_name = surface slope type at each grid cell
units = index
dimensions = (horizontal_loop_extent)
type = integer
[smcmax]
standard_name = soil_porosity
long_name = volumetric soil porosity
Expand Down Expand Up @@ -9590,12 +9599,6 @@
type = real
kind = kind_phys
active = (control_for_land_surface_scheme == identifier_for_noah_wrfv4_land_surface_scheme)
[soiltype]
standard_name = soil_type_classification
long_name = soil type at each grid cell
units = index
dimensions = (horizontal_loop_extent)
type = integer
[stc_save]
standard_name = soil_temperature_save
long_name = soil temperature before entering a physics scheme
Expand Down Expand Up @@ -9842,12 +9845,6 @@
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[vegtype]
standard_name = vegetation_type_classification
long_name = vegetation type at each grid cell
units = index
dimensions = (horizontal_loop_extent)
type = integer
[w_upi]
standard_name = vertical_velocity_for_updraft
long_name = vertical velocity for updraft
Expand Down
8 changes: 5 additions & 3 deletions ccpp/driver/GFS_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module GFS_diagnostics

!--- private data type definition ---
type data_subtype
integer, dimension(:), pointer :: int2 => NULL()
real(kind=kind_phys), dimension(:), pointer :: var2 => NULL()
real(kind=kind_phys), dimension(:), pointer :: var21 => NULL()
real(kind=kind_phys), dimension(:,:), pointer :: var3 => NULL()
Expand Down Expand Up @@ -113,6 +114,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
! ExtDiag%mask [char*64 ] description of mask-type !
! ExtDiag%intpl_method [char*64 ] method to use for interpolation !
! ExtDiag%cnvfac [real*8 ] conversion factor to output specified units !
! ExtDiag%data(nb)%int2(:) [integer ] pointer to 2D data [=> null() for a 3D field] !
! ExtDiag%data(nb)%var2(:) [real*8 ] pointer to 2D data [=> null() for a 3D field] !
! ExtDiag%data(nb)%var21(:) [real*8 ] pointer to 2D data for ratios !
! ExtDiag%data(nb)%var3(:,:) [real*8 ] pointer to 3D data [=> null() for a 2D field] !
Expand Down Expand Up @@ -2610,7 +2612,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
ExtDiag(idx)%mod_name = 'gfs_sfc'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Sfcprop(nb)%slope(:)
ExtDiag(idx)%data(nb)%int2 => Sfcprop(nb)%slope(:)
enddo

idx = idx + 1
Expand Down Expand Up @@ -2724,7 +2726,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
ExtDiag(idx)%mod_name = 'gfs_sfc'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Sfcprop(nb)%stype(:)
ExtDiag(idx)%data(nb)%int2 => Sfcprop(nb)%stype(:)
enddo

idx = idx + 1
Expand Down Expand Up @@ -2819,7 +2821,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
ExtDiag(idx)%mod_name = 'gfs_sfc'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%vtype(:)
ExtDiag(idx)%data(nb)%int2 => sfcprop(nb)%vtype(:)
enddo

idx = idx + 1
Expand Down
35 changes: 35 additions & 0 deletions cpl/module_block_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module module_block_data
implicit none

interface block_data_copy
module procedure block_copy_1d_i4_to_2d_r8
module procedure block_copy_1d_to_2d_r8
module procedure block_copy_2d_to_2d_r8
module procedure block_copy_2d_to_3d_r8
Expand Down Expand Up @@ -50,6 +51,40 @@ module module_block_data

! -- copy: 1D to 2D

subroutine block_copy_1d_i4_to_2d_r8(destin_ptr, source_ptr, block, block_index, scale_factor, rc)

! -- arguments
real(ESMF_KIND_R8), pointer :: destin_ptr(:,:)
integer, pointer :: source_ptr(:)
type(block_control_type), intent(in) :: block
integer, intent(in) :: block_index
real(kind_phys), optional, intent(in) :: scale_factor
integer, optional, intent(out) :: rc

! -- local variables
integer :: localrc
integer :: i, ib, ix, j, jb
real(kind_phys) :: factor

! -- begin
localrc = ESMF_RC_PTR_NOTALLOC
if (associated(destin_ptr) .and. associated(source_ptr)) then
factor = 1._kind_phys
if (present(scale_factor)) factor = scale_factor
do ix = 1, block%blksz(block_index)
ib = block%index(block_index)%ii(ix)
jb = block%index(block_index)%jj(ix)
i = ib - block%isc + 1
j = jb - block%jsc + 1
destin_ptr(i,j) = factor * real(source_ptr(ix), kind=kind_phys)
enddo
localrc = ESMF_SUCCESS
end if

if (present(rc)) rc = localrc

end subroutine block_copy_1d_i4_to_2d_r8

subroutine block_copy_1d_to_2d_r8(destin_ptr, source_ptr, block, block_index, scale_factor, rc)

! -- arguments
Expand Down
Loading