Presentation on theme: "BCCR - Sep 20101 Advanced Topics in WRF Cindy Bruyère NCAR is Sponsored by NSF."— Presentation transcript:
BCCR - Sep Advanced Topics in WRF Cindy Bruyère NCAR is Sponsored by NSF
BCCR - Sep Topics Registry –John Michalakes (NREL), Dave Gill & Michael Duda (NCAR) –http://www.mmm.ucar.edu/wrf/WG2/software_v2http://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 WRF Software Architecture Registry
BCCR - Sep WRF Registry "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
BCCR - Sep 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 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 Registry State Entry NumTLev : An integer indicating the number of time levels Two 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 Registry State Entry IO : String indicating whether and how the variable is subject to I/O and Nesting i - input r - restart (never remove!!) h - history u/d - feedback (up and down) s - smoothing f - forcing numbers - stream number The ‘ 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 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 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 code state 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_hyd from wrfout and add CLDFRA state 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 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 file state 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 _ ” auxhist3_interval = 60 frames_per_auxhist3 = 24 io_form_auxhist3 = 2
BCCR - Sep IO Control - Usage Let’s again remove p_hyd from wrfout and add CLDFRA, 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 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 _ ” auxhist3_interval = 60 frames_per_auxhist3 = 24 io_form_auxhist3 = 2
BCCR - Sep 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 Rconfig Entry - Example Type Sym How set Nentries Default rconfig integer spec_bdy_width namelist,bdy_control 1 1 –Define an namelist variable “spec_bdy_width” in the bdy_control section of namelist.input –Type integer –Specifies that spec_bdy_width applies to all domains in the run –Default value if 1 if not specified --- File: namelist.input --- &bdy_control spec_bdy_width = 5, spec_zone = 1, relax_zone = 4,... /
BCCR - Sep Rconfig Entry - Example Type Sym How set Nentries Default rconfig integer start_year namelist,time_control max_domains 1993 –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 --- File: namelist.input --- &time_control start_year = 2010, 2010, start_month = 09, 09, start_day = 21, 21,... /
BCCR - Sep 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,qs package 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 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 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 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 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 Example: Compute a Diagnostic Compute local local max wind speed and the local indices of the local maximum
BCCR - Sep ! Compute global maximum and associated i,j point CALL wrf_dm_maxval_real ( max_ws, idex, jdex ) Example: Compute a Diagnostic Compute global max, and indices of the global max Output the value on process zero, the “monitor” ! 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 Example: Compute a Diagnostic --- Output file: rsl.out Max Timing for main: time _12:03:00 on domain 1: elapsed secs. Max Timing for main: time _12:06:00 on domain 1: elapsed secs. Max Timing for main: time _12:09:00 on domain 1: elapsed secs Output file: rsl.out Timing for main: time _12:03:00 on domain 1: elapsed secs. Timing for main: time _12:06:00 on domain 1: elapsed secs. Timing for main: time _12:09:00 on domain 1: elapsed secs....
BCCR - Sep Input data geogrid.exe ungrib.exe metgrid.exe static grib IM netCDF Rec1: flag Rec2: date,field,dims Rec3: projection Rec4: wind rotation Rec5: 2D data slab
BCCR - Sep 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.htmhttp://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.pdf Documentation in User’s Guide Chap 3 Test IM files with plotfmt.exe & rd_intermediate.exe
BCCR - Sep The rd_intermediate lists information about the fields found in an intermediate-format file ================================================ FIELD = TT UNITS = K DESCRIPTION = Temperature DATE = _12:00:00 FCST = SOURCE = unknown model from NCEP GRID 212 LEVEL = I,J DIMS = 185, 129 IPROJ = 1 REF_X, REF_Y = , REF_LAT, REF_LON = , DX, DY = , TRUELAT1 = DATA(1,1)= ================================================ Utility: rd_intermediate
BCCR - Sep The plotfmt program plots the fields in the ungrib intermediate-formatted files Utility: plotfmt
BCCR - Sep 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 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
BCCR - Sep Biases in Climate Model Data FC = CC + ∆CT
BCCR - Sep Radiation schemes When running future scenarios using regional models, your model will inherently contain the climate signal for the increase CO 2 scenario you are simulating But you want the regional model to have the same CO 2 concentrations to match the scenario you are interested in Only CAM has CO 2 that changes in time out to The rest has a single CO 2 value –Using other - make sure you hardcode the CO 2 for the time you run - cumbersome –For CAM - make sure you change the values if you run a scenario other than A2
BCCR - Sep 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