How to Use the
John Micha
Dave G
WRF Software Archite
e WRF Registry
alakes, NCEP
Gill, NCAR
ecture Working Group
Outline
• What is the WRF Registry
• Keyword syntax
• The BIG Three
• Examples
– Runtime I/O mods
– Adding a variable to the name
– Adding an array to WRF
– Compute a diagnostic
– New physics scheme
– Passive tracer
elist
WRF Software Arch
Text based file for real and WRF
Active data dictionary
Used with cpp to auto generate source
Controls/defines
Variables (I/O, comms, nesting)
Communications
namelist options
hitecture
Registry
About 300k lines added to source
Easy – 3x the size since initial release
Compile-time option
./clean
./configure
./compile
Registry.EM_COMMON (else lost changes)
Registry Keywords
• Currently implemented as a text file
• Types of entry:
– Dimspec – Describes dimensio
model
– State – Describes state variabl
– I1 – Describes local variables a
– Typedef – Describes derived ty
structure
s
e: Registry/Registry.EM_COMMON
ons that are used to define arrays in the
les and arrays in the domain structure
and arrays in solve
ypes that are subtypes of the domain
Registry Keywords
• Types of entry:
– Rconfig – Describes a configur
– Package – Describes attribute
– Halo – Describes halo update
– Period – Describes communica
– Xpose – Describes communica
– include – Similar to a CPP #inc
s
ration (e.g. namelist) variable or array
es of a package (e.g. physics)
interprocessor communications
ations for periodic boundary updates
ations for parallel matrix transposes
clude file
Registry State Entry
# Type Sym Dims Use Tlev Sta
state real tsk ij misc 1-
• Elements
– Entry: The keyword “state”
– Type: The type of the state variab
integer, logical, character, or der
– Sym: The symbolic name of the v
– Dims: A string denoting the dime
hyphen (-)
– Use: A string denoting associatio
array, or a hyphen
– NumTLev: An integer indicating th
arrays) or hypen (for variables)
ag IO Dname Descrip
i01rhusdf “TSK" ”SKIN TEMP“
ble or array (real, double,
rived)
variable or array
ensionality of the array or a
on with a solver or 4D scalar
he number of time levels (for
Registry State Entry
# Type Sym Dims Use Tlev Sta
state real tsk ij misc 1-
• Elements
– Stagger: String indicating stagge
Z, or hyphen)
– IO: String indicating whether and
various I/O and Nesting
– DName: Metadata name for the v
– Units: Metadata units of the varia
– Descrip: Metadata description of
ag IO Dname Descrip
i01rhusdf “TSK" ”SKIN TEMP“
ered dimensions of variable (X, Y,
d how the variable is subject to
variable
able
the variable
State Entry: Defining a variable-set
• Fields are added to a variable-set o
# Type Sym Dims Use Tlev St
state real tsk ij
misc 1 -
• IO is a string that specifie
available to initial, restart,
may consist of 'h' (subject
dataset), 'r' (restart dataset
• The 'h', 'r', and 'i' specifier
combination.
t for an I/O stream
on an I/O stream in the Registry
tag IO Dname Descrip
- i01rhusdf “TSK" ”SKIN TEMP“
es if the variable is to be
, or history I/O. The string
t to history I/O), 'i' (initial
t).
rs may appear in any order or
State Entry: Defining a variable-set
• Fields are added to a variable-set o
# Type Sym Dims Use Tlev St
state real tsk ij
misc 1 -
• The ‘h’ and ‘i’ specifiers m
optional integer string con
• Zero denotes that the varia
input or history I/O stream
• The characters ‘1’ through
auxiliary input or history I
t for an I/O stream
on an I/O stream in the Registry
tag IO Dname Descrip
- i01rhusdf “TSK" ”SKIN TEMP“
may be followed by an
nsisting of ‘0’, ‘1’, … , ‘9’
able is part of the principal
m.
h ‘9’ denote one of the
I/O streams.
State Entry: Defining a variable-set
• Fields are added to a variable-set o
# Type Sym Dims Use Tlev St
state real tsk ij
misc 1 -
usdf refers to nesting options
SMOOTH, f = FORCE
u – at end of each set of child
d – at instantiation of child d
f – at beginning of each set o
s – after each feedback
t for an I/O stream
on an I/O stream in the Registry
tag IO Dname Descrip
- i01rhusdf “TSK" ”SKIN TEMP“
s: u = UP, d = DOWN, s =
d time steps
domain
of child time steps
State Entry: Defining a variable-set
• Fields are added to a variable-set o
# Type Sym Dims Use Tlev St
state real tsk ij
misc 1 -
Only variables involved with
packages are required to be s
Local variables inside of phy
controlled by the Registry
t for an I/O stream
on an I/O stream in the Registry
tag IO Dname Descrip
- i01rhusdf “TSK" ”SKIN TEMP“
h I/O, communications,
state
ysics packages are not
Rconfig Entry
# Type Sym
rconfig integer spec_bdy_width name
• This defines namelist entries
• Elements
– Entry: the keyword “rconfig
– Type: the type of the namel
string )
– Sym: the name of the name
– How set: indicates how the
derived, and if namelist, wh
How set Nentries Default
elist,bdy_control 1 1
g”
list variable (integer, real, logical,
elist variable or array
variable is set: e.g. namelist or
hich block of the namelist it is set in
Rconfig Entry
# Type Sym
rconfig integer spec_bdy_width name
• This defines namelist entries
• Elements
– Nentries: specifies the dime
array. If 1 (one) it is a varia
otherwise specify max_dom
defined in module_driver_c
– Default: the default value of
specified in the namelist; hy
How set Nentries Default
elist,bdy_control 1 1
ensionality of the namelist variable or
able and applies to all domains;
mains (which is an integer parameter
constants.F).
f the variable to be used if none is
yphen (-) for no default
Package Entry
• Elements
– Entry: the keyword “package
– Package name: the name of
– Associated rconfig choice: t
value of that variable that ch
# specification of microphysics opt
package passiveqv mp_physics=
package kesslerscheme mp_physics=
package linscheme mp_physics=
package ncepcloud3 mp_physics=
package ncepcloud5 mp_physics=
# namelist entry that controls micr
rconfig integer mp_physics nam
e”,
the package: e.g. “kesslerscheme”
the name of a rconfig variable and the
hoses this package
tions - moist:qv
==0 - moist:qv,qc,qr
==1
- moist:qv,qc,qr,qi,qs,qg
==2 - moist:qv,qc,qr
==3
- moist:qv,qc,qr,qi,qs
==4
rophysics option 0
melist,physics max_domains
Package Entry
• Elements
– Package state vars: unused
– Associated variables: the na
chem, scalar) and the fields
uses, and the state variables
# specification of microphysics opt
package passiveqv mp_physics=
package kesslerscheme mp_physics=
package linscheme mp_physics=
package ncepcloud3 mp_physics=
package ncepcloud5 mp_physics=
# namelist entry that controls micr
rconfig integer mp_physics nam
at present; specify hyphen (-)
ames of 4D scalar arrays (moist,
within those arrays this package
s (state:u_gc, ...)
tions - moist:qv
==0 - moist:qv,qc,qr
==1
- moist:qv,qc,qr,qi,qs,qg
==2 - moist:qv,qc,qr
==3
- moist:qv,qc,qr,qi,qs
==4
rophysics option 0
melist,physics max_domains
Outline
• Examples
– 1) Add output without rec
– 2) Add a variable to the n
– 3) Add an array
– 4) Compute a diagnostic
– 5) Add a physics package
– 6) Tracer
compiling
namelist
e
Example 1: Add ou
• Edit the namelist.input file, the time_
iofields_filename = "my
io_form_auxhist24 = 2 (
auxhist24_interval = 10
• Place the fields that you want in the
+:h:24:RAINC,RAINNC
• Where “+” means ADD this variable
stream, and “24” is the stream num
utput without recompiling
_control namelist record
youtfields.txt” (MAXDOM)
(choose an available stream)
0 (MAXDOM, every 10 minutes)
named text file myoutfields.txt
to the output stream, “h” is the history
mber
Example 1: Zap ou
• Edit the namelist.input file, the time_
iofields_filename = "my
• Place the fields that you want in the
-:h:0:W,PB,P
• Where “-” means REMOVE this varia
stream, and “0” is the stream numb
utput without recompiling
_control namelist record
youtfields.txt”
named text file myoutfields.txt
able from the output stream, “h” is the history
ber (standard WRF history file)
Outline
• Examples
– 1) Add output without rec
– 2) Add a variable to the n
– 3) Add an array
– 4) Compute a diagnostic
– 5) Add a physics package
– 6) Tracer
compiling
namelist
e
Example 2: Add a
• Use the examples for the rcon
• Find a namelist variable similar
– Integer vs real vs logical vs
– Single value vs value per d
– Select appropriate namelis
• Insert your mods in all approp
variable to the namelist
nfig section of the Registry
r to what you want
s character
domain
st record
priate Registry files
Example 2: Add a
• Remember that ALL Registry c
cleaned and rebuilt
./clean -a
./configure
./compile em_real
variable to the namelist
changes require that the WRF code be
l
Example 2: Add a
• Adding a variable to the name
in the Registry file:
rconfig integer my_option_1 namelist,time_contro
rconfig integer my_option_2 namelist,time_contro
• Accessing the variable is throu
USE module_configure
INTEGER :: my_option_1 , my
CALL nl_get_my_option_1( 1
CALL nl_set_my_option_2( g
variable to the namelist
elist requires the inclusion of a new line
ol 1 0 - "my_option_1" "test namelist option”
ol max_domains 0
ugh an automatically generated function:
y_option_2
1, my_option_1 )
grid%id, my_option_2 )
Example 2: Add a
• You also have access to the namelis
SUBROUTINE foo ( grid , ... )
USE module_domain
TYPE(domain) :: grid
print *,grid%my_option_1
variable to the namelist
st variables from the grid structure …
Example 2: Add a
• … and you also have access to the
SUBROUTINE foo2 ( config_flags , ... )
USE module_configure
TYPE(grid_config_rec_type) :: config_flags
print *,config_flags%my_option_2
variable to the namelist
namelist variables from config_flags
Example 2: Add a
• What your variable looks like in
&time_control
run_days
run_hours
run_minutes
run_seconds
start_year
my_option_1
my_option_2
variable to the namelist
n the namelist.input file
= 0,
= 0,
= 40,
= 0,
= 2006, 2006, 2006,
= 17
= 1, 2, 3