Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Why module_initialize_ideal.F does not take effect?

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

Xiaoxingyun

New member
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.
 
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.
 
Ming Chen said:
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?
 
Please set cen_lat/cen_lon the same way as in real-data case and let me know whether it works. Thanks.
 
Ming Chen said:
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.
 
Ming Chen said:
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!
 
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.
 
Ming Chen said:
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?
 
Please modify the code inc/nl_config.inc as follows and let me know whether it works. Thanks.

Code:
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
 
Ming Chen said:
Please modify the code inc/nl_config.inc as follows and let me know whether it works. Thanks.

Code:
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.
 
Ming Chen said:
Please modify the code inc/nl_config.inc as follows and let me know whether it works. Thanks.

Code:
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.
 
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.
 
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.
 
In the share/output_wrf.F file, add a call to model_to_grid_config_rec as the third executable statement:
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
+    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:
		: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:
		: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:
  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)
 
Top