Skip to content

Commit 523cccf

Browse files
committed
fix more surface initialization stuff
1 parent e14ce20 commit 523cccf

File tree

2 files changed

+76
-37
lines changed

2 files changed

+76
-37
lines changed

scm/src/scm_input.F90

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ subroutine get_case_init(scm_state, scm_input)
381381
real(kind=dp) :: input_sfalb_ice
382382
real(kind=dp) :: input_emis_ice
383383
real(kind=dp) :: input_lai !< leaf area index for RUC LSM
384+
real(kind=dp) :: input_snodi
385+
real(kind=dp) :: input_weasdi
384386

385387
real(kind=dp), allocatable :: input_tslb(:) !< soil temperature for RUC LSM (K)
386388
real(kind=dp), allocatable :: input_smois(:) !< volume fraction of soil moisture for RUC LSM (frac)
@@ -695,6 +697,8 @@ subroutine get_case_init(scm_state, scm_input)
695697
call NetCDF_read_var(grp_ncid, "sfalb_lnd_bck", .False., input_sfalb_lnd_bck)
696698
call NetCDF_read_var(grp_ncid, "emis_ice", .False., input_emis_ice)
697699
call NetCDF_read_var(grp_ncid, "lai", .False., input_lai)
700+
call NetCDF_read_var(grp_ncid, "snodi", .False., input_snodi)
701+
call NetCDF_read_var(grp_ncid, "weasdi", .False., input_weasdi)
698702

699703
!> - Read in the forcing data.
700704

@@ -937,6 +941,8 @@ subroutine get_case_init(scm_state, scm_input)
937941
scm_input%input_sfalb_lnd_bck = input_sfalb_lnd_bck
938942
scm_input%input_emis_ice = input_emis_ice
939943
scm_input%input_lai = input_lai
944+
scm_input%input_snodi = input_snodi
945+
scm_input%input_weasdi = input_weasdi
940946

941947
if (scm_state%runtime_mult /= 1.0) then
942948
scm_state%runtime = scm_state%runtime*scm_state%runtime_mult
@@ -1140,6 +1146,8 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
11401146
real(kind=dp), allocatable :: input_sfalb_lnd_bck(:) !<
11411147
real(kind=dp), allocatable :: input_sfalb_ice(:) !<
11421148
real(kind=dp), allocatable :: input_emis_ice(:) !<
1149+
real(kind=dp), allocatable :: input_snodi(:)
1150+
real(kind=dp), allocatable :: input_weasdi(:)
11431151

11441152
! forcing variables
11451153
real(kind=sp), allocatable :: input_force_pres_surf(:) !< forcing surface pressure (Pa)
@@ -1501,6 +1509,8 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
15011509
input_sfalb_lnd_bck ( input_n_init_times), &
15021510
input_sfalb_ice ( input_n_init_times), &
15031511
input_emis_ice ( input_n_init_times), &
1512+
input_snodi ( input_n_init_times), &
1513+
input_weasdi ( input_n_init_times), &
15041514
stat=allocate_status)
15051515

15061516
needed_for_lsm_ics = .False.
@@ -1837,6 +1847,8 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
18371847
call NetCDF_read_var(ncid, "sfalb_lnd_bck", .False., input_sfalb_lnd_bck)
18381848
call NetCDF_read_var(ncid, "emis_ice", .False., input_emis_ice)
18391849
call NetCDF_read_var(ncid, "lai", .False., input_lai)
1850+
call NetCDF_read_var(ncid, "snodi", .False., input_snodi)
1851+
call NetCDF_read_var(ncid, "weasdi", .False., input_weasdi)
18401852

18411853

18421854
call check(NF90_CLOSE(NCID=ncid),"nf90_close()")
@@ -2127,6 +2139,8 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
21272139
scm_state%sfc_type = 0.0
21282140
else if (input_SurfaceType == 'land') then
21292141
scm_state%sfc_type = 1.0
2142+
else if (input_SurfaceType == 'ice') then
2143+
scm_state%sfc_type = 2.0
21302144
end if
21312145
!no sea ice type?
21322146

@@ -2343,6 +2357,8 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
23432357
scm_input%input_sfalb_lnd = input_sfalb_lnd(active_init_time)
23442358
scm_input%input_sfalb_lnd_bck = input_sfalb_lnd_bck(active_init_time)
23452359
scm_input%input_emis_ice = input_emis_ice(active_init_time)
2360+
scm_input%input_snodi = input_snodi(active_init_time)
2361+
scm_input%input_weasdi = input_weasdi(active_init_time)
23462362
end if
23472363

23482364
if (input_surfaceForcingWind == 'z0') then

scm/src/scm_type_defs.F90

Lines changed: 60 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ module scm_type_defs
341341
real(kind=dp) :: input_sfalb_ice !<
342342
real(kind=dp) :: input_emis_ice !<
343343
real(kind=dp) :: input_lai !< leaf area index for RUC LSM
344+
real(kind=dp) :: input_snodi
345+
real(kind=dp) :: input_weasdi
344346

345347
real(kind=dp), allocatable :: input_tslb(:) !< soil temperature for RUC LSM (K)
346348
real(kind=dp), allocatable :: input_smois(:) !< volume fraction of soil moisture for RUC LSM (frac)
@@ -850,6 +852,8 @@ subroutine scm_input_create(scm_input, ntimes, nlev, nsoil, nsnow, nice, nvegcat
850852
scm_input%input_sfalb_lnd_bck = real_zero
851853
scm_input%input_emis_ice = real_zero
852854
scm_input%input_lai = real_zero !< leaf area index for RUC LSM
855+
scm_input%input_snodi = real_zero
856+
scm_input%input_weasdi = real_zero
853857

854858
allocate(scm_input%input_tslb(nsoil), scm_input%input_smois(nsoil), scm_input%input_sh2o(nsoil), &
855859
scm_input%input_smfr(nsoil), scm_input%input_flfr(nsoil))
@@ -1076,8 +1080,8 @@ subroutine physics_set(physics, scm_input, scm_state)
10761080
!since landfrac and lakefrac are read in with the orographic data (here and in FV3GFS_io), we need to set their values
10771081
!to -999.9 when only LSM ICs are available in order for some of the logic below to work as intended.
10781082
if (scm_state%lsm_ics) then
1079-
physics%Sfcprop%landfrac(i) = -999.9
1080-
physics%Sfcprop%lakefrac(i) = -999.9
1083+
physics%Sfcprop%landfrac(i) = missing_value
1084+
physics%Sfcprop%lakefrac(i) = missing_value
10811085
end if
10821086
!
10831087
! Orographical data (2D)
@@ -1222,7 +1226,7 @@ subroutine physics_set(physics, scm_input, scm_state)
12221226
! Derive physics quantities using surface model ICs.
12231227
!
12241228
if(scm_state%model_ics .or. scm_state%lsm_ics) then
1225-
if (physics%Sfcprop%stype(i) == 14 .or. physics%Sfcprop%stype(i)+0.5 <= 0) then
1229+
if (physics%Sfcprop%stype(i) == 14 .or. physics%Sfcprop%stype(i) <= 0) then
12261230
physics%Sfcprop%landfrac(i) = real_zero
12271231
physics%Sfcprop%stype(i) = 0
12281232
if (physics%Sfcprop%lakefrac(i) > real_zero) then
@@ -1231,7 +1235,7 @@ subroutine physics_set(physics, scm_input, scm_state)
12311235
endif
12321236

12331237
if (physics%Model%frac_grid) then
1234-
if (physics%Sfcprop%landfrac(i) > -999.0_dp) then
1238+
if (.not. is_missing_value(physics%Sfcprop%landfrac(i))) then
12351239
physics%Sfcprop%slmsk(i) = ceiling(physics%Sfcprop%landfrac(i)-1.0e-6)
12361240
if (physics%Sfcprop%slmsk(i) == 1 .and. physics%Sfcprop%stype(i) == 14) &
12371241
physics%Sfcprop%slmsk(i) = 0
@@ -1275,7 +1279,7 @@ subroutine physics_set(physics, scm_input, scm_state)
12751279
endif
12761280
endif
12771281
else ! not a fractional grid
1278-
if (physics%Sfcprop%landfrac(i) > -999.0_dp) then
1282+
if (.not. is_missing_value(physics%Sfcprop%landfrac(i))) then
12791283
if (physics%Sfcprop%lakefrac(i) > real_zero) then
12801284
physics%Sfcprop%oceanfrac(i) = real_zero
12811285
physics%Sfcprop%landfrac(i) = real_zero
@@ -1319,7 +1323,6 @@ subroutine physics_set(physics, scm_input, scm_state)
13191323
endif
13201324
endif
13211325
end if
1322-
13231326
!
13241327
! NSSTM variables
13251328
!
@@ -1394,7 +1397,7 @@ subroutine physics_set(physics, scm_input, scm_state)
13941397
! Compute surface fields that may/maynot present in model IC files.
13951398
!
13961399
if (scm_state%model_ics .or. scm_state%lsm_ics) then
1397-
if (scm_input%input_snodl <= real_zero) then
1400+
if (is_missing_value(scm_input%input_snodl) .or. scm_input%input_snodl == real_zero) then
13981401
if (physics%Sfcprop%landfrac(i) > real_zero) then
13991402
tem = real_one / physics%Sfcprop%landfrac(i)
14001403
physics%Sfcprop%snodl(i) = physics%Sfcprop%snowd(i) * tem
@@ -1403,34 +1406,60 @@ subroutine physics_set(physics, scm_input, scm_state)
14031406
endif
14041407
end if
14051408

1406-
if (scm_input%input_weasdl <= real_zero) then
1409+
if (is_missing_value(scm_input%input_weasdl) .or. scm_input%input_weasdl == real_zero) then
14071410
if (physics%Sfcprop%landfrac(i) > real_zero) then
1408-
tem = real_one / physics%Sfcprop%landfrac(i)
1411+
tem = real_one / (physics%Sfcprop%fice(i)*(real_one - physics%Sfcprop%landfrac(i)) + physics%Sfcprop%landfrac(i))
14091412
physics%Sfcprop%weasdl(i) = physics%Sfcprop%weasd(i) * tem
14101413
else
14111414
physics%Sfcprop%weasdl(i) = real_zero
14121415
endif
14131416
end if
14141417
end if
14151418

1416-
if (scm_input%input_tsfcl <= real_zero) then
1419+
if (is_missing_value(scm_input%input_tsfcl) .or. scm_input%input_tsfcl == real_zero) then
14171420
physics%Sfcprop%tsfcl(i) = physics%Sfcprop%tsfco(i) !--- compute tsfcl from existing variables
14181421
end if
14191422

1420-
if (scm_input%input_zorlw <= real_zero) then
1423+
if (is_missing_value(scm_input%input_zorlw) .or. scm_input%input_zorlw == real_zero) then
14211424
physics%Sfcprop%zorlw(i) = physics%Sfcprop%zorl(i) !--- compute zorlw from existing variables
14221425
end if
14231426

1424-
if (scm_input%input_zorll <= real_zero) then
1427+
if (is_missing_value(scm_input%input_zorll) .or. scm_input%input_zorll == real_zero) then
14251428
physics%Sfcprop%zorll(i) = physics%Sfcprop%zorl(i) !--- compute zorll from existing variables
14261429
end if
14271430

1428-
if (scm_input%input_zorli <= real_zero) then
1431+
if (is_missing_value(scm_input%input_zorli) .or. scm_input%input_zorli == real_zero) then
14291432
physics%Sfcprop%zorli(i) = physics%Sfcprop%zorl(i) !--- compute zorli from existing variables
14301433
end if
14311434

1435+
if (is_missing_value(scm_input%input_emis_ice) .or. scm_input%input_emis_ice == real_zero) then
1436+
physics%Sfcprop%emis_ice(i) = 0.96
1437+
end if
1438+
1439+
if (((is_missing_value(scm_input%input_sncovr_ice) .or. scm_input%input_sncovr_ice == real_zero)) .and. physics%Model%lsm /= physics%Model%lsm_ruc) then
1440+
physics%Sfcprop%sncovr_ice(i) = real_zero
1441+
end if
1442+
1443+
if (is_missing_value(scm_input%input_snodi) .or. scm_input%input_snodi == real_zero) then
1444+
if (physics%Sfcprop%fice(i) > real_zero) then
1445+
tem = real_one / (physics%Sfcprop%fice(i)*(real_one-physics%Sfcprop%landfrac(i))+physics%Sfcprop%landfrac(i))
1446+
physics%Sfcprop%snodi(i) = min(physics%Sfcprop%snowd(i) * tem, 3.0)
1447+
else
1448+
physics%Sfcprop%snodi(i) = real_zero
1449+
endif
1450+
end if
1451+
1452+
if (is_missing_value(scm_input%input_weasdi) .or. scm_input%input_weasdi == real_zero) then
1453+
if (physics%Sfcprop%fice(i) > real_zero) then
1454+
tem = real_one / (physics%Sfcprop%fice(i)*(real_one-physics%Sfcprop%landfrac(i))+physics%Sfcprop%landfrac(i))
1455+
physics%Sfcprop%weasdi(i) = physics%Sfcprop%weasd(i)*tem
1456+
else
1457+
physics%Sfcprop%weasdi(i) = real_zero
1458+
endif
1459+
end if
1460+
14321461
if (physics%Model%use_cice_alb) then
1433-
if (scm_input%input_albdirvis_ice <= real_zero) then
1462+
if (is_missing_value(scm_input%input_albdirvis_ice) .or. scm_input%input_albdirvis_ice == real_zero) then
14341463
if (physics%Sfcprop%oceanfrac(i) > real_zero .and. &
14351464
physics%Sfcprop%fice(i) >= physics%Model%min_seaice) then
14361465
physics%Sfcprop%albdirvis_ice(i) = 0.6_dp
@@ -1441,34 +1470,28 @@ subroutine physics_set(physics, scm_input, scm_state)
14411470
endif
14421471
endif
14431472

1444-
if (scm_input%input_zorlwav <= real_zero) then
1473+
if (is_missing_value(scm_input%input_zorlwav) .or. scm_input%input_zorlwav == real_zero) then
14451474
physics%Sfcprop%zorlwav(i) = physics%Sfcprop%zorlw(i) !--- compute zorlwav from existing variables
14461475
end if
1447-
1448-
if(physics%Model%frac_grid .and. (scm_state%model_ics .or. scm_state%lsm_ics) ) then ! 3-way composite
1449-
if( physics%Model%phour < 1.e-7) physics%Sfcprop%tsfco(i) = max(con_tice, physics%Sfcprop%tsfco(i))
1450-
tem1 = real_one - physics%Sfcprop%landfrac(i)
1451-
tem = tem1 * physics%Sfcprop%fice(i) ! tem = ice fraction wrt whole cell
1452-
physics%Sfcprop%zorl(i) = physics%Sfcprop%zorll(i) * physics%Sfcprop%landfrac(i) &
1453-
+ physics%Sfcprop%zorli(i) * tem &
1454-
+ physics%Sfcprop%zorlw(i) * (tem1-tem)
1455-
1456-
physics%Sfcprop%tsfc(i) = physics%Sfcprop%tsfcl(i) * physics%Sfcprop%landfrac(i) &
1457-
+ physics%Sfcprop%tisfc(i) * tem &
1458-
+ physics%Sfcprop%tsfco(i) * (tem1-tem)
1459-
else
1460-
if (physics%Sfcprop%slmsk(i) == 1) then
1461-
physics%Sfcprop%zorl(i) = physics%Sfcprop%zorll(i)
1476+
1477+
if (is_missing_value(scm_input%input_tsfc) .or. scm_input%input_tsfc == real_zero) then
1478+
if(physics%Model%frac_grid) then
1479+
physics%Sfcprop%tsfco(i) = max(con_tice, physics%Sfcprop%tsfco(i))
1480+
tem1 = real_one - physics%Sfcprop%landfrac(i)
1481+
tem = tem1 * physics%Sfcprop%fice(i) ! tem = ice fraction wrt whole cell
1482+
physics%Sfcprop%tsfc(i) = physics%Sfcprop%tsfcl(i) * physics%Sfcprop%landfrac(i) &
1483+
+ physics%Sfcprop%tisfc(i) * tem &
1484+
+ physics%Sfcprop%tsfco(i) * (tem1-tem)
1485+
else
1486+
if (physics%Sfcprop%slmsk(i) == 1) then
14621487
physics%Sfcprop%tsfc(i) = physics%Sfcprop%tsfcl(i)
1463-
else
1488+
else
14641489
tem = real_one - physics%Sfcprop%fice(i)
1465-
physics%Sfcprop%zorl(i) = physics%Sfcprop%zorli(i) * physics%Sfcprop%fice(i) &
1466-
+ physics%Sfcprop%zorlw(i) * tem
1467-
14681490
physics%Sfcprop%tsfc(i) = physics%Sfcprop%tisfc(i) * physics%Sfcprop%fice(i) &
1469-
+ physics%Sfcprop%tsfco(i) * tem
1470-
endif
1471-
endif ! if (Model%frac_grid)
1491+
+ physics%Sfcprop%tsfco(i) * tem
1492+
endif
1493+
end if
1494+
end if
14721495

14731496
if (scm_state%model_ics .and. check_missing(scm_input%input_tiice)) then
14741497
physics%Sfcprop%tiice(i,1) = physics%Sfcprop%stc(i,1) !--- initialize internal ice temp from soil temp at layer 1

0 commit comments

Comments
 (0)