Go to next page Go to previous page Go to top page Go to table of contents

Previous Section Headers

User's Guide to LSM1.1


2. LSM1.1 Code Description


The land surface model consists of two main routines: lsmini, which initializes the model (see section A.1 Calling diagram for lsmini), and lsmdrv, which is the main time-stepping call to the model (see A.1 Calling diagram for lsmdrv). The code consists of two types of files: *.h files are included through the #include pre-processor directive. *.F files are the main Fortran source files. The source files are found in the directories ccm/lsm, ccm/csm_share, ccm/csm_share/msg and ccm/ccmlsm_share

2.1 *.h files

Routine
Description
basin.h. contains the basin drainage common blocks needed for the basin runoff calculation
basindyn.h contains the common block for basin runoff dynamic memory allocation 
basinpar.h Contains parameters for the basin runoff computation. 
cpl.h Contains declarations and common blocks needed when the LSM is run through the flux coupler.
cplavg.h Contains common blocks needed for flux averaging when the LSM is run through the flux coupler. 
cpl_compat.h Flux coupled run only. Sets the message ID's needed to pass message's to and from the flux coupler. Parameters used in determining that the version of the flux coupler being used is compatable with what is exepected. 
cfort.h Determines how different compilers deal with calling "C" routines from FORTRAN. 
dynmem.h Contains the common block specifying the total number of land points, the total number of subgrid points and the maximum size of "little" vectors. 
implicit.h Sets no implicit Fortran variable type.
lakcon.h Contains the lakcon common block of constants for the lake temperature model.
lsmctl.h Contains the lsmctl common block of run control variables. 
lsmhis.h Contains the lsmhis common block of history file variables.
lsmhisdyn.h Contains common blocks for history and restart file variables with dynamically allocated memory.
lsmio.h Contains the lsmio common block, which flags Fortran unit numbers in use for input or output.
lsmpar.h Determines LSM model parameters. (see Parameters)
lsmspmd.h Contains the common block for the distributed memory implementation.
lsmtc.h Contains the common block for time-invariant variables without dynamically allocated memory which are initialized in lsmini to lsmdrv. These variables include time-invariant surface types, soil hydraulic properties, soil thermal properties, and grid latitudes and longitudes. 
lsmtcdyn.h Contains the common block for dynamically allocated time-invariant variables. 
lsmtvdyn.h Contains the common block for dynamically allocated time-varying variables.
ncd.h Contains common blocks for LSM history files variables. 
ncdini.h Contains common blocks for initial LSM dataset variables. 
ncdtc.h Contains common blocks for the time constant history file variables. 
msgid.h Flux coupled run only. Sets the message ID's needed to pass message's to and from the flux coupler. 
misc.h Sets pre-processor #define and #undef directives for resolution independent CPP directives. (cf. section Pre-Processor Directives
orb.h Constants used for the earth's orbit calculations. 
orb_cosz.h Determines the cosine of the solar zenith angle. This is a FORTRAN statement function, hence it's a header file rather than a source file.
phycon.h Contains the phycon common block of physical constants. 
preproc.h Contains resolution dependent CPP directives. (cf. Pre-Processor Directives). 
radcon.h Contains the radcon common block of albedo-related radiation constants. 
snocon.h Contains the snocon common block of miscellaneous snow parameters 
soicon.h Contains the soicon common block of parameters that vary with soil ``type 
vegcon.h Contains the vegcon common block of vegetation-dependent parameters. 
vegtyp.h Contains the vegtyp common block of multiple plant types and fractional areas for each surface type. 

2.2 *.F files

Routine
Description
allocdyn.F Dynamically allocates memory for lpt and kpt dependent variables.
ao.F Used for LSM initialization. Generates weights and indices for area of overlap between the input grid and the output LSM grid
ao_i.F Used for LSM initialization. Calls ao
area_ave.F Used for LSM initialization. Computes area averaging of fields from the input grid to the output LSM grid
atmini.F Generates LSM input for the CCM3 model (initial run only).
basindrv.F Determines the basin drainage runoff vector. 
basinini.F Determines the basin matrix over land points. 
basinmat.F Generates the basin drainage matrix. 
bsszlrF Returns zeros of Bessel functions (called by gauaw
calendr.F Generates calendar day information from the time step 
canh2o.F Calculates canopy water 
cell_area.F Used for LSM initialization. Determines grid cells areas.
cell_box.F Used for LSM initialization, Determines southern edges, western edges and centers of grid cells 
cell_edge.F Used for LSM initialization. Determines southern and western edges of grid cells. 
cplavg.F Flux coupled run only. Time averages the LSM fluxes needed as input to the flux coupler. 
cpl_compat.F Flux coupled run only. Tests that this version of LSM is compatable with the version of the flux coupler being used. 
datetime.F Generic date and time routine. 
do_csmsnd_rcv.F Flux coupled run only. Determines if data should be sent to or received from the flux coupler. 
ecodyn.F Sets vegetation phenology (growing season, leaf area index, stem area index), vegetation biomass, and soil carbon for the next time step (i.e., the next call to the land surface model). Although vegetation and soil do not vary from year-to-year, they are included here so that they can change over time based on current surface conditions. Leaf and stem areas are only updated every albedo time step (i.e., if albedos are not calculated every time step) so that there is no inconsistency in the leaf and stem areas used to calculate albedos and those used in the rest of the model. The wetted fraction of canopy is also calculated here based on the current canopy water and leaf and stem areas. 
endrun.F Stops the run.
freemem.F Frees dynamically allocated memory. 
fsurdat.F Determines the time-invariant LSM surface dataset variables when FINIDAT is set to "arbitrary initialization". 
getavu.F Obtains the next available Fortran unit number. 
gauaw.F Determines the gaussian latitudes and weights for the LSM grid.
getdate.c Determines current date and time information. 
getmem.F Performs dynamic memory allocation. 
getfil.F Obtains the local copy of a desired file. It first looks in the current working directory for the file. If the file is not found there, it then checks for the file in on disk in the directory given by the namelist variable DATADIR. If the file is not there, it attempts to obtain it from the Mass Store.
histcrt.F Creates new LSM history files. 
histcrttc.F This Creates the LSM time constant history dataset. 
histcrtini.F This Creates LSM initial condition datasets. 
histend.F Determines if the current time is the end of a history interval. 
histhan.F The main history and restart file handler. It opens new history files, writes data to the current history file, closes the file (and archives it on the Mass Store if desired) and writes and disposes restart files. 
histini.F Initializes variables for LSM history files 
histlst.F Innitializes the active field list for LSM history files. 
histmlf.F Accumulates the multi-level fields over the history time interval. 
histnam.F Creates history filenames. 
histslf.F Accumulates the single-level fields over the history time interval
histtc.F Creates a history file of LSM time constant data 
histwrt.F Writes LSM history files. 
histwrtini.F Writes LSM initial datasets. 
histwrttc.F Writes the LSM time constant dataset. 
infil.F Calculates surface runoff and infiltration. 
lakconi.F Block data subprogram. Initializes the lakcon common block of constants for the lake temperature model. 
laktem.F Calculates lake temperatures. 
landtyp.F Used for LSM initialization. Determines land types on the LSM grid. 
landwat.F Used for LSM initialization. Generates %lake and %wetland on the LSM grid. 
lencs.F Determines the position of the right-most non-blank, non-null character in a character variable. 
linebuf_stdout.c Causes standard output to only be line buffered. In other words causes the output to be written out after each line is written, rather than when the output buffer is full. This is useful for debugging, but should be turned off for production runs to save system CPU time.
lsm.F Calculates surface fluxes and updates the ecological, hydrologic, and thermal state of the land. 
lsmcrarbi.F Used for LSM initialization. Creates the LSM initial file at startup and performs dynamic memory allocation when FINIDAT is set to "arbitrary initialization" 
lsmcrarbi_dyn.F Used for LSM initialization. Determines initial values for time variant variables when FINIDAT is set to "arbitrary initialization". 
lsmcrarbi.F Used for LSM initialization. Creates the LSM initial file at startup when FINIDAT is set to "arbitrary initialization" 
lsm_csminircv.F Flux coupled run only. Receives initial control data from the flux coupler
lsm_csminisnd.F Flux coupled run only. Sends initial control data to the flux coupler
lsm_csmrcv.F Flux coupled run only. Receives data from the flux coupler 
lsm_csmsnd.F Flux coupled run only. Sends data to the flux coupler 
lsmctli.F Initializes the LSMEXP namelist run control variables (cf. Run Options).
lsmdrv.F The driver for the LSM model. 
lsmini.F Initializes the land surface model. 
lsmmain.F Flux coupled run only. The main program for the LSM model. 
lsmrdinit.F Used for LSM initialization. Reads in the LSM initial dataset and initializes appropriate variables when FINIDAT not equal to to "arbitrary initialization". 
lsmrd_initdyn.F Reads in dynamically allocated variables from the LSM initial dataset.
lsmrdrest.F Reads in the LSM restart dataset and restarts the model for continuation and branch runs. 
lsmrd_restdyn.F Reads in dynamically allocated variables from LSM restart dataset. 
lsmtci.F Builds the subgrid to grid mapping indices and weights and vice versa, sets up multi-processing and initializes time-invariant variables (such as vegetation, soil types, soil properties, etc.) for all kpt subgrid points. 
lsmtvi.F Initializes time varying variables for an initial run by calls to ecosystem dynamics (ecodyn) and albedo subroutines (suralb). Although soot is currently time-invariant, it is included here so that snow can age over time.
lsmzen.F Calculate the cosine of the solar zenith angle. 
map_i.F Used for LSM initialization. The driver for area averaging initialization.
max_ovr.F Used for LSM initialization. Determines the maximum number of overlapping cells between the input and output grids.
mlf2xy.F  Maps a mslxkpt subgrid vector to a (longitude x latitude x msl) array to be output to the history file. Non-land points are set to a ``special value'' (currently 1.e30).
msg_mpi_wrapper.F Flux coupled run only. A collection of routines that serve as wrappers MPI calls. 
msspni.F Sets the pathnames for history and restart files archived to the Mass Store. 
ncderr.F Handles error for netCDF calls. 
opnfil.F Opens a disk file. 
orb.F This file contains several different subroutines. It calculates the solar declination angle and the earth/sun distance factor for a given time of the year. Also it calculates the earth's orbital parameters (such as obliquity and eccentricity for a given year).
phenol.F Sets leaf and stem areas from prescribed monthly values. 
phyconi.F Block data subprogram. Sets physical constants for the phycon common block. 
putfil.F Archives a disk file to the Mass Store. 
radconi.F Block data subprogram. Sets albedo-related radiation constants for the radcon common block. 
rank.F Returns index of the largest value in input array 
rankn.F Returns indices of the nmax largest values in input array
relavu.F Closes and releases a Fortran unit number. 
restwrt.F Writes LSM restart files. 
setarr.F Sets an array to a constant value. 
shell_cmd.F Executes a given system command to the UNIX shell.
slf2xy.F  Maps a subgrid vector of length kpt to a 2 dimensional (longitude x latitude ) array for output the history file. Non-land points are set to a ``special value'' (currently 1.e30).
snoalb.F Calculates snow albedos. 
snoconi.F Block data subprogram. Sets snow parameters for the snocon common block. 
snoh2o.F Calculates snow water. 
soialb.F Calculates albedos for soil, lakes, wetlands, and glaciers, accounting for snow. 
soiconi.F block data subprogram. Sets soil ``type" dependent variables for the soicon common block. 
soih2o.F Calculates soil water and sub-surface drainage. 
soilcol.F Used for LSM initialization. Generates soil colors on the LSM grid. 
soiltex.F Used for LSM initializaiton. Generates generates %sand, %silt and %clay on the LSM grid. 
soitem.F Calculates soil temperatures. 
stomata.F Calculates leaf stomatal resistance and leaf photosynthesis for sunlit or shaded leaves. 
suralb.F Calculates albedos for the next model time step using the current values for the state of the land (e.g., snow, soil water, canopy water), leaf and stem areas for the next time step, and zenith angle for the next time step. Calculating albedos for the next time step facilitates a simple interface between the atmosphere and land models. However, because the albedos are being calculated for the next time step, variables needed for surface radiation calculations in surrad (ground albedos; surface albedos; absorbed and transmitted fluxes) must be saved for the next time step. This subroutine is only called if the next time step is a radiation time step. This is needed because the atmospheric radiation (which requires surface albedos) may not be calculated every time step (e.g., only every three time steps). Because albedos are not necessarily updated every time step, leaf and stem areas are only updated if it is an albedo time step to ensure the same values used for the albedo calculations are also used for surface radiation, surface temperature, and energy flux calculations.
surbgc.F Calculates the net primary production from photosynthesis and respiration and other surface biogeochemical fluxes. Currently, only CO2 fluxes are simulated. 
surphy.F Performs the surface biophysical calculations (energy and momentum fluxes, temperatures).
surrad.F Uses relative reflected, transmitted, and absorbed solar fluxes (output from suralb.F and twostr.F) to calculate: (a) reflected solar radiation, (b) the solar radiation absorbed by vegetation and ground, for later use in the surface temperature and flux calculations, and (c) the photosynthetically active radiation absorbed by sunlit and shaded leaves, for use in the stomatal resistance calculations. Because the land surface model calculates its own absorbed solar radiation, one should ensure that when coupling to an atmospheric model the absorbed solar radiation (averaged to the atmospheric grid) is the same as that calculated by the atmospheric model. This subroutine, which is called every time step, depends on output from suralb.F, which may be called less frequently. If albedos are only updated every three time steps, the result is that surface radiation is also only updated every three time steps provided that the incoming solar radiation from the atmosphere is also only updated every three time steps.
surtem.F Calculates surface temperatures and fluxes. stomata is called twice to calculate leaf stomatal resistance and photosynthesis for sunlit and shaded fractions of the canopy. 
timing_stubs.F Stubs for timing routines. The code does call these routines at various places, if you place code in the stubs useful timing information will be produced.
tridia.F Solves a tridiagonal system of equations using the algorithm discussed by Press et al. (1986), page 40. 
twostr.F Calculates the two-stream optical parameters and the fluxes absorbed, reflected, and transmitted by the vegetation per unit incoming flux for later use in surrad
vegconi.F Block data subprogram. Initializes the vegcon common block of vegetation-dependent parameters. 
vegtypi.F Block data subprogram. Initializes the vegtyp common block of multiple plant types and their fractional area for each surface type 
verh2o.F Performs the vertical (column) hydrology calculations. 
wrap_nf.F Generic wrapper routines for netCDF calls. By going through these codes it's easier to update to a new version of the netCDF library.

Sub Sections

    2.1 *.h files
    2.2 *.F files


Go to next page Go to previous page Go to top page Go to table of contents

 Search for keywords in the LSM1.1 as coupled to CCM3.6 Users GuideSearch page

Questions on these pages can be sent to... mvertens@ucar.edu


$Name: ccm3_6_6_latest2 $ $Revision: 1.11.4.1 $ $Date: 1999/03/25 21:40:15 $ $Author: erik $