Why module_initialize_ideal.F does not take effect?

Topics related to running an idealized case
Post Reply
Xiaoxingyun
Posts: 25
Joined: Thu Nov 19, 2020 12:39 pm

Why module_initialize_ideal.F does not take effect?

Post by Xiaoxingyun » Fri Nov 20, 2020 11:36 am

Dear all,

I didn't change any of the codes and the namelist after compilation. But I find the module_initialize_ideal.F cannot correctly set the central latitude.

I find the default central latitude should be 40 according to the statement CALL nl_set_cen_lat(1,40.) in the module_initialize_ideal.F in WRF 4.2.1 (or module_initialize_les.F in WRF 3.5.1 ) of the official em_les test. As shown in the Figure 1.
Figure 1.jpg
But the actual central latitude in the wrfinput_d01 of the official em_les test produced via running ideal.exe is still 0. As shown in Figure 2.
figure 2.jpg
Any suggestion to solve this problem?

Besides, does anyone know how to set mminlu, LU_INDEX, and ISLTYP in the em_les ideal case before running ideal.exe?

Many thank in advance.

Ming Chen
Posts: 1588
Joined: Mon Apr 23, 2018 9:42 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Ming Chen » Mon Nov 23, 2020 7:19 pm

Despite the specification in the initialization, the center lat and lon values are later respecified to values in namelist. Please see the code inc/nl_config.inc


SUBROUTINE nl_get_cen_lat ( id_id , cen_lat )
USE module_configure, ONLY : model_config_rec
real , INTENT(OUT) :: cen_lat
INTEGER id_id
cen_lat = model_config_rec%cen_lat(id_id)
RETURN


Note that the default values for lat/lon are 0. This is why you see zero values in wrfinput.
WRF Help Desk

Xiaoxingyun
Posts: 25
Joined: Thu Nov 19, 2020 12:39 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Xiaoxingyun » Wed Nov 25, 2020 2:39 am

Ming Chen wrote:
Mon Nov 23, 2020 7:19 pm
Despite the specification in the initialization, the center lat and lon values are later respecified to values in namelist. Please see the code inc/nl_config.inc


SUBROUTINE nl_get_cen_lat ( id_id , cen_lat )
USE module_configure, ONLY : model_config_rec
real , INTENT(OUT) :: cen_lat
INTEGER id_id
cen_lat = model_config_rec%cen_lat(id_id)
RETURN


Note that the default values for lat/lon are 0. This is why you see zero values in wrfinput.
Hi Ming,

Thank you for your reply!
I know in the real cases, we can set ref_lat in the namelist.wps. But in the ideal em_les cases, which parameters in the namelist.input should be set to change the latitude?

Ming Chen
Posts: 1588
Joined: Mon Apr 23, 2018 9:42 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Ming Chen » Wed Nov 25, 2020 4:46 pm

Please set cen_lat/cen_lon the same way as in real-data case and let me know whether it works. Thanks.
WRF Help Desk

Xiaoxingyun
Posts: 25
Joined: Thu Nov 19, 2020 12:39 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Xiaoxingyun » Thu Nov 26, 2020 3:14 pm

Ming Chen wrote:
Wed Nov 25, 2020 4:46 pm
Please set cen_lat/cen_lon the same way as in real-data case and let me know whether it works. Thanks.

Hi Ming,

Thanks for your reply.
I tried adding ref_lat=30, and cen_lat=30, respectively, in the &domain part of the namelist.input. But they caused errors( ERRORS while reading one or more namelists from namelist.input) in running the ideal.exe.

Xiaoxingyun
Posts: 25
Joined: Thu Nov 19, 2020 12:39 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Xiaoxingyun » Sun Nov 29, 2020 10:57 pm

Ming Chen wrote:
Wed Nov 25, 2020 4:46 pm
Please set cen_lat/cen_lon the same way as in real-data case and let me know whether it works. Thanks.
Hi Ming,

The ref_lat should be set in the &geogrid part in the namelist.wps. I tried adding it in the &domains part in the namelist.input, but an error occurs. And I also checked the handbook, but I didn't find how to set central latitude in the namelist.input for the ideal cases. Could you give some suggestions? Thanks a lot!

Ming Chen
Posts: 1588
Joined: Mon Apr 23, 2018 9:42 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Ming Chen » Mon Nov 30, 2020 10:40 pm

When running WPS for real-data case, ref_lat and ref_lon are taken as cen_lat and cen_lon. I suppose they should be the same in ideal cases.
WRF Help Desk

Xiaoxingyun
Posts: 25
Joined: Thu Nov 19, 2020 12:39 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Xiaoxingyun » Tue Dec 01, 2020 6:41 am

Ming Chen wrote:
Mon Nov 30, 2020 10:40 pm
When running WPS for real-data case, ref_lat and ref_lon are taken as cen_lat and cen_lon. I suppose they should be the same in ideal cases.

Thank you for your reply!
I added ref_lat in the namelist.input and then run the ideal.exe, but it stoped and showed "ERRORS while reading one or more namelists from namelist.input" in the rsl file. Could there be other possible ways to set the latitude?

Ming Chen
Posts: 1588
Joined: Mon Apr 23, 2018 9:42 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Ming Chen » Mon Dec 07, 2020 11:34 pm

Please modify the code inc/nl_config.inc as follows and let me know whether it works. Thanks.

Code: Select all

SUBROUTINE nl_get_cen_lat ( id_id , cen_lat )
USE module_configure, ONLY : model_config_rec
real , INTENT(OUT) :: cen_lat
INTEGER id_id
cen_lat = 30.
RETURN
WRF Help Desk

Xiaoxingyun
Posts: 25
Joined: Thu Nov 19, 2020 12:39 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Xiaoxingyun » Mon Dec 14, 2020 3:47 am

Ming Chen wrote:
Mon Dec 07, 2020 11:34 pm
Please modify the code inc/nl_config.inc as follows and let me know whether it works. Thanks.

Code: Select all

SUBROUTINE nl_get_cen_lat ( id_id , cen_lat )
USE module_configure, ONLY : model_config_rec
real , INTENT(OUT) :: cen_lat
INTEGER id_id
cen_lat = 30.
RETURN
Thank you very much!
I will test it and come back to you later.

Xiaoxingyun
Posts: 25
Joined: Thu Nov 19, 2020 12:39 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Xiaoxingyun » Tue Dec 22, 2020 12:04 am

Ming Chen wrote:
Mon Dec 07, 2020 11:34 pm
Please modify the code inc/nl_config.inc as follows and let me know whether it works. Thanks.

Code: Select all

SUBROUTINE nl_get_cen_lat ( id_id , cen_lat )
USE module_configure, ONLY : model_config_rec
real , INTENT(OUT) :: cen_lat
INTEGER id_id
cen_lat = 30.
RETURN
Hi Ming,

Sorry for the late reply.
I modified the code, but it still did not take effect.
Because the file inc/nl_config.inc only exits after compilation, so I first modified the code and then run the ideal.exe. But in the produced wrfinput_d01 file, the cen_lat is still 0, unchanged. May there be some other ways to make it take effect?
Thanks a lot.

Ming Chen
Posts: 1588
Joined: Mon Apr 23, 2018 9:42 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Ming Chen » Tue Dec 22, 2020 8:27 pm

I will take a look and get back to you. Thanks for your patience.
WRF Help Desk

Ming Chen
Posts: 1588
Joined: Mon Apr 23, 2018 9:42 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Ming Chen » Wed Dec 23, 2020 4:33 pm

Please try the following options:

(1) In dyn_em/module_initialize_ideal.F, set cen_lat = 40.
CALL nl_set_cen_lat(1,40.)

(2) In share/output_wrf.F, after about line 106, you will find the piece of code:
CALL wrf_debug( 300 , wrf_err_message )
CALL modify_io_masks ( grid%id ) ! this adjusts the I/O masks according to the users run-time specs, if any

Add the following line right after " CALL modify_io_masks ( grid%id )"
CALL model_to_grid_config_rec ( grid%id , model_config_rec , config_flags )

(3) recompile WRF and run the case again.

Let me know how it works. Thanks.
WRF Help Desk

Ming Chen
Posts: 1588
Joined: Mon Apr 23, 2018 9:42 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by Ming Chen » Wed Dec 23, 2020 4:34 pm

It is possible that NONE of these "assigned" variables are passed into the wrfinput_d01 file

CALL nl_set_mminlu(1, ' ')

CALL nl_set_iswater(1,0)

CALL nl_set_cen_lat(1,40.)

CALL nl_set_cen_lon(1,-105.)

CALL nl_set_truelat1(1,0.)

CALL nl_set_truelat2(1,0.)

CALL nl_set_moad_cen_lat (1,0.)

CALL nl_set_stand_lon (1,0.)

CALL nl_set_pole_lon (1,0.)

CALL nl_set_pole_lat (1,90.)

CALL nl_set_map_proj(1,0)

As a result, the output stays the same as in wrfinput.
WRF Help Desk

davegill
Posts: 97
Joined: Mon Apr 23, 2018 9:03 pm

Re: Why module_initialize_ideal.F does not take effect?

Post by davegill » Wed Dec 23, 2020 4:46 pm

In the share/output_wrf.F file, add a call to model_to_grid_config_rec as the third executable statement:

Code: Select all

     CALL wrf_debug( 300 , wrf_err_message )
     CALL modify_io_masks ( grid%id )   ! this adjusts the I/O masks according to the users run-time specs, if any
+    CALL model_to_grid_config_rec ( grid%id , model_config_rec , config_flags )
Does this work for you?

After I added this call, then the metadata in the LES wrfinput_d01 was correct:

Code: Select all

		:CEN_LAT = 40.f ;
		:CEN_LON = -105.f ;
		:TRUELAT1 = 0.f ;
		:TRUELAT2 = 0.f ;
		:MOAD_CEN_LAT = 0.f ;
		:STAND_LON = 0.f ;
		:POLE_LAT = 90.f ;
		:POLE_LON = 0.f ;
Without the change, the output is all zeros:

Code: Select all

		:CEN_LAT = 0.f ;
		:CEN_LON = 0.f ;
		:TRUELAT1 = 0.f ;
		:TRUELAT2 = 0.f ;
		:MOAD_CEN_LAT = 0.f ;
		:STAND_LON = 0.f ;
		:POLE_LAT = 0.f ;
		:POLE_LON = 0.f ;
The metadata in the wrfinput_d01 file matches with intended output from the modified code:

Code: Select all

  CASE (les)

    CALL nl_set_mminlu(1, '    ')
    CALL nl_set_iswater(1,0)
    CALL nl_set_cen_lat(1,40.)
    CALL nl_set_cen_lon(1,-105.)
    CALL nl_set_truelat1(1,0.)
    CALL nl_set_truelat2(1,0.)
    CALL nl_set_moad_cen_lat (1,0.)
    CALL nl_set_stand_lon (1,0.)
    CALL nl_set_pole_lon (1,0.)
    CALL nl_set_pole_lat (1,90.)
    CALL nl_set_map_proj(1,0)
Dave Gill
NCAR/MMM

Post Reply

Return to “Idealized Cases”