22
Atmosphere Model Example Exercises Community Atmosphere Model Exercises prepared by Rich Neale Presented by Dani Coleman and Cecile Hannay AMP-CGD, NCAR

Community Atmosphere Model

  • Upload
    aletha

  • View
    38

  • Download
    0

Embed Size (px)

DESCRIPTION

Atmosphere Model Example Exercises Community Atmosphere Model Exercises prepared by Rich Neale Presented by Dani Coleman and Cecile Hannay AMP-CGD, NCAR. Community Atmosphere Model. Examples Turn off ‘freeze-drying’ approximation in CAM4 ( namelist change, Arctic ) - PowerPoint PPT Presentation

Citation preview

Page 1: Community Atmosphere Model

Atmosphere Model Example Exercises

Community Atmosphere Model

Exercises prepared by Rich NealePresented by Dani Coleman and Cecile Hannay

AMP-CGD, NCAR

Page 2: Community Atmosphere Model

Community Atmosphere ModelExamples1. Turn off ‘freeze-drying’ approximation in CAM4

(namelist change, Arctic)2. Increase orographic height over the western US by

50% (dataset change, mid-latitude)3. Increase the triggering threshold for deep convection

just over land (code change, Tropical)KeyCommands to be typed and code snippets appear in the Courier fontA backslash ‘\’ indicates typed command continues on next line (it does not mean return)

Page 3: Community Atmosphere Model

Creating F-cases F-case refers to a specific model configuration with prescribed (observed data) ocean and prescribed sea-ice (thickness, area)Compset Type Atmosphere Land Ocean Ice

F Interactive Interactive Data Thermodynamic

B Interactive Interactive Interactive Interactive

Create a new F-casecd /home/$LOGNAME/cesm_collection/cesm1_0_3/scriptscntl=cesm1_0_3.f2000.cntl• The casename is your choice; I like it to tell me as much as possible about the case. I also like to set shell variables so I don’t have to type the long names all the time!CASEDIR=~/cesm_case/$cntlcreate_newcase -case $CASEDIR -res T31_T31 -compset F_2000 -mach alps

• Note the difference with the B-case we’ve been running (no need to do this again!)

create_newcase -case $CASEDIR -res T31_gx3v7 -compset B_1850 -mach alps

Page 4: Community Atmosphere Model

Control CaseRun length options (run for 2 months)cd $CASEDIR./xmlchange -file env_run.xml -id STOP_N -val 2./xmlchange -file env_run.xml -id STOP_OPTION -val nmonths

Configure ./configure -case*** Most examples that follow are configured the same up to this point, so on those exercises just change the CASENAME and CASEDIR and you can use the same commands ***

BuildCASENAME=$cntl./$CASENAME.alps.build

Page 5: Community Atmosphere Model

Control Case: continuedSubmitbsub < ./$CASENAME.alps.run

Checking jobsbjobsShows output similar to:JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME992612 s07hsu0 PEND 48cpu alps6 *2000.cntl Mar 21 14:14

Recall Day1 tutorial for how to know when and how well the model is running….While this runs, continue with the tutorial to learn what we will do next.

Page 6: Community Atmosphere Model

Example 1: Namelist Change• ACTION: Switch off an approximation that reduces the cloud fraction in

very dry atmospheric conditions (Vavrus and Walliser, 2008)

Page 7: Community Atmosphere Model

Optional: Use a script• This tutorial is written for the command line and you may skip this page• It is possible to put most of the commands necessary to run CESM

in a shell script instead of calling them from the command line• Advantages of a script

• An exact record of the commands used to make each case• Easy reproducibility or make small changes for another case

• Disadvantages of a script• More advanced: have to understand scripting language (example is c-shell)• When the construction of a case requires editing or adding a file, you must

have the script stop before the edit and resume afterward• If you want to use the script: copy the instructors’ script for the control case to

your directory, open it in an editor, read and understand it and make the necessary modifications to use it for example 1 (including changing the case and filenames!)

cp /home/s07hsu00/cesm_case/cesm1_0_3.f2000.cntl.csh ~/cesm_case/newcase.csh

Since this is a more advanced method, there are no more instructions for doing it this way but it should be possible to figure it out yourself.

• Otherwise, continue as directed…

Page 8: Community Atmosphere Model

Example 1: Namelist ChangeFollow control case example until before the configureSet freeze drying to .False.Two methods-- choose one:1. Via env_conf.xml using xmlchange (configure after this)xmlchange -file env_conf.xml -id CAM_NAMELIST_OPTS -val "cldfrc_freeze_dry=.false."

2. Via buildnamelist file (configure before this)cd Buildconfemacs cam.buildnml.csh add the following two lines

&cldfrc_nlcldfrac_freeze_dry = .false.

Return to control case instructions at build pointAfter build, check CAM namelist in the run directory to confirm above changecd /work/$LOGNAME/cesm_run/diff $CASE1/run/atm_in $CNTL/run/atm_in

Page 9: Community Atmosphere Model

Example 1: Comparing to controlYou might need to load the ncview and netcdf modulesmodule list shows what is loaded already If necessary, use these commands to addmodule load ncviewmodule load netcdfA quick comparison: create an ncfile containing the diffs between two cases (both runs need to be finished for this to work!)cd /work/$LOGNAME/cesm_archive/CNTL=cesm1_0_3.f2000.cntlCASE1=cesm1_0_3.f2000.nofrzdryFILECNTL=$CNTL/atm/hist/$CNTL.cam2.h0.0001-01.nc FILECASE1=$CASE1/atm/hist/$CASE1.cam2.h0.0001-01.ncncdiff $FILECNTL $FILECASE1 diff_${CASE1}_${CNTL}.ncUse ncview to browsencview ${CASE1}_diff.ncWhat to look for? Surface temperature (TS), surface energy budget (FSDS,FLNS), surface pressure (PS), cloud (CLDLOW)

Page 10: Community Atmosphere Model

Example 2: Dataset change• ACTION: Change input boundary datasets (orography) by increasing it’s

value by 50% in the western USA

Page 11: Community Atmosphere Model

Example 2: Dataset change• ACTION: Change input boundary datasets (orography) by increasing it’s

value by 50% in the western USA

See alternative case 2a at the end to add a Sea Surface Temperature (SST) anomaly

Page 12: Community Atmosphere Model

Example 2: Dataset changeFollow control case example until after the configure

Now we want to modify Orography surface boundary dataset

Orography file (specifies mean height PHIS) bnd_topo=/work/s07hsu00/cesm_inputdata/atm/cam/topo/USGS-gtopo30_48x96_c050520.nc

The next slide shows how to use ncap2 to modify this dataset. However, ncap2 is not available on alps so instead please link to the modified data set after changing to

your $CASEDIRcd $CASEDIRln –s /home/s07hsu00/USGS-gtopo30_48x96_us_oro_x50.nc .

You can run the ncdiff/ncview at the bottom of the next page to view the differences between the two files.

Page 13: Community Atmosphere Model

Example 2: Dataset changeChange orography surface boundary data1) Make a local copy in your $CASEDIRcp /work/s07hsu00/cesm_inputdata/atm/cam/topo/USGS-gtopo30_48x96_c050520.nc \

USGS-gtopo30_48x96_c050520_orig.nc2) Use nco utilities to edit values on the file (http://nco.sourgeforce.net)We will use a function called ncap2 – (netCDF Arithmetic Averager) single line command below

ncap2 -O -s 'lat2d[lat,lon]=lat ; lon2d[lat,lon]=lon’ \

-s 'omask=(lat2d >= 30. && lat2d <= 50.) && (lon2d >= 235. && lon2d <= 260.)' \

-s 'PHIS=(PHIS*(1.+omask*0.5))' \USGS-gtopo30_48x96_c050520_orig.nc USGS-gtopo30_48x96_us_oro_x50.nc1. Define 2D latitude and longitude arrays2. Create a mask – setting = 1 for the desired lat/lon range; elsewhere = 03. Apply mask to 2D field (PHIS = surface geopotential = gZ) – 1.5x PHIS in region of interest

Check datancdiff –v PHIS USGS-gtopo30_48x96_us_oro_x50.nc \

USGS-gtopo30_48x96_c050520_orig.nc PHIS_diff.ncncview PHIS_diff.nc

1

2

3

Page 14: Community Atmosphere Model

Example 2: Dataset changeEdit namelist to point to modified dataset<edit> Buildconf/cam.buildnml.cshChange bnd_topo = ‘$DIN_LOC_ROOT/atm/cam/topo/USGS-gtopo30_48x96_c050520.nc’To bnd_topo = ‘./USGS-gtopo30_48x96_us_oro_x50.nc’

Build model./${CASENAME}.alps.build

Copy changed orography boundary data to run directorycp USGS-gtopo30_48x96_us_oro_x50.nc /work/$LOGNAME/cesm_run/$CASENAME/run

Return to Control Case AFTER build pointBefore running the model, how can you check what is different between this run

and the control? Hint: copy of namelist saved in $CASEDIR/CaseDocs/atm_inWhat to look for when experiment is complete? Surface temperature (TS), surface pressure (PS), cloud (CLDLOW), rainfall (PRECT), winds

(OMEGA,U,W)

Page 15: Community Atmosphere Model

Example 3: Code Change• Examine the mean effects of delaying the initiation of convection by

increasing the minimum required convective available potential energy (CAPE) to initiate convection over land;

Models peak around noonToo early

Page 16: Community Atmosphere Model

Example 3: Code Change• Follow guide for control example until configure thenCopy fortran code file that controls deep convection calculation (Zhang and

McFarlane, 1995) to local code mod directory for the atmospherecd $CASEDIR/SourceMods/src.camcp /home/s07hsu00/cesm_collection/cesm1_0_3/models/atm/cam/src/physics/cam/zm_conv.F90 .

Edit zm_conv.F90:Search for the following lines

if (cape(i) > capelmt) then lengath = lengath + 1 index(lengath) = i

end if

The minimum CAPE (capelmt) for triggering convection is = 70 J/kg everywhere.Let’s increase the value over land (x10 to 700 K/kg) to analyze what the mean

effect of delaying convection is.

Page 17: Community Atmosphere Model

Example 3: Code ChangeSo change the following in sub-routine zm_convr (use ‘ctrl s’ to search in emacs)

if (cape(i) > capelmt) then lengath = lengath + 1 index(lengath) = i

end ifTo

if (cape(i) > capelmt_mask) then lengath = lengath + 1 index(lengath) = i

end ifAnd before this add

if (landfrac(i) > 0.5_r8) thencapelmt_mask = 10._r8*capelmt

elsecapelmt_mask = capelmt

end ifAnd in routine zm_convr after

use phys_control, only: cam_physpkg_is Add real(r8) :: capelmt_mask

Return to Control Case AFTER configure point

Use a local variable for the convection trigger

Scale the existing trigger value by 10x if land fraction is >50%

Page 18: Community Atmosphere Model

Example 3: Code ChangeWhat to look for? (may require longer than 2 months for good signal) Surface temperature (TS), surface fluxes (LHFLX,SHFLX), cloud (CLDLOW), rainfall

(PRECT) over land How does it affect the diurnal cycle? (if feeling brave output hourly rainfall (PRECT)

and surface temperature (TS) over a limited land region

Page 19: Community Atmosphere Model

Example 2a: Dataset change• ACTION: Change input boundary datasets (Sea Surface Temperature) by

increasing it’s value by 2K in the tropical Central Pacific

Page 20: Community Atmosphere Model

Example 2a: Dataset changeFollow control case example until before the configure

You need to modify the SST file. This file is located in the central input data location:$DIN_LOC_ROOT/ocn/docn7/SSTDATA/sst_HadOIBl_bc_48x96_clim_c050526.ncwith $DIN_LOC_ROOT = /work/s07hsu00/cesm_inputdata

The next steps shows how to use ncap2 to modify this dataset. However, ncap2 is not available on alps so instead please link to the modified data set after changing

to your $CASEDIRcd $CASEDIRln -s /home/s07hsu00/sst_HadOIBl_bc_48x96_clim_warmtcp.nc . You can run the ncdiff/ncview at the bottom of the next page to view the differences between the

two files

If ncap2 is available, copy file to your local directory and follow instructions on the next pagecp $DIN_LOC_ROOT/ocn/docn7/SSTDATA/sst_HadOIBl_bc_48x96_clim_c050526.nc \

sst_HadOIBl_bc_48x96_clim_c050526_orig.nc

Page 21: Community Atmosphere Model

Example 2a: Dataset changeChange SST surface boundary dataUse nco utilities to edit values on the file (http://nco.sourgeforce.net)We will use a function called ncap2 – (netCDF Arithmetic Averager) single line command below

ncap2 –O –s 'lat2d[lat,lon]=lat ; lon2d[lat,lon]=lon' \

–s 'omask=(lat2d >= -10. && lat2d <= 10.) && (lon2d >= 180. && lon2d <= 240.)' \

-s 'SST_cpl=(SST_cpl+omask*2.)' \ sst_HadOIBl_bc_48x96_clim_c050526_orig.nc sst_HadOIBl_bc_48x96_clim_warmtcp.nc

1. Define 2D latitude and longitude arrays2. Create a mask – setting = 1 for the desired lat/lon range; elsewhere = 03. Apply mask to 2D field (SST_cpl): +2K in region of interest (equatorial Pacific)

Check datancdiff –v SST_cpl sst_HadOIBl_bc_48x96_clim_warmtcp.nc \

sst_HadOIBl_bc_48x96_clim_c050526_orig.nc SST_cpl_diff.ncncview SST_cpl_diff.nc

1

2

3

Page 22: Community Atmosphere Model

Example 2a: Dataset changeApply changed SST ./xmlchange –file env_conf.xml –id DOCN_SSTDATA_FILENAME \ –val “./sst_HadOIBl_bc_48x96_clim_warmtcp.nc”./xmlchange –file env_conf.xml –id DOCN_SSTDATA_YEAR_START –val “0”./xmlchange –file env_conf.xml –id DOCN_SSTDATA_YEAR_END –val “0”

Build modelcd $CASEDIR./{$CASENAME}.alps.build

Copy changed SST data to run directorycp sst_HadOIBl_bc_48x96_clim_warmtcp.nc /work/$LOGNAME/cesm_run/$CASENAME/run>

Return to Control Case AFTER build pointBefore running the model, how can you check what is different between this run

and the control? Hint: copy of namelist saved in $CASEDIR/CaseDocs/atm_inWhat to look for? Surface temperature (TS), surface pressure (PS), cloud (CLDLOW), rainfall (PRECT), winds

(OMEGA,U,W)Did you notice that Example 2 and 2a used different methods to modify namelist?