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

Definition of namelist variable with default vector values

LluisFB

Member
I am facing some memory/efficiency issues in an implementation of a new variable WRF-MPAS post #33232, that I think I could be able to solve if I could provide a list of default values for the bins.

So here my question, is there a way that I can define a new entry in the namelist with array default values? In the registry I defined my namelist new parameters htasrng, hhursrng, but by now their default value is -1.

I am wondering if I can provide directly a first list of values. I now how to provide default scalar values, but not vectorial.

If I do something like this at registry.cordex:
Code:
rconfig   real    htasrng              namelist,cordex       max_rng        173.15,268.15,273.15,278.15,283.15,288.15,293.15,298.15,303.15      rh    "htasrng"        "bins for temporal residence of tas"   ""
I got an error message from fortran telling me that is expecting (/ /),

If I add them directly as:
Code:
rconfig   real    htasrng              namelist,cordex       max_rng       (/ 173.15,268.15,273.15,278.15,283.15,288.15,293.15,298.15,303.15 /)     rh    "htasrng"        "bins for temporal residence of tas"   ""
I got error message during the compilation, I guess, due to the pre-processing and automatic writing of code:
Code:
(...)
ifort -c -real-size `expr 8 \* 4` -i4  -O0 -fno-inline -no-ip -ip -fp-model precise -w -ftz -align all -fno-alias -FR -convert big_endian  -g -O0 -fno-inline -no-ip -traceback  -I../dyn_em -I../dyn_nmm  -IWRF/external/esmf_time_f90  -IWRF/main -IWRF/external/io_netcdf -IWRF/external/io_int -IWRF/frame -IWRF/share -IWRF/phys -IWRF/wrftladj -IWRF/chem -IWRF/inc -I/opt/netcdf/netcdf-4/intel/2021.4.0/include  module_configure.f90
module_configure.f90(11173): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( <IDENTIFIER> TYPE BYTE CLASS COMPLEX REAL INTEGER CHARACTER DOUBLE DOUBLECOMPLEX ...
htasrng = (/
------------^
module_configure.f90(11174): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( <IDENTIFIER> TYPE BYTE CLASS COMPLEX REAL INTEGER CHARACTER DOUBLE DOUBLECOMPLEX ...
(...)

In the file frame/module_configure.f90, I got:
Code:
htasrng = (/
hhursrng = (/

I did not find any details on the Tiger-team documentation.

If I try to introduce the values manually, they got removed by the pre-compilation mechanism and I got the same error.

Many thanks in advance,

Lluís
 
Lluís,
The namelist options in WRF are designed to specify physics/dynamics/data options used for each domain. It is not supposed to provide values to specific variables used for calculation in the model. Basically I don't think you can modify Registry as described in your post.
Please let me know if I misunderstand what you intend to do.
 
Hi Ming,

I need to provide the bins in order to be able to internally compute the temporal histogram. These values are needed in order to be able to compute the diagnostic. So, this diagnostic requires at least 3 configuration values in order to work.

It will be great if the user can get some pre-configured configuration of the diagnostic. This is why I am trying to get default vector values in the namelist.

Is it more clear?

Lluís
 
Lluís,
Thanks for the clarification. I guess I understand what you intend to do. Unfortunately I don't think WRF Registry is designed to work for your case, which is way too complicated for WRF to automatically generate codes for the diagnostics.
 
Dear all,

I am happy to inform that I solved it.

The trick was far more simple as I thought. I just need to remove any space in the
Code:
registry.cordex
and provide enough values as to reach the default length of the variable.

In summary this means in the
Code:
registry.cordex
:
Code:
## L. Fita. This should work, but WRF is not prepared for 4D output variables like this
rconfig   integer nhtasrng                namelist,cordex       1              38      rh    "nhtasrng"                 "amount + 1 of high-resolution bins for temporal residence of tas"   ""
rconfig   integer nhhursrng               namelist,cordex       1              25      rh    "nhhursrng"                "amount + 1 of high-resolution bins for temporal residence of hurs"  ""
rconfig   integer nltasrng                namelist,cordex       1              21      rh    "nltasrng"                 "amount + 1 of low-resolution bins for temporal residence of tas"   ""
rconfig   integer nlhursrng               namelist,cordex       1              25      rh    "nlhursrng"                "amount + 1 of low-resolution bins for temporal residence of hurs"  ""
## L. Fita, so, WRF output will provide a (n[h/l]tasrng*n[h/l]hursrng) 3D variable instead
rconfig   integer nhtashursrng                namelist,cordex       1              950      rh    "nhtashursrng"                 "amount + 1 of high-resolution bins for temporal residence of tas and hurs (nhtas+1)*(nhhurs+1)"   ""
rconfig   integer nltashursrng                namelist,cordex       1              525      rh    "nltashursrng"                 "amount + 1 of low-resolution bins for temporal residence of tas and hurs (nltas+1)*(nlhurs+1)"   ""
### This is not working, but I left it here for reference
rconfig   real    htasrng                namelist,cordex       max_lbins      (/173.15,268.15,269.15,270.15,271.15,272.15,273.15,274.15,275.15,276.15,277.15,278.15,279.15,280.15,281.15,282.15,283.15,284.15,285.15,286.15,287.15,288.15,289.15,290.15,291.15,292.15,293.15,294.15,295.15,296.15,297.15,298.15,299.15,300.15,301.15,302.15,303.15,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00/) rh    "htasrng"                  "high-resolution bins for temporal residence of tas"   ""
rconfig   real    hhursrng               namelist,cordex       max_lbins      (/0.00,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.70,0.75,0.80,0.85,0.90,0.95,1.00,1.05,1.10,1.15,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00/)      rh    "hhursrng"                 "high-resolution bins for temporal residence of hurs"  ""
rconfig   real    ltasrng                namelist,cordex       max_lbins      (/173.15,233.15,238.15,243.15,248.15,253.15,258.15,263.15,268.15,273.15,278.15,283.15,288.15,293.15,298.15,303.15,308.15,313.15,318.15,323.15,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00/)      rh    "ltasrng"                  "low-resolution bins for temporal residence of tas"   ""
rconfig   real    lhursrng               namelist,cordex       max_lbins      (/0.00,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.70,0.75,0.80,0.85,0.90,0.95,1.00,1.05,1.10,1.15,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00/)      rh    "lhursrng"                 "low-resolution bins for temporal residence of hurs"  ""

where rangs of the dimensions are defined in
Code:
frame/module_driver_constants.F
as:
Code:
#ifdef CORDEXDIAG
#if CDXWRF>=3
   ! 5. CORDEX-WRF diagnostics
   ! Maximum amount of bins per variable for the simultaneous time of residence
   INTEGER, PARAMETER                                    :: max_lbins = 50
   ! Maximum amount of bins for the simultaneous time of residence  
   INTEGER, PARAMETER                                    :: max_rng = 1000
#endif
#endif

Doing that and remembering that 3D variables in WRF are shaped as [i,k,j], (east_west, level, south_north), then I make it work

Many thanks for the help.

Lluís
 
Last edited:
Top