The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.

How to Use the WRF Registry John Michalakes, NCEP Dave Gill, NCAR ... – 1) Add output without recompiling – 2) Add a variable to the namelist

Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by , 2017-02-04 04:15:03

How to Use the WRF Registry - University Corporation for ...

How to Use the WRF Registry John Michalakes, NCEP Dave Gill, NCAR ... – 1) Add output without recompiling – 2) Add a variable to the namelist

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 3: Add an

•  Adding a state array to the sol
Registry

•  Use the previous Registry instr

n Array

lver, requires adding a single line in the

ructions for a state or I1 variable

Example 3: Add an

•  Select a variable similar to one
–  1d, 2d, or 3d
–  Staggered (X, Y, Z, or not “
–  Associated with a package
–  Part of a 4d array
–  Input (012), output, restar
–  Nesting, lateral forcing, fee

n Array

e that you would like to add
“-”, do not leave blank)

rt
edback

Example 3: Add an

•  Copy the “similar” field’s line a
•  Remember, no Registry change

rebuild

state real h_diabatic ikj misc
"h_diabatic" "PREVIOUS TIME
!
state real msft ij misc
"MAPFAC_M" "Map scale fac
!
state real ht ij misc
"HGT" "Terrain Heigh
!
state real ht_input ij misc
"HGT_INPUT" "Terrain Heigh
!
state real TSK_SAVE ij misc
"TSK_SAVE" "SURFACE SKIN
!

n Array

and make a few edits
e takes effect until a “clean -a” and

1- r \!

ESTEP CONDENSATIONAL HEATING"!

1- i012rhdu=(copy_fcnm) \!

ctor on mass grid"!

1- i012rhdus \!
ht" !

1- - \!

ht from FG Input File"!

1- - \!

TEMPERATURE" "K"!

Example 3: Add an

•  Always modify Registry.core_n
where core_name might be EM

state real h_diabatic ikj misc
"h_diabatic" "PREVIOUS TIME
!
state real msft ij misc
"MAPFAC_M" "Map scale fac
!
state real ht ij misc
"HGT" "Terrain Heigh
!
state real ht_input ij misc
"HGT_INPUT" "Terrain Heigh
!
state real TSK_SAVE ij misc
"TSK_SAVE" "SURFACE SKIN
!

n Array

name_COMMON or Registry.core_name,
M

1- r \!

ESTEP CONDENSATIONAL HEATING"!

1- i012rhdu=(copy_fcnm) \!

ctor on mass grid"!

1- i012rhdus \!
ht" !

1- - \!

ht from FG Input File"!

1- - \!

TEMPERATURE" "K"!

Example 3: Add an

•  Add a new 3D array that is sum
all_moist, in the Registry.EM_C
–  Type: real
–  Dimensions: 3D and ikj ord
–  Supposed to be output onl
–  Name in netCDF file: ALL_M

state real all_moi

dyn_em 1-

”ALL_MOIST"

"sum of all of moisture

"kg kg-1"!

n Array

m of all moisture species, called
COMMON

dering, not staggered
ly: h
MOIST

ist ikj \!
h \!
\!
e species" \!

Example 3: Add an

•  Registry state variables becom
usually called grid inside of the

•  WRF model top  integrate 
•  Each step, the grid construct is
•  No source changes for new ou

solver routine

n Array

me part of the derived data structure
e WRF model.
 solve_interface  solve
s carried along for the ride
utput variables required until below the

Example 3: Add an

•  Top of solve_em.F
•  grid is passed in
•  No need to declare any new va

!WRF:MEDIATION_LAYER:SO
!

SUBROUTINE solve_em (
!

config_flags , &!

n Array

ariables, such as all_moist
OLVER!
( grid , &!

Example 3: Add an

•  The solve routine calls first_rk_
•  grid is passed in
•  No need to pass any variables,

!WRF:MEDIATION_LAYER:SO
!

CALL first_rk_step_pa
!

config_flags , &!

n Array

_step_part1
, such as all_moist

OLVER!
art1( grid , &!

Example 3: Add an

•  Top of first_rk_step_part1.F
•  grid is passed in
•  No need to declare any new va

!WRF:MEDIATION_LAYER:SO
!
MODULE module_first_rk_
!
CONTAINS!
!

SUBROUTINE first_rk_s
!

config_flags , &!

n Array

ariables, such as all_moist
OLVER!
_step_part1!

step_part1 ( grid , &!

Example 3: Add an

•  In first_rk_step_part1, add the
microphysics driver

•  Syntax for variable=local_varia
•  All state arrays are contained w

CALL microphysics_driv
QV_CURR=moist(ims
QC_CURR=moist(ims
QR_CURR=moist(ims
QI_CURR=moist(ims
QS_CURR=moist(ims
QG_CURR=moist(ims
QH_CURR=moist(ims
all_moist=grid%al

n Array

e new array to the call for the

able is an association convenience
within grid, and must be de-referenced

ver( &!

s,kms,jms,P_QV), &!

s,kms,jms,P_QC), &!

s,kms,jms,P_QR), &!

s,kms,jms,P_QI), &!

s,kms,jms,P_QS), &!

s,kms,jms,P_QG), &!

s,kms,jms,P_QH), &!

ll_moist , &!

Example 3: Add an

•  After the array is re-referenced
microphysics_driver routine, w
–  Pass the variable through t
–  Declare our passed in 3D a

,all_moist &!
!
!
!
!
!
REAL, DIMENSION(ims:ime

INTENT(OUT) :: a

n Array

d from grid and we are inside the
we need to
the argument list
array

e ,kms:kme ,jms:jme ), &!
all_moist!

Example 3: Add an

•  After the array is re-referenced
microphysics_driver routine, w
–  Zero out the array at each

! Zero out moisture
!

DO j = jts,MIN(jde-1
DO k = kts,kte!
DO i = its,MIN(ide-1

all_moist(i,k,j)
END DO!
END DO!
END DO!

n Array

d from grid and we are inside the
we need to

time step

sum.!

1,jte)!

1,ite)!
= 0.0 !

Example 3: Add an

•  After the array is re-referenced
microphysics_driver routine, w
–  At the end of the routine, fo
exists, add that component

DO j = jts,MIN(jde-1,jte
DO k = kts,kte!
IF ( f_QV ) THEN!
DO i = its,MIN(ide-
all_moist(i,k,j)

END DO!
END IF!

n Array

d from grid and we are inside the
we need to
or each of the moist species that
t to all_moist

e)!

-1,ite)!
) = all_moist(i,k,j) + &!

qv_curr(i,k,j)!

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 4: Compu

•  Problem: Output global averag
location of maximum for 10 m

•  Steps:
–  Modify solve to compute w
sum and maxima at the en
–  Use reduction operations
global qualities
–  Output these on one proc
process)

ute a Diagnostic

ge and global maximum and lat/lon
meter wind speed in WRF

wind-speed and then compute the local
nd of each time step
built-in to WRF software to compute the

cess (process zero, the “monitor”

Example 4: Compu

•  Compute local sum and local max and the lo

--- File: dyn_em/solve_em.F

! Compute local maximum and sum
sum_ws = 0.
max_ws = 0.
DO j = jps, jpe
DO i = ips, ipe
wind_vel = sqrt( grid%u10
IF ( wind_vel .GT. max_ws
max_ws = wind_vel
idex = i
jdex = j
ENDIF
sum_ws = sum_ws + wind_ve
ENDDO
ENDDO

ute a Diagnostic

ocal indices of the local maximum

(near the end) ---
of 10m wind-speed

0(i,j)**2+ grid%v10(i,j)**2 )
s ) THEN

el

Example 4: Compu

•  Compute global sum, global max, a
intrinsics)

! Compute global sum
sum_ws = wrf_dm_sum_rea

! Compute global maximum a
CALL wrf_dm_maxval_real

ute a Diagnostic

and indices of the global max (WRF

al ( sum_ws )
and associated i,j point
l ( max_ws, idex, jdex )

Example 4: Compu

•  On the process that contains the m
longitude of that point; on other pr

•  The use parallel reduction to store

IF ( ips .LE. idex .AND. ide
jps .LE. jdex .AND. jde

glat = grid%xlat(idex,jde
glon = grid%xlong(idex,jd
ELSE
glat = -99999.
glon = -99999.
ENDIF

! Compute global maximum to fin
glat = wrf_dm_max_real ( gla
glon = wrf_dm_max_real ( glo

ute a Diagnostic

maximum value, obtain the latitude and
rocesses set to an artificially low value.
that result on every process

ex .LE. ipe .AND. &
ex .LE. jpe ) THEN
ex)
dex)

nd glat and glon
at )
on )

Example 4: Compu

•  Output the value on process zero,

! Print out the result on the mon
IF ( wrf_dm_on_monitor() ) THE
WRITE(outstring,*)'Avg. ',s
CALL wrf_message ( TRIM(out
WRITE(outstring,*)'Max. ',m

CALL wrf_message ( TRIM(out
ENDIF

ute a Diagnostic

the “monitor”

nitor process
EN
sum_ws/((ide-ids+1)*(jde-jds+1))
tstring) )
max_ws,' Lat. ',glat,&

' Lon. ',glon
tstring) )

Example 4: Compu

•  Output from process zero of a mult

--- Output file: rsl.out.0000 ---

...

Avg. 5.159380

Max. 15.09370 Lat. 37.25022

Timing for main: time 2000-01-24_12:03:00

Avg. 5.166167

Max. 14.97418 Lat. 37.25022

Timing for main: time 2000-01-24_12:06:00

Avg. 5.205693

Max. 14.92687 Lat. 37.25022

Timing for main: time 2000-01-24_12:09:00
...

ute a Diagnostic

ti-process run

Lon. -67.44571
on domain 1: 8.96500 elapsed secs.

Lon. -67.44571
on domain 1: 4.89460 elapsed secs.

Lon. -67.44571
on domain 1: 4.83500 elapsed secs.

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 5: Input p

•  Add a new physics package w
model

•  This is how we could supply a
field that is traditionally fixed

•  Example is sea surface tempe

periodic SSTs

with time varying input source to the
a time varying value to the model for a
erature

Example 5: Input p

•  Problem: adapt WRF to input a
condition, e.g. SSTs, from an i

•  Given: Input file in WRF I/O for
•  Modify WRF model to read the

available to WRF surface phys

periodic SSTs

a time-varying lower boundary
input file for a new surface scheme
rmat containing 12-hourly SST’s
ese into a new state array and make
sics

Example 5: Input p

•  Steps
–  Add a new state variable a
package (that will use the
–  Add to variable stream for
–  Adapt physics interface to
–  Setup namelist to input th

periodic SSTs

and definition of a new surface layer
e variable) to the Registry
r an unused Auxiliary Input stream
o pass new state variable to physics
he file at desired interval


Click to View FlipBook Version