390 likes | 587 Views
NCAR is Sponsored by NSF. Advanced Topics in WRF. Cindy Bruyère. Topics. Registry John Michalakes (NREL), Dave Gill & Michael Duda (NCAR) http://www.mmm.ucar.edu/wrf/WG2/software_v2 Special issues related to climate runs Input Data Biases in climate model data Radiation schemes
E N D
NCAR is Sponsored by NSF Advanced Topics in WRF Cindy Bruyère BCCR - Sep 2010
Topics • Registry • John Michalakes (NREL), Dave Gill & Michael Duda (NCAR) • http://www.mmm.ucar.edu/wrf/WG2/software_v2 • Special issues related to climate runs • Input Data • Biases in climate model data • Radiation schemes • Model boundaries • Soil data • Using ndown for climate model runs BCCR - Sep 2010
WRF Software Architecture Registry BCCR - Sep 2010
"Active data-dictionary” for managing WRF data structures Database describing attributes of model state, intermediate, and configuration data Dimensionality, number of time levels, staggering Association with physics I/O classification (history, initial, restart, boundary) Communication points and patterns Configuration lists (e.g. namelists) Nesting up- and down-scale interpolation WRF Registry BCCR - Sep 2010
Registry Data Base • Currently implemented as a text file: Registry/Registry.EM • Types of entry: • Dimspec– Describes dimensions that are used to define arrays in the model • State – Describes state variables and arrays in the domain structure • I1– Describes local variables and arrays in solve • Typedef– Describes derived types that are subtypes of the domain structure • Rconfig – Describes a configuration (e.g. namelist) variable or array • Package – Describes attributes of a package (e.g. physics) • Halo– Describes halo update interprocessor communications • Period– Describes communications for periodic boundary updates BCCR - Sep 2010
Registry State Entry Type: The type of the state variable or array (real, double, integer, logical, character) Sym: The symbolic name of the variable or array (name used in code) Dims: A string denoting the dimensionality of the array. b indicates additional boundary arrays. Eight LBC arrays for boundary and boundary tendencies u_b[xy][se] ( i/j, k, spec_bdy_width, time) u_bt[xy][se] (i/j, k, spec_bdy_width, time) Type Sym Dims Use TLev Stag IO Name Desc Units state real u ikjb dyn_em 2 X i01rhusdf "U" "X WIND COMPONENT" "m s-1" BCCR - Sep 2010
Registry State Entry NumTLev: An integer indicating the number of time levelsTwo 3D state arrays corresponding to the 2 time levels of U u_1 & u_2 Stagger: String indicating staggered dimensions of variable (X, Y, Z, or hyphen) Name / Descption / Units: Metadata for the variable Type Sym Dims Use TLev Stag IO Name Desc Units state real u ikjb dyn_em 2 X i01rhusdf "U" "X WIND COMPONENT" "m s-1" BCCR - Sep 2010
Registry State Entry IO: String indicating whether and how the variable is subject to I/O and Nestingi - inputr - restart (never remove!!)h - historyu/d - feedback (up and down)s - smoothingf - forcingnumbers - stream numberThe ‘h’, ‘r’, and ‘i’ specifiers may appear in any order or combination.The ‘h’ and ‘i’ specifiers may be followed by an optional integer string consisting of ‘0’, ‘1’, … , ‘9’ Zero denotes that the variable is part of the principal input or history I/O stream. The characters ‘1’ through ‘9’ denote one of the auxiliary input or history I/O streams. Type Sym Dims Use TLev Stag IO Name Desc Units state real u ikjb dyn_em 2 X i01rhusdf "U" "X WIND COMPONENT" "m s-1" BCCR - Sep 2010
Registry State Entry - IO Type Sym Dims Use TLev Stag IO Name Desc Units state real u ikjb dyn_em 2 X i01rhusdf "U" "X WIND COMPONENT" "m s-1" irh-- The state variable will be included in the WRF model input, restart, and history I/O streams irh13 -- The state variable has been added to the first and third auxiliary history output streams; it has been removed from the principal history output stream, because zero is not among the integers in the integer string that follows the character 'h' irh01 -- The state variable has been added to the first auxiliary history output stream; it is also retained in the principal history output i205hr -- Now the state variable is included in the principal input stream as well as auxiliary inputs 2 and 5. Note that the order of the integers is unimportant. The variable is also in the principal history output stream ir12h -- No effect; there is only 1 restart data stream i01 -- Data goes into real and into WRF i1 -- Data goes into real only BCCR - Sep 2010
IO Control - Usage • Change if/where is variable is written out for all subsequent model runs • Best to make this change in Registry.EM • Remember to recompile the codestate real p_hyd ikj dyn_em 1 - irh "p_hyd" "hydrostatic pressure" "Pa"state real CLDFRA ikj misc 1 - r "CLDFRA" "CLOUD FRACTION" "" Remove p_hydfrom wrfout and add CLDFRAstate real p_hyd ikj dyn_em 1 - ir "p_hyd" "hydrostatic pressure" "Pa"state real CLDFRA ikj misc 1 - rh "CLDFRA" "CLOUD FRACTION" "" BCCR - Sep 2010
IO Control - Usage • Change if/where is variable is written out for all subsequent model runs • For this example we want to add RAINC and RAINNC to an extra output filestate integer RAINC ij misc 1 - h03 "RAINC" "" "ACCUMULATED TOTAL CUMULUS PRECIPITATION" state integer RAINNC ij misc 1 - h03 "RAINC" "" "ACCUMULATED TOTAL GRID SCALE PRECIPITATION" • Edit namelist.input auxhist3_outname= “rainfall_d<domain>_<date>” auxhist3_interval = 60 frames_per_auxhist3= 24 io_form_auxhist3 = 2 BCCR - Sep 2010
IO Control - Usage • Let’s again removep_hydfrom wrfout and addCLDFRA, but this time do it at runtime • NO need to change Registry.EM, or compile • Prepare text file (‘my_output.txt’) to define io fields: -:h:0:p_hyd +:h:0:CLDFRA • Edit namelist.input iofields_filename = ‘my_output.txt’ BCCR - Sep 2010
IO Control - Usage • If we also want to add the RAINC and RAINNC fields like before, we need to add the following to our text file: • ‘my_output.txt’: -:h:0:p_hyd +:h:0:CLDFRA+:h:3:RAINC,RAINNC • Edit namelist.input iofields_filename = ‘my_output.txt’ auxhist3_outname= “rainfall_d<domain>_<date>” auxhist3_interval = 60 frames_per_auxhist3= 24 io_form_auxhist3 = 2 BCCR - Sep 2010
Rconfig Entry Type Sym How set Nentries Default rconfig integer spec_bdy_width namelist,bdy_control 1 1 Type: The type of the namelist variable or array Sym: The symbolic name of the namelist variable or array How set: Indicates how the variable is set, and in which block of the namelist it is set in. Nentries: Specifies the dimensionality of the variable. 1 - if it applies to all domains; max_domains - different values applies to different domains. Default: The default value of the variable to be used if none is specified in the namelist. BCCR - Sep 2010
Rconfig Entry - Example • Define an namelist variable “spec_bdy_width” in the bdy_control section of namelist.input • Type integer • Specifies that spec_bdy_width applies to alldomains in the run • Default value if 1 if not specified Type Sym How set Nentries Default rconfig integer spec_bdy_width namelist,bdy_control 1 1 --- File: namelist.input --- &bdy_control spec_bdy_width = 5, spec_zone = 1, relax_zone = 4, . . . / BCCR - Sep 2010
Rconfig Entry - Example • Define an namelist variable “start_year” in the time_control section of namelist.input • Type integer • Specifies that start_year requires an entry for each active domain in the run • Default value if 1993 if not specified Type Sym How set Nentries Default rconfig integer start_year namelist,time_control max_domains 1993 --- File: namelist.input --- &time_control start_year = 2010, 2010, start_month = 09, 09, start_day = 21, 21, . . . / BCCR - Sep 2010
Package Entry # specification of microphysics options package passiveqv mp_physics==0 - moist:qv 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,qr,qi,qspackage thompson mp_physics==8 - moist: qv,qc,qr,qi,qs,qg;scalar:qni,qnr # namelist entry that controls microphysics option rconfig integer mp_physics namelist,physics max_domains 0 USE module_state_descriptions ... Micro_select : SELECT CASE ( mp_physics ) CASE ( KESSLERSCHEME ) CALL kessler ( ... CASE ( THOMPSON ) CALL mp_gt_driver ( ... ... END SELECT micro_select Packages define automatically enumerated types to avoid the usual tests ( i.e. option #17 for microphysics) BCCR - Sep 2010
Halo Entry # Halo update communications halo HALO_EM_TKE_C dyn_em 4:ph_2,phb Communication name: Given to the particular communication Associated dynamical core: dyn_em Stencil size: 4, or (2n+1)^2-1 (i.e. 8, 24, 48; semi-colon separated) Which variables: names of the variables (comma separated) ** X ** * BCCR - Sep 2010
Period Entry # Period update communications period PERIOD_EM_COUPLE_A dyn_em 2:mub,mu_1,mu_2 Communication name: Given to the particular communication Associated dynamical core: dyn_em Stencil size: # rows and columns to share for periodic lateral BCs Which variables: names of the variables (comma separated) BCCR - Sep 2010
Example: Compute a Diagnostic • Problem: Wind the max wind gust in your model domain at each model time step • Steps: • Modify solve to compute wind-speed and then compute the local sum and maxima at the end of each time step • Use reduction operations built-in to WRF software to compute the global qualities • Output these on one process (process zero, the “monitor” process) BCCR - Sep 2010
Example: Compute a Diagnostic • Compute local local max wind speed and the local indices of the local maximum --- File: dyn_em/solve_em.F (near the end) --- ! Compute local maximum and sum of 10m wind-speed max_ws = 0. DO j = jps, jpe DO i = ips, ipe wind_vel = sqrt( grid%u10(i,j)**2+ grid%v10(i,j)**2 ) IF ( wind_vel .GT. max_ws ) THEN max_ws = wind_vel idex = i jdex = j ENDIF ENDDO ENDDO BCCR - Sep 2010
Example: Compute a Diagnostic • Compute global max, and indices of the global max • Output the value on process zero, the “monitor” ! Compute global maximum and associated i,j point CALL wrf_dm_maxval_real ( max_ws, idex, jdex ) ! Print out the result on the monitor process IF ( wrf_dm_on_monitor() ) THEN WRITE(outstring,*)'Max. ',max_ws, CALL wrf_message ( TRIM(outstring) ) ENDIF BCCR - Sep 2010
Example: Compute a Diagnostic --- Output file: rsl.out.0000 --- . . . Timing for main: time 2000-01-24_12:03:00 on domain 1: 8.96500 elapsed secs. Timing for main: time 2000-01-24_12:06:00 on domain 1: 4.89460 elapsed secs. Timing for main: time 2000-01-24_12:09:00 on domain 1: 4.83500 elapsed secs. . . . --- Output file: rsl.out.0000 --- . . . Max. 15.09370 Timing for main: time 2000-01-24_12:03:00 on domain 1: 8.96500 elapsed secs. Max. 14.97418 Timing for main: time 2000-01-24_12:06:00 on domain 1: 4.89460 elapsed secs. Max. 14.92687 Timing for main: time 2000-01-24_12:09:00 on domain 1: 4.83500 elapsed secs. . . . BCCR - Sep 2010
Input data static grib IM netCDF Rec1: flag Rec2: date,field,dims Rec3: projection Rec4: wind rotationRec5: 2D data slab geogrid.exe metgrid.exe ungrib.exe BCCR - Sep 2010
netCDF input Data Common format for Global Climate Models Unreleased code for NCAR CCSM Model Example program to write data into the IM format http://www.mmm.ucar.edu/wrf/OnLineTutorial/WPS/IM_files.htm Documentation to read/write netCDF data http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f77.pdfhttp://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f90.pdf Documentation in User’s Guide Chap 3 Test IM files withplotfmt.exe&rd_intermediate.exe BCCR - Sep 2010
The rd_intermediate lists information about the fields found in an intermediate-format file Utility: rd_intermediate ================================================FIELD = TTUNITS = K DESCRIPTION = TemperatureDATE = 2000-01-24_12:00:00 FCST = 0.000000SOURCE = unknown model from NCEP GRID 212LEVEL = 200100.000000I,J DIMS = 185, 129IPROJ = 1 REF_X, REF_Y = 1.000000, 1.000000 REF_LAT, REF_LON = 12.190000, -133.459000 DX, DY = 40.635250, 40.635250 TRUELAT1 = 25.000002DATA(1,1)=295.910950================================================ BCCR - Sep 2010
The plotfmt program plots the fields in the ungrib intermediate-formatted files Utility: plotfmt BCCR - Sep 2010
Biases in Climate Model Data • Climate modelers often only look at anomalies in their models. • In other words, if decadal anomaly trends in current climate is correct in the model, one has some confidence that future trend predictions in the model will be fairly accurate. • This does not say anything about the absolute fields in these models and one often find that although we have some confidence in the climate trends from these models, they have some strong biases in the actual fields. • Then these actual fields are used as boundary conditions to drive regional climate models - these biases may have detrimental effects on model results BCCR - Sep 2010
Biases in Climate Model Data • To address this problem various methods have been developed by regional climate modelers to remove biases from global models before these datasets are used as boundary conditions for regional climate models • In both cases only the climate trends from the global models are used as guidance for the regional models future_climate = current_climate + ∆climate_trend future_climate = current_climate + ∆climate_trend BCCR - Sep 2010
Biases in Climate Model Data FC = CC + ∆CT FC = CC + ∆CT BCCR - Sep 2010
Radiation schemes • When running future scenarios using regional models, your model will inherently contain the climate signal for the increase CO2 scenario you are simulating • But you want the regional model to have the same CO2 concentrations to match the scenario you are interested in • Only CAM has CO2 that changes in time out to 2100. The rest has a single CO2 value • Using other - make sure you hardcode the CO2 for the time you run - cumbersome • For CAM - make sure you change the values if you run a scenario other than A2 BCCR - Sep 2010
Boundary Conditions &bdy_control spec_bdy_width = 5, spec_zone = 1, relax_zone = 4, &bdy_control spec_bdy_width = 10, spec_zone = 1, relax_zone = 9, spec_exp = 0.33, BCCR - Sep 2010
Input data • For climate data we often do not have soil fields in the future datasets • Soil values are only used at the initial time • So one can get soil from a different dataset - for a comparable time and season • Make sure there is a couple of weeks or longer spinup time in the model to reach a balanced state • Do remember that the data probbaly have different projections and more importantly different landsea masks BCCR - Sep 2010
Input data ======================================== name=SEAICE interp_option=four_pt+average_4pt interp_mask=LANDSEA(1) masked=land fill_missing=0. ======================================== name=SM000010 interp_option=sixteen_pt+four_pt+average_4pt masked=water interp_mask=LANDSEAN(0) fill_missing=1. flag_in_output=FLAG_SM000010 ======================================== ======================================== name=LANDSEA interp_option=nearest_neighbor fill_missing=-1. fill_lev=200100:LANDMASK(1) ======================================== name=LANDSEAN interp_option=nearest_neighbor fill_missing=-1. fill_lev=200100:LANDMASKN(1) output=no ======================================== BCCR - Sep 2010
Input data ======================================== name=SEAICE interp_option=four_pt+average_4pt interp_mask=LANDSEA(1) masked=land fill_missing=0. ======================================== name=SM000010 interp_option=sixteen_pt+four_pt+average_4pt masked=water interp_mask=LANDSEAN(0) fill_missing=1. flag_in_output=FLAG_SM000010 ======================================== ======================================== name=LANDSEA interp_option=nearest_neighbor fill_missing=-1. fill_lev=200100:LANDMASK(1) ======================================== name=LANDSEAN interp_option=nearest_neighbor fill_missing=-1. fill_lev=200100:LANDMASKN(1) output=no ======================================== BCCR - Sep 2010
ndown and climate runs CCSM ~ 150 km BCCR - Sep 2010