Skip to content

VeloSteve/Coral-Model-V12

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Coral-Model-V12

Archived versions of this software are available:

DOI The software is under a "3-Clause BSD License". See the LICENSE file and other license_*.txt files for included third-party software.

This is the model used for a paper submitted for publication by Logan, Dunne, Ryan, Baskett, and Donner in early 2020. Publication details are not yet available and may change.

To run the model:

  1. Install MATLAB, using a 2013 version or later. R2019b is the last version tested.
  2. Place the directory containing this file with all its contents where MATLAB can access it.
  3. Edits mentioned below will be in the file modelVars.txt, which contains a single JSON string.
  4. Obtain m_map from www.eoas.ubc.ca/~rich/map.html, and edit m_mapPath to point at the directory where you install it.
  5. Edit outputBase to point to a location for output files.
  6. In all locations, replace "D:/GitHub/Coral-Model-V12/" with the base directory in which you have placed this model.
  7. Edit useThreads to a value no greater than the number of workers allowed in your MATLAB configuration. Later, try changing this to optimize performance.
  8. For Windows, the file timeIteration_23040_mex.mexw64 is already in place. On other architectures use MATLAB Coder to compile timeIteration.m for your machine. As an entry point, use the main program, ideally after editing everyx in modelVars.txt to 100 or 1000 for faster operation. Rename the resulting "mex" file exactly as shown. The number must match the number of time points in the computation, as reflected in the array "time".
  9. Open A_Coral_Model.m and replace "D:\GitHub\Coral-Model-V12\modelVars.txt" with the actual path to the modelVars file you edited above.
  10. From the base directory used above, run A_Coral_Model.m

Definitions for all variables in modelVars.txt

 

Input options.   These are the variables which may be modified by editing modelVars.txt. At runtime they are stored in an object called ParameterDictionary, which provides some limited error checking.

Name

Example value

Description

Science

dataset

ESM2M

Category of climate dataset

E

true

Allow the symbionts to evolve.

OA

false

Include a growth penalty based on ocean acidification effects.

RCP

rcp26

The representative concentration pathway selection for this run.     rcp26, rcp45, rcp60, rcp85, and control400 are supported.

superAdvantage

0.5

Thermal advantage in degrees C for any special symbionts.

superMode

7

Mode of special symbiont introduction, defined in setupSuperSymbionts.m

superGrowthPenalty

0.25

Coral growth penalty applied when a heat-tolerant symbiont strain dominates.

superStart

1861

Year of introduction of special symbionts.

Computation

everyx

1

If > 1 skip reefs for fast debugging or feature testing.

specialSubset

useEveryx

Options: "no" = compute all reefs, ignoring everyx; "useEveryx" = obey the values in everyx; "keyOnly": compute only the reefs listed in keyReefs; "eq", "lo", "hi" = compute reefs with absolute value of latitude in the range [0, 7], (7, 15], or > 15, respectively.

optimizerMode

False

This is normally false, but must be set true when optimizing the proportionality constant.

useThreads

6

Number of threads (MATLAB workers) to use, subject to system configuration limits.

Output

doPlots

true

If false the plots cotrolled by allFigs, keyReefs, and the following do[plot type] options are all disabled.

allFigs

false

Output a MATLAB figure for each reef cell simulated.

keyReefs

[150 420 421 512]

A list of reefs to be included in the run, even if they would otherwise be skipped due to a value of everyx = 1.  Also, figures are generated for these reefs even if allFigs is false.

doCoralCoverFigure

false

Produce a figure showing global coral cover over time

doCoralCoverMaps

false

Produce several maps with reefs colored by various health-related values

doDetailedStressStats

false

Save end-of-run statistics at 1-year resolution after 1950, otherwise just 6 years of interest are output.

doGenotypeFigure

false

Plot optimum temperature versus time for each key reef (see keyReefs)

doGrowthRateFigure

false

Plot growth versus temperature for each key reef (see keyReefs)

newMortYears

false

Generate a ".mat" file with the first time each reef experiences 5 years of mortality.

saveVarianceStats

false

Save data for comparing selectional variance and last year of coral cover.  A diagnostic only.

Paths

codebase

D:/GitHub/Coral-Model/

Used only by the GUI, this is the location of the model.

m_mapPath

D:/GitHub/m_map/

Source directory for m_map code.

matPath

D:/GitHub/Coral-Model/mat_files/

Location of mat files for biological constants, proportionality constants and some other inputs.

outputBase

D:/CoralTest/ModelResults/

A directory for all output files.  Subdirectories will be made to separate runs with different key parameters such as E, OA, and RCP.

omegaPath

D:/GitHub/Coral-Model/ClimateData/

Directory for ocean acidification input files.

sstPath

D:/GitHub/Coral-Model/ClimateData/

Location of the SST histories for each reef cell and climate scenario.





 

 

Expected output

Expected initial outputs include an echo of the parameters from modelVars.txt, and a line reading "Modeling 1925 reefs". The value will be smaller if you have selected a subset of all reefs. Next there will be progress lines, for example "Set 2 is 26 percent complete." where the set number indicates which worker thread is in use.

The run will end with several tables in this format:

Permanently bleached reefs as of the date given:
Year         1950    2000    2016    2050    2075    2100  Total Reefs Max Latitude
Equatorial  24.14   24.14   27.59   56.90   93.10  100.00           58          7.0
Low          6.15    6.15    6.15   24.62   81.54  100.00           65         15.0
High         8.22    9.59   12.33   46.58   87.67  100.00           73         28.5
All Reefs   12.24   12.76   14.80   42.35   87.24  100.00          196 

Followed by some timing statistics.