35
Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

Embed Size (px)

Citation preview

Page 1: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

Model Physics / Porting Physics to the NMMB

NEMS-NMMB Tutorial19 February 2014

Brad Ferrier, Dusan Jovic, & Ratko Vasic

Page 2: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 2

Outline• Physics options and parameter settings (slides 3-17)– Shortwave (SW) and longwave (LW) radiation (sl 3-4)– Planetary boundary layer (PBL) and surface layer (sl 5,7)– Gravity wave drag + mountain blocking (sl 6-7)– Land surface schemes (sl 8-9)– Convection (sl 10-11, 16) and microphysics (sl 12-16)– Full GFS physics suite (sl 17)

• Source codes and porting physics (slides 18-35)– Flowcharts of codes relating various physics (sl 18-21)– Adding a new physics array, + output fields (sl 22-31)– RRTM & GFS codes in /phys directory (sl 32)– Physics calls in model solver (sl 33-35)

2/19/2014

Page 3: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 3

Radiation Options• “GFDL” radiation (phys/module_RA_GFDL.F90)

– Lacis & Hansen shortwave (SW) , Fels & Schwartzkopf (LW)– Prescribed ozone & CO2 – No aerosols, incoming TOA SW fluxes reduced by 3%– Simple clouds, fixed absorption coefficients for cloud water and ice

• RRTM radiation (phys/module_RA_RRTM.F90)– Similar to RRTMG in WRF– Version 2 (currently running in GFS), soon to be upgraded to version 3– Ported from AER and optimized for EMC by Yu-Tai Hou, coupled to the

NMMB by Hsin-Mu Lin– Prescribed ozone (predicted in GFS) & CO2, O2, and various trace gases– Bilinear interpolation from 5o climatological aerosols– Much more sophisticated treatment of clouds than GFDL

• LW: Hu & Stamnes (1993) for water, Ebert & Curry (1992) for ice (+ other options)• SW: Hu & Stamnes (1993) for water, Fu (1996) for ice (+ other options)2/19/2014

Page 4: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 4

Configure File Settings - Radiationshortwave: # Shortwave radiation schemes, either gfdl or rrtmlongwave: # Longwave radiation schemes, either gfdl or rrtm…co2tf: 1 # Read (0) or generate internally (1) the GFDL CO2 transmission functions

…nrads: # Number of dynamics timesteps between calls to shortwavenradl: # Number of dynamics timesteps between calls to longwave…nhrs_udef: true # Accumulator arrays are reset to 0 by user-defined options (next).

nhrs_rdlw: # Frequency in hours between times when LW radiation fluxes are reset to 0

nhrs_rdsw: # Frequency in hours between times when SW radiation fluxes are reset to 0

• Use the same option for shortwave & longwave (i.e., use “gfdl” for both or “rrtm” for both)

• Recommend nrads=nradl and set so that radiation is called at times corresponding with output (e.g. top of the hour)

2/19/2014

Page 5: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 5

Surface Layer and PBL• Mellor-Yamada-Janjic (MYJ) surface layer

(phys/module_SF_JSFC.F90)

• MYJ PBL (phys/module_BL_MYJPBL.F90)

– Nonsingular Mellor-Yamada level 2.5, a local scheme– Predicts turbulent kinetic energy (TKE), represented as 3D

array Q2 (=2*TKE) in code– TKE > background value in areas of turbulence away from

the PBL (e.g., jet streaks)• GFS PBL (phys/module_BL_GFSPBL.F90)

– 1st order non-local Pan-Mahrt scheme– Differs from what’s in the GFS because it uses the MYJ

surface layer (added by Weiguo Wang in 2010)2/19/2014

Page 6: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 6

Gravity Wave Drag (GWD)and Mountain Blocking (+MB)

• GWD+MB (nmm/module_GWD.F90)– Provided from GFS (Jordan Alpert & Shrinivas Moorthi) – Tendencies applied only to horizontal winds– Calculates the level of the “dividing streamline” (DS)

• Lott & Miller mountain blocking below DS, air is slowed as it flows around the barrier

• Kim & Arakawa gravity wave drag above DS, air goes over the barrier and is subject to possible wave breaking

– Requires 14 different fields related to the terrain• Maximum height above the mean height in the grid box, slope,

anisotropy/aspect ratio, angle of the mountain range w/r/t East, normalized 4th moment of the orographic convexity, orographic asymmetry & length scale along 4 vertical planes (W-E, N-S, SW-NE, NW-SE)

• Currently calculated from 30-sec terrain data2/19/2014

Page 7: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 7

Configure File Settingssfc_layer: # Surface layer schemes, myj only…turbulence: # Turbulence schemes, myj or gfs…gwdflg: true # True--> GWD on ; False--> GWD off cdmb: 0.1* # adjusts mountain blockingcleffamp: 2.24 * # adjusts the gravity wave drag (GWD) sigfac: 3.00 * # dividing streamline is searched above the highest

elevation by sigfac*Zstd (Zstd=std dev of terrain)

factop: 0.50 # limit deacceleration (momentum deposition) aloftrlolev: 50.00 # adjusts GWD when p > rlolev (centibars) in a complex waydpmin: 0.00 # minimum thickness of the reference layer

* Values for cdmb, cleffamp, sigfac based on optimal settings for 12-km runs2/19/2014

Page 8: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 8

Land Surface Schemes • Noah (phys/module_LS_NOAHLSM.F90)

– 4 soil layers (10, 30, 60, & 100 cm thick) + snow layer– 19 soil types (STASGO)– Land use & vegetation types

• 24 from older USGS• 20 from newer IGBP (MODIS-derived, used in NAM)

– Urban canopy model (phys/module_SF_URBAN.F90)• Little (if any?) testing in EMC meso group

• LISS (phys/module_LS_LISS.F90)

– Land ice sea model (Vukovic et al., 2010, ) introduced into NMMB by Zavisa

– 4 soil layers + snow layer2/19/2014

Page 9: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 9

Configure File Settingsland_surface: # land surface schemes, noah or liss…ucmcall: # Use (=1) or do not use (=0) urban canopy model ivegsrc: # Use (=1) or do not use (=0) IGBP vegetation & land use types…nhrs_srfc: # Frequency in hours between times when surface energy

and moisture fluxes are reset to 0

Settings shared by surface layer, PBL, GWD+MB, and land surface:nphs: # Number of dynamics time steps between calls to land

surface, turbulence (sfc layer + PBL), and GWD+MB

2/19/2014

Page 10: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 10

Convection• Betts-Miller-Janjic (phys/module_CU_BMJ.F90)

– BMJ scheme changes T & Q only• Simplified Arakawa Schubert

(phys/module_CU_BMJ.F90)

– SAS is a mass flux scheme (added by Weiguo Wang in 2010)

– ncloud=1, detrains liquid & ice (partitioned into various pre-existing species, may differ from HWRF)

• Both schemes account for deep (precipitating) and shallow (nonprecipitating) modes of convection

2/19/2014

Page 11: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 11

Configure File Settingsconvection: # Convective scheme, either bmj or sas…nprecip: # Number of dynamics timesteps between calls to convection and

microphysics Settings that control the BMJ schemefres: 0.75 # resolution factor for dsp's (default) fr: 1.0 # land factor for dsp's (dafault) fsl: 0.75 # reduction factor for "slow" dsp's over land (dafault) fss: 0.75 # reduction factor for "slow" dsp's over water (dafault)

Settings that control BMJ deep & shallow convection switches (true/false)entrain: .false. # includes entrainment in parcel ascentnewall: .false. # new treatment for shallow cloudsnewswap: .false. # new shallow clouds at swap points* (commented out)newupup: .false. # new shallow clouds with upward heat &moisture transportnodeep: .false. # all deep convection diverted to shallow convection

* Swap points are when shallow convection is considered after deep convection test fails (entropy decreases)

2/19/2014

Page 12: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 12

Microphysics (1 of 3)• Old NAM/HWRF (phys/module_MP_ETANEW.F90)

– ‘fer’ - similar to “old Eta” in WRF (etampold, mp_physics=95)– Uses smaller look up tables for rain– Predicts cloud water, rain, and ice (internal algorithm

separates cloud ice from snow/graupel) mixing ratios, and density of ice (“rime factor”) within the microphysics

• New NAM (phys/module_MP_FER_HIRES.F90)– ‘fer_hires’ - similar to “new Eta” in WRF (etampnew,

mp_physics=5)– Uses larger look up tables for rain– Soon to be updated by “Ferrier-Aligo” version

• Being tested in real-time parallels & HWRF retrospectives, changes made to represent deep convection better (esp radar reflectivities)

2/19/2014

Page 13: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 13

Microphysics (2 of 3)• GFS (phys/module_MP_GFS.F90)– Similar to what’s in GFS (added by Weiguo Wang in 2010)

– Sundqvist condensation, partial cloudiness allows clouds to form at RH > RHcrit (=95% in NMMB)

– Predicts cloud water & cloud ice; rain and snow fall out and do not remain in atmosphere

• WSM6 (phys/module_MP_WSM6.F90)– Developed by Hong et al. (added by Weiguo in 2010)

– Predicts cloud water, cloud ice, rain, snow, & graupel– Added based on feedback from SPC, used in 4-km NSSL ARW

2/19/2014

Page 14: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 14

Microphysics (3 of 3)

• Thompson (phys/module_mp_thompson.F90 & phys/module_mp_radar.F90)– Recently added by Greg and Dusan– Predicts mixing ratios of cloud water, cloud ice, rain, snow,

& graupel, as well as number concentrations of rain and cloud ice

– Extra care dedicated to the treatment of snow using the work of Paul Field

– Greg is finishing the coupling with the RRTM radiation

2/19/2014

Page 15: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 15

Configure File Settings (1 of 2)microphysics: # Microphysics scheme, either fer, fer_hires, gfs, wsm6, or

thompson.…spec_adv: # Separately advect hydrometeor species (=true) or advect

only total condensate (=false). Recommend spec_adv=true for thompson. (Added with help from Weiguo Wang)

lmprate: # Write microphysics processes of 4D array MPRATES to history files (=true), otherwise write a single 3D array with zero values (=false). Currently available for fer, fer_hires, & wsm6 microphysics (added by Eric Aligo).

…nprecip: # Number of dynamics timesteps between calls to

convection and microphysics

2/19/2014

Page 16: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 16

Configure File Settings (2 of 2)NOTE: User must set nhrs_udef to .TRUE. and set the emptying frequencies (nhrs_*)

to the desired values or else all accumulations will automatically be emptied at the frequency of history output.

nhrs_udef: true # User defined (=true) or frequency of history output (=false)

nhrs_prec: 3 # Frequency in hours between times when precip arrays are emptiednhrs_heat: 3 # Frequency in hours between times when heating arrays are emptiednhrs_clod: 3 # Frequency in hours between times when cloud arrays are emptied*

Above example has the precipitation “buckets”, diabatic heating rates for convection & microphysics, and cloud fractions from radiation* being set to 3-h accumulations.

* Cloud fractions are calculated in the radiation and not in the microphysics.

2/19/2014

Page 17: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 17

Full GFS Physics (‘gbphys’)gfs: false # Select entire GFS physics (=true) or individual options (=false)

(added by Ratko Vasic, used in global NMMB development)

Midway in module_SOLVER_GRID_COMP.F90:

gfs_phys_test: IF(.NOT.int_state%GFS)THEN• Run the various physics discussed earlier• CALL UPDATE_WATER*, Radiation, RDTEMP*, Turbulence,

CLTEND*, Convection, Microphysics, and CLTEND* (twice)ELSE gfs_phys_test !<-- Use GFS physics package

• Lots of preparation, initialize arrays, etc.• CALL GRRAD (GFS radiation), GBPHYS (other GFS physics)• Update 2D arrays (all involve >2000 lines of code)

ENDIF gfs_phys_test

2/19/2014

Page 18: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 18 of 31

Flowcharts of Physics Codes

With Respect to NMMB Solver

2/19/2014

Page 19: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 19

Flowchart for Radiation & Convection

nmm/module_SOLVER_GRID_COMP.F90

nmm/module_RADIATION.F90

phys/module_RA_GFDL.F90

phys/module_RA_RRTM

.F90

(calls *_nmmb.f)

nmm/module_CONVECTION.F90

phys/module_CU_BMJ.F90

phys/module_CU_SAS.F90

2/19/2014

Page 20: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 20

Flowchart for Microphysics

nmm/module_SOLVER_GRID_COMP.F90

nmm/module_MICROPHYSICS.F90

phys/

module_MP_

ETANEW.F90

phys/

module_MP_

FER_HIRES.F90

phys/

Module_MP_GFS.F90

phys/

module_MP_WSM6.F90

phys/

module_mp_THOMPSON.F90mo

dule_mp_radar.F90

Other Physics

2/19/2014

Page 21: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 21

Flowchart for Turbulence, etc.

nmm/module_SOLVER_GRID_COMP.F90

nmm/module_TURBULENCE.F90

phys/module_LS_NOAHLSM.F90

phys/module_LS_LISS.F90

phys/module_SF_JSFC.F90

phys/module_BL_MYJPBL.F90

phys/module_BL_GFSPBL.F90

OR

OR

GWD + MB (optional)nmm/module_GWD.F90

Surface Layer

Land Surface

PBL

2/19/2014

Page 22: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

Adding a New Array

e.g. 2D snow cover (SNOWC array)and

MODIS albedo flag (ialbsrc)

Page 23: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 23

List of Codes To Change /nmm directorymodule_GET_CONFIG.F90 - Add a configure file variablemodule_INIT_READ_BIN.F90 - Read from binary file module_INIT_READ_NEMSIO.F90 - Read from NEMSIO file (NPS input & restart files)module_SOLVER_INTERNAL_STATE.F90 - Loads into ‘generic’ int_state%VARS module_SOLVER_GRID_COMP.F90 - Main solver: initializes, then passes to physicsmodule_RADIATION.F90 - Used by radiation, adjust sfc albedos over snowmodule_TURBULENCE.F90 - Updated by land surface

module_WRITE_ROUTINES.F90 - Rename variables in NEMSIO GrADS control files

job/regression_tests/solver_state.txt#------------------------------------------------------------# Name History Owned eXport Description# Name Restart Import Time_ser#------------------------------------------------------------...### 2D real...'SNOWC' H R O - - T 'Snow Cover (fraction: 0--1)'

2/19/2014

Page 24: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 24

Adding a configure file variable (1 of 2)

! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ MESSAGE_CHECK="GET_CONFIG: Extract IALBSRC from Config File" IF(int_state%PRINT_ESMF .OR. int_state%PRINT_ALL) & CALL ESMF_LogWrite(MESSAGE_CHECK,ESMF_LOGMSG_INFO,rc=RC)! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ! CALL ESMF_ConfigGetAttribute(config=CF & !<-- The configure file object ,value =int_state%IALBSRC & !<-- Put extracted quantity here ,label ='ialbsrc:' & !<-- The quantity's label in the configure file ,rc =RC) !! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ CALL ERR_MSG(RC,MESSAGE_CHECK,RC_CONF)

module_GET_CONFIG.F90[ ialbsrc: .true. # MODIS albedos (=true), Matthews albedos (=false) ]

2/19/2014

Page 25: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 25

Adding a configure file variable (2 of 2)

jobs/regression_test/solver_state.txt#------------------------------------------------------------# Name History Owned eXport Description# Name Restart Import Time_ser#------------------------------------------------------------

### 0D integer (scalar)

'IALBSRC' H - O - - - 'Albedo source identifier, 0--> Matthews albedos, 1--> MODIS albedos'

2/19/2014

ialbsrc: .true. # MODIS albedos (=true), Matthews albedos (=false)

Added to the configure file

Page 26: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 26

Reading from a Binary FileSubroutine read_binary in module_INIT_READ_BIN.F90 !-----------------------------------------------------------------------!*** SNO and SNOWC!----------------------------------------------------------------------- IF(MYPE==0)THEN READ(NFCST)TEMP1 ENDIF CALL DSTRB(TEMP1,int_state%SNO,1,1,1,1,1,MYPE,MPI_COMM_COMP) DO J=JMS,JME DO I=IMS,IME if(int_state%SNO(I,J).gt.0.) then int_state%SNOWC(I,J)=0.98 else int_state%SNOWC(I,J)=0.0 endif ENDDO ENDDO

2/19/2014

Page 27: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 27

Reading from a NEMSIO File (1 of 3)

Subroutine read_nemsio in module_INIT_READ_NEMSIO.F90

read_blocks: if(.not.int_state%RESTART) then ! cold start!

(1) Stuff on next slide for reading from an NPS-generated NEMSIO “input” file

else read_blocks ! Restart

(2) Stuff 2 slides later for reading from a model NEMSIO restart file

endif read_blocks ! cold start /restart

=> Remember to new array(s) in both locations!

2/19/2014

Page 28: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 28

Reading from a NEMSIO File (2 of 3)Subroutine read_nemsio in module_INIT_READ_NEMSIO.F90

(reads from an NPS-generated NEMSIO file)!------------------------------------------------------------------!*** SNO and SNOWC!-------------------------------------------------------------------! call getrecn(recname,reclevtyp,reclev,nrec,'sno','sfc',1,recn) if(recn>0) then fldst=(recn-1)*fldsize do j=jts,jte js=(j-jts)*(ite-its+1) do i=its,ite int_state%SNO(i,j)=tmp(i-its+1+js+fldst) if(int_state%SNO(i,j).gt.0.) then int_state%SNOWC(i,j) = 0.98 else int_state%SNOWC(i,j) = 0.0 endif enddo enddo endif

2/19/2014

Page 29: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 29

Reading from a NEMSIO File (3 of 3)

Subroutine read_nemsio in module_INIT_READ_NEMSIO.F90(reads from a model NEMSIO restart file)

!--------------------------------------------------------------------!*** SNOWC!--------------------------------------------------------------------! call getrecn(recname,reclevtyp,reclev,nrec,'snowc','sfc',1,recn) if(recn>0) then fldst=(recn-1)*fldsize do j=jts,jte js=(j-jts)*(ite-its+1) do i=its,ite int_state%SNOWC(i,j)=tmp(i-its+1+js+fldst) enddo enddo endif2/19/2014

Page 30: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 30

Other Steps (as in Dusan’s presentation)

module_SOLVER_INTERNAL_STATE.F90

module_SOLVER_GRID_COMP.F90

SUBROUTINE SOLVER_INITIALIZE. . .int_state%SNOWC(I,J) = 0.. . .SUBROUTINE SOLVER_RUN. . .CALL RADIATION (<args>, int_state%SNOWC,<args>). . .CALL TURBL(<args>, int_state%SNOWC,<args>)

REAL(kind=KFPT),DIMENSION(:,:),POINTER :: <other arrays>, SNOWC, <more arrays> . . .CALL SET_VAR_PTR(int_state%VARS,NV,'SNOWC' ,int_state%SNOWC ,(/ IMS,JMS /),(IME,JME /) )

2/19/2014

Page 31: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 31

Renamed Output Fields

2/19/2014

Configure file option:

write_nemsioctl: .TRUE. # True--> Yes write ctl for nemsio run history files

Sample output from run directory, 3-h history file & GrADS control (ctl) file from the 1st domain:

nmmb_hst_01_nio_0003h_00m_00.00s nmmb_hst_01_nio_0003h_00m_00.00s.ctl

Most array names are the same as in solver_state.txt , except for:

1. History files. Arrays are renamed in subroutine WRITE_NEMSIO_RUNHISTORY_OPEN in module_WRITE_ROUTINES.F90 at “IF (RECNAME(NREC)==“ lines. Examples:

Array names in model: W_TOT, CW, U, V, T, Q, O3 Renamed fields in NEMSIO files: vvel, clwmr, ugrd, vgrd, tmp, spfh, o3mr

2. Restart files. Arrays are renamed in subroutine WRITE_NEMSIO_RUNRESTART_OPEN at similar lines. They are usually the same as in the history files, except for vertical velocity.

a. “W” in model is part of the full vertical velocity, written as “w” to the history file and “vvel” in the restart file.

b. “W_TOT” in model is the full vertical velocity, written as “vvel” only to the history file (based on the current solver_state.txt file in the SVN trunk).

Page 32: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 32

RRTM & GFS Codes in /phys*.f files (compiled in –r8)

calpreciptype.f ideaca.f mstadbtn2.f radiation_clouds_nmmb.f sascnv.fcnvc90.f idea_co2.f mstadbtn.f radiation_gases.f sascnvn.fco2hc.f idea_dissipation.f mstcnv.f radiation_gases_gfs.f set_soilveg.fdate_def.f idea_h2o.f namelist_soilveg.f radiation_gases_nmmb.f sfc_diag.fdcyc2.f idea_ion.f ozinterp.f radiation_surface.f sfc_diff.fdcyc2.pre.rad.f idea_o2_o3.f ozne_def.f radiation_surface_gfs.f sfc_drv.fefield.f idea_phys.f ozphys.f radiation_surface_nmmb.f sfc_land.ffuncphys.f idea_solar_heating.f physcons.f rad_initialize.f sfc_nst.fgbphys.f idea_tracer.f physparam.f rad_initialize_nmmb.f sfc_ocean.fget_prs.f iounitdef.f physpara_nmmb.f radlw_datatb.f sfc_sice.fgfs_phy_tracer_config.f lrgsclr.f precpd.f radlw_datatb_nmmb.f sfcsub.fgocart_tracer_config.f machine.f precpd_nmmb.f radlw_main.f sflx.fgocart_tracer_config_stub.f mersenne_twister.f progt2.f radlw_main_nmmb.f shalcnv.fgrrad.f module_bfmicrophysics.f progtm_module.f radlw_param.f shalcv_1lyr.fgrrad_gfs.f module_nst_model.f radiation_aerosols.f radlw_param_nmmb.f shalcv.fgrrad_nmmb.f module_nst_parameters.f radiation_aerosols_gfs.f radsw_datatb.f shalcv_fixdp.fgscond.f module_nst_water_prop.f radiation_aerosols_nmmb.f radsw_datatb_nmmb.f shalcv_opr.fgsmddrive.f moninp1.f radiation_astronomy.f radsw_main.f tracer_const_h.fgwdc.f moninp.f radiation_astronomy_gfs.f radsw_main_nmmb.f tridi2t3.fgwdps.f moninq1.f radiation_astronomy_nmmb.f radsw_param.fh2oc.f moninq.f radiation_clouds.f radsw_param_nmmb.fh2ohdc.f mstadb.f radiation_clouds_gfs.f rascnvv2.f

*_nmmb.f files – all but precpd_nmmb.f are related to RRTM radiation in the NMMB

grrad_nmmb.f radiation_aerosols_nmmb.f radiation_gases_nmmb.f radlw_datatb_nmmb.f radsw_datatb_nmmb.fphyspara_nmmb.f radiation_astronomy_nmmb.f radiation_surface_nmmb.f radlw_main_nmmb.f radsw_main_nmmb.fprecpd_nmmb.f radiation_clouds_nmmb.f rad_initialize_nmmb.f radlw_param_nmmb.f radsw_param_nmmb.f

2/19/2014

Page 33: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

Sequence of Physics Callsin Model Solver

nmm/module_SOLVER_GRID_COMP.F90

Page 34: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 34

Physics Calls in Solver_Run (1 of 2)

SUBROUTINE SOLVER_RUN in module_SOLVER_GRID_COMP.F90

• MAX_FIELDS (_HR, _W6) – maximum hourly severe WX fields• UPDATE_WATER – couple/synchronize WATER(:,:,:,P_Qx) [ => TRACERS(:,:,:,P_Qx) ]

arrays with 3D CWM, F_ice, F_rain, F_RimeF (“ferrier”) arrays• CALL READPCP – Read input precip obs, NDAS precipitation assimilation• CALL TIME_MEASURE – time fields for GFDL radiation (NTIMESTEP_RAD=NTIMESTEP+1)• RADIATION + various ESMF calls for time fields (controlled by nrads=nradl)• RDTEMP – update T from radiative temperature tendencies (RSWTT, RLWTT)• SWAPHN, POLEHN – exchange across E-W boundary & poles (global NMMB)

=> Reset to 0 radiation & land sfc accumulators (“buckets”), controlled by nhrs_xxx• Turbulence branch (controlled by nphs):

– TURBL – sfc layer, land surface, PBL, GWD+MB)– HALO_EXCH – halo exchanges for DUDT, DVDT– H_TO_V_TEND – interpolate from H (mass) to V (velocity) points, update U,V winds– SWAPHN, POLEHN, SWAPWN, POLEWN – exchange across boundaries (global NMMB)

2/19/2014

Page 35: Model Physics / Porting Physics to the NMMB NEMS-NMMB Tutorial 19 February 2014 Brad Ferrier, Dusan Jovic, & Ratko Vasic

NMMB Tutorial: Physics 35

Physics Calls in Solver_Run (2 of 2)(cont.)

=> Reset to 0 heating, precipitation, & microphysical process accumulators (nhrs_xxx)• Moist processes branch (controlled by nprecip)

– CLTEND (ICTEND=-1) – defines TOLD 3D array– CUCNVC – convection – HALO_EXCH, H_TO_V_TEND – SWAPHN, POLEHN, SWAPWN, POLEWN – exchange across boundaries (global NMMB)– GSMDRIVE – microphysics– CLTEND (ICTEND=0) – Calculates cloud (Cu+micro) temperature tendencies (Tadj)– CHKSNOW, ADJPPT – NDAS precipitation assimilation– SWAPHN, POLEHN – Q, CW … include WATER(:,:,:,P_Qx) for other schemes? – HALO_EXCH – halo exchanges for Q, CW

• CLTEND (ICLTEND=1) – update T from cloud temperature tendencies (Tadj)• SWAPHN, POLEHN – exchange T across boundaries (global)• HALO_EXCH – halo exchanges for T, WATER(:,:,:,P_Qx)

2/19/2014