Structure - USDAForestService/ForestVegetationSimulator GitHub Wiki

FVS Repository Structure

First-Level Subdirectories

Within the directory organization are a number of subdirectories, which, in turn, contain files and/or additional subdirectories. The subdirectories at the highest level within the codebase will be referred to as first-level subdirectories. The subdirectories within the first-level subdirectories will be referred to as second-level, and so on.

There are many first-level subdirectories. Most were set up to contain source code for a particular part of the FVS model. In this way, related code files are located in the same subdirectory. The subdirectory name is an abbreviated indicator of the part of the model to which its code pertains. For example, the subdirectory named dbs contains source code for the database model. It’s not always practical to keep related source code files in the same subdirectory, but you should make every attempt to maintain this type of logical order when modifying code in your branch.

Several of the first-level subdirectories are discussed below. Some have been grouped for discussion purposes.

common - The first-level subdirectory common contains declarations of variables and arrays used throughout the FVS code as globals. All files in common have filenames in all caps, and filename extensions of .F77. This is in contrast to the Fortran source code files in other subdirectories, which have filenames in all lowercase and extensions of .f. The files in the first-level common subdirectory are universal in that they can be included in the build for any geographic variant executable. There are other common subdirectories within some of the other first-level subdirectories. Those contain declarations of global variables and arrays used in particular variants or model components. Source code files in common subdirectories should be reserved only for global declarations.

base - The base subdirectory contains source code used to build the base model of FVS. The files in base are universal in that there is nothing in their source code that limits their use to a subset of geographic variants. The files could potentially be used to build any variant. If you modify source code in base you should make every attempt to keep it applicable to all variants. If you have to modify a source code file so that it is specific only to a subset of variants, you should move that source code file out of base and into the appropriate variant-specific directory. You should also move the original, unedited file to an appropriate variant-specific directory. Contact an Administrator if you are unsure of the appropriate locations for files. You will need to edit the affected source list files to reflect the new file locations.

Variant-specific subdirectories - Many of the subdirectories have names with the two-letter designation for a geographic variant of FVS. For example, the subdirectory named ie refers to the Inland Empire variant of FVS. Source code contained in the variant-specific subdirectories is used only to build that specific variant or a group of related variants. For information on the FVS variants and their two-letter designations, refer to the FVS website (https://www.fs.usda.gov/fvs/whatis).

Extension subdirectories - A number of the subdirectories contain source code for an FVS extension. Extensions are model segments that are typically optional to include in an executable. For example, many of the variants can be built with extensions that simulate the effects of insects or disease. The Essential FVS document, available from the FVS website (https://www.fs.usda.gov/fvs/documents/guides.shtml), describes the various extensions. For information about the various insect and disease extensions and the variants to which they apply, refer to the Forest Health Protection website (https://www.fs.usda.gov/foresthealth/applied-sciences/fvs-models).

There are a few special subdirectories that do not contain source code, and they are described below.

bin - The bin subdirectory does not contain source code. It contains files used to build executables. The procedure used to build executables is described in the Build Process wiki documents. Developers may need to modify the FVSxx_sourceList.txt files in their branch (where xx is the variant designation), but the files in main should not be updated. When builds are completed, your local bin directory may contain additional subdirectories and files related to the builds, including the executable files. These subdirectories and the files they contain should not be uploaded to the open-fvs repository.

changeNotes - The changeNotes subdirectory does not contain source code. It contains text files describing changes made to the source code. These files may be valuable to developers when trying to determine when particular features were changed in the code. You should not modify the changeNotes subdirectory in main unless an Administrator has given you explicit permission to do so.

tests - The tests subdirectory does not contain source code. It contains subdirectories and files needed to run tests on executables built with modified code. The required testing process is described in the Testing wiki document.

APPENDIX A: Subroutine Overview

The typical FVS convention requires that file names be the same as subroutine names, and that only one subroutine is contained in a file. See Appendix B for a description of the organization of the FVS directory structure. The purpose of some of the primary FVS growth and mortality subroutines is described below. The bolded subroutines can be found in the base/src source directory. All other subroutines are used in specific variants or in an FVS extension.

  1. Run Initialization, and File Management

    • Primary: MAIN, FILOPN, MYOPEN, GROHED, BLKDAT, GRINIT, SITSET
  2. Process Keywords

    • Primary: INITRE
    • Secondary: KEYRDR, KEYWDS, ERRGRO, HABTYP, HBDECD, FORKOD, SPDECD
  3. Read Input Stand and Tree Data

    • Primary: INTREE
    • Secondary: DAMCDS SPCTRN
  4. Compute Initial Stand Statistics

    • Primary: NOTRE, DENSE, STATS, VOLS
    • Secondary: SETUP
  5. Backdate densities / Dub missing data / Compute calibration statistics

    • Primary: CRATET
    • Secondary: DGDRIV, REGENT, CROWN, DUBSCR
  6. Control Looping Over Cycles

    • Primary: TREGRO, GRINCR, GRADD
  7. Control of event monitor

    • Primary: EVMON
  8. Thinnings

    • Primary: CUTS
    • Secondary: CUTSTK
  9. Grow Large Trees

    • Primary: DGDRIV, DGF, HTGF, CROWN
    • Secondary: HTCALC CWCALC
  10. Grow Small trees

    • Primary: REGENT
    • Secondary: SMHTGF (Some variants)
  11. Mortality

    • Primary: MORTS
    • Secondary: SDICAL, VARMRT
  12. Regeneration

    • Primary: ESTAB
    • Secondary: REGENT
  13. Volume Computation

    • Primary: VOLS
    • Secondary: CFVOL, BFVOL, BEHPRM, CFTOPK, BFTOPK, VARVOL, FORMCL
  14. Model Output

    • Primary: SUMOUT, DISPLY, PRTRLS, EXTREE

Appendix B: Organization of the FVS Source Code

COMMON indicates a directory of include files that contain labeled COMMON blocks. This file directory immediately under the FVS file directory contains base model COMMON blocks used in all variants and COMMON blocks for some of the extensions. The COMMON directory under a variant specific directory (e.g. FVS/AK/COMMON) contains COMMON blocks which are specific to that variant.

SRC indicates a file directory containing FORTRAN source code. This file directory immediately under the base file directory (i.e. BASE/SRC) contains base model code used in all variants. This file directory under a variant specific directory (e.g. FVS/AK/SRC) contains source code that is variant specific to the extent that it is not used in all variants but may be used in more than one variant.

All files used in an FVS executable are listed in the fvs\bin\FVS??_sourceList.txt files, where ?? refers to the 2-character abbreviation for the FVS variant. E.g. the source list file for the Inland Empire variant (IE) is named fvs\bin\FVSie_sourceList.txt. Refer to these file lists to make sure that a subroutine is used in the variant of interest.

Directory - Description

fvs\
β”œβ”€β”€β”€acd			Acadian variant 
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€ak			Southeast Alaska / Coastal British Columbia variant 
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€base			Base model, routines used in all variants
β”‚   β”œβ”€β”€β”€baseDocument
β”‚   └───src
β”œβ”€β”€β”€bc			British Columbia variant
β”œβ”€β”€β”€bgc			BioGeoChemical extension
β”‚   └───src
β”œβ”€β”€β”€bin			
β”œβ”€β”€β”€bm			Blue Mountains variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€ca			Inland California / Southern Cascades variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€changeNotes
β”œβ”€β”€β”€ci			Central Idaho variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€clim			Climate Effects extension
β”‚   β”œβ”€β”€β”€base
β”‚   └───bc
β”œβ”€β”€β”€common
β”œβ”€β”€β”€covr			Cover (Canopy and Shrubs) extension
β”‚   └───src
β”œβ”€β”€β”€cr			Central Rockies extension
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€cs			Central States variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€dbs			Database extension
β”‚   └───src
β”œβ”€β”€β”€dfb			Douglas-fir Beetle Impact extension
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€dftm			Douglas-fir Tussock Moth Outbreak extension
β”‚   └───src
β”œβ”€β”€β”€ec			East Cascades variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€econ			Economics extension
β”‚   └───src
β”œβ”€β”€β”€em			Eastern Montana extension
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€estb			Full Regeneration Establishment Model extension
β”‚   └───src
β”œβ”€β”€β”€fire			Fire and Fuels extension
β”‚   β”œβ”€β”€β”€ak			Fire-related AK variant specific
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€base		Fire Base
β”‚   β”‚   β”œβ”€β”€β”€common
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€bc			Fire-related BC variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€bm			Fire-related BM variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ca			Fire-related CA variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€clim
β”‚   β”‚   └───base		Fire-related Climate extension specific
β”‚   β”‚   └───bc		Fire-related Climate / BC variant specific
β”‚   β”œβ”€β”€β”€ci			Fire-related CI variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€cr			Fire-related CR variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€cs			Fire-related CS variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ec			Fire-related EC variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€em			Fire-related EM variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€fireDocument
β”‚   β”œβ”€β”€β”€fofem		First-Order Fire Effects Model
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ie			Fire-related IE variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ls			Fire-related LS variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€nc			Fire-related NC variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ne			Fire-related NE variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ni			Fire-related NI variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€pn			Fire-related PN variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€sn			Fire-related SN variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€so			Fire-related SO variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€tt			Fire-related TT variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ut			Fire-related UT variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€wc			Fire-related WC variant specific 
β”‚   β”‚   └───src
β”‚   └───ws			Fire-related WS variant specific 
β”‚       └───src
β”œβ”€β”€β”€ie			Inland Empire variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€kt			Kootenai/Kaniksu/Tally Lake variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€lpmpb			Lodgepole Pine Mountain Pine Beetle Impact Ext.
β”‚   └───src
β”œβ”€β”€β”€ls			Lake States variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€metric			Metric Input/Output
β”‚   β”œβ”€β”€β”€ak			Metric-related AK variant specific
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€base		Metric-related Base 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€clim 		Metric-related Climate extension specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€cr			Metric-related CR variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€dbs			Metric-related Database extension specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€dfb			Metric-related Douglas-fir Beetle Imp. Ext.specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€estb		Metric-related Full Regen. Estab Model specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€fire		Metric-related Fire and Fuels extension specific 
β”‚   β”‚   β”œβ”€β”€β”€base
β”‚   β”‚   β”‚   └───src
β”‚   β”‚   └───cr
β”‚   β”œβ”€β”€β”€ls			Metric-related LS variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€mistoe		Metric-related Dwarf Mistletoe Impact Ext. specific
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ne			Metric-related NE variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€newmist		Metric-related New Dwarf Mistletoe Ext.specific
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ni			Metric-related NI variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ppbase		Metric-related Parallel Processing Ext. Specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€rd			Metric-related Wstern Root Disease Ext. specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€so			Metric-related SO variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€strp		Metric-related Partial Regen. Estb. Ext. specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€ut			Metric-related UT variant specific 
β”‚   β”‚   └───src
β”‚   β”œβ”€β”€β”€wc			Metric-related WC variant specific 
β”‚   β”‚   └───src
β”‚   └───wwpb		Metric-related West-wide Pine Beetle Ext. specific 
β”‚       └───src
β”œβ”€β”€β”€mistoe			Dwarf Mistletoe Impact extension 
β”‚   └───src
β”œβ”€β”€β”€nc			Northern California (Klamath Mountains) variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€ne			Northeast variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€newmist			New (3D) Dwarf Mistletoe Impact extension
β”‚   └───src
β”œβ”€β”€β”€ni			Northern Idaho variant
β”‚   └───src
β”œβ”€β”€β”€on			Ontario variant
β”‚   └───src
β”œβ”€β”€β”€oz			Ozark variant
β”‚   └───src
β”œβ”€β”€β”€pg			Mass storage routines
β”‚   └───src
β”œβ”€β”€β”€pn			Pacific Northwest Coast variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€rd			Western Root Disease Impact extension
β”‚   └───src
β”œβ”€β”€β”€sn			Southern variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€so			South Central Oregon / Northeast California variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€strp			Partial Regeneration Establishment Model extension
β”‚   └───src
β”œβ”€β”€β”€tests			Model verification testing
β”‚   β”œβ”€β”€β”€APIviaR
β”‚   β”œβ”€β”€β”€FVSak
β”‚   β”œβ”€β”€β”€FVSbcc
β”‚   β”œβ”€β”€β”€FVSbmc
β”‚   β”œβ”€β”€β”€FVScac
β”‚   β”œβ”€β”€β”€FVScic
β”‚   β”œβ”€β”€β”€FVScrc
β”‚   β”œβ”€β”€β”€FVScs
β”‚   β”œβ”€β”€β”€FVSecc
β”‚   β”œβ”€β”€β”€FVSemc
β”‚   β”œβ”€β”€β”€FVSiec
β”‚   β”‚   └───econ
β”‚   β”œβ”€β”€β”€FVSktc
β”‚   β”œβ”€β”€β”€FVSls
β”‚   β”œβ”€β”€β”€FVSncc
β”‚   β”œβ”€β”€β”€FVSne
β”‚   β”œβ”€β”€β”€FVSpnc
β”‚   β”œβ”€β”€β”€FVSsn
β”‚   β”œβ”€β”€β”€FVSsoc
β”‚   β”œβ”€β”€β”€FVSttc
β”‚   β”œβ”€β”€β”€FVSutc
β”‚   β”œβ”€β”€β”€FVSwcc
β”‚   β”œβ”€β”€β”€FVSwsc
β”‚   β”œβ”€β”€β”€ODBC
β”‚   β”‚   β”œβ”€β”€β”€access
β”‚   β”‚   β”œβ”€β”€β”€conn_strings
β”‚   β”‚   └───sqlite
β”‚   └───testSetFromFMSC
β”‚   β”‚   └───sqlite
β”‚   └───VolTest
β”œβ”€β”€β”€tt			Tetons variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€ut			Utah variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€volume			National Cruise System 
β”‚   └───src
β”œβ”€β”€β”€wc			West Cascades variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€wpbr			White Pine Blister Rust extension
β”‚   └───src
β”œβ”€β”€β”€ws			Westside Sierra Nevada variant
β”‚   β”œβ”€β”€β”€common
β”‚   └───src
β”œβ”€β”€β”€wsbwe			Western Spruce Budworm extension
β”‚   └───src
└───wwpb			West-wide Pine Beetle extension
    └───src