Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
96a7a12
Changed soil colour to be initialised through input files.
mpaiao Oct 10, 2025
eb77222
This commit adds the ability for NoahMP to read in soil colour maps, …
mpaiao Oct 16, 2025
84b4d4e
Delete bogus character
mpaiao Oct 28, 2025
cf61dcc
Remove duplicate variable declaration in mpas_atmphys_lsm_noahmpinit.F.
mpaiao Oct 28, 2025
29163af
Add more information to some warning messages.
mpaiao Nov 1, 2025
04b198c
Add more information to the initialisation error message.
mpaiao Nov 1, 2025
3415e5b
fix typo
mpaiao Nov 1, 2025
807bb2a
Change soil colour categories to 21, the last one being a dummy categ…
mpaiao Nov 2, 2025
3fec49e
Replace Makefile with the most recent MONAN version, so this branch c…
mpaiao Jan 29, 2026
6c6ac5d
First attempt to refactor the soil colour pull request.
mpaiao Jun 26, 2026
43090a2
Fix typo.
mpaiao Jun 26, 2026
ccf402b
Add missing variable declaration.
mpaiao Jun 26, 2026
efb786a
Removed bogus extra argument for Noah.
mpaiao Jun 26, 2026
9904c45
Another typo...
mpaiao Jun 26, 2026
040fb52
Added missing mminsc to init_atmosphere Registry.xml
mpaiao Jun 26, 2026
41b918b
Error in mpas_geotile_manager.F, which could affect reading soil colo…
mpaiao Jun 26, 2026
9dd07a8
Fix minor bug on Registry.xml. Unlikely to fix the crash though.
mpaiao Jun 26, 2026
f4904e2
Revert changes for the default soil colour classes. One more commit t…
mpaiao Jun 26, 2026
1892c46
Added a few additional safeguards so the code runs in case the user w…
mpaiao Jun 26, 2026
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
325 changes: 151 additions & 174 deletions Makefile

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/core_atmosphere/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,10 @@
#endif
#ifdef DO_PHYSICS
<var name="isltyp"/>
<var name="isctyp"/>
<var name="ivgtyp"/>
<var name="mminlu"/>
<var name="mminsc"/>
<var name="isice_lu"/>
<var name="iswater_lu"/>
<var name="landmask"/>
Expand Down Expand Up @@ -984,6 +986,7 @@
<var name="pin"/>
<var name="ozmixm"/>
<var name="mminlu"/>
<var name="mminsc"/>
<var name="isice_lu"/>
<var name="iswater_lu"/>
<var name="xland"/>
Expand Down Expand Up @@ -4462,14 +4465,20 @@
<!-- ================================================================================================== -->

<var name="isltyp" type="integer" dimensions="nCells" units="unitless"
description="dominant soil category"/>
description="dominant soil texture category"/>

<var name="isctyp" type="integer" dimensions="nCells" units="unitless"
description="dominant soil colour category"/>

<var name="ivgtyp" type="integer" dimensions="nCells" units="unitless"
description="dominant vegetation category"/>

<var name="mminlu" type="text" dimensions="" units="unitless"
description="land use classification"/>

<var name="mminsc" type="text" dimensions="" units="unitless"
description="soil colour classification"/>

<var name="isice_lu" name_in_code="isice" type="integer" dimensions="" units="unitless" default_value="24"
description="Index category for snow/ice"/>

Expand Down
11 changes: 11 additions & 0 deletions src/core_atmosphere/mpas_atm_core.F
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ subroutine atm_mpas_init_block(dminfo, stream_manager, block, mesh, dt)
integer :: nCells, nEdges, nVertices, nVertLevels
integer :: thread
character(len=StrKIND), pointer :: mminlu
character(len=StrKIND), pointer :: mminsc

integer, pointer :: nThreads
integer, dimension(:), pointer :: cellThreadStart, cellThreadEnd
Expand Down Expand Up @@ -562,6 +563,16 @@ subroutine atm_mpas_init_block(dminfo, stream_manager, block, mesh, dt)
write(mminlu,'(a)') 'USGS'
end if

! Before calling physics_init, ensure that mminsc contains the name of the soil colour dataset
call mpas_pool_get_array(sfc_input, 'mminsc', mminsc)
if (len_trim(mminsc) == 0) then
call mpas_log_write('****************************************************************')
call mpas_log_write('No information on soil colour dataset is available.')
call mpas_log_write('Assume that we are using ''DEFAULT_RAD_NOAH''.')
call mpas_log_write('****************************************************************')
write(mminsc,'(a)') 'DEFAULT_RAD_NOAH'
end if


if (moist_physics) then
!initialization of some input variables in registry:
Expand Down
9 changes: 7 additions & 2 deletions src/core_atmosphere/physics/mpas_atmphys_driver_lsm.F
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ subroutine allocate_lsm
if(.not.allocated(cpm_p) ) allocate(cpm_p(ims:ime,jms:jme) )
if(.not.allocated(cqs2_p) ) allocate(cqs2_p(ims:ime,jms:jme) )
if(.not.allocated(isltyp_p) ) allocate(isltyp_p(ims:ime,jms:jme) )
if(.not.allocated(isctyp_p) ) allocate(isctyp_p(ims:ime,jms:jme) )
if(.not.allocated(ivgtyp_p) ) allocate(ivgtyp_p(ims:ime,jms:jme) )
if(.not.allocated(glw_p) ) allocate(glw_p(ims:ime,jms:jme) )
if(.not.allocated(grdflx_p) ) allocate(grdflx_p(ims:ime,jms:jme) )
Expand Down Expand Up @@ -216,6 +217,7 @@ subroutine deallocate_lsm
if(allocated(gsw_p) ) deallocate(gsw_p )
if(allocated(hfx_p) ) deallocate(hfx_p )
if(allocated(isltyp_p) ) deallocate(isltyp_p )
if(allocated(isctyp_p) ) deallocate(isctyp_p )
if(allocated(ivgtyp_p) ) deallocate(ivgtyp_p )
if(allocated(lai_p) ) deallocate(lai_p )
if(allocated(lh_p) ) deallocate(lh_p )
Expand Down Expand Up @@ -279,7 +281,7 @@ subroutine lsm_from_MPAS(configs,mesh,diag_physics,sfc_input,its,ite)
character(len=StrKIND),pointer:: config_microp_scheme, &
config_convection_scheme

integer,dimension(:),pointer:: isltyp,ivgtyp
integer,dimension(:),pointer:: isltyp,isctyp,ivgtyp

real(kind=RKIND),dimension(:),pointer :: acsnom,acsnow,canwat,chs,chs2,chklowq,cpm,cqs2,glw, &
grdflx,gsw,hfx,lai,lh,noahres,potevp,qfx,qgh,qsfc, &
Expand Down Expand Up @@ -336,6 +338,7 @@ subroutine lsm_from_MPAS(configs,mesh,diag_physics,sfc_input,its,ite)
call mpas_pool_get_array(diag_physics,'znt' ,znt )

call mpas_pool_get_array(sfc_input,'isltyp' ,isltyp )
call mpas_pool_get_array(sfc_input,'isctyp' ,isctyp )
call mpas_pool_get_array(sfc_input,'ivgtyp' ,ivgtyp )
call mpas_pool_get_array(sfc_input,'shdmin' ,shdmin )
call mpas_pool_get_array(sfc_input,'shdmax' ,shdmax )
Expand Down Expand Up @@ -409,6 +412,7 @@ subroutine lsm_from_MPAS(configs,mesh,diag_physics,sfc_input,its,ite)
znt_p(i,j) = znt(i)

isltyp_p(i,j) = isltyp(i)
isctyp_p(i,j) = isctyp(i)
ivgtyp_p(i,j) = ivgtyp(i)
shdmin_p(i,j) = shdmin(i)
shdmax_p(i,j) = shdmax(i)
Expand Down Expand Up @@ -490,7 +494,7 @@ subroutine lsm_to_MPAS(configs,mesh,diag_physics,sfc_input,its,ite)
!local pointers:
character(len=StrKIND),pointer:: config_microp_scheme

integer,dimension(:),pointer:: isltyp,ivgtyp
integer,dimension(:),pointer:: isltyp,isctyp,ivgtyp

real(kind=RKIND),dimension(:),pointer :: acsnom,acsnow,canwat,chs,chs2,chklowq,cpm,cqs2,glw, &
grdflx,gsw,hfx,lai,lh,noahres,potevp,qfx,qgh,qsfc, &
Expand Down Expand Up @@ -544,6 +548,7 @@ subroutine lsm_to_MPAS(configs,mesh,diag_physics,sfc_input,its,ite)
call mpas_pool_get_array(diag_physics,'znt' ,znt )

call mpas_pool_get_array(sfc_input,'isltyp' ,isltyp )
call mpas_pool_get_array(sfc_input,'isctyp' ,isctyp )
call mpas_pool_get_array(sfc_input,'ivgtyp' ,ivgtyp )
call mpas_pool_get_array(sfc_input,'shdmin' ,shdmin )
call mpas_pool_get_array(sfc_input,'shdmax' ,shdmax )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ subroutine lsm_noahmp_fromMPAS(configs,mesh,diag,diag_physics,diag_physics_noahm

integer:: i,its,ite
integer:: n,ns,nsoil,nsnow,nzsnow
integer,dimension(:),pointer:: isltyp,ivgtyp
integer,dimension(:),pointer:: isltyp,isctyp,ivgtyp

real(kind=RKIND),dimension(:),pointer:: latCell,lonCell
real(kind=RKIND),dimension(:),pointer:: shdmax,shdmin,vegfra,tmn,xice,xland
Expand Down
17 changes: 16 additions & 1 deletion src/core_atmosphere/physics/mpas_atmphys_lsm_noahinit.F
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ subroutine lsminit(dminfo,mesh,configs,diag_physics,sfc_input)
character(len=StrKIND),pointer:: mminlu,mminsl

integer,pointer:: nCells,nSoilLevels
integer,dimension(:),pointer:: ivgtyp,isltyp
integer,dimension(:),pointer:: ivgtyp,isltyp,isctyp

real(kind=RKIND),dimension(:),pointer:: snoalb,snow,snowh
real(kind=RKIND),dimension(:,:),pointer:: tslb,smois,sh2o
Expand All @@ -118,6 +118,7 @@ subroutine lsminit(dminfo,mesh,configs,diag_physics,sfc_input)
call mpas_pool_get_dimension(mesh,'nSoilLevels',nSoilLevels)

call mpas_pool_get_array(sfc_input,'isltyp', isltyp)
call mpas_pool_get_array(sfc_input,'isctyp', isctyp)
call mpas_pool_get_array(sfc_input,'ivgtyp', ivgtyp)
call mpas_pool_get_array(sfc_input,'sh2o' , sh2o )
call mpas_pool_get_array(sfc_input,'smois' , smois )
Expand Down Expand Up @@ -149,6 +150,20 @@ subroutine lsminit(dminfo,mesh,configs,diag_physics,sfc_input)
call physics_error_fatal("module_sf_noahlsm.F: lsminit: out of range value "// &
"of ISLTYP. Is this field in the input?" )

! Make sure all cells have reasonable soil colour indices.
errflag = 0
do iCell = 1, nCells
if(isctyp(iCell) < 1) then
errflag = 1
write(err_message,*) "module_sf_noahlsm.F: lsminit: out of range ISCTYP ", &
iCell,isctyp(iCell),isltyp(iCell),ivgtyp(iCell)
call physics_message(err_message)
endif
end do
if (errflag == 1) &
call physics_error_fatal("module_sf_noahlsm.F: lsminit: out of range value "// &
"of ISCTYP. Is this field in the input?" )

!initializes soil liquid water content SH2O:
do iCell = 1, nCells
bx = bb(isltyp(iCell))
Expand Down
10 changes: 9 additions & 1 deletion src/core_atmosphere/physics/mpas_atmphys_lsm_noahmpinit.F
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ subroutine init_lsm_noahmp(configs,mesh,clock,diag_physics,diag_physics_noahmp,o

!--- local variables and arrays:
character(len=StrKIND),pointer:: mminlu
character(len=StrKIND),pointer:: mminsc

integer:: ns

Expand Down Expand Up @@ -73,6 +74,10 @@ subroutine init_lsm_noahmp(configs,mesh,clock,diag_physics,diag_physics_noahmp,o
call mpas_pool_get_array(sfc_input,'mminlu',mminlu)
mpas_noahmp%llanduse = mminlu

!--- read NoahmpTable.TBL:
call mpas_pool_get_array(sfc_input,'mminsc',mminsc)
mpas_noahmp%lsoilcol = mminsc

!call mpas_log_write(' ')
!call mpas_log_write('--- enter subroutine NoahmpReadTable:')
call NoahmpReadTable(mpas_noahmp)
Expand Down Expand Up @@ -234,7 +239,7 @@ subroutine noahmp_init(configs,mesh,clock,diag_physics,diag_physics_noahmp,outpu
logical,pointer:: urban_physics

integer,pointer:: nsoilcomps
integer,dimension(:),pointer:: isltyp,ivgtyp
integer,dimension(:),pointer:: isltyp,isctyp,ivgtyp
integer,dimension(:),pointer:: isnowxy
integer,dimension(:),pointer:: irnumsi,irnummi,irnumfi

Expand Down Expand Up @@ -322,11 +327,14 @@ subroutine noahmp_init(configs,mesh,clock,diag_physics,diag_physics_noahmp,outpu
!--- initialization of time-invariant surface variables needed in subroutine NoahmpInitMain:
call mpas_pool_get_array(sfc_input,'dzs' ,dzs )
call mpas_pool_get_array(sfc_input,'isltyp',isltyp)
call mpas_pool_get_array(sfc_input,'isctyp',isctyp)
call mpas_pool_get_array(sfc_input,'ivgtyp',ivgtyp)

do i = its, ite
mpas_noahmp%isltyp(i) = isltyp(i)
mpas_noahmp%isctyp(i) = isctyp(i)
mpas_noahmp%ivgtyp(i) = ivgtyp(i)

enddo
do ns = 1, nsoil
mpas_noahmp%dzs(ns) = dzs(ns,its)
Expand Down
2 changes: 1 addition & 1 deletion src/core_atmosphere/physics/mpas_atmphys_update_surface.F
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ subroutine physics_update_sst(dminfo,config_frac_seaice,mesh,sfc_input,diag_phys

call mpas_pool_get_array(sfc_input,'isice' ,isice )
call mpas_pool_get_array(sfc_input,'iswater' ,iswater )
call mpas_pool_get_array(sfc_input,'isltyp' ,isltyp )
call mpas_pool_get_array(sfc_input,'isltyp' ,isltyp )
call mpas_pool_get_array(sfc_input,'ivgtyp' ,ivgtyp )
call mpas_pool_get_array(sfc_input,'landmask' ,landmask )
call mpas_pool_get_array(sfc_input,'vegfra' ,vegfra )
Expand Down
1 change: 1 addition & 0 deletions src/core_atmosphere/physics/mpas_atmphys_vars.F
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ module mpas_atmphys_vars

integer,dimension(:,:),allocatable:: &
isltyp_p, &!dominant soil type category [-]
isctyp_p, &!dominant soil colour category [-]
ivgtyp_p !dominant vegetation category [-]

real(kind=RKIND),dimension(:),allocatable:: &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@

- but in the file listed in the namelist as: HRLDAS_SETUP_FILE = "
- The initialization fields are: SNOW,CANWAT,TSK,TSLB,SMOIS
- This file also contains the static grid/domain information: XLAT,XLONG,TMN,HGT,SEAICE,MAPFAC_MX,MAPFAC_MY,SHDMAX,SHDMIN,XLAND,IVGTYP,ISLTYP,DZS,ZS
- This file also contains the static grid/domain information: XLAT,XLONG,TMN,HGT,SEAICE,MAPFAC_MX,MAPFAC_MY,SHDMAX,SHDMIN,XLAND,IVGTYP,ISLTYP,ISCTYP,DZS,ZS
- This file can also contains some optional fields: LAI
- NOTE: a WRF input file can be used as a HRLDAS_SETUP_FILE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ subroutine ConfigVarInTransfer(noahmp, NoahmpIO)
! config domain variable
noahmp%config%domain%SurfaceType = 1
noahmp%config%domain%NumSwRadBand = 2
noahmp%config%domain%SoilColor = 4
noahmp%config%domain%SoilColor = NoahmpIO%ISCTYP(I)
noahmp%config%domain%NumCropGrowStage = 8
noahmp%config%domain%FlagSoilProcess = NoahmpIO%calculate_soil
noahmp%config%domain%NumSoilTimeStep = NoahmpIO%soil_update_steps
Expand All @@ -75,6 +75,7 @@ subroutine ConfigVarInTransfer(noahmp, NoahmpIO)
noahmp%config%domain%SoilTimeStep = NoahmpIO%DTBL * NoahmpIO%soil_update_steps
noahmp%config%domain%GridSize = NoahmpIO%DX
noahmp%config%domain%LandUseDataName = NoahmpIO%LLANDUSE
noahmp%config%domain%SoilColDataName = NoahmpIO%LSOILCOL
noahmp%config%domain%VegType = NoahmpIO%IVGTYP(I)
noahmp%config%domain%CropType = NoahmpIO%CROPCAT(I)
noahmp%config%domain%IndicatorIceSfc = NoahmpIO%ICE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ subroutine NoahmpIOVarFinalizeDefault(NoahmpIO)
if ( allocated (NoahmpIO%zsoil) ) deallocate ( NoahmpIO%zsoil ) ! depth to soil interfaces [m]
if ( allocated (NoahmpIO%ivgtyp) ) deallocate ( NoahmpIO%ivgtyp ) ! vegetation type
if ( allocated (NoahmpIO%isltyp) ) deallocate ( NoahmpIO%isltyp ) ! soil type
if ( allocated (NoahmpIO%isctyp) ) deallocate ( NoahmpIO%isctyp ) ! soil colour class
if ( allocated (NoahmpIO%vegfra) ) deallocate ( NoahmpIO%vegfra ) ! vegetation fraction []
if ( allocated (NoahmpIO%tmn) ) deallocate ( NoahmpIO%tmn ) ! deep soil temperature [K]
if ( allocated (NoahmpIO%xland) ) deallocate ( NoahmpIO%xland ) ! =2 ocean; =1 land/seaice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ subroutine NoahmpIOVarInitDefault(NoahmpIO)
if ( .not. allocated (NoahmpIO%zsoil) ) allocate ( NoahmpIO%zsoil (1:nsoil ) ) ! depth to soil interfaces [m]
if ( .not. allocated (NoahmpIO%ivgtyp) ) allocate ( NoahmpIO%ivgtyp (its:ite ) ) ! vegetation type
if ( .not. allocated (NoahmpIO%isltyp) ) allocate ( NoahmpIO%isltyp (its:ite ) ) ! soil type
if ( .not. allocated (NoahmpIO%isctyp) ) allocate ( NoahmpIO%isctyp (its:ite ) ) ! soil colour class
if ( .not. allocated (NoahmpIO%vegfra) ) allocate ( NoahmpIO%vegfra (its:ite ) ) ! vegetation fraction []
if ( .not. allocated (NoahmpIO%tmn) ) allocate ( NoahmpIO%tmn (its:ite ) ) ! deep soil temperature [K]
if ( .not. allocated (NoahmpIO%xland) ) allocate ( NoahmpIO%xland (its:ite ) ) ! =2 ocean; =1 land/seaice
Expand Down Expand Up @@ -469,6 +470,7 @@ subroutine NoahmpIOVarInitDefault(NoahmpIO)
NoahmpIO%ice = undefined_int
NoahmpIO%ivgtyp = undefined_int
NoahmpIO%isltyp = undefined_int
NoahmpIO%isctyp = undefined_int
NoahmpIO%isnowxy = undefined_int
NoahmpIO%coszen = undefined_real
NoahmpIO%xlat = undefined_real
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ module NoahmpIOVarType
integer :: soil_update_steps ! number of model time steps to update soil process
integer, allocatable, dimension(:) :: ivgtyp ! vegetation type
integer, allocatable, dimension(:) :: isltyp ! soil type
integer, allocatable, dimension(:) :: isctyp ! soil colour class
real(kind=kind_noahmp), allocatable, dimension(:) :: coszen ! cosine zenith angle
real(kind=kind_noahmp), allocatable, dimension(:) :: xlat ! latitude [rad]
real(kind=kind_noahmp), allocatable, dimension(:,:) :: dz8w ! thickness of atmo layers [m]
Expand Down Expand Up @@ -516,6 +517,7 @@ module NoahmpIOVarType

CHARACTER(LEN=256) :: mminsl = 'STAS' ! soil classification
CHARACTER(LEN=256) :: llanduse ! (=USGS, using USGS landuse classification)
CHARACTER(LEN=256) :: lsoilcol ! (=Noah, using Noah's native soil colour classification)

!------------------------------------------------------------------------
! Timing:
Expand Down
Loading