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.
-
Run Initialization, and File Management
- Primary: MAIN, FILOPN, MYOPEN, GROHED, BLKDAT, GRINIT, SITSET
-
Process Keywords
- Primary: INITRE
- Secondary: KEYRDR, KEYWDS, ERRGRO, HABTYP, HBDECD, FORKOD, SPDECD
-
Read Input Stand and Tree Data
- Primary: INTREE
- Secondary: DAMCDS SPCTRN
-
Compute Initial Stand Statistics
- Primary: NOTRE, DENSE, STATS, VOLS
- Secondary: SETUP
-
Backdate densities / Dub missing data / Compute calibration statistics
- Primary: CRATET
- Secondary: DGDRIV, REGENT, CROWN, DUBSCR
-
Control Looping Over Cycles
- Primary: TREGRO, GRINCR, GRADD
-
Control of event monitor
- Primary: EVMON
-
Thinnings
- Primary: CUTS
- Secondary: CUTSTK
-
Grow Large Trees
- Primary: DGDRIV, DGF, HTGF, CROWN
- Secondary: HTCALC CWCALC
-
Grow Small trees
- Primary: REGENT
- Secondary: SMHTGF (Some variants)
-
Mortality
- Primary: MORTS
- Secondary: SDICAL, VARMRT
-
Regeneration
- Primary: ESTAB
- Secondary: REGENT
-
Volume Computation
- Primary: VOLS
- Secondary: CFVOL, BFVOL, BEHPRM, CFTOPK, BFTOPK, VARVOL, FORMCL
-
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