WRF
WRF copied to clipboard
Bug for determining the use of urban LCZ parameter table
https://github.com/wrf-model/WRF/blob/21c72141142fc6c8d203d2bf79f1990e45a0aef8/phys/module_physics_init.F#L3355
max_utype_urb2d = maxval(UTYPE_URB2D)*1.0
#if ( defined( DM_PARALLEL ) && ( ! defined( STUBMPI ) ) )
max_utype_urb2d = wrf_dm_max_real(max_utype_urb2d)
#endif
IF (config_flags%use_wudapt_lcz.eq.0 .and. max_utype_urb2d.gt.3.0) THEN !new LCZ
CALL wrf_error_fatal &
('USING 10 WUDAPT LCZ WITHOUT URBPARM_LCZ.TBL. SET USE_WUDAPT_LCZ=1')
ENDIF
IF (config_flags%use_wudapt_lcz.eq.1 .and. max_utype_urb2d.le.3.0) THEN ! new LCZ
CALL wrf_error_fatal &
('USING URBPARM_LCZ.TBL WITH OLD 3 URBAN CLASSES. SET USE_WUDAPT_LCZ=0')
ENDIF
The above code is not always correct. For example, if the WRF study domain only has less than 3 LCZ types, then the max_utype_urb2d will be <3 and then if users activate use_wudapt_lcz in namelist, the model will give an error stating that users need to deactivate the LCZ.
A possible fix would be replace the max_utype_urb2d calculation with the following max_landtype:
max_landtype = maxval(IVGTYP)*1.0
#if ( defined( DM_PARALLEL ) && ( ! defined( STUBMPI ) ) )
max_landtype = wrf_dm_max_real(max_landtype)
#endif
IF (config_flags%use_wudapt_lcz .eq. 0 .and. max_landtype .gt. 50.0) THEN !new LCZ
CALL wrf_error_fatal &
('USING 10 WUDAPT LCZ WITHOUT URBPARM_LCZ.TBL. SET USE_WUDAPT_LCZ=1')
ENDIF
IF (config_flags%use_wudapt_lcz .eq. 1 .and. max_landtype .le. 50.0) THEN ! new LCZ
CALL wrf_error_fatal &
('USING URBPARM_LCZ.TBL WITH OLD 3 URBAN CLASSES. SET USE_WUDAPT_LCZ=0')
ENDIF
Note that all LCZ numbers have IVGTYP values of 51~61, so we can use the above if-statement to decide if LCZ data is used in the input data.
@andreazonato , what do you think?
Hi @cenlinhe You are definitely right. Actually I never faced this problem, and rarely LCZ are <3. But I guess for some particular case it can happen.
Thank you!
@andreazonato do you want to submit a PR to fix this or do you want me to do it?
Hi, Thank you for this answer. I actually face the same error when running WRF.exe with set use wudapt=1 Except I have more than 3 classes in my study case but i do not have LCZ 1, 10 and 11.
I let the non existant classes on urbparam_lcz files with default values, could it be an answer?
I try to replace the above code with the suggestion but i still have the same error:
-------------- FATAL CALLED --------------- USING URBPARM_LCZ.TBL WITH OLD 3 URBAN CLASSES. SET USE_WUDAPT_LCZ=0 -------------------------------------------
I try to set use wudapt = 0 but i have the other error possible:
-------------- FATAL CALLED --------------- USING 10 WUDAPT LCZ WITHOUT URBPARM_LCZ.TBL. SET USE_WUDAPT_LCZ=1 -------------------------------------------
So wrf simultaneously recognized i have only 3 urban classes and 10 wudapt lcz classes?
I don't understand where is the problem. I use wudapt to generate an LCZ map and inject into WPS tool before running real.exe with success but not wrf.
Thank you for your help or suggestion!
Magalie.
@magalietecher Which WRF version did you use? After WRF v4.4.2, the LCZ number in WRF system is changed from 31-41 to 51-61 to avoid overlapping with NLCD 40-land-category numbers. So please check your WRF version and your LCZ map in your input file. As far as I know, if you use the external LCZ tool to generate the LCZ map, they produce 31~41 for LCZ, which may be the reason for your model error.
Hello and thank you for your answer. I am currently working on WRF and WPS V4.3. The LCZ Map i use is classified in 31-41. I have seen this suggestion in another issue and tried to apply them but i have the same errors as mentioned above..
OK, if you are using the V4.3, then change the "max_landtype .gt. 50.0" and "max_landtype .le. 50.0" in the above fix to "max_landtype .gt. 30.0" and "max_landtype .le. 30.0" to see if it solves the problem.
Hi, Thank you for this suggestion, I tried it with these modifications: max_landtype = maxval(IVGTYP)*1.0 #if ( defined( DM_PARALLEL ) && ( ! defined( STUBMPI ) ) ) max_landtype = wrf_dm_max_real(max_landtype) #endif IF (config_flags%use_wudapt_lcz .eq. 0 .and. max_landtype .gt. 30.0) THEN !new LCZ CALL wrf_error_fatal & ('USING 10 WUDAPT LCZ WITHOUT URBPARM_LCZ.TBL. SET USE_WUDAPT_LCZ=1') ENDIF IF (config_flags%use_wudapt_lcz .eq. 1 .and. max_landtype .le. 30.0) THEN ! new LCZ CALL wrf_error_fatal & ('USING URBPARM_LCZ.TBL WITH OLD 3 URBAN CLASSES. SET USE_WUDAPT_LCZ=0') ENDIF
And unfortunately, i still have the same error as the picture joined..
Can you print out the variable values for "IVGTYP" and "max_landtype" before "IF (config_flags%use_wudapt_lcz .eq. 0 .and. max_landtype .gt. 30.0) THEN !new LCZ"?
I'm sorry, i'm novice so i'm really not sure I understand your demand. I remove those two lines from the file:
max_landtype = maxval(IVGTYP)*1.0 max_landtype = wrf_dm_max_real(max_landtype)
Is that what you want?
I rerun wrf.exe and it failed again.
no, I want to know the value of IVGTYP and max_landtype at the place where your model crashed to diagnose what is wrong. So please add the print-out code below before "IF (config_flags%use_wudapt_lcz .eq. 0 .and. max_landtype .gt. 30.0) THEN !new LCZ": print*, 'max_landtype = ', max_landtype
@andreazonato do you want to submit a PR to fix this or do you want me to do it?
I guess there is something else going on, let's solve this issue first
I'm sorry, i'm novice so i'm really not sure I understand your demand. I remove those two lines from the file:
max_landtype = maxval(IVGTYP)*1.0 max_landtype = wrf_dm_max_real(max_landtype)
Is that what you want?
I rerun wrf.exe and it failed again.
Hi Magalie. So I'm wondering how many LCZ you actually find in your domain (more than 3 I guess) and if num_land_cat is set=41 . This could in case be the issue.
Andrea
Hi, Thank you again for your help. Update, I finally find where was the error. I have previously modified the LCZ classes and did not check my geogrid files generated by w2w. The file contained 41 classes but did not have any when i check the lu_index so wrf.exe crash systematically when use_wudapt_lcz was set to 1.
I regenerated another geogrid file, check if lu_index was correct and wrf.exe is actually simulating output. So it was more an issue with w2w output and modifying geogrid file than wrf.exe.
I think i may search if there is an already open issue on a way to modify geogrid file or open it.
Thank you again, Magalie
Hi all:
I am having the same problem here. Everything works fine with met_em using WPS/WRF combo v4.3.1 but getting this problem now with WRF v4.5.1. Now, I will check if things improve rerunning using latest w2w and WPS tools geogrib, met_em from v4.5.1.
Hi @cenlinhe
Could you help me with this bug? With WRF 4.5.2, I have this message: USING URBPARM_LCZ.TBL WITH OLD 3 URBAN CLASSES. SET USE_WUDAPT_LCZ=0 I supposed that the w2w output is correct (please see figure attached). There are 39 classes because the region doesn't have classes 1 and 11). I also attached the namelist.input and a screenshot
Thank you so much. Vladimir.
Hi Vladimir, please re-number your LCZ categories to 51-61 for the corresponding 1-11 LCZ types. After WRF v4.4.2, the LCZ number in WRF system is changed from 31-41 to 51-61 to avoid overlapping with NLCD 40-land-category numbers. So please check revise your LCZ number in your input file. If you use the external w2w LCZ tool to generate the LCZ map, they produce 31~41 for LCZ, which may be the reason for your model error.
Hi @cenlinhe
Thank you for your reply. After your comment, I tried to apply the CGLC-MODIS-LCZ dataset that considers 51-61 classes. With this, Wrf runs successfully.
Best regards, Vladimir
Hi, I got the same problem as " USING URBPARM_LCZ.TBL WITH OLD 3 URBAN CLASSES. SET USE_WUDAPT_LCZ=0", i have used the w2w LCZ tool to generate LCZ map, @VladimirSobral can you please explain how you solve this, did you rename the classes of geo_em.d0X.nc file?
Hi, i had the same problem with WRF 4.4. If it could help, i modify the geogrid file (lu_index, landusef and Land cat) instead of 31-41 with 51-61 LCZ classes with ncdump and ncgen. It takes some time but i tested it, metgrib, real.exe and WRF.exe works fine. I Hope it helped.
Magalie
Hi Magalie, Thank you very much for the suggestion and time. I am using the latest version of WRF (4.5.1), and I have tried to modify the lu_index, and landusef and still got the error (I can run metgrib, real.exe but fails to run WRF.exe.).
@ss0293 you should try to use CGLC-MODIS-LCZ in the WPS while running the geogrid.exe, so you probably don't need to change the lu_index number
Hi @ss0293
I have preferred to use CGLC-MODIS-LCZ, as @tslin2 mentioned, instead of the w2w LCZ tool. There will be a WRF-integrated version of W2W in the future, so it could be easier to use.