Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NOAA-EMC/noahmp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6a51f0295bc1a877475b527157a33aa86eb532fe
Choose a base ref
...
head repository: NOAA-EMC/noahmp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1e259014c1eba9070cec7027d8b4b479ae54275a
Choose a head ref
  • 4 commits
  • 4 files changed
  • 1 contributor

Commits on Mar 10, 2024

  1. Copy the full SHA
    79cfb7d View commit details

Commits on Mar 13, 2024

  1. clean debug print

    uturuncoglu committed Mar 13, 2024
    Copy the full SHA
    c0b9ac3 View commit details

Commits on Apr 16, 2024

  1. Merge branch 'develop' into hotfix/debug_mode

    uturuncoglu committed Apr 16, 2024
    Copy the full SHA
    2f30e10 View commit details

Commits on Apr 30, 2024

  1. Merge pull request #9 from NOAA-EMC/hotfix/debug_mode

    uturuncoglu authored Apr 30, 2024
    Copy the full SHA
    1e25901 View commit details
Showing with 254 additions and 167 deletions.
  1. +25 −10 drivers/nuopc/lnd_comp_domain.F90
  2. +1 −1 drivers/nuopc/lnd_comp_driver.F90
  3. +109 −40 drivers/nuopc/lnd_comp_io.F90
  4. +119 −116 drivers/nuopc/lnd_comp_types.F90
35 changes: 25 additions & 10 deletions drivers/nuopc/lnd_comp_domain.F90
Original file line number Diff line number Diff line change
@@ -60,7 +60,8 @@ subroutine lnd_set_decomp_and_domain_from_mosaic(gcomp, noahmp, rc)
integer, intent(out) :: rc

! local variables
real(r4), target, allocatable :: tmpr4(:)
real(r4), target, allocatable :: tmpr4(:)
real(r8), target, allocatable :: tmpr8(:)
integer :: n
integer :: decomptile(2,6)
integer :: maxIndex(2)
@@ -183,6 +184,10 @@ subroutine lnd_set_decomp_and_domain_from_mosaic(gcomp, noahmp, rc)
allocate(tmpr4(noahmp%domain%begl:noahmp%domain%endl))
tmpr4(:) = 0.0
end if
if (.not. allocated(tmpr8)) then
allocate(tmpr8(noahmp%domain%begl:noahmp%domain%endl))
tmpr8(:) = 0.0
end if

! ---------------------
! Get fraction from orography file
@@ -207,18 +212,27 @@ subroutine lnd_set_decomp_and_domain_from_mosaic(gcomp, noahmp, rc)
! following link: https://github.com/ufs-community/ufs-weather-model/issues/1423
! ---------------------

! read field
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C',noahmp%domain%ni, '.vegetation_type.tile*.nc'
flds(1)%short_name = 'vegetation_type'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! allocate data
if (.not. allocated(vegtype)) then
allocate(vegtype(noahmp%domain%begl:noahmp%domain%endl))
end if
vegtype(:) = int(tmpr4)

! read field
if (trim(noahmp%nmlist%ic_type) == 'sfc') then
filename = trim(noahmp%nmlist%input_dir)//'sfc_data.tile*.nc'
flds(1)%short_name = 'vtype'
flds(1)%ptr1r8 => tmpr8
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
vegtype(:) = int(tmpr8)
else
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C',noahmp%domain%ni, '.vegetation_type.tile*.nc'
flds(1)%short_name = 'vegetation_type'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
vegtype(:) = int(tmpr4)
end if

! ---------------------
! Calculate mask from land-sea fraction
@@ -228,7 +242,7 @@ subroutine lnd_set_decomp_and_domain_from_mosaic(gcomp, noahmp, rc)
allocate(noahmp%domain%mask(noahmp%domain%begl:noahmp%domain%endl))
end if

where (noahmp%domain%frac(:) > 0.0_r8 .and. vegtype(:) >= 0)
where (noahmp%domain%frac(:) > 0.0_r8 .and. vegtype(:) > 0)
noahmp%domain%mask(:) = 1
elsewhere
noahmp%domain%mask(:) = 0
@@ -319,6 +333,7 @@ subroutine lnd_set_decomp_and_domain_from_mosaic(gcomp, noahmp, rc)
! ---------------------

if (allocated(tmpr4)) deallocate(tmpr4)
if (allocated(tmpr8)) deallocate(tmpr8)

call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)

2 changes: 1 addition & 1 deletion drivers/nuopc/lnd_comp_driver.F90
Original file line number Diff line number Diff line change
@@ -283,7 +283,7 @@ subroutine drv_run(gcomp, noahmp, rc)
end if

! initialize model variables
call noahmp%InitializeStates(noahmp%nmlist, noahmp%static, month)
call noahmp%InitializeStates(noahmp%nmlist, noahmp%static, noahmp%domain, month)
end if
end if

149 changes: 109 additions & 40 deletions drivers/nuopc/lnd_comp_io.F90
Original file line number Diff line number Diff line change
@@ -467,7 +467,9 @@ subroutine read_static(noahmp, rc)
! local variables
type(field_type), allocatable :: flds(:)
real(r4), target, allocatable :: tmpr4(:)
real(r8), target, allocatable :: tmpr8(:)
real(r4), target, allocatable :: tmp2r4(:,:)
real(r8), target, allocatable :: tmp2r8(:,:)
character(len=CL) :: filename
real(ESMF_KIND_R8), parameter :: pi_8 = 3.14159265358979323846_r8
character(len=*), parameter :: subname=trim(modName)//':(read_static) '
@@ -485,11 +487,21 @@ subroutine read_static(noahmp, rc)
tmpr4(:) = 0.0
end if

if (.not. allocated(tmpr8)) then
allocate(tmpr8(noahmp%domain%begl:noahmp%domain%endl))
tmpr8(:) = 0.0_r8
end if

if (.not. allocated(tmp2r4)) then
allocate(tmp2r4(noahmp%domain%begl:noahmp%domain%endl,12))
tmp2r4(:,:) = 0.0
end if

if (.not. allocated(tmp2r8)) then
allocate(tmp2r8(noahmp%domain%begl:noahmp%domain%endl,1))
tmp2r8(:,:) = 0.0_r8
end if

!----------------------
! Read latitude, we could also retrive from ESMF mesh object
!----------------------
@@ -509,66 +521,121 @@ subroutine read_static(noahmp, rc)
! Read soil type
!----------------------

allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.soil_type.tile*.nc'
flds(1)%short_name = 'soil_type'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%soiltyp = int(tmpr4)
deallocate(flds)
if (trim(noahmp%nmlist%ic_type) == 'sfc') then
allocate(flds(1))
write(filename, fmt="(A)") trim(noahmp%nmlist%input_dir)//'sfc_data.tile*.nc'
flds(1)%short_name = 'stype'
flds(1)%ptr1r8 => tmpr8
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%soiltyp = int(tmpr8)
deallocate(flds)
else
allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.soil_type.tile*.nc'
flds(1)%short_name = 'soil_type'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%soiltyp = int(tmpr4)
deallocate(flds)
end if

!----------------------
! Read vegetation type
!----------------------

allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.vegetation_type.tile*.nc'
flds(1)%short_name = 'vegetation_type'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%vegtype = int(tmpr4)
deallocate(flds)
if (trim(noahmp%nmlist%ic_type) == 'sfc') then
allocate(flds(1))
write(filename, fmt="(A)") trim(noahmp%nmlist%input_dir)//'sfc_data.tile*.nc'
flds(1)%short_name = 'vtype'
flds(1)%ptr1r8 => tmpr8
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%vegtype = int(tmpr8)
deallocate(flds)
else
allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.vegetation_type.tile*.nc'
flds(1)%short_name = 'vegetation_type'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%vegtype = int(tmpr4)
deallocate(flds)
end if

!----------------------
! Read slope type
!----------------------

allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.slope_type.tile*.nc'
flds(1)%short_name = 'slope_type'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%slopetyp = int(tmpr4)
deallocate(flds)
if (trim(noahmp%nmlist%ic_type) == 'sfc') then
allocate(flds(1))
write(filename, fmt="(A)") trim(noahmp%nmlist%input_dir)//'sfc_data.tile*.nc'
flds(1)%short_name = 'slope'
flds(1)%ptr1r8 => tmpr8
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%slopetyp = int(tmpr8)
deallocate(flds)
else
allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.slope_type.tile*.nc'
flds(1)%short_name = 'slope_type'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%slopetyp = int(tmpr4)
deallocate(flds)
end if

!----------------------
! Read deep soil temperature
!----------------------

allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.substrate_temperature.tile*.nc'
flds(1)%short_name = 'substrate_temperature'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%tg3 = dble(tmpr4)
deallocate(flds)
if (trim(noahmp%nmlist%ic_type) == 'sfc') then
allocate(flds(1))
write(filename, fmt="(A)") trim(noahmp%nmlist%input_dir)//'sfc_data.tile*.nc'
flds(1)%short_name = 'tg3'
flds(1)%nrec = 1; flds(1)%ptr2r8 => tmp2r8
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%tg3 = tmp2r8(:,1)
deallocate(flds)
else
allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.substrate_temperature.tile*.nc'
flds(1)%short_name = 'substrate_temperature'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%tg3 = dble(tmpr4)
deallocate(flds)
end if

!----------------------
! Read maximum snow albedo
!----------------------

allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.maximum_snow_albedo.tile*.nc'
flds(1)%short_name = 'maximum_snow_albedo'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%snoalb = dble(tmpr4)
deallocate(flds)
if (trim(noahmp%nmlist%ic_type) == 'sfc') then
allocate(flds(1))
write(filename, fmt="(A)") trim(noahmp%nmlist%input_dir)//'sfc_data.tile*.nc'
flds(1)%short_name = 'snoalb'
flds(1)%nrec = 1; flds(1)%ptr2r8 => tmp2r8
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%snoalb = tmp2r8(:,1)
deallocate(flds)
else
allocate(flds(1))
write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', noahmp%domain%ni, '.maximum_snow_albedo.tile*.nc'
flds(1)%short_name = 'maximum_snow_albedo'
flds(1)%ptr1r4 => tmpr4
call read_tiled_file(noahmp, filename, flds, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%snoalb = dble(tmpr4)
deallocate(flds)
end if

!----------------------
! Read vegetation greenness, monthly average
@@ -610,7 +677,9 @@ subroutine read_static(noahmp, rc)
!----------------------

if (allocated(tmpr4)) deallocate(tmpr4)
if (allocated(tmpr8)) deallocate(tmpr8)
if (allocated(tmp2r4)) deallocate(tmp2r4)
if (allocated(tmp2r8)) deallocate(tmp2r8)

call ESMF_LogWrite(subname//' done for '//trim(filename), ESMF_LOGMSG_INFO)

Loading