next up previous contents
Next: 2 Modifying CLM2.0 Input Up: CodeReference Previous: Contents   Contents


1 Code Structure

1.1 Calling Tree

The following is a brief outline of the calling sequence for the main CLM2.0 driver routine, driver.F90. A comprehensive outline of the calling sequence for the full CLM2.0 model is provided in the accompanying html document, CLM2.0 Comprehensive Calling Sequence.

1.2 Code Flow - Main Interface

The CLM2.0 model can be built to run in one of three modes. It can run as a stand alone executable where atmospheric forcing data is periodically read . This will be referred to as offline mode. It can also be run as part of the Community Atmosphere Model (CAM) where communication between the atmospheric and land models occurs via subroutine calls. This will be referred to as cam mode. Finally, it can be run as a component in a system of geophysical models (CCSM). In this mode, the atmosphere, land (CLM2), ocean and sea-ice models are run as separate executables that communicate with each other via the CCSM flux coupler. This will be referred to as csm mode.

offline mode: The routine, program_off.F90, provides the program interface for running CLM2.0 in offline mode. This routine first initializes the CLM2.0 model. Part of this initialization consists of the the determination of orbital parameters by a call to the routine shr_orb_params.F90. Subsequently, the time stepping loop of the model is executed by obtaining atmospheric forcing and calling the CLM2.0 driver.

csm mode: The routine, program_csm.F90, provides the program interface for running CLM2.0 in csm mode. In this mode, orbital parameters are obtained from the flux coupler during initialization whereas atmospheric data are obtained from the flux coupler during the time stepping loop.

cam mode: The module, atm_lndMod.F90, contains the subroutine interfaces necessary to run CLM2.0 in cam mode. The model is initialized by a call to subroutine atmlnd_ini whereas subroutine atmlnd_drv is called at every time step by the CAM atmospheric model to update the land state and return the necessary states and fluxes back to the atmosphere.

1.3 Code Flow - Driver Loop

The following presents a brief outline of the routines appearing in the calling sequence for program_off.F90, the main CLM2.0 offline program. Most of the following routines are invoked from the driver routine, driver.F90.

shr_orb_params: Calculate Earth's orbital parameters.

Initialize: Calls a series of subroutines (see CLM2.0 Comprehensive Calling Sequence) which initialize model parameters, read and/or create a surface dataset, read the initial file (initial simulations only), read the restart file (restart or branch simulations only). If no initial dataset is specified in the namelist, the model uses an internal initialization. If no surface dataset is specified in the namelist, the model uses a list of raw datasets to create a surface dataset and read it in.

atmdrv: Read in atmospheric fields and generate atmospheric forcing.

driver: Driver for CLM2.0 physics.

histend: Determine if current time step is the end of history interval.

get_curr_date: Determine calender information for next time step.

interpMonthlyVeg: Determine if two new months of vegetation data need to be read in.

readMonthlyVegetation: Read monthly vegetation data for two consecutive months.

Hydrology1: 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 and (4) snow layer initialization if the snow accumulation exceeds 10 mm.

Fwet: Determine the fraction of foliage covered by water and the fraction of foliage that is dry and transpiring.

Biogeophysics1: Main subroutine to determine leaf temperature and surface fluxes based on ground temperature from previous time step.

QSat: Compute saturation mixing ratio and the change in saturation mixing ratio with respect to temperature.

SurfaceRadiation: Compute Visible and NIR solar fluxes absorbed by vegetation and ground surface. Split canopy absorption into sunlit and shaded canopy. Calculate NDVI and reflected solar radiation. This routine is also used for surface radiation for lake biogeophysics.

BareGroundFluxes: Compute sensible and latent heat fluxes and their derivatives with respect to ground temperature using ground temperatures from previous time step for non-vegetated surfaces or snow-covered vegetation. Calculate stability and aerodynamic resistances.

MoninObukIni: Initialize Monin-Obukhov length.

FrictionVelocity: Calculation of the friction velocity and the relation for potential temperature and humidity profiles of surface boundary layer.

CanopyFluxes: Calculates the leaf temperature, leaf fluxes, transpiration, photosynthesis and updates the dew accumulation due to evaporation.

Stomata: Leaf stomatal resistance and leaf photosynthesis. Uses Ball-Berry formulation for stomatal conductance, and Farquhar photosynthesis model.

SensibleHCond: Provides dimensional and non-dimensional sensible heat conductances for canopy and soil flux calculations.

LatentHCond: Provides dimensional and non-dimensional latent heat conductances for canopy and soil flux calculations.

Biogeophysics_Lake: Calculates lake temperatures and surface fluxes. Lake temperatures are determined from a one-dimensional thermal stratification model based on eddy diffusion concepts to represent vertical mixing of heat.

EcosystemDyn: Determine vegetation phenology

SurfaceAlbedo: Surface albedos, fluxes (per unit incoming direct and diffuse radiation) reflected, transmitted, and absorbed by vegetation, and sunlit fraction of the canopy.

shr_orb_decl: Determine solar declination for next time step.

shr_orb_cosz: Determine cosine of solar zenith angle for next time step.

SnowAlbedo: Determine direct and diffuse visible and NIR snow albedos.

SoilAlbedo: Determine soil/lake/glacier/wetland albedos.

TwoStream: Use two-stream approximation to calculate visible and NIR 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.

Biogeophysics2: Main subroutine to determine soil/snow temperatures including ground surface temperature and update surface fluxes for new ground temperature.

SoilTemperature: Determine soil/snow temperatures including ground surface temperature.

SoilThermProp: Determine soil/snow thermal conductivity and heat capacity.

Tridiagonal: Solve tridiagonal system of equations.

PhaseChange: Determine phase change within soil/snow layers.

Hydrology2: Main subroutine to determine soil/snow hydrology.

SnowWater: Determine the change of snow mass and the snow water.

SurfaceRunoff: Determine surface runoff.

Infiltration: Determine infiltration into surface soil layer (minus the evaporation).

SoilWater: Determine soil moisture.

Drainage: Determine subsurface runoff.

SnowCompaction: Determine natural compaction and metamorphosis of snow.

CombineSnowLayers: Combine thin snow elements.

Combo: Combine two snow elements in terms of temperature, liquid water and ice contents, and layer thickess.

DivideSnowLayers: Divide thick snow elements.

WetIceHydrology: Calculate hydrology for ice and wetland. Maintains a constant water volume for wetlands and ice.

Hydrology_Lake: Determine fate of snow on lake. Force constant lake volume.

SnowAge: Determine age of snow for albedo calculations.

BalanceCheck: Error checks for energy and water balance.

histUpdate: Accumulate history fields over history time interval.

Rtmriverflux: Route surface and subsurface runoff into rivers for RTM river routing model.

Rtm: RTM river routing model.

histHandler: Main history file handler. This code 1) increments field accumulation counters at every time step and determines if next time step is beginning of history interval 2) at the end of a history interval, increments the current time sample counter, opens a new history file if needed, writes history data to current history file and resets field accumulation counters to zero and 3) when a history file is full, or at the last time step of the simulation, closes history file and disposes to mass store (only if file is open), resets time sample counter to zero (only if file is full) and increments file counter by one (only if file is full)

restwrt: Write binary restart files.

inicwrt: Write netCDF initial files.

next up previous contents
Next: 2 Modifying CLM2.0 Input Up: CodeReference Previous: Contents   Contents
Mariana Vertenstein 2002-05-14