WRF Model: Physics Implementation OUTLINE Physics Schemes Three_level Structure Rules for WRF physics WRF Physics Features WRF Language What you might need to do Shu-hua Chen NCAR/AFWA (UC Davis, Sep.)
WRF Model:
Physics Implementation
OUTLINE
Physics SchemesThree_level Structure
Rules for WRF physicsWRF Physics Features
WRF LanguageWhat you might need to do
Shu-hua ChenNCAR/AFWA
(UC Davis, Sep.)
Physics Schemes
Physical Process Available
Microphysics Kessler, Lin et al. , Ncloud3, Ncloud5
Cumulus KF, BMJ
Subgrid scale turbulence TKE, Smagrinsky,
Constant K
Radiation RRTM(L), Dudhia(S),
Goddard(S)
PBL MRF
Surface layer Similarity theory
Land-surface layer 5-layer soil temperature
Solver
Physics_driverSELECT CASE (CHOICE) CASE ( NOPHY ) CASE ( SCHEME1 ) CALL XXX CASE ( SCHEME2 ) CALL YYY CASE DEFAULTEND SELECT
Individual physics scheme ( XXX )
Three-level Structure
WRF … solve_rk ADV TENDENCIES
phy_init
ADVANCE VARS
…
INIT
.
.
.
microphysics_driver
Radiation_driver
Cumulus_driver
pbl_driver
phy_prep
moist_physics_prep
Solver
Physics_driverSELECT CASE (CHOICE) CASE ( NOPHY ) CASE ( SCHEME1 ) CALL XXX CASE ( SCHEME2 ) CALL YYY CASE DEFAULTEND SELECT
Individual physics scheme ( XXX )
Three-level Structure
Physics Standard Interface
SELECT CASE (CHOICE) CASE ( NOPHY ) CASE ( SCHEME1 ) CALL XXX(…) CASE ( SCHEME2 ) CALL YYY(…) CASE DEFAULTEND SELECT
Physics_driver
Solver
Physics_driverSELECT CASE (CHOICE) CASE ( NOPHY ) CASE ( SCHEME1 ) CALL XXX CASE ( SCHEME2 ) CALL YYY CASE DEFAULTEND SELECT
Individual physics scheme ( XXX )
Three-level Structure
Domain size: ids, ide, jds, jde, kds, kde
Memory size: ims, ime, jms, jme, kms, kme
Tile size: its, ite, jts, jte, kts, kte
Three Sets of Dimensions
halo
halo
halo
hal
o
(ids,ide)
patchpatchpatch
patch
patch patch
patch patch
patch(ims,ime)
Memory size (ims,kms,jms)
WRF … solve_rk ADV TENDENCIES
phy_init
ADVANCE VARS
…
INIT
.
.
.
microphysics_driver
Radiation_driver
Cumulus_driver
pbl_driver
phy_prep
moist_physics_prep
Subroutine kessler(QV, T,& its,ite,jts,jte,kts,kte,& ims,ime,jms,jme,kms,kme,& ids,ide,jds,jde,kds,kde)
F77
Subroutine kessler(QV, T, . . . & its,ite,jts,jte,kts,kte,& ims,ime,jms,jme,kms,kme,& ids,ide,jds,jde,kds,kde )
F90
a) Replace continuation characters in the 6th column with f90 continuation `&‘ at end of previous line
1. F90
Coding Rules
a) Replace continuation characters in the 6th column with f90 continuation `&‘ at end of previous line
1. F90
b)Replace the 1st column `C` for comment with `!`
c This is a test
F77
! This is a test
F90
Coding Rules
a) Replace continuation characters in the 6th column with f90 continuation `&‘ at end of previous line
1. F90
b)Replace the 1st column `C` for comment with `!`
2. No common block
3. Use “ implicit none ”
5. Variable dimensions and do loops
Coding Rules
4. Use “ intent ”
xxx = individual scheme
ex, module_cu_kf.F
Naming Rules
module_yy_xxx.F (module)
yy = ra is for radiation bl is for PBL cu is for cumulus mp is for microphysics.
YY = ra is for radiation bl is for PBL cu is for cumulus
Naming Rules
RXXYYTEN (tendencies)
XX = variable (th, u, v, qv, qc, … )
ex, RTHBLTEN
Coding rules
Vectorized code preferred
( might depend on which physics component )
Rules for WRF Physics
Naming rules
One scheme one module
• Unified global constatnts
(module_model_constants.F)
WRF Physics Features
REAL , PARAMETER :: r_d = 287. REAL , PARAMETER :: r_v = 461.6 REAL , PARAMETER :: cp = 7.*r_d/2. REAL , PARAMETER :: cv = cp-r_d . . .
• Unified global constatnts
(module_model_constants.F)
WRF Physics Features
• Vertical index (kms is at the bottom)
• Unified common calculations
(saturation mixing ratio)
Solver
Physics_driverSELECT CASE (CHOICE) CASE ( NOPHY ) CASE ( SCHEME1 ) CALL XXX CASE ( SCHEME2 ) CALL YYY CASE DEFAULTEND SELECT
Individual physics scheme ( XXX )
Three-level Structure
• Unified global constatnts
(module_model_constants.F)
WRF Physics Features
• Unified common calculations
(saturation mixing ratio)
• Vertical index (kms is at bottom)
• kme = kte + 1 (physics)
kme = kte (dynamics)
WRF Language
• Patch, tile, ….
• Moisture field, moist(i,k,j,?), is 4D
• ? = P_QV, P_QC, P_QR, P_QI,P_QS,
P_QG (module_state_description.F)
• PARAM_FIRST_SCALAR IF ( P_QI .ge. PARAM_FIRST_SCALAR ) . . .
P_QV, P_QC, P_QR, …
Registry
package kesslerscheme mp_physics==1 - moist:qv,qc,qr
package linscheme mp_physics==2 - moist:qv,qc,qr,qi,qs,qg
package ncepcloud3 mp_physics==3 - moist:qv,qc,qr
package ncepcloud5 mp_physics==4 - moist:qv,qc,
What you might need to do ?
Run existing codes
(namelist.input)
Physics Buffet
mp_physics = 2, ra_lw_physics = 1, ra_sw_physics = 1, bl_sfclay_physics = 1, bl_surface_physics = 1, bl_pbl_physics = 1, cu_physics = 1,
WRF Development Team
Numerics and Software
(J. Klemp)
Data Assimilation (T. Schlatter)
Analysis and Validation
(K. Droegemeier)
Community Involvement
(W. Kuo)
Operational Implementation
(G. DiMego)
Ensemble Forecasting
(D. Stensrud)
Data Handling and Archive (G. DiMego)
NCEP Requirements
(G. DiMego)
AFWA Requirements
(M. Farrar)
Wo
rkin
g G
rou
ps
Standard Initialization (J. McGinley)
3-D Var (J. Derber)
4-D Var (D. Barker)
Dynamic Model Numerics
(W. Skamarock)
Software Architecture,
Standards, and Implementation (J. Michalakes) Regional Climate
Modeling (proposed)
Workshops, Distribution, and Support
(J. Dudhia)
Model Physics (J. Brown)
Atmospheric Chemistry (P. Hess)
Analysis and Visualization (L. Wicker)
Model Testing and Verification
(C. Davis)Land Surface
Models (proposed)