9/26/2001
Peter Thornton

Function call trace for CLM2.0 in offline mode

The following assumes that the CPP variable SPMD is defined
(the model is run through MPI) and masterproc corresponds
to the MPI process with rank 0
 


First-level function calls

program_off   (in ./main/program_off.F90)
Description: the main program interface for CLM2.0 in offline mode
Calling sequence:
program program_off
    spmd_init
    shr_orb_params(iyear_AD, eccen, obliq, mvelp, obliqr, lambm0, mvellpp, log_print)
    initialize(eccen, obliqr,lambm0,mvelpp)
    do nstep = nbstep, nestep
        atmdrv(nstep)
        driver(nstep, doalb, eccen, obliqr, lambm0, mvelpp)
    end do
    mpi_barrier(mpicom, ier)
    mpi_finalize(ier)
end program program_off

(the timing functions are used many times in the following second and third level subroutines, but they
are not included in the calling sequence descriptions)


Second-level function calls

spmd_init()   (in ./main/spmdMod.F90)
Description:  Initialize MPI
Calling sequence:
subroutine spmd_init
    mpi_initialized(mpi_running, ier)
    if (!mpi_running) call mpi_init(ier)
    mpi_comm_rank(mpicom, iam, ier)
    mpi_comm_size(mpicom, npes, ier)
    mpi_get_processor_name(proc_name(iam), length(iam), ier)
    mpi_allgather(length(iam), 1, mpiint, length,1, mpiint, mpicom, ier)
    mpi_gatherv( proc_name(iam), length(iam), mpichar, proc_name, length, displ, mpichar, 0,mpicom,ier)
end subroutine spmd_init
Calling routine:  program_off

shr_orb_params()   (in ./csm_share/shr_orb_mod.F90)
Description: Uses the input year to calculate the earth's orbital parameters.
Calling routine:  program_off

initialize()   (in ./main/initializeMod.F90)
Description:  Initialization routine for CLM2 model
Calling sequence:
subroutine initialize
    header()
    control_init() (non-empty argument list if called in coupled mode...)
    control_print()
    (if coupled or offline) timemgr_init()
    (if offline) advance_timestep()
    Rtmgridini()
    if (coupled)
        csm_recvorb(eccen,obliqr,lambm0,mvelpp)
        csm_sendcontrol(irad)
        csm_recvgrid(cam_longxy,cam_latixy, cam_numlon, cam_landfrac, cam_landmask)
    endif
    if (offline)
        if (no surface dataset is specified) mksrfdat()
        surfrd(vegxy,wtxy)
    else
        if (no surface dataset defined) mksrfdat(cam_longxy,cam_latixy,cam_numlon,cam_landfrac, cam_landmask)
        surfrd(vegxy,wtxy, cam_longxy,cam_latixy,cam_numlon, cam_landfrac, cam_landmask)
    end else
    pftconrd()
    clm_map(wtxy)
    iniTimeConst()
    Rtmlandini()
    (if coupled) csm_sendrunoff()
    if (continuation run)  restrd()
    if (offline) atm_getgrid()
    histini()
    accini()
    interpMonthlyVeg(fsurdat,mon,day)
    if (initial run) iniTimeVar(readini,calday,nbstep,eccen,obliqr,lambm0,mvelpp)
    if (coupled) csm_sendalb()
end subroutine initialize
Calling routine:  program_off

atmdrv()   (in ./main/atmdrvMod.F90)
Description:  Reads atmospheric fields from an input file and generates the atmospheric forcing grids required by the land model.  Returns forcing data for the current time step (nstep).
Calling sequence:
subroutine atmdrv(nstep)
    get_curr_date(kyr,kmo,kda,mcsec)
    if (open_data) atm_openfile(kda,kmo, kyr, locfn, itim, atmmin)
    if (open_data  or read data time step) atm_readdata(locfn,kmo,itim)
    interpa2s( lots of parameters...)
    xy2v( called multiple times, for each of the atmospheric fields)
end subroutine atmdrv()
Calling routine:  program_off

driver()   (in ./main/driver.F90)
Description:  This is the main model driver function for CLM2.0, with calls to the main science subroutines.  It is called for a single time step, with the orbital parameters for that timestep.
Calling sequence:
subroutine driver()
    if (coupled)
        csm_dosndrcv(nstep,doalb)
        if (dorecv) csm_recv(nstep)
    endif
    histend(nstep)
    get_curr_date(yrp1,monp1,dayp1,secp1,offset=dtime)
    if (doalb) interpMonthlyVeg(fsurdat,nstep,kmop1,kdap1)
    do k=begpatch, endpatch
        if (!lake)
           Hydrology1(clm(k))
           Biogeophysics1(clm(k))
        else Biogeophysics_Lake(clm(k))
        EcosystemDyn(clm(k),doalb)
        if (doalb) SurfaceAlbedo(clm(k),caldayp1,eccen,obliqr,lambm0,mvelpp)
        if (!lake) Biogeophysics2(clm(k))
    end do
    if (coupled)
        if (csm_doflxave) csm_flxave(nstep)
        if (dosend) csm_send(nstep)
    endif
    do k=begpatch,endpatch
        if (!lake) Hydrology2(clm(k))
        else Hydrology_lake(clm(k))
        SnowAge(clm(k))
        BalanceCheck(clm(k))
    end do
    histUpdate(nstep)
    RiverFlux(nstep)
    histhandler(nstep)
end subroutine driver()
Calling routine:  program_off

mpi_barrier()
Calling routine:  program_off

mpi_finalize()
Calling routine:  program_off


Third-level function calls


header()   (in ./main/initializeMod.F90)
Description:  Writes the model verison number to standard output. Version number is used from clm_varctl.
Calling routine:  initialize()

control_init()   (in ./main/controlMod.F90)
Description:  Initialize the run control variables. All parameters are optional, if coupled use them all, if not use none. If called from masterproc, read namelist from standard input, with the model control information.  Override many of these namelist options if coupled, using the input parameters to control_init().  Does lots of error checks on the namelist parameters.  Assign model calendar variables.  Read the list of history variables to write.  Set variables for model physics (irad).  Set restart file name.
Calling sequence:
subroutine control_init()
    if (SPMD) control_spmd()
end subroutine control_init()
Calling routine:  initialize()

control_print()   (in ./main/controlMod.F90)
Description:  Print settings of run control variables.
Calling sequence:
subroutine control_print()
end subroutine control_print()
Calling routine:  initialize()

timemgr_init()   (in ./main/time_manager.F90)
Description:  Performs time manager initialization for offline or coupled mode
Calling sequence:
subroutine timemgr_init()
end subroutine timemgr_init()
Calling routine:  initialize()

Rtmgridini()   (in ./riverroute/RtmMod.F90)
Description: Initialize RTM grid and land mask (U. of Texas River Transport Model)
Calling sequence:
subroutine Rtmgridini()
    celledge(many parameters)
    cellarea(many parameters)
end subroutine Rtmgridini()
Calling routine:  initialize()

csm_recvorb()   (in ./main/clm_csmMod.F90)
Description: Receive the orbital data from  the flux coupler.  Then parse it out into the variables used by the  land model.
Calling sequence:
subroutine csm_recvorb(eccen, obliqr, lambm0, mvelpp)
    shr_msg_recv_i (ibuffr, size(ibuffr), SHR_MSG_TID_CPL, SHR_MSG_TAG_C2LI)
    csm_compat(maj_vers, min_vers,SHR_MSG_L_MAJ_V04, SHR_MSG_L_MIN_V00)
    shr_msg_recv_r (rbuff, size(rbuff), SHR_MSG_TID_CPL, SHR_MSG_TAG_C2LI)
    compat_check_spval(spval, ..,..) - called several times to check compatibility of various parameters
    shr_msg_recv_c (cbuff, ncbuff, SHR_MSG_TID_CPL, SHR_MSG_TAG_C2LI)
    if (SPMD) mpi_bcast() - called several times to send orbital parameters to all processors
end subroutine csm_recvorb
Calling routine:  initialize()

csm_sendcontrol()   (in ./main/clm_csmMod.F90)
Description: Send first control data to flux coupler and "invalid" grid  containing special value data
Calling routine:  initialize()

csm_recvgrid()   (in ./main/clm_csmMod.F90)
Description: Receive valid land grid and land mask from coupler
Calling routine:  initialize()

mksrfdat() (in ./mksrfdata/mksrfdatMod.F90)
Description: Make land model surface dataset from original "raw" data files
Calling sequence:
subroutine mksrfdat()
    if (offline) mkgrid_offline()
    if (coupled) mkgrid_cam(cam_longxy, cam_latixy, cam_numlon, cam_landfrac, cam_landmask)
    mkpft (mksrf_fvegtyp, ndiag,  noveg, pctlnd_pft, pft, pctpft)
    mklanwat (mksrf_flanwat, ndiag,  pctlak, pctwet)
    mkirrig (mksrf_firr, ndiag,  pctirr)
    mkglacier (mksrf_fglacier, ndiag, pctgla)
    mksoitex (mksrf_fsoitex, ndiag, pctgla, sand3d, clay3d)
    mksoicol (mksrf_fsoicol, ndiag, pctgla, soic2d)
    mklai (mksrf_flai, ndiag, pft, mlai, msai, mhgtt, mhgtb)
    mkurban (mksrf_furban, ndiag, pcturb)
    surfwrt(fsurdat, pft, pctpft, mlai, msai, mhgtt, mhgtb)
Calling routine:  initialize()

surfrd()   (in ./main/surfFileMod.F90)
Description: Read surface data file and make subgrid patches.  This uses many calls to the NetCDF library
functions, all of which are in ./camclm_share/wrap_nf.F90.   This is where the multiple PFTs for each
gridcell are defined, with area weighting.
Calling routine:  initialize()

pftconrd()   (in ./main/pftcFileMod.F90)
Description:  Read the plant functional type (PFT) constants during program initialization.  Data are broadcast
to all processors with mpi_bcast() if SPMD.
Calling routine:  initialize()

clm_map()   (in ./main/clm_map.F90)
Description:  Build mapping indices to go from grid -> vector of land points -> vector of subgrid patches.
This routine calls code to allocate dynamic memory, depending on the size of the vectors.
Calling sequence:
subroutine clm_map()
    mapvar_ini
    clm_varder_ini
    histvar_ini
    accumvar_ini
    monthveg_ini
end subroutine clm_map()
Calling routine:  initialize()
Calling routine:  initialize()

iniTimeConst()   (in ./main/iniTimeConst.F90)
Description:  Initialize the time-invariant clm parameters.  This is dome on the patch vector, with mapping
from the lsmlon x lsmlat x maxpatch array.  There are a lot of constants here repeated by patch, that only need
to be defined once... using a lot of memory unnecessarily.
Calling routine:  initialize()

Rtmlandini()   (in ./riverroute/RtmMod.F90)
Description:  Initialize RTM-land interpolation weights (U. of Texas River Transport Model) and variables related to runoff time averaging.  This routine called for offline run.  Subcalls have not been traced yet...
Calling routine:  initialize()

csm_sendrunoff()   (in ./main/clm_csmMod.F90)
Description:  Send valid runoff information back to flux coupler.  Multiple MPI calls.
Calling routine:  initialize()

restrd()   (in ./main/restFileMod.F90)
Description:  Read CLM restart file. Open history file if needed.  If the current history file(s) are not full, file(s) are opened so that subsequent time samples are added until the file is full. A new history file is used on a branch run.  This routine sets nbstep from the previous timing parameters.
Calling routine:  initialize()

atm_getgrid()   (in ./main/atmdrvMod.F90)
Description:  For offline run, read or generate atmospheric grid data for one time step.  Allocate space for the atmospheric grid variables. Multiple NetCDF calls.
Calling routine:  initialize()

histini()   (in ./main/histFileMod.F90)
Description:  Initialize variables for history files.
Calling sequence:
subroutine histini()
    histlst
end subroutine histini
Calling routine:  initialize()

accini()   (in ./main/accumulMod.F90)
Description: Subroutines [accini], [accslf], and [accext] can be used to  accumulate specified fields over user-defined intervals. This  interval and the type of accumulation is unique to each field processed. Subroutine [accini] defines the fields to be processed and the type of accumulation. Subroutine [accslf] does the actual accumulation. Subroutine [accext] extracts the current value of a specified field.
Calling routine:  initialize()

interpMonthlyVeg()   (in ./main/mvegFileMod.F90)
Description:  Determine if 2 new months of data are to be read for the interpolation from monthly to daily veg parameters.
Calling sequence:
subroutine interpMonthlyVeg
    readMonthlyVegetation (fveg, nstep, kmo, kda, months)
end subroutine interpMonthlyVeg
Calling routine:  initialize() , driver()

iniTimeVar()   (in ./main/iniTimeVar.F90)
Description:  For an initial run, initialize the following variables: h2osno, h2ocan, h2osoi_liq, h20soi_ice, h2osoi_vol, snowdp, snowage, snl, dz, z, zi.  Some variables are initialized through calls to EcosystemDyn , Fwet,
and SurfaceAlbedo.
Calling sequence:
subroutine iniTimeVar (readini, calday, nstep, eccen, obliqr, lambm0 , mvelpp)
    type_inidat (initype) (results sent out with mpi_bcast)
    if (INICFILE) inicrd
    if (HISTFILE) histrd
    snowdp2lev
    EcosystemDyn (clm(k), doalb)
    Fwet(clm(k))
    SurfaceAlbedo (clm(k), calday, eccen, obliqr, lambm0, mvelpp)
end subroutine iniTimeVar
Calling routine:  initialize()

csm_sendalb()   (in ./main/clm_csmMod.F90)
Description:  Send initial albedos, surface temperature and snow data to the flux coupler
Calling routine:  initialize()

atm_openfile()   (in ./main/atmdrvMod.F90)
Description:  Open atmospheric forcing netCDF file. Many NetCDF calls, followed by an mpi_bcast call.
Calling routine:  atmdrv()

atm_readdata()   (in ./main/atmdrvMod.F90)
Description:  Read atmospheric forcing from netCDF file.
Calling routine:  atmdrv()

interpa2s()   (in ./main/atmdrvMod.F90)
Description:  Area average fields from atmosphere grid to surface grid.  Start with call to initialize the
interpolation parameters - interpa2si().  Then many calls to areaave(), one for each field.
Calling routine:  atmdrv()

xy2v()   (in ./main/xy2v.F90)
Description: Convert a grid-average field to subgrid patch vector
Calling routine:  atmdrv()

csm_dosndrcv()   (in ./main/clm_csmMod.F90)
Description:  Determine if send/receive information to/from flux coupler Send msgs (land state and fluxes) to the flux coupler only when  doalb is true (i.e. on time steps before the atm does a solar radiation computation). Receive msgs (atm state) from the flux coupler only when dorad is true (i.e. on time steps  when the atm does a solar radiation computation).  The fluxes are then averaged between the send and receive calls.
Calling routine:  driver()

csm_recv()   (in ./main/clm_csmMod.F90)
Description:  Receive atmospheric data from the flux coupler
Calling routine:  driver()

histend()   (in ./main/histHandlerMod.F90)
Description:  Determine if end of history interval. Calls get_curr_date()
Calling routine:  driver()

Hydrology1()   (in ./biogeophys/Hydrology1.F90)
Description:  Calculation of
(1) water storage of intercepted precipitation
(2) direct throughfall and canopy drainage of precipitation
(3) the fraction of foliage covered by water and the fraction
    of foliage that is dry and transpiring.
(4) snow layer initialization if the snow accumulation exceeds 10 mm.
Note:  The evaporation loss is taken off after the calculation of leaf temperature in the subroutine clm_leaftem.f90, not in this subroutine.
Calling sequence:
subroutine Hydrology1(clm)
    Fwet()
end subroutine Hydrology1
Calling routine:  driver()

Biogeophysics1()   (in ./biogeophys/Biogeophysics1.F90)
Description:  This is the main subroutine to execute the calculation of leaf temperature and surface fluxes. Biogeophysics2.F90 then determines soil/snow and ground temperatures and updates the surface fluxes for the new ground temperature.
Calling sequence:
subroutine Biogeophysics1(clm)
    QSat(clm%tg, clm%forc_pbot, eg, degdT, qsatg, qsatgdT)
    SurfaceRadiation (clm)
    if (veg_nosno == 0) BareGroundFluxes (clm%tg,     clm%thm,   clm%qg,    clm%thv,   clm%z0mg,   &
                            clm%z0hg,   clm%z0qg,  clm%dqgdT, clm%htvp,  clm%beta,   &
                            clm%zii,    clm%ur,    clm%dlrad, clm%ulrad, clm%cgrnds, &
                            clm%cgrndl, clm%cgrnd, clm    )
    else CanopyFluxes (clm%z0mv,   clm%z0hv,  clm%z0qv,  clm%thm,   clm%forc_th, &
                        clm%thv,    clm%tg,    clm%qg,    clm%dqgdT, clm%htvp,        &
                        clm%emv,    clm%emg,   clm%dlrad, clm%ulrad, clm%cgrnds,      &
                        clm%cgrndl, clm%cgrnd, clm    )
end subroutine BioGeophysics1(clm)
Calling routine:  driver()

Biogeophysics_Lake()   (in ./biogeophys/Biogeophysics_Lake.F90)
Description:  Calculates lake temperatures  and surface fluxes. Method: Lake temperatures are determined from a one-dimensional thermal stratification model based on eddy diffusion concepts to  represent vertical mixing of heat.
Calling sequence:
subroutine Biogeophysics_Lake (clm)
    SurfaceRadiation (clm)
    QSat(clm%t_grnd, clm%forc_pbot, eg, degdT, qsatg, qsatgdT     )
    MoninObukIni(ur, thv, dthv, zldis, z0mg, um, obu  )
    do iteration
        FrictionVelocity (displa, z0mg,  z0hg,  z0qg,  obu, um, ustar, temp1, temp2, clm)
        QSat(clm%t_grnd, clm%forc_pbot, eg, degdT, qsatg, qsatgdT     )
    enddo iteration
    Tridiagonal (nlevlak, a, b, c, r, clm%t_lake(1:nlevlak))
end subroutine Biogeophysics_Lake
Calling routine:  driver()

EcosystemDyn()   (in ./ecosysdyn/EcosystemDyn.F90)
Description:  Ecosystem dynamics: phenology, vegetation, soil carbon.  Also vegetation covered by snow.
Calling routine:  driver() , iniTimeVar()

SurfaceAlbedo()   (in ./biogeophys/SurfaceAlbedo.F90)
Description:  Surface albedos. Also fluxes (per unit incoming direct and diffuse radiation) reflected, transmitted, and absorbed by vegetation. Also sunlit fraction of the canopy.
Calling sequence:
subroutine SurfaceAlbedo(clm, caldayp1, eccen, obliqr, lambm0, mvelpp)
    shr_orb_decl (caldayp1, eccen, mvelpp, lambm0, obliqr, delta   , eccf )
    shr_orb_cosz(caldayp1, clm%lat, clm%lon, delta)
    SnowAlbedo (clm, coszen, nband, ic, albsnd)
    SnowAlbedo (clm, coszen, nband, ic, albsni)
    SoilAlbedo (clm, coszen, nband, albsnd, albsni)
    do n wavebands
        calls to TwoStream for direct and diffuse
        TwoStream (clm,      ib,  ic,       coszen,   vai, rho,      tau, clm%fabd, clm%albd, clm%ftdd, clm%ftid, gdir )
        TwoStream (clm,      ib,  ic,       coszen,   vai, rho,      tau, clm%fabi, clm%albi, ftdi, clm%ftii, gdir )
    enddo
end subroutine SurfaceAlbedo
Calling routine:  driver(), iniTimeVar()

Biogeophysics2()   (in ./biogeophys/Biogeophysics2.F90)
Description:  This is the main subroutine to execute the calculation of soil/snow and ground temperatures and update surface fluxes based on the new ground temperature.
Calling sequence:
subroutine Biogeophysics2(clm)
    SoilTemperature(clm, clm%tssbef, clm%htvp, clm%emg, clm%cgrnd, clm%dlrad, clm%tg, xmf, fact )
end subtoutine Biogeophysics2
Calling routine:  driver()

csm_flxave()   (in ./main/clm_csmMod.F90)
Description:  Average output fluxes for flux coupler. Add land surface model output fluxes to accumulators every time step. When icnt==ncnt, compute the average flux over the time interval.
Calling routine:  driver()

csm_send()   (in ./main/clm_csmMod.F90)
Description:  Send data to the flux coupler. Gathers together the path-level information in a 1d array, transforms
to a 2d array, and sends to coupler. Write a sequence of global integrals if debug flag is set.
Calling sequence:
subroutine csm_send (nstep)
    get_curr_date (yr,mon,day,ncsec)
    shr_msg_send_i (ibuffs   , size(ibuffs)    , SHR_MSG_TID_CPL, SHR_MSG_TAG_L2C)
    shr_msg_send_r (send2d   , size(send2d)    , SHR_MSG_TID_CPL, SHR_MSG_TAG_L2C)
    shr_msg_send_r (ocnrof_vec,size(ocnrof_vec), SHR_MSG_TID_CPL, SHR_MSG_TAG_L2C)
end subroutine csm_send
Calling routine:  driver()

Hydrology2()   (in ./biogeophys/Hydrology2.F90)
Description:  This is the main subroutine to execute the calculation of soil/snow hydrology.
Calling sequence:
subroutine Hydrology2(clm)
    SnowWater (clm)
    if (itypwat == istsoil)
        SurfaceRunoff  (clm, zwice, vol_liq, s, zwt, fcov)
        Infiltration   (clm)
        SoilWater      (clm, vol_liq, dwat, hk, dhkdw)
        Drainage       (clm,  zwice, vol_liq, s,   zwt, fcov, hk,    dhkdw,   dwat )
    endif
    SnowCompaction (clm)
    CombineSnowLayers (clm)
    DivideSnowLayers (clm)
    if (itypwat == istsoil) Irrigation (clm)
    if (itypwat == istwet or istice) WetIceHydrology (clm)
end subroutine Hydrology2
Calling routine:  driver()

Hydrology_Lake()   (in ./biogeophys/Hydrology_Lake.F90)
Description:  snow-on-lake calculations, and force constant lake volume.
Calling routine:  driver()

SnowAge()   (in ./biogeophys/SnowAge.F90)
Description:  Updates snow age, based on BATS code.
Calling routine:  driver()

BalanceCheck()
Description:  Water and energy balance check. This subroutine accumulates the numerical truncation errors of the water and energy balance calculation. It is helpful to see the performance of the process of integration. The error for energy balance:  error = abs(Net radiation - the change of internal energy - Sensible heat - Latent heat) The error should be less than 0.02 W/m2 in each time integration interval; The error for water balance: error = abs(precipitation - change of water storage - evaporation - runoff). The error should be less than 0.001 mm in  each time integration interval.
Calling routine:  driver()

histUpdate()   (in ./main/histUpdate.F90)
Description:  update history file fields. Includes many calls to histslf() and histmlf() (for single-level and multiple-level fields)
Calling routine:  driver()

RiverFlux()   (in ./riverroute/RiverFluxMod.F90)
Description:  Interface with RTM river routing model.  Calls Rtm().
Calling routine:  driver()

histhandler()   (in ./main/histHandlerMod.F90)
Description:  On each time step, multiple checks for updating and writing history files, and for writing restart
file.  Many subroutine calls to open, write, move files to mass sstore, etc.
Calling routine:  driver()
 


Fourth-level function calls

control_spmd()   (in ./main/controlMod.F90)
Description:  Distributes Namelist data to all processors. One process is set as the master, and it
controls the flow of data from disk to all processors, or collects data from all processors and writes it to disk.
Calling sequence:
subroutine control_spmd()
    mpi_bcast(parameter)  - this is called many times, with a single parameter each time.
end subroutine control_spmd()
Calling routine:  control_init()

celledge()   (in ./main/areaMod.F90)
Description:  Southern and western edges of grid cells. Called using "interface" to regional or global functions.
Calling routine:  Rtmgridini() , interpa2si()

cellarea()   (in ./main/areaMod.F90)
Description:  Area of grid cells (square kilometers). Called using "interface" to regional or global functions.
Calling routine:  Rtmgridini(), interpa2si()

shr_msg_recv_i()   (in ./csm_share/shr_msg_mod.F90)
Description:
Calling routine:  csm_recvorb()

csm_compat()   (in ./main/clm_csmMod.F90)
Description:
Calling routine:  csm_recvorb()

shr_msg_recv_r()   (in ./csm_share/shr_msg_mod.F90)
Description:
Calling routine:  csm_recvorb()

compat_check_spval()   (in ./main/clm_csmMod.F90)
Description:
Calling routine:  csm_recvorb()

shr_msg_recv_c()   (in ./csm_share/shr_msg_mod.F90)
Description:
Calling routine:  csm_recvorb()

mkgrid_offline()   (in ./mksrfdata/mkgridMod.F90)
Description:
Calling routine:  mksrfdat()

mkgrid_cam()   (in ./mksrfdata/mkgridMod.F90)
Description:
Calling routine:  mksrfdat()

mkpft()   (in ./mksrfdata/mkpft.F90)
Description:
Calling routine:  mksrfdat()

mklanwat()   (in ./mksrfdata/mklanwat.F90)
Description:
Calling routine:  mksrfdat()

mkirrig()   (in ./mksrfdata/mkirrig.F90)
Description:
Calling routine:  mksrfdat()

mkglacier()   (in ./mksrfdata/mkglacier.F90)
Description:
Calling routine:  mksrfdat()

mksoitex()   (in ./mksrfdata/mksoitex.F90)
Description:
Calling routine:  mksrfdat()

mksoicol()   (in ./mksrfdata/mksoicol.F90)
Description:
Calling routine:  mksrfdat()

mklai()   (in ./mksrfdata/mklai.F90)
Description:
Calling routine:  mksrfdat()

mkurban()   (in ./mksrfdata/mkurban.F90)
Description:
Calling routine:  mksrfdat()

surfwrt()   (in./main/surfFileMod.F90)
Description:
Calling routine:  mksrfdat()

mapvar_ini()   (in ./main/clm_varmap.F90)
Description:  Initializes mapping vectors (dynamic memory allocation).
landvec: ixy,jxy -> numland
                 wtxy,patch ->numland x maxpatch
patchvec: ixy,jxy,mxy,wtxy -> numpatch
Calling routine:  clm_map()

clm_varder_ini()   (in ./main/clm_varder.F90)
Description:  allocate memory for clm derived type -> numpatch.  This is a lot of memory...
Calling routine:  clm_map()

histvar_ini()   (in ./main/histFileMod.F90)
Description:  allocate dynamic memory for history fields.
Calling routine:  clm_map()

accumvar_ini()   (in ./main/accumulMod.F90)
Description:  Allocate dynamic memory for accumulation fields -> numpatch x maxaccflds
Calling routine:  clm_map()

monthveg_ini()   (in ./main/mvegFileMod.F90)
Description: Allocate dynamic memory for LAI (1 and 2) SAI (1 and 2) and top and bottom canopy heights (1 and 2) .
Calling routine:  clm_map()

histlst()  (in ./main/histFileMod.F90)
Description:  Initialize active field list for history files.
Contains many calls to histfldini(), one for each variable in the history lists.
Calling routine:  histini()

readMonthlyVegetation()   (in ./main/mvegFileMod.F90)
Description:  Read monthly vegetation data for two consecutive months
Calling routine:  interpMonthlyVeg()

type_inidat()  (in ./main/inicFileMod.F90)
Description:  Determines the type of initial condition file - returns either "HISTFILE" or "INICFILE"
Calling routine:  iniTimeVar()

inicrd()   (in ./main/inicFileMod.F90)
Description:  Read initial data from netCDF instantaneous initial data history file  for variables:
snlsno, dzsno, zsno, zisno, h2ocan, h2osno, snowdp, snowage, h2osoi_liq, h2osoi_ice, t_veg, t_grnd, t_soisno, t_lake
Includes many NetCDF calls to read data from the file, then many land_to_patch() calls to convert from land
vector to patch vector.
Calling routine:  iniTimeVar()

histrd()   (in ./main/inicFileMod.F90)
Description:  Read initial data from netCDF history file for variables SNOWDP, SNOWAGE, TV, TV, TSOI, TSNOW, SOILLIQ, SOILICE, SNOWLIQ, SNOWICE, H2OCAN, H2OSNO.  Doesn't use the same land_to_patch logic used in inicrd().
Calling routine:  iniTimeVar()

snodp2lev()   (in ./main/snodep2lev.F90)
Decsription: Create snow layers and interfaces, given snow depth.
Calling routine:  iniTimeVar()

Fwet()   (in ./biogeophys/Hydrology1.F90)
Description:  Calculate the fraction of all vegetation surfaces which are wet including stem area which contribute to evaporation.
Calling routine:  iniTimeVar() , Hydrology1()

interpa2si()   (in ./main/atmdrvMod.F90)
Description:  Initialize variables for atm->land model surface interpolation.
Calling sequence:
subroutine interpa2si
    celledge
    cellarea
    areaini
Calling routine:  interpa2s()

areaave()   (in ./main/areaMod.F90)
Description: Area averaging of field from input to output grids
Calling routine:  interpa2s() , areaini()

QSat()   (in ./biogeophys/QSat.F90)
Description:  Computes saturation mixing ratio and the change in saturation mixing ratio with respect to temperature.
Calling routine:  Biogeophysics1() , CanopyFluxes() , Biogeophysics_Lake()

SurfaceRadiation()   (in ./biogeophys/SurfaceRadiation.F90)
Description:  Solar fluxes absorbed by vegetation and ground surface.  Includes loop over n wavebands (currently 2, vis and nir).  Splits canopy absorption into sunlit and shaded canopy.  Calculates NDVI and reflected solar radiation.  This same routine is also used for surface radiation for lake biogeophysics.
Calling routine:  Biogeophysics1() , Biogeophysics_Lake()

BareGroundFluxes()   (in ./biogeophys/BareGroundFluxes.F90)
Description:  Compute sensible and latent fluxes and their derivatives with respect to ground temperature using ground temperatures from previous time step.  Calculate stability and aerodynamic resistances.
Calling sequence:
subroutine BareGroundFluxes(clm)
    MoninObukIni(ur, thv, dthv, zldis, z0mg, um, obu  )
    do (iter = 1,3) (stability iteration)
        FrictionVelocity(displa, z0mg, z0hg, z0qg, obu, um, ustar, temp1, temp2, clm)
     end do
end subroutine BareGroundFluxes
Calling routine:  Biogeophysics1()

CanopyFluxes()   (in ./biogeophys/CanopyFluxes.F90)
Description:  This subroutine: 1. Calculates the leaf temperature:  2. Calculates the leaf fluxes, transpiration, photosynthesis and updates the dew accumulation due to evaporation.
Calling sequence:
subroutine CanopyFluxes (z0mv,   z0hv,  z0qv,  thm,   th,  thv,    tg,    qg,    dqgdT, htvp, emv,    emg,   dlrad, ulrad, cgrnds, cgrndl, cgrnd, clm )
    QSat (clm%t_veg, clm%forc_pbot, el, deldT, qsatl, qsatldT)
    MoninObukIni(ur, thv, dthv, zldis, z0mv, um, obu  )
    do iteration
        FrictionVelocity (clm%displa, z0mv,  z0hv,  z0qv,  obu, um, ustar, temp1, temp2, clm)
        Stomata(mpe,        clm%parsun, svpts,     eah,      thm,        &
                  o2,         co2,        clm%btran, rb,       clm%rssun,  &
                  clm%psnsun, clm%qe25,   clm%kc25,  clm%ko25, clm%vcmx25, &
                  clm%akc,    clm%ako,    clm%avcmx, clm%bp,   clm%mp,     &
                  foln,       clm%folnmx, clm%c3psn, clm       )
        Stomata(mpe,        clm%parsha, svpts,     eah,      thm,        &
                  o2,         co2,        clm%btran, rb,       clm%rssha,  &
                  clm%psnsha, clm%qe25,   clm%kc25,  clm%ko25, clm%vcmx25, &
                  clm%akc,    clm%ako,    clm%avcmx, clm%bp,   clm%mp,     &
                  foln,       clm%folnmx, clm%c3psn, clm       )
        SensibleHCond(rah(1), rb,   rah(2), wta,  wtl, wtg,    wta0, wtl0,   wtg0, wtal, wtga,   wtgl, clm     )
        LatentHCond(raw(1), rb,    raw(2), rpp,   wtaq, wtlq,   wtgq,  wtaq0,  wtlq0, wtgq0, wtalq,  wtgaq, wtglq,  clm    )
        QSat(clm%t_veg, clm%forc_pbot, el, deldT, qsatl, qsatldT    )
        test for convergence
    enddo iteration
end subroutine CanopyFluxes
Calling routine:  Biogeophysics1()

Tridiagonal()   (in ./biogeophys/Tridiagonal.F90)
Description:  Solution to tridiagonal matrix (?)
Calling routine:  Biogeophysics_Lake() , SoilTemperature()

shr_orb_decl()   (in ./csm_share/shr_orb_mod.F90)
Description:  Compute earth/orbit parameters using formula suggested by Duane Thresher.  Compute eccentricity factor and solar declination using day value where a round day (such as 213.0) refers to 0z at Greenwich longitude.
Calling routine:  SurfaceAlbedo()

shr_orb_cosz()   (in ./csm_share/shr_orb_mod.F90)
Description:  FUNCTION to return the cosine of the solar zenith angle. Assumes 365.0 days/year.
Calling routine:  SurfaceAlbedo()

SnowAlbedo()   (in ./biogeophys/SnowAlbedo.F90)
Description:  Determine snow albedos.  Snow albedo depends on snow-age, zenith angle, and thickness of snow, age gives reduction of visible radiation.  Different albedos for vis and nir.
Calling routine:  SurfaceAlbedo()

SoilAlbedo()   (in ./biogeophys/SoilAlbedo.F90)
Description:  Determine ground surface albedo, accounting for the fractional coverage of snow
Calling routine:  SurfaceAlbedo()

TwoStream()   (in ./biogeophys/TwoStream.F90)
Description:  Use two-stream approximation of Dickinson (1983) Adv Geophysics 25:305-353 and Sellers (1985) Int J Remote Sensing 6:1335-1372 to calculate fluxes absorbed by vegetation, reflected by vegetation, and transmitted through vegetation for unit incoming direct or diffuse flux given an underlying surface with known albedo.
Calling routine:  SurfaceAlbedo()

SoilTemperature()   (in ./biogeophys/SoilTemperature.F90)
Description:  Snow and soil temperatures including phase change.
Calling sequence:
Subroutine SoilTemperature
    SoilThermProp (tk, cv, clm)
    Tridiagonal (i, at, bt, ct, rt, clm%t_soisno(clm%snl+1:nlevsoi))
    PhaseChange (fact(clm%snl+1),   brr(clm%snl+1), hs, dhsdT, tssbef(clm%snl+1), xmf, clm )
end subroutine SoilTemperature
Calling routine:  Biogeophysics2()

shr_msg_send_i()   (in ./csm_share/shr_msg_mod.F90)
Description:  send the integer :: array "arr(n)" to task "tid" with id "msgid".  Uses call to mpi_isend or mpi_send.
Calling routine:  csm_send()

shr_msg_send_r()   (in ./csm_share/shr_msg_mod.F90)
Description:  send the real :: array "arr(n)" to task "tid" with id "msgid". Uses call to mpi_isend or mpi_send.
Calling routine:  csm_send()

SnowWater()   (in ./biogeophys/SnowWater.F90)
Description:  Evaluate the change of snow mass and the snow water onto soil. Water flow within snow is computed by an explicit and non-physical based scheme, which permits a part of liquid water over the holding capacity (a tentative value is used, i.e. equal to 0.033*porosity) to percolate into the underlying layer.  Except for cases where the porosity of one of the two neighboring layers is less than 0.05, zero flow is assumed. The water flow out of the bottom of the snow pack will participate as the input of the soil water and runoff.
Calling routine:  Hydrology2()

SurfaceRunoff()   (in ./biogeophys/SurfaceRunoff.F90)
Description:  Calculate surface runoff. The original code was provide by Robert E. Dickinson based on  following clues:  exponential decrease of Ksat, a water table  level determination level including highland and lowland levels  and fractional area of wetland (water table above the surface).  Runoff is parameterized from the lowlands in terms of precip incident on wet areas and a base flow, where these are estimated using ideas from TOPMODEL.
The original scheme was modified by Z.-L. Yang and G.-Y. Niu, using a new method to determine water table depth and  the fractional wet area (fcov);  computing runoff (surface and subsurface) from this fraction and the remaining fraction (i.e. 1-fcov);  for the 1-fcov part, using BATS1e method to compute surface and subsurface runoff.
Calling routine:  Hydrology2()

Infiltration()   (in ./biogeophys/Infiltration.F90)
Description:  Calculate infiltration into surface soil layer (minus the evaporation)
Calling routine:  Hydrology2()

SoilWater()   (in ./biogeophys/SoilWater.F90)
Description:  Soil moisture is predicted from a 10-layer model (as with soil temperature), in which the vertical soil moisture transport is governed by infiltration, runoff, gradient diffusion, gravity, and root extraction through canopy transpiration.  The net water applied to the surface layer is the snowmelt plus precipitation plus the throughfall  of canopy dew minus surface runoff and evaporation. The vertical water flow in an unsaturated porous media is described by Darcy's law, and the hydraulic conductivity and the soil negative potential vary with soil water content and soil texture based on the work of Clapp and Hornberger (1978) and Cosby et al. (1984). The equation is integrated over the layer thickness, in which the time rate of change in water mass must equal the net flow across the bounding interface, plus the rate of internal source or sink. The terms of water flow across the layer interfaces are linearly expanded by using first-order Taylor expansion.  The equations result in a tridiagonal system equation.
Calling routine:  Hydrology2()

Drainage()   (in ./biogeophys/Drainage.F90)
Description:  Calculate subsurface drainage.
Calling routine:  Hydrology2()

SnowCompaction()   (in ./biogeophys/SnowCompaction.F90)
Description:  Determine the change in snow layer thickness due to compaction and settling.  Three metamorphisms of changing snow characteristics are implemented, i.e., destructive, overburden, and melt. The treatments of the former two are from SNTHERM.89 and SNTHERM.99 (1991, 1999). The contribution due to melt metamorphism is simply taken as a ratio of snow ice fraction after the melting versus before the melting.
Calling routine:  Hydrology2()

CombineSnowLayers()   (in ./biogeophys/CombineSnowLayers.F90)
Description:  Combine snow layers that are less than a minimum thickness or mass.  If the snow element thickness or mass is less than a prescribed minimum, then it is combined with a neighboring element.
Calls Combo() to combine layers
Calling routine:  Hydrology2()

DivideSnowLayers()   (in ./biogeophys/DivideSnowLayers.F90)
Description:  Subdivides snow layers if they exceed their prescribed maximum thickness.
Calls Combo() to divide layers.
Calling routine:  Hydrology2()

Irrigation()   (in ./biogeophys/Irrigation.F90)
Description:  Irrigate crops to depth of 30 cm.  Saturate the soil to a depth of 30 cm by making the liquid water volume equal the effective porosity.  (This has known problems and has been removed from current coupled simulations -PET)
Calling routine:  Hydrology2()

WetIceHydrology()   (in ./biogeophys/WetIce Hydrology.F90)
Description:  Calculate hydrology for ice and wetland.  Maintains a constant water volume for wetlands and ice.
Calling routine:  Hydrology2()

histslf()   (in ./main/histFileMod.F90)
Description:  Accumulate single-level field over history time interval
Calling routine:  histUpdate()

histmlf()   (in ./main/histFileMod.F90)
Description:  Accumulate multi-level field over history time interval
Calling routine:  histUpdate()

Rtm()   (in ./riverroute/RtmMod.F90)
Description:  River routing model (based on U. Texas code)
Calling routine:  RiverFlux()


Fifth-level function calls (and higher)

histfldini()   (in ./main/histFileMod.F90)
Description:  Set up history file field (active or inactive).
Calling routine:  histlst()

land_to_patch()   (in ./main/inicFileMod.F90)
Description:  Reorders the vectors from land to patch. Calls mpi_scatter.  Uses a generic function call "interface"
to access for different data types.
Calling routine:  inicrd()

areaini()  (in ./main/areaMod.F90)
Description:  Area averaging initialization. This subroutine is used in conjunction with areaave.F for area-average
mapping of a field from one grid to another.
Calling sequence:
subroutine areaini()
    areamap
    areaave
end subroutine areaini
Calling routine:  interpa2si()

areamap()   (in ./main/areaMod.F90)
Description:  Get indices and weights for area-averaging between input and output grids.
Calling sequence:
subroutine areamap()
    areaovr
end subroutine areamap()
Calling routine:  areaini()

areaovr()   (in ./main/areaMod.F90)
Description:  uses the latitude and longitude of two overlapping grids to calculate the area of overlap. Uses the
algorithm area = dlon * d(sin(lat)) * radius * radius
Calling routine:  areamap()

MoninObukIni()   (in ./biogeophys/MoninObukIni.F90)
Description:  Initialization of the Monin-Obukhov length.
Calling routine:  BareGroundFluxes() , CanopyFluxes() , Biogeophysics_Lake()

FrictionVelocity()   (in ./biogeophys/FrictionVelocity.F90)
Description:  Calculation of the friction velocity, relation for potential temperature and humidity profiles of surface boundary layer.
Calling routine:  BareGroundFluxes(), CanopyFluxes() , Biogeophysics_Lake()

Stomata()   (in ./biogeophys/Stomata.F90)
Description:  Leaf stomatal resistance and leaf photosynthesis. Uses Ball-Berry formulation for stomatal conductance, and Farquhar C3 photosynthesis model.
Calling routine: CanopyFluxes()

SensibleHCond()   (in ./biogeophys/SensibleHCond.F90)
Description:  Provides dimensional and non-dimensional sensible heat conductances for canopy and soil fux calculations.
Calling routine: CanopyFluxes()

LatentHCond()   (in ./biogeophys/LatentHCond.F90)
Description:  Provides dimensional and non-dimensional latent heat conductances for canopy and soil flux calculations.  Latent fluxes differs from the sensible heat flux due to stomatal resistance.
Calling routine: CanopyFluxes()

SoilThermProp()   (in ./biogeophys/SoilThermProp.F90)
Description:  Calculation of thermal conductivities and heat capacities of snow/soil layers
(1) The volumetric heat capacity is calculated as a linear combination in terms of the volumetric fraction of the constituent phases. (2) The thermal conductivity of soil is computed from the algorithm of Johansen (as reported by Farouki 1981), and of snow is from the formulation used in SNTHERM (Jordan 1991).
Calling routine:  SoilTemperature()

PhaseChange()   (in ./biogeophys/PhaseChange.F90)
Description:  Calculation of the phase change within snow and soil layers: (1) Check the conditions for which the phase change may take place, i.e., the layer temperature is great than the freezing point and the ice mass is not equal to zero (i.e. melting), or the layer temperature is less than the freezing point and the liquid water mass is not equal to zero (i.e. freezing). (2) Assess the rate of phase change from the energy excess (or deficit) after setting the layer temperature to freezing point. (3) Re-adjust the ice and liquid mass, and the layer temperature
Calling routine:  SoilTemperature()

Combo()  (in ./biogeophys/Combo.F90)
Description: Combines two elements and returns the following combined variables: dz, t, wliq, wice.  The combined temperature is based on the equation: the sum of the enthalpies of the two elements =  that of the combined element.
Calling routine:  CombineSnowLayers() , DivideSnowLayers()


MPI Library function calls

mpi_initialized()   (in the MPI library...)
Calling routine:  spmd_init()

mpi_init()  (in the MPI library...)
Calling routine:  spmd_init()

mpi_comm_rank()   (in the MPI library...)
Calling routine:  spmd_init()

mpi_comm_size()   (in the MPI library...)
Calling routine:  spmd_init()

mpi_get_processor_name()   (in the MPI library...)
Calling routine:  spmd_init()

mpi_allgather()   (in the MPI library...)
Calling routine:  spmd_init()

mpi_gatherv()   (in the MPI library...)
Calling routine:  spmd_init()

mpi_bcast()   (in the MPI library...)
Calling routine:  control_spmd() , csm_recvorb()