Example 5: Input p
• Add a new state variable to Re
in the variable set for input on
# type symbol dims use tl stag i
state real nsst ij misc 1 - i
• Also added to History and Res
• Result:
– 2-D variable named grid
solve_em
– Dimensions: ims:ime, jm
– Input and output on the
variable under the name
periodic SSTs
egistry/Registry.EM_COMMON and put it
n Auxiliary Input Stream #4
io dname description units
i4h "NEW_SST" "Time Varying SST" "K“
start
d%nsst defined and available in
ms:jme
e AuxInput #4 stream will include the
e NEW_SST
Example 5: Input p
• Pass new state variable to sur
--- File: dyn_em/module_first_rk
CALL surface_driver(
...
! Optional
& ,QV_CURR=moist(ims,kms,jms,P_Q
& ,QC_CURR=moist(ims,kms,jms,P_Q
& ,QR_CURR=moist(ims,kms,jms,P_Q
& ,QI_CURR=moist(ims,kms,jms,P_Q
& ,QS_CURR=moist(ims,kms,jms,P_Q
& ,QG_CURR=moist(ims,kms,jms,P_Q
& ,NSST=grid%nsst
& ,CAPG=grid%capg, EMISS=grid%em
& ,RAINBL=grid%rainbl,SR=grid%em
& ,RAINNCV=grid%rainncv,REGIME=r
...
periodic SSTs
rface physics
k_step_part1.F ---
&
QV), F_QV=F_QV &
QC), F_QC=F_QC &
QR), F_QR=F_QR &
QI), F_QI=F_QI &
QS), F_QS=F_QS &
QG), F_QG=F_QG &
& ! new
miss, HOL=hol,MOL=grid%mol &
m_sr &
regime,T2=grid%t2,THC=grid%thc &
Example 5: Input p
• Add new variable nsst to Phys
--- File: phys/module_surfa
SUBROUTINE surface_driver(
...
! Other optionals (mo
& ,nsst
& ,capg,emiss,hol,mol
& ,rainncv,rainbl,reg
& ,qsg,qvg,qcg,soilt1
& ,smfr3d,keepfr3dfla
...
...
REAL, DIMENSION( ims:ime, jms:jm
• By making this an “Optional”
compatibility with other cores
variable hasn’t been added.
periodic SSTs
sics Driver in Mediation Layer &
ace_driver.F --- &
&
ore or less em specific) &
l &
gime,t2,thc &
1,tsnav
ag ))
me ), OPTIONAL, INTENT(INOUT):: nsst
argument, we preserve the driver’s
and with versions of WRF where this
Example 5: Input p
• Add call to Model-Layer subroutine for
--- File: phys/module_surface_
!$OMP PARALLEL DO &
!$OMP PRIVATE ( ij, i, j, k )
DO ij = 1 , num_tiles
sfclay_select: SELECT CASE(sf_sfc
CASE (SFCLAYSCHEME)
...
CASE (NEWSFCSCHEME) ! <- This
IF (PRESENT(nsst)) THEN
CALL NEWSFCCHEME(
nsst,
ids,ide, jds,jde, kds,
ims,ime, jms,jme, kms,
i_start(ij),i_end(ij),
ELSE
CALL wrf_error_fatal('Missi
ENDIF
...
END SELECT sfclay_select
ENDDO
!$OMP END PARALLEL DO
• Note the PRESENT test to make sure n
periodic SSTs
r new physics package to Surface Driver
_driver ---
clay_physics)
is defined by the Registry “package” entry
&
&
,kde, &
,kme, &
, j_start(ij),j_end(ij), kts,kte )
ing argument for NEWSCHEME in surface driver')
new optional variable nsst is available
Example 5: Input p
• Add definition for new physics
namelist variable sf_sfclay_ph
rconfig integer sf_sfclay_physi
package sfclayscheme sf_sfclay
package
package myjsfcscheme sf_sfclay
package gfssfcscheme sf_sfclay
newsfcscheme sf_sfclay
• This creates a defined constan
selection of the new scheme w
sf_sfclay_physics is set to ‘4’
• clean –a and recompile
periodic SSTs
s package NEWSCHEME as setting 4 for
hysics
ics namelist,physics max_domains 0
y_physics==1 - -
-
y_physics==2 - -
y_physics==3 - -
y_physics==4 -
nt NEWSFCSCHEME and represents
when the namelist variable
’ in the namelist.input file
so code and Registry changes take effect
Example 5: Input p
• Setup namelist to input SSTs f
--- File: nameli
&time_control
...
auxinput4_inname
auxinput4_interval_h
...
/
... =
&physics
sf_sfclay_physics
...
/
• Run code with sst_input file in
periodic SSTs
from the file at desired interval
ist.input ---
= "sst_input"
h = 12
= 4, 4, 4
n run-directory
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
Tracer Example
Modify Registry for new fields.
Use the “tracer” array with a new 3D
Use existing NML option
Initialize data in real.
Identify (i,j) location
Spread in “PBL”
Set values in solver.
“Release” per time step
component
Tracer Example
Registry/Registry.EM add our new field
# New tracer for examp
state real plume ikjftb
1 - irhusdf=(bdy_in
"PLUME" "Fukushima T
# 4D arrays need an as
package tracer_test3 tra
tracer:plume
d “PLUME” as part of “TRACER” array.
ple
b tracer \
nterp:dt) \
Tracer" " "
ssociated package
acer_opt==3 - \
Tracer Example
Modify the real and WRF programs to initi
“PLUME” array
dyn_em/module_initialize_real.F (initial v
dyn_em/solve_em.F (continuous plume in
! Add in the Fukushima init
IF ( ( its .LE. 50 ) .AND
( jts .LE. 50 ) .AND
tracer(50,1:5,50,P_plu
END IF
ialize and continuously re-supply the
value from real.exe)
n wrf.exe)
tial venting.
D. ( ite .GE. 50 ) .AND. &
D. ( jte .GE. 50 ) ) THEN
ume) = 1.
Tracer Example
• Modify the test/em_real/namelist.inpu
• Include the new settings for the tracer
&dynamics
tracer_opt = 3, 3, 3,
ut file
r option required from the Registry file
Tracer Example