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

to get a working version of 9-layer soil NoahMP #82

Open
HelinWei-NOAA opened this issue Jul 21, 2023 · 16 comments
Open

to get a working version of 9-layer soil NoahMP #82

HelinWei-NOAA opened this issue Jul 21, 2023 · 16 comments
Assignees

Comments

@HelinWei-NOAA
Copy link
Owner

the control_debug_p8 test failed and showed lots of complaints from the section of the soil moisture initialization code. I believe once this test passes, the restart test will pass too

@HelinWei-NOAA
Copy link
Owner Author

I have merged the current develop branch to Rongqian's ufs-noahmp-soil-level branch. There are some conflicts and bugs. I fixed them and the branch name is nsoil9

@HelinWei-NOAA
Copy link
Owner Author

@barlage Just test. Can you access this issue?

@HelinWei-NOAA
Copy link
Owner Author

The first complaint is from fv3atm_common_io.F90

140: At line 263 of file /scratch1/NCEPDEV/global/Helin.Wei/save/git/sync/nsoil9/ufs-weather-model/FV3/io/fv3atm_common_io.F90
140: Fortran runtime error: Index '5' of dimension 3 of array 'var3d' above upper bound of 4

I found the problem. "If" in line 1137 of fv3atm_sfc_io.F90 should change to "elseif"

@HelinWei-NOAA
Copy link
Owner Author

103: forrtl: severe (408): fort: (3): Subscript #1 of the array REFSMCNOAH has value 0 which is less than the lower bound of 1
103:
103: Image PC Routine Line Source
103: fv3.exe 00000000130992FF Unknown Unknown Unknown

The soil type is used as index for arrary REFSMCNOAH. For some reason, we did have soil type 0 cases.

@HelinWei-NOAA
Copy link
Owner Author

57: forrtl: error (75): floating point exception
57: Image PC Routine Line Source
57: fv3.exe 00000000130A258B Unknown Unknown Unknown
57: libpthread-2.17.s 00002B394E54F630 Unknown Unknown Unknown
57: fv3.exe 000000001141BBCF module_mp_soil_in 80 module_mp_soil_init.f90
57: fv3.exe 000000000FD1324F noahmpdrv_mp_noah 1933 noahmpdrv.F90

@HelinWei-NOAA
Copy link
Owner Author

With some fixes the control_debug_p8 still failed. However the restart RT ran to the completion and the results were indentical except for one parameter nsoil. nsoil is 4 in the control output files while 9 in the restart outputs.

@barlage
Copy link
Collaborator

barlage commented Jul 24, 2023

@HelinWei-NOAA yes, I can see it.

@HelinWei-NOAA
Copy link
Owner Author

@RongqianYang-NOAA Some issues from init_soil_3_mp. zs is the input soil layer depth, zhave is the output soil layer depth. Both are not right from printouts.

134: num_soil_layers= 9 4 9
134: zs= 1.000000000000000E-002 4.000000000000000E-002 0.100000000000000
134: 0.300000000000000 0.600000000000000 1.00000000000000
134: 1.60000000000000 3.00000000000000 4.56000000000000
134: zhave= 0.000000000000000E+000 5.000000000000000E-002 0.250000000000000
134: 0.700000000000000 1.50000000000000 3.00000000000000
134: NaN NaN NaN

@HelinWei-NOAA
Copy link
Owner Author

@RongqianYang-NOAA For control_p8_debug, should lsoil_lsm be set to 9? If lsoil_lsm is set to 4, the test can go through.

@RongqianYang-NOAA
Copy link
Collaborator

Should be 9. I just checked the runs I mentioned, '4' is used, even I set to '9' in the regression RUN file.

@RongqianYang-NOAA
Copy link
Collaborator

It appears there is a problem with the dimension of 'zhave'. Trying to figure it out now.

@HelinWei-NOAA
Copy link
Owner Author

@RongqianYang-NOAA zhave is the input soil layer depth. If we use 4-layer noah, it is supposed to be 4. But you allocate the max of lsoil and lsoil_lsm (here is 9) to it.
zhave(1)=0
DO l = 1 , num_st_levels_input
zhave(l+1) = st_levels_input(l) / 100.
END DO
zhave(num_st_levels_input+2) = 300. / 100.

So you have given the value up to 6 levels. For index 7-9, the is no value given(NaN from printout). However in the code you have used the value at the 7th level

  z_wantt_2 : do lwant = 1 , num_soil_layers
     z_havet_2 : do lhave = 1 , num_st_levels_input +2
        if ( ( zs(lwant) .ge. zhave(lhave  ) ) .and. &
             ( zs(lwant) .le. zhave(lhave+1) ) ) then

zhave(ihave+1), so it is looking for the value zhave(num_st_levels_input +2 +1), which is undefined. That's the cause of the crash.

@RongqianYang-NOAA
Copy link
Collaborator

The value of 'zhave' in the code is more than just 4 or only for the Noah LSM. It includes potentially 6 (the old version of cycled RUC), 9 (the recent version of RUC), and 4 (in the case of Noah) in the regional SRW IC (lsoil or lsoil_lsm values). It considers Noah and Non-Noah ICes and the potential use for restart flag. It involves "level" to "level" interpolation (e.g., RUC with different vertical levels), and "layer" to "level" (from Noah to RUC). 'zhave' needs to be flexible. 'NaN' is OK as long as you don't use it. The reason the model did not crash in non-debugging mode is because the elements of the allocated array are assigned numerically to 9999E20 (or similar) instead of "NaN". I am checking the code now to see what is going on. It is possible to have a bug when dealing with "layer" to "level"/"layer" indexing as the Noah MP has an extra layer at the bottom and we're actually doing "layer" to "layer" interpolation.

Disclaimer: I did not invent the code, it is a simplified and combined version of codes in the module_soil_pre.F90 and module_sf_ruclsm.F90 (rucinit part).

@RongqianYang-NOAA
Copy link
Collaborator

Just tested the FV3_HRRR suite (using the same control_debug_p8 conf, but running 'control_hrrr' and adding the print statement of 'zs' and 'zhave' in 'module_soil_pre.F90'), where only 'module_soil_pre.F90' and 'lsm_ruc.F90' are involved (does not have Noah MP related code and my addons). It also uses "num_st_levels_input +2" (around line 222) in "module_soil_pre.F0'. But the model can go through. Edited output looks like:

540 0: RUC Land Surface Model used
541 0: The Physics options are
542 0: mosaic_lu = 0
543 0: mosaic_soil = 0
544 0: isncond_opt = 1
545 0: isncovr_opt = 1

1203 83: num_soil_layers= 9 4 9
1204 83: zs= 0.000000000000000E+000 1.000000000000000E-002 4.000000000000000E-002
1205 83: 0.100000000000000 0.300000000000000 0.600000000000000
1206 83: 1.00000000000000 1.60000000000000 3.00000000000000
1207 83: zhave= 0.000000000000000E+000 5.000000000000000E-002 0.250000000000000
1208 83: 0.700000000000000 1.50000000000000 3.00000000000000
1209 83: NaN NaN NaN

Compared to the previous post:

1203 83: num_soil_layers= 9 4 9
1204 83: zs= 0.000000000000000E+000 1.000000000000000E-002 4.000000000000000E-002
1205 83: 0.100000000000000 0.300000000000000 0.600000000000000
1206 83: 1.00000000000000 1.60000000000000 3.00000000000000
1207 83: zhave= 0.000000000000000E+000 5.000000000000000E-002 0.250000000000000
1208 83: 0.700000000000000 1.50000000000000 3.00000000000000
1209 83: NaN NaN NaN

The printouts are the same. 'NaN' does not matter in 'zhave'. There is something else causes the crash. Still checking.

@RongqianYang-NOAA
Copy link
Collaborator

The font does not show up correctly. My apology.

@HelinWei-NOAA
Copy link
Owner Author

HelinWei-NOAA commented Aug 24, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants