diff --git a/.Rbuildignore b/.Rbuildignore
index 44e8514cd..ee556d8ac 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -3,7 +3,7 @@
^hector.Rproj$
^\.Rproj\.user$
-## Github config, license, CI, etc.
+## GitHub config, license, CI, etc.
^CONTRIBUTING.md$
^LICENSE.md$
^changelog.txt$
@@ -18,18 +18,19 @@
^project_files$
^output$
^scripts$
+^scripts/
^logs$
^test_hector.sh$
^src/hector$
^src/.*\.txt$
^src/.*\.a$
^src/.*\.d$
+^.*\.o$
^src/main.*$
^src/makefile.standalone$
^src/testing$
^misc$
^data-raw$
-^analysis$
^.vscode$
# pkgdown config and output
@@ -39,3 +40,11 @@ _pkgdown.yml
# lintr config
.lintr
+^doc$
+^Meta$
+^vignettes/articles$
+
+# README and similar files
+^CITATION\.cff$
+^CODE_OF_CONDUCT\.md$
+^README\.Rmd$
diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml
new file mode 100644
index 000000000..e6daa0e87
--- /dev/null
+++ b/.github/workflows/R-CMD-check.yaml
@@ -0,0 +1,60 @@
+name: R-CMD-check
+# Controls when the action will run.
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - '**' # matches every branch
+
+ schedule:
+ # * is a special character in YAML so you have to quote this string
+ # Launch run at 6am the 1st of every month.
+ - cron: '0 6 1 * *'
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+jobs:
+ R-CMD-check:
+ runs-on: ${{ matrix.config.os }}
+
+ name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+ strategy:
+ fail-fast: false
+ matrix:
+ config:
+ - {os: macos-latest, r: 'release'}
+ - {os: windows-latest, r: 'release'}
+ - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
+ - {os: ubuntu-latest, r: 'release'}
+ - {os: ubuntu-latest, r: 'oldrel-1'}
+
+ env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+ R_KEEP_PKG_SOURCE: yes
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: r-lib/actions/setup-pandoc@v2
+
+ - uses: r-lib/actions/setup-r@v2
+ with:
+ r-version: ${{ matrix.config.r }}
+ http-user-agent: ${{ matrix.config.http-user-agent }}
+ use-public-rspm: true
+
+ - uses: r-lib/actions/setup-r-dependencies@v2
+ with:
+ extra-packages: any::rcmdcheck
+ needs: check
+
+ - uses: r-lib/actions/check-r-package@v2
+ with:
+ upload-snapshots: true
+ args: 'c("--no-manual", "--as-cran")'
+ error-on: '"error"'
+ check-dir: '"check"'
diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml
index 547c18d0d..8bfcd434c 100644
--- a/.github/workflows/codecov.yaml
+++ b/.github/workflows/codecov.yaml
@@ -4,9 +4,9 @@ on:
- master
pull_request:
branches:
- - master
+ - '**' # matches every branch
schedule:
- # * is a special character in YAML so you have to quote this string, it is set up to run at 6am
+ # * is a special character in YAML so you have to quote this string, it is set up to run at 6am
# on the first day of the month, this is helpful for periods of time when PRs are not being merged.
- cron: '0 6 1 * *'
# Allows you to run this workflow manually from the Actions tab
@@ -16,15 +16,15 @@ name: test-coverage
jobs:
test-coverage:
- runs-on: macOS-latest
+ runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- - uses: r-lib/actions/setup-r@master
+ - uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
- - uses: r-lib/actions/setup-pandoc@master
+ - uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
run: |
@@ -40,6 +40,9 @@ jobs:
key: macOS-r-4.0-2-${{ hashFiles('.github/depends.Rds') }}
restore-keys: macOS-r-4.0-2-
+ - name: Install libcurl
+ run: sudo apt-get install libcurl4-openssl-dev
+
- name: Install dependencies
run: |
install.packages(c("remotes"))
diff --git a/.github/workflows/command-line.yaml b/.github/workflows/command-line.yaml
index 7e73d84a0..2daacf7ab 100644
--- a/.github/workflows/command-line.yaml
+++ b/.github/workflows/command-line.yaml
@@ -8,12 +8,13 @@ on:
push:
branches:
- master
- - github_actions
pull_request:
- branches: master
+ branches:
+ - '**' # matches every branch
+
schedule:
# * is a special character in YAML so you have to quote this string
- # Launch run at 6am the 1st of every month.
+ # Launch run at 6am the 1st of every month.
- cron: '0 6 1 * *'
# Allows you to run this workflow manually from the Actions tab
@@ -32,9 +33,7 @@ jobs:
- uses: actions/checkout@v2
- name: build and run
run: |
- sudo apt install libboost-filesystem-dev libboost-system-dev
-
- ver=`awk '/define.*BOOST_LIB_VERSION/ {print $3}' /usr/include/boost/version.hpp`
- echo Boost version $ver
- BOOSTLIB=/usr/local/lib BOOSTVERSION=$ver BOOSTROOT=/usr/include/boost make hector
+ sudo apt-get update
+ sudo apt install libboost-dev
+ make hector
bash ./test_hector.sh ./src/hector
diff --git a/.github/workflows/leeyabot.yml b/.github/workflows/leeyabot.yml
new file mode 100644
index 000000000..87495a428
--- /dev/null
+++ b/.github/workflows/leeyabot.yml
@@ -0,0 +1,55 @@
+name: leeyabot
+on:
+ pull_request:
+ branches:
+ - '**' # matches every branch
+
+jobs:
+ run:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: iterative/setup-cml@v1
+ - uses: r-lib/actions/setup-r@v2
+ with:
+ r-version: 'release'
+
+ - name: Install libcurl
+ run: sudo apt-get install libcurl4-openssl-dev
+
+ - name: Install dependencies
+ env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ install.packages(c("ggplot2", "rmarkdown", "dplyr", "remotes", "here"))
+ remotes::install_github("hadley/emo")
+ remotes::install_deps(dependencies = TRUE)
+ shell: Rscript {0}
+
+ - name: Install package
+ run: R CMD INSTALL .
+
+ - name: Generate report
+ run: |
+ rmarkdown::render("./scripts/OutputDifferences.Rmd", run_pandoc = FALSE)
+ shell: Rscript {0}
+
+ - name: Post comment
+ env:
+ REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ # Post reports as comments in GitHub PRs
+ cd scripts/
+ if [ -f "diff_plot.png" ]
+ then
+ cat OutputDifferences.knit.md >> report.md
+ echo "" >> report.md
+ echo "" >> report.md
+ elif [ -f "same_plot.png" ]
+ then
+ cat OutputDifferences.knit.md >> report.md
+ else
+ cat OutputDifferences.knit.md >> report.md
+ echo "leeyabot down :(" > report.md
+ fi
+ cml comment create report.md
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
deleted file mode 100644
index cdf4cf9ad..000000000
--- a/.github/workflows/lint.yaml
+++ /dev/null
@@ -1,57 +0,0 @@
-on:
- push:
- branches:
- - main
- - master
- pull_request:
- branches:
- - main
- - master
-
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-name: lint
-
-jobs:
- lint:
- runs-on: ubuntu-latest
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- steps:
- - name: Install libcurl
- run: sudo apt-get install libcurl4-openssl-dev
-
- - uses: actions/checkout@v2
- - uses: r-lib/actions/setup-r@v1
-
- - name: Query dependencies
- run: |
- install.packages('remotes')
- saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
- writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
- shell: Rscript {0}
-
- - name: Cache R packages
- uses: actions/cache@v2
- with:
- path: ${{ env.R_LIBS_USER }}
- key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
- restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
-
- - name: Install dependencies
- run: |
- install.packages(c("remotes", "lintr"))
- remotes::install_deps(dependencies = TRUE)
- shell: Rscript {0}
-
- - name: Install package
- run: R CMD INSTALL .
-
- - name: Lint
- run: |
- # lintr configuration settings are in the .lintr file
- out <- lintr::lint_package()
- invisible(lapply(out, print))
- if (length(out)) stop("lints found")
- shell: Rscript {0}
diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml
index 86b79724b..90d17597d 100644
--- a/.github/workflows/pkgdown.yaml
+++ b/.github/workflows/pkgdown.yaml
@@ -1,53 +1,47 @@
+# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
+# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
+ branches: [master]
+ pull_request:
branches:
- - main
- - master
- schedule:
- # * is a special character in YAML so you have to quote this string
- # Launch run at 6am the 1st of every month.
- - cron: '0 6 1 * *'
-
- # Allows you to run this workflow manually from the Actions tab
+ - '**' # matches every branch
+ release:
+ types: [published]
workflow_dispatch:
name: pkgdown
jobs:
pkgdown:
- runs-on: macOS-latest
+ runs-on: ubuntu-latest
+ # Only restrict concurrency for non-PR jobs
+ concurrency:
+ group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
+ env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- - uses: actions/checkout@v2
-
- - uses: r-lib/actions/setup-r@v1
+ - uses: actions/checkout@v3
- - uses: r-lib/actions/setup-pandoc@v1
+ - uses: r-lib/actions/setup-pandoc@v2
- - name: Query dependencies
- run: |
- install.packages('remotes')
- saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
- writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
- shell: Rscript {0}
+ - uses: r-lib/actions/setup-r@v2
+ with:
+ use-public-rspm: true
- - name: Cache R packages
- uses: actions/cache@v2
+ - uses: r-lib/actions/setup-r-dependencies@v2
with:
- path: ${{ env.R_LIBS_USER }}
- key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
- restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
+ extra-packages: any::pkgdown, local::.
+ needs: website
- - name: Install dependencies
- run: |
- remotes::install_deps(dependencies = TRUE)
- install.packages("pkgdown", type = "binary")
+ - name: Build site
+ run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}
- - name: Install package
- run: R CMD INSTALL .
-
- - name: Deploy package
- run: |
- git config --local user.email "actions@github.com"
- git config --local user.name "GitHub Actions"
- Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
+ - name: Deploy to GitHub pages 🚀
+ if: github.event_name != 'pull_request'
+ uses: JamesIves/github-pages-deploy-action@v4.4.1
+ with:
+ clean: false
+ branch: gh-pages
+ folder: docs
diff --git a/.github/workflows/rcmd.yml b/.github/workflows/rcmd.yml
deleted file mode 100644
index 4df8d7a81..000000000
--- a/.github/workflows/rcmd.yml
+++ /dev/null
@@ -1,111 +0,0 @@
-# Controls when the action will run.
-on:
- push:
- branches:
- - master
- - github_actions
- pull_request:
- branches: master
-
- schedule:
- # * is a special character in YAML so you have to quote this string
- # Launch run at 6am the 1st of every month.
- - cron: '0 6 1 * *'
-
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-name: R-CMD
-
-jobs:
- R-CMD:
- runs-on: ${{ matrix.config.os }}
-
- name: ${{ matrix.config.os }} (${{ matrix.config.r }})
-
- strategy:
- fail-fast: false
- matrix:
- config:
- # test on one version of R for MacOSX
- - {os: macOS-latest, r: 'release'}
-
- # test on one version of R for windows
- - {os: windows-latest, r: 'release'}
-
- # latest stable version of R for ubuntu-16.04 is 3.5; ubuntu-latest is migrating to 20.04 by the end of 2020
- - {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- - {os: ubuntu-16.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
-
- env:
- R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
- RSPM: ${{ matrix.config.rspm }}
-
- steps:
- - uses: actions/checkout@v2
-
- - uses: r-lib/actions/setup-r@master
- with:
- r-version: ${{ matrix.config.r }}
-
- - uses: r-lib/actions/setup-pandoc@master
-
- - name: Query dependencies
- run: |
- install.packages('remotes')
- saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
- writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
- shell: Rscript {0}
-
- - name: Cache R packages
- if: runner.os != 'Windows'
- uses: actions/cache@v1
- with:
- path: ${{ env.R_LIBS_USER }}
- key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
- restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
-
- - name: Install system dependencies
- if: runner.os == 'Linux'
- env:
- RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
- run: |
- Rscript -e "remotes::install_github('r-hub/sysreqs')"
- sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
- sudo -s eval "$sysreqs"
-
- - name: Install XQuartz on MacOS
- if: runner.os == 'macOS'
- run: brew install xquartz
-
- - name: Install dependencies
- run: |
- remotes::install_deps(dependencies = TRUE)
- remotes::install_cran("rcmdcheck")
-
- shell: Rscript {0}
-
- - name: Session info
- run: |
- options(width = 100)
- pkgs <- installed.packages()[, "Package"]
- sessioninfo::session_info(pkgs, include_base = TRUE)
- shell: Rscript {0}
-
- - name: Check
- env:
- _R_CHECK_CRAN_INCOMING_: false
- run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
- shell: Rscript {0}
-
- - name: Show testthat output
- if: always()
- run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
- shell: bash
-
- - name: Upload check results
- if: failure()
- uses: actions/upload-artifact@master
- with:
- name: ${{ runner.os }}-r${{ matrix.config.r }}-results
- path: check
diff --git a/.github/workflows/unit-testing.yaml b/.github/workflows/unit-testing.yaml
new file mode 100644
index 000000000..8475a99df
--- /dev/null
+++ b/.github/workflows/unit-testing.yaml
@@ -0,0 +1,35 @@
+# Build the gtest Hector and run it
+
+name: C++ unit tests
+
+# Controls when the action will run.
+on:
+ pull_request:
+ branches:
+ - '**' # matches every branch
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+jobs:
+ # This workflow contains one job that builds hector on ubuntu using the
+ # googletest framework.
+ ubuntu:
+ runs-on: ubuntu-latest
+
+ # Steps represent a sequence of tasks that will be executed as part of the job
+ steps:
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+ - uses: actions/checkout@v2
+ - name: Install gtest
+ # based on https://github.com/bastianhjaeger/github_actions_gtest_example
+ run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp lib/*.a /usr/local/lib
+ - name: Install Boost
+ run: sudo apt install libboost-filesystem-dev libboost-system-dev
+ - name: build and run
+ # NB we don't really need to define BOOSTROOT and GTROOT; these are the defaults
+ run: |
+ BOOSTROOT=/usr/local/
+ GTROOT=/usr/local/
+ make testing
+ ./src/unit-testing/hector-unit-tests
diff --git a/.gitignore b/.gitignore
index 13224e25d..513e6bf3a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,8 @@
src/hector
src/hector-ext
src/hector-api
+src/unit-testing/hector-unit-tests
+src/unit-testing/hector-unit-tests.dSYM/
# Hector logs
logs/*.*
@@ -62,12 +64,10 @@ libs/
*.suo
# Output
-output/output*
+output/*.csv
# R
.Rhistory
-R/batchrunner/*.pdf
-R/batchrunner/*.csv
.Rapp.history
.Rproj.user
.RData
@@ -80,3 +80,5 @@ vignettes/rsconnect
# vignette caches
/vignettes/*_cache
docs
+/doc/
+/Meta/
diff --git a/.lintr b/.lintr
index c7efcdf7d..dbac387f5 100644
--- a/.lintr
+++ b/.lintr
@@ -1,4 +1,4 @@
-linters: with_defaults(
+linters: linters_with_defaults(
object_name_linter = NULL,
line_length_linter(100)
)
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000..a9761694f
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,56 @@
+{
+ "files.associations": {
+ "iostream": "cpp",
+ "new": "cpp",
+ "array": "cpp",
+ "atomic": "cpp",
+ "bit": "cpp",
+ "*.tcc": "cpp",
+ "cctype": "cpp",
+ "clocale": "cpp",
+ "cmath": "cpp",
+ "compare": "cpp",
+ "complex": "cpp",
+ "concepts": "cpp",
+ "cstdarg": "cpp",
+ "cstddef": "cpp",
+ "cstdint": "cpp",
+ "cstdio": "cpp",
+ "cstdlib": "cpp",
+ "ctime": "cpp",
+ "cwchar": "cpp",
+ "cwctype": "cpp",
+ "deque": "cpp",
+ "list": "cpp",
+ "map": "cpp",
+ "unordered_map": "cpp",
+ "vector": "cpp",
+ "exception": "cpp",
+ "algorithm": "cpp",
+ "functional": "cpp",
+ "iterator": "cpp",
+ "memory": "cpp",
+ "memory_resource": "cpp",
+ "numeric": "cpp",
+ "optional": "cpp",
+ "random": "cpp",
+ "string": "cpp",
+ "string_view": "cpp",
+ "system_error": "cpp",
+ "tuple": "cpp",
+ "type_traits": "cpp",
+ "utility": "cpp",
+ "fstream": "cpp",
+ "initializer_list": "cpp",
+ "iomanip": "cpp",
+ "iosfwd": "cpp",
+ "istream": "cpp",
+ "limits": "cpp",
+ "ostream": "cpp",
+ "ranges": "cpp",
+ "sstream": "cpp",
+ "stdexcept": "cpp",
+ "streambuf": "cpp",
+ "typeinfo": "cpp"
+ }
+}
\ No newline at end of file
diff --git a/CITATION.cff b/CITATION.cff
new file mode 100644
index 000000000..2e21ff403
--- /dev/null
+++ b/CITATION.cff
@@ -0,0 +1,37 @@
+cff-version: 3.0.0-alpha
+message: "If you use this software in your work, please cite it as below."
+authors:
+- family-names: "Dorheim"
+ given-names: "Kalyn"
+ orcid: "https://orcid.org/0000-0001-8093-8397"
+- family-names: "Bond-Lamberty"
+ given-names: "Ben"
+ orcid: "https://orcid.org/0000-0001-9525-4633"
+- family-names: "Hartin"
+ given-names: "Corinne"
+ orcid: "https://orcid.org/0000-0003-1834-6539"
+- family-names: "Link"
+ given-names: "Robert"
+ orcid: "https://orcid.org/0000-0002-7071-248X"
+- family-names: "Nicholson"
+ given-names: "Mat"
+- family-names: "Pralit"
+ given-names: "Patel"
+ orcid: "https://orcid.org/0000-0003-3992-1061"
+- family-names: "Pressburger"
+ given-names: "Leeya"
+ orcid: "https://orcid.org/0000-0002-6850-2504"
+- family-names: "Shiklomanov"
+ given-names: "Alexey"
+ orcid: "https://orcid.org/0000-0003-4022-5979"
+- family-names: "Vega-Westhoff"
+ given-names: "Benjamin"
+ orcid: "https://orcid.org/0000-0001-7881-8388"
+- family-names: "Woodard"
+ given-names: "Dawn"
+ orcid: "https://orcid.org/0000-0002-0468-4660"
+title: "Hector a simple carbon-climate model"
+version: 3.0.0-alpha
+doi: TODO
+date-released: TODO
+url: "https://github.com/jgcri/hector"
\ No newline at end of file
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..8509e596a
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,133 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the overall
+community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or
+advances of any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email
+address, without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards
+of acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies
+when an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the project leads, [Kalyn Dorheim](mailto:kalyn.dorheim@pnnl.gov)
+and/or [Ben Bond-Lamberty](mailto:bondlamberty@pnnl.gov).
+All complaints will be reviewed and investigated promptly and fairly.
+
+Community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+This code of conduct, including the consequences laid out below, applies equally
+to the community leaders, of course. Any temporary or permanent ban will result
+in the person in question being removed from the leadership.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series of
+actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or permanent
+ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within the
+community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.0,
+available at https://www.contributor-covenant.org/version/2/0/
+code_of_conduct.html.
+
+Community Impact Guidelines were inspired by [Mozilla's code of conduct
+enforcement ladder](https://github.com/mozilla/diversity).
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see the FAQ at
+https://www.contributor-covenant.org/faq. Translations are available at https://
+www.contributor-covenant.org/translations.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 82a52d81b..000000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# How to contribute
-
-We welcome third-party patches, which are essential for advancing the science and architecture of Hector.
-But there are a few guidelines that we ask contributors to follow, guidelines that ease the maintainers' organizational and logistical duties, while encouraging development by others.
-
-## Getting Started
-
-* Make sure you have a [GitHub account](https://github.com/signup/free).
-* **Open an issue** describing your proposed change or work (after making sure one does not already exist).
- * Clearly describe the issue including steps to reproduce when it is a bug.
- * Discuss how your change will affect Hector, and thus whether it's MAJOR, MINOR, or a PATCH.
- * Interact with the project maintainers to refine/change/prioritize your issue and identify what branch will be targeted (see below).
-* Trivial changes to comments or documentation do not require creating a new issue.
-* Fork the repository on GitHub.
-
-## Making Changes
-
-* **Start your work on the correct branch**.
- * Active branches are based on Hector's [version numbering system](https://github.com/JGCRI/hector/wiki/VersionNumbers).
- * If your change is a PATCH, it will typically be based on the current dev branch; if MINOR, the next minor release branch; if MAJOR, the next major release branch. For example, as of this writing there are branches `dev`, `rc1.2` and `rc2.0`, corresponding to the PATCH-MINOR-MAJOR start points respectively.
- * We will never accept pull requests to the `master` branch.
-* Follow Hector's [coding style](https://github.com/JGCRI/hector/wiki/StyleGuide).
-* Check for unnecessary whitespace with `git diff --check` before committing.
-* Make sure your commit messages are descriptive but succinct, describing what was changed and why, and **reference the relevant issue number**. Make commits of logical units.
-* Make sure you have added the necessary tests for your changes.
-* Run _all_ the tests to assure nothing else was accidentally broken.
-
-## Submitting Changes
-
-* Push your changes to your fork of the repository.
-* Submit a pull request to the main Hector repository.
-* **Your pull request should include one of the following two statements**:
- * You own the copyright on the code being contributed, and you hereby grant PNNL unlimited license to use this code in this version or any future version of Hector. You reserve all other rights to the code.
- * Somebody else owns the copyright on the code being contributed (e.g., your employer because you did it as part of your work for them); you are authorized by that owner to grant PNNL an unlimited license to use this code in this version or any future version of Hector, and you hereby do so. All other rights to the code are reserved by the copyright owner.
-* The core team looks at Pull Requests on a regular basis, and will respond as soon as possible.
-
-# Additional Resources
-
-* [General GitHub documentation](http://help.github.com/)
-* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
diff --git a/DESCRIPTION b/DESCRIPTION
index 4c0c32734..a8baeb234 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,30 +1,47 @@
Package: hector
Title: The Hector Simple Climate Model
-Version: 2.5.0
-Authors@R: c(person("Robert", "Link",
- email = "robert.link@pnnl.gov",
- role = "aut",
- comment = c(ORCID = "0000-0002-7071-248X")),
+Version: 3.0.0
+Authors@R: c(person("Kalyn", "Dorheim",
+ email = "kalyn.dorheim@pnnl.gov",
+ role = c("aut", "cre"),
+ comment = c(ORCID = "0000-0001-8093-8397")),
+ person("Ben", "Bond-Lamberty",
+ email = "bondlamberty@pnnl.gov",
+ role = "aut",
+ comment = c(ORCID = "0000-0001-9525-4633")),
+ person("Skylar", "Gering",
+ email = "sgering@g.hmc.edu",
+ role = "ctb",
+ comment = c(ORCID = "0000-0003-1974-3966")),
person("Corinne", "Hartin",
email = "hartin.corinne@epa.gov",
role = "ctb",
comment = c(ORCID = "0000-0003-1834-6539")),
- person("Ben", "Bond-Lamberty",
- email = "bondlamberty@pnnl.gov",
- role = "ctb",
- comment = c(ORCID = "0000-0001-9525-4633")),
- person("Kalyn", "Dorheim",
- email = "kalyn.dorheim@pnnl.gov",
- role = "cre",
- comment = c(ORCID = "0000-0001-8093-8397")),
+ person("Robert", "Link",
+ role = "ctb",
+ comment = c(ORCID = "0000-0002-7071-248X")),
+ person("Mat", "Nicholson",
+ role = "ctb",
+ comment = c(github = "mnichol3")),
person("Pralit", "Patel",
email = "pralit.patel@pnnl.gov",
role = "ctb",
comment = c(ORCID = "0000-0003-3992-1061")),
+ person("Leeya", "Pressburger",
+ email = "leeya.pressburger@pnnl.gov",
+ role = c("ctb", "dtc"),
+ comment = c(ORCID = "0000-0002-6850-2504")),
person("Alexey", "Shiklomanov",
email = "alexey.shiklomanov@nasa.gov",
role = "ctb",
- comment = c(ORCID = "0000-0003-4022-5979")))
+ comment = c(ORCID = "0000-0003-4022-5979")),
+ person("Benjamin", "Vega-Westhoff",
+ role = "ctb",
+ comment = c(ORCID = "0000-0001-7881-8388")),
+ person("Dawn", "Woodard",
+ email = "dawn.woodard@pnnl.gov",
+ role = "ctb",
+ comment = c(ORCID = "0000-0002-0468-4660")))
Description: Provides an R interface for the Hector Simple Climate
Model. Using this interface you can set up and initialize the model,
change model parameters and emissions inputs, run Hector, and
@@ -35,22 +52,26 @@ License: GPL-3
Encoding: UTF-8
LazyData: true
LinkingTo: Rcpp, BH
-Imports: Rcpp (>= 0.12), BH (>= 1.69)
+Imports: Rcpp (>= 0.12)
Suggests:
testthat,
- nleqslv,
knitr,
+ lintr (>= 3.0),
rmarkdown,
ggplot2,
- magrittr (>= 1.5),
- ragg,
- here
+ magrittr (>= 1.5)
Collate:
- 'aadoc.R'
'RcppExports.R'
+ 'aadoc.R'
'biome.R'
+ 'fxns.R'
'hector.R'
'messages.R'
'units.R'
VignetteBuilder: knitr
-RoxygenNote: 7.1.1
+Config/Needs/website: kableExtra, nleqslv
+RoxygenNote: 7.2.3
+SystemRequirements: GNU make
+URL: https://github.com/JGCRI/hector, https://jgcri.github.io/hector/
+BugReports: https://github.com/JGCRI/hector/issues
+Language: en-US
diff --git a/NAMESPACE b/NAMESPACE
index 8f3efbf80..0994de054 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -3,13 +3,7 @@
S3method(format,hcore)
S3method(print,hcore)
export(AERO_SCALE)
-export(ATMOSPHERIC_C)
-export(ATMOSPHERIC_CH4)
export(ATMOSPHERIC_CO2)
-export(ATMOSPHERIC_N2O)
-export(ATMOSPHERIC_O3)
-export(ATM_OCEAN_FLUX_HL)
-export(ATM_OCEAN_FLUX_LL)
export(BETA)
export(C2F6_CONSTRAIN)
export(CCL4_CONSTRAIN)
@@ -24,12 +18,48 @@ export(CH3CCL3_CONSTRAIN)
export(CH3CL_CONSTRAIN)
export(CH4_CONSTRAIN)
export(CO2_CONSTRAIN)
+export(CO3)
export(CO3_HL)
export(CO3_LL)
+export(CONCENTRATIONS_CH4)
+export(CONCENTRATIONS_CO2)
+export(CONCENTRATIONS_N2O)
+export(CONCENTRATIONS_O3)
+export(DACCS_UPTAKE)
+export(DELTA_C2F6)
+export(DELTA_CCL4)
+export(DELTA_CF4)
+export(DELTA_CFC11)
+export(DELTA_CFC113)
+export(DELTA_CFC114)
+export(DELTA_CFC115)
+export(DELTA_CFC12)
+export(DELTA_CH3BR)
+export(DELTA_CH3CCL3)
+export(DELTA_CH3CL)
+export(DELTA_CH4)
+export(DELTA_CO2)
+export(DELTA_HALON1211)
+export(DELTA_HALON1301)
+export(DELTA_HALON2402)
+export(DELTA_HCFC141B)
+export(DELTA_HCFC142B)
+export(DELTA_HCFC22)
+export(DELTA_HFC125)
+export(DELTA_HFC134A)
+export(DELTA_HFC143A)
+export(DELTA_HFC227EA)
+export(DELTA_HFC23)
+export(DELTA_HFC245FA)
+export(DELTA_HFC4310)
+export(DELTA_N2O)
+export(DELTA_SF6)
export(DETRITUS_C)
+export(DIC)
export(DIC_HL)
export(DIC_LL)
export(DIFFUSIVITY)
+export(EARTH_C)
export(ECS)
export(EMISSIONS_BC)
export(EMISSIONS_C2F6)
@@ -60,6 +90,7 @@ export(EMISSIONS_HFC245FA)
export(EMISSIONS_HFC32)
export(EMISSIONS_HFC4310)
export(EMISSIONS_N2O)
+export(EMISSIONS_NH3)
export(EMISSIONS_NMVOC)
export(EMISSIONS_NOX)
export(EMISSIONS_OC)
@@ -68,14 +99,14 @@ export(EMISSIONS_SO2)
export(FFI_EMISSIONS)
export(FLUX_INTERIOR)
export(FLUX_MIXED)
+export(FRAC_DECOMP_CH4)
+export(FRAC_FROZEN)
+export(FRAC_STATIC)
+export(FTOT_CONSTRAIN)
export(F_LITTERD)
-export(F_LUCD)
-export(F_LUCV)
export(F_NPPD)
export(F_NPPV)
-export(GETDATA)
-export(GLOBAL_TEMP)
-export(GLOBAL_TEMPEQ)
+export(GLOBAL_TAS)
export(HALON1211_CONSTRAIN)
export(HALON1301_CONSTRAIN)
export(HALON2402_CONSTRAIN)
@@ -91,32 +122,42 @@ export(HFC23_CONSTRAIN)
export(HFC245FA_CONSTRAIN)
export(HFC32_CONSTRAIN)
export(HFC4310_CONSTRAIN)
-export(LAND_AIR_TEMP)
-export(LAND_CFLUX)
+export(HL_OCEAN_UPTAKE)
+export(LAND_TAS)
export(LIFETIME_SOIL)
export(LIFETIME_STRAT)
export(LL_DEBUG)
export(LL_NOTICE)
+export(LL_OCEAN_UPTAKE)
export(LL_SEVERE)
export(LL_WARNING)
+export(LO_WARMING_RATIO)
export(LUC_EMISSIONS)
+export(LUC_UPTAKE)
export(N2O_CONSTRAIN)
export(NATURAL_CH4)
-export(NATURAL_SO2)
export(NAT_EMISSIONS_N2O)
export(NBP)
+export(NBP_CONSTRAIN)
export(NPP)
export(NPP_FLUX0)
-export(OCEAN_AIR_TEMP)
export(OCEAN_C)
-export(OCEAN_CFLUX)
export(OCEAN_C_DO)
export(OCEAN_C_HL)
export(OCEAN_C_IO)
export(OCEAN_C_LL)
-export(OCEAN_SURFACE_TEMP)
+export(OCEAN_C_ML)
+export(OCEAN_PREIND_C_ID)
+export(OCEAN_PREIND_C_SURF)
+export(OCEAN_TAS)
+export(OCEAN_UPTAKE)
+export(PCO2)
export(PCO2_HL)
export(PCO2_LL)
+export(PERMAFROST_C)
+export(PERMAFROST_MU)
+export(PERMAFROST_SIGMA)
+export(PH)
export(PH_HL)
export(PH_LL)
export(PREINDUSTRIAL_CH4)
@@ -124,6 +165,9 @@ export(PREINDUSTRIAL_CO2)
export(PREINDUSTRIAL_N2O)
export(PREINDUSTRIAL_O3)
export(Q10_RH)
+export(Q_CO2)
+export(RF_ACI)
+export(RF_ALBEDO)
export(RF_BC)
export(RF_C2F6)
export(RF_CCL4)
@@ -153,22 +197,55 @@ export(RF_HFC23)
export(RF_HFC245FA)
export(RF_HFC32)
export(RF_HFC4310)
+export(RF_MISC)
export(RF_N2O)
+export(RF_NH3)
export(RF_O3_TROP)
export(RF_OC)
export(RF_SF6)
export(RF_SO2)
-export(RF_SO2D)
-export(RF_SO2I)
export(RF_TOTAL)
-export(RF_T_ALBEDO)
export(RF_VOL)
-export(SETDATA)
+export(RH)
+export(RHO_BC)
+export(RHO_C2F6)
+export(RHO_CCL4)
+export(RHO_CF4)
+export(RHO_CFC11)
+export(RHO_CFC113)
+export(RHO_CFC114)
+export(RHO_CFC115)
+export(RHO_CFC12)
+export(RHO_CH3BR)
+export(RHO_CH3CCL3)
+export(RHO_CH3CL)
+export(RHO_HALON1211)
+export(RHO_HALON1301)
+export(RHO_HALON2402)
+export(RHO_HCFC141B)
+export(RHO_HCFC142B)
+export(RHO_HCFC22)
+export(RHO_HFC125)
+export(RHO_HFC134A)
+export(RHO_HFC143A)
+export(RHO_HFC227EA)
+export(RHO_HFC23)
+export(RHO_HFC245FA)
+export(RHO_HFC32)
+export(RHO_HFC4310)
+export(RHO_NH3)
+export(RHO_OC)
+export(RHO_SF6)
+export(RHO_SO2)
export(SF6_CONSTRAIN)
export(SOIL_C)
-export(TEMP_HL)
-export(TEMP_LL)
+export(SST)
+export(SST_HL)
+export(SST_LL)
+export(TAS_CONSTRAIN)
+export(THAWEDP_C)
export(TID)
+export(TRACKING_DATE)
export(TT)
export(TU)
export(TWI)
@@ -176,12 +253,14 @@ export(VEG_C)
export(VOLCANIC_SCALE)
export(VOLCANIC_SO2)
export(WARMINGFACTOR)
-export(Y2000_SO2)
export(create_biome)
export(enddate)
export(fetchvars)
export(get_biome_list)
+export(get_tracking_data)
+export(get_tracking_data_impl)
export(getdate)
+export(getfxn)
export(getname)
export(getunits)
export(isactive)
@@ -196,4 +275,5 @@ export(shutdown)
export(split_biome)
export(startdate)
importFrom(Rcpp,sourceCpp)
+importFrom(utils,read.csv)
useDynLib(hector)
diff --git a/NEWS.md b/NEWS.md
new file mode 100644
index 000000000..db356515b
--- /dev/null
+++ b/NEWS.md
@@ -0,0 +1,102 @@
+# hector 3.0.0
+
+* Updated parameterization, incorporating latest consensus science and for best model performance relative to historical observations
+* New radiative forcing calculations for consistency with AR6
+* Better and more complete software tests; many bug fixes
+* Updated from RCPs to SSPs as the default included scenarios
+* New net biome production (land-atmosphere carbon exchange) constraint
+* New [online documentation](https://jgcri.github.io/hector/)
+* Experimental implementation of permafrost implementation: models permafrost thaw as well as CO2 and CH4 release; optional and currently off by default. See [Woodard et al. 2021](https://gmd.copernicus.org/articles/14/4751/2021/gmd-14-4751-2021.pdf)
+* New carbon tracking: lets users trace the origin and fate of CO2-C within Hector’s carbon cycle; optional and currently off by default see [carbon tracking example](../articles/ex_carbon_tracking.html) additional details can be found in
+* All changes will be documented in Dorheim et al. in prep
+* Variable name changes see [v3 variable changes](../articles/v3_output_changes.html) for more details
+
+
+# hector 2.5.0
+
+[](https://doi.org/10.5281/zenodo.4721584)
+
+* Register Ftalbedo as input
+* Add other non CO~2~ GHG constraints
+* Version of Hector that participated in [RCMIP I](https://gmd.copernicus.org/articles/13/5175/2020/) and [RCMIP II](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2020EF001900)
+
+
+# hector 2.3.0
+
+[](https://doi.org/10.5281/zenodo.3144007)
+
+* Constrain atmospheric CO~2~ concentration to be equal to the
+ preindustrial concentration during the model spinup. The result of
+ this is that the concentration at the beginning of the simulation
+ will be equal to the value specified in the `PREINDUSTRIAL_CO2`
+ parameter, which was not the case previously.
+
+# hector 2.2.2
+
+[](https://doi.org/10.5281/zenodo.2667325)
+
+* Fix bug that was causing requests for H~2~O forcing in the R interface
+ to return N~2~O forcing instead (the model internals were
+ unaffected).
+* Fix bug that was causing API requests for halocarbon forcing to
+ return absolute forcing values, rather than values relative to the
+ base year (which is what is done for all other forcings).
+* Add missing `RF_VOL` (volcanic forcing) dependency to forcing component. In practice the
+ missing dependency had no effect because the forcing component
+ already had a dependency on the SO~2~ component, which also provides
+ the volcanic forcing, but in the event that we ever split them up,
+ this will ensure that the dependency graph is still valid. (All 2.2.2 changes merged in PR #303)
+
+# hector 2.2.1
+
+* Report global averages for land temperature, ocean air
+ temperature, and ocean surface temperature.
+* Fix bug that prevented CH~4~ emissions from being read.
+
+# hector 2.2.0
+
+[](https://doi.org/10.5281/zenodo.2605439)
+
+* Add a new parameter: `VOLCANIC_SCALE`. This parameter adjusts the
+ strength of the response to volcanic forcing. (PR #291)
+* Add `getname()` function to return the name of a Hector core.
+
+# hector 2.1.0
+
+* Add `reset()` function to the API. Calling this function resets a
+ Hector core to an earlier time, rerunning the spinup if
+ appropriate. (PR #243)
+
+# hector 2.0.0
+
+[](https://doi.org/10.5281/zenodo.1194360)
+
+* Incorporated 1-D diffusive ocean heat model as new temperature component (DOECLIM) (PR #206)
+* Bugfix: double counting halocarbon radiative forcing (PR #201)
+* Bugfix: re-enabled CO~2~ concentration constraint (PR #163)
+* Various changes to internals to support calling Hector from external code like `pyhector`
+* Component loggers are now optional (PR #218)
+* Renamed anthro emissions to ffi emissions (fossil fuel industrial) (PR #116)
+
+# hector 1.1.2
+
+* Add `libhector` target OS X and Windows project files (it was already
+ available in the Linux build). This library is used when
+ you want to link Hector to an outside program.
+
+# hector 1.1.1
+
+* Fix OS X build
+* Update sample output files
+* Add GPL license
+
+# hector 1.1
+
+* API for linking with external models.
+* Backend R scripts faster and cleaner.
+* Minor bug fixes and documentation updates.
+
+# hector 1.0
+
+* First release. Corresponds to [Hartin et al. (2015)](http://www.geosci-model-dev.net/8/939/2015/gmd-8-939-2015.pdf).
+
diff --git a/R/RcppExports.R b/R/RcppExports.R
index 91ce7df72..3d8c0a952 100644
--- a/R/RcppExports.R
+++ b/R/RcppExports.R
@@ -1,21 +1,23 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
-#' @include aadoc.R
#' @describeIn msgtype Message type for retrieving data from a component
-#' @export
#' @keywords internal
GETDATA <- function() {
.Call('_hector_GETDATA', PACKAGE = 'hector')
}
#' @describeIn msgtype Message type for setting data in a component
-#' @export
#' @keywords internal
SETDATA <- function() {
.Call('_hector_SETDATA', PACKAGE = 'hector')
}
+#' @describeIn msgtype Character used to separate biome from variable name
+BIOME_SPLIT_CHAR <- function() {
+ .Call('_hector_BIOME_SPLIT_CHAR', PACKAGE = 'hector')
+}
+
#' @describeIn loglevels Set logging at 'debug' level.
#' @export
LL_DEBUG <- function() {
@@ -40,7 +42,13 @@ LL_SEVERE <- function() {
.Call('_hector_LL_SEVERE', PACKAGE = 'hector')
}
-#' @describeIn emissions Black carbon emissions (\code{"Tg"})
+#' @describeIn parameters Start of carbon tracking (Year)
+#' @export
+TRACKING_DATE <- function() {
+ .Call('_hector_TRACKING_DATE', PACKAGE = 'hector')
+}
+
+#' @describeIn emissions Black carbon emissions
#' @export
EMISSIONS_BC <- function() {
.Call('_hector_EMISSIONS_BC', PACKAGE = 'hector')
@@ -52,10 +60,16 @@ RF_TOTAL <- function() {
.Call('_hector_RF_TOTAL', PACKAGE = 'hector')
}
+#' @describeIn constraints Constrain total radiative forcing
+#' @export
+FTOT_CONSTRAIN <- function() {
+ .Call('_hector_FTOT_CONSTRAIN', PACKAGE = 'hector')
+}
+
#' @describeIn forcings Radiative forcing due to albedo
#' @export
-RF_T_ALBEDO <- function() {
- .Call('_hector_RF_T_ALBEDO', PACKAGE = 'hector')
+RF_ALBEDO <- function() {
+ .Call('_hector_RF_ALBEDO', PACKAGE = 'hector')
}
#' @describeIn forcings Radiative forcing due to CO2
@@ -64,12 +78,24 @@ RF_CO2 <- function() {
.Call('_hector_RF_CO2', PACKAGE = 'hector')
}
-#' @describeIn forcings Radiative forcing due to N2O
+#' @describeIn delta the foring tropospheric adjustments for N2O
+#' @export
+DELTA_CO2 <- function() {
+ .Call('_hector_DELTA_CO2', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the foring tropospheric adjustments for N2O
#' @export
RF_N2O <- function() {
.Call('_hector_RF_N2O', PACKAGE = 'hector')
}
+#' @describeIn delta Radiative forcing due to N2O
+#' @export
+DELTA_N2O <- function() {
+ .Call('_hector_DELTA_N2O', PACKAGE = 'hector')
+}
+
#' @describeIn forcings Radiative forcing due to stratospheric water vapor
#' @export
RF_H2O_STRAT <- function() {
@@ -82,42 +108,72 @@ RF_O3_TROP <- function() {
.Call('_hector_RF_O3_TROP', PACKAGE = 'hector')
}
-#' @describeIn forcings Radiative forcing due to black carbon
+#' @describeIn forcings Radiative forcing due to black carbon aerosol-radiation interactions
#' @export
RF_BC <- function() {
.Call('_hector_RF_BC', PACKAGE = 'hector')
}
-#' @describeIn forcings Radiative forcing due to organic carbon
+#' @describeIn rho a radiative forcing efficiency for BC aerosol-radiation interactions
+#' @export
+RHO_BC <- function() {
+ .Call('_hector_RHO_BC', PACKAGE = 'hector')
+}
+
+#' @describeIn forcings Radiative forcing due to organic carbon aerosol-radiation interactions
#' @export
RF_OC <- function() {
.Call('_hector_RF_OC', PACKAGE = 'hector')
}
-#' @describeIn forcings Direct contribution of SO2 to radiative forcing
+#' @describeIn rho a radiative forcing efficiency for OC aerosol-radiation interactions
#' @export
-RF_SO2D <- function() {
- .Call('_hector_RF_SO2D', PACKAGE = 'hector')
+RHO_OC <- function() {
+ .Call('_hector_RHO_OC', PACKAGE = 'hector')
}
-#' @describeIn forcings Indirect contribution of SO2 to radiative forcing
+#' @describeIn forcings Radiative forcing due to NH3 aerosol-radiation interactions
#' @export
-RF_SO2I <- function() {
- .Call('_hector_RF_SO2I', PACKAGE = 'hector')
+RF_NH3 <- function() {
+ .Call('_hector_RF_NH3', PACKAGE = 'hector')
}
-#' @describeIn forcings Total contribution (direct and indirect) of SO2 to radiative forcing
+#' @describeIn rho a radiative forcing efficiency for NH3 aerosol-radiation interactions
+#' @export
+RHO_NH3 <- function() {
+ .Call('_hector_RHO_NH3', PACKAGE = 'hector')
+}
+
+#' @describeIn forcings Radiative forcing due to SO2 aerosol-radiation interactions
#' @export
RF_SO2 <- function() {
.Call('_hector_RF_SO2', PACKAGE = 'hector')
}
+#' @describeIn forcings aerosol-cloud interactions, includes contributions from SO2, BC and OC
+#' @export
+RF_ACI <- function() {
+ .Call('_hector_RF_ACI', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for SO2
+#' @export
+RHO_SO2 <- function() {
+ .Call('_hector_RHO_SO2', PACKAGE = 'hector')
+}
+
#' @describeIn forcings Radiative forcing due to volcanic activity
#' @export
RF_VOL <- function() {
.Call('_hector_RF_VOL', PACKAGE = 'hector')
}
+#' @describeIn forcings Radiative miscellaneous forcing read in from ini.
+#' @export
+RF_MISC <- function() {
+ .Call('_hector_RF_MISC', PACKAGE = 'hector')
+}
+
RFADJ_PREFIX <- function() {
.Call('_hector_RFADJ_PREFIX', PACKAGE = 'hector')
}
@@ -246,7 +302,7 @@ RF_HCFC141B <- function() {
.Call('_hector_RF_HCFC141B', PACKAGE = 'hector')
}
-#' @describeIn haloforcings Radiative forcing due to HCFC-142b
+#' @describeIn haloforcings Radiative forcing due to HCCFC-142b
#' @export
RF_HCFC142B <- function() {
.Call('_hector_RF_HCFC142B', PACKAGE = 'hector')
@@ -282,6 +338,324 @@ RF_CH3BR <- function() {
.Call('_hector_RF_CH3BR', PACKAGE = 'hector')
}
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for CF4
+#' @export
+RHO_CF4 <- function() {
+ .Call('_hector_RHO_CF4', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for C2F6
+#' @export
+RHO_C2F6 <- function() {
+ .Call('_hector_RHO_C2F6', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-23
+#' @export
+RHO_HFC23 <- function() {
+ .Call('_hector_RHO_HFC23', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-32
+#' @export
+RHO_HFC32 <- function() {
+ .Call('_hector_RHO_HFC32', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-4310
+#' @export
+RHO_HFC4310 <- function() {
+ .Call('_hector_RHO_HFC4310', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-125
+#' @export
+RHO_HFC125 <- function() {
+ .Call('_hector_RHO_HFC125', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-134a
+#' @export
+RHO_HFC134A <- function() {
+ .Call('_hector_RHO_HFC134A', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-143a
+#' @export
+RHO_HFC143A <- function() {
+ .Call('_hector_RHO_HFC143A', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-227ea
+#' @export
+RHO_HFC227EA <- function() {
+ .Call('_hector_RHO_HFC227EA', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-254fa
+#' @export
+RHO_HFC245FA <- function() {
+ .Call('_hector_RHO_HFC245FA', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for sulfur hexafluoride
+#' @export
+RHO_SF6 <- function() {
+ .Call('_hector_RHO_SF6', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for CFC-11
+#' @export
+RHO_CFC11 <- function() {
+ .Call('_hector_RHO_CFC11', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for CFC-12
+#' @export
+RHO_CFC12 <- function() {
+ .Call('_hector_RHO_CFC12', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for CFC-113
+#' @export
+RHO_CFC113 <- function() {
+ .Call('_hector_RHO_CFC113', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for CFC-114
+#' @export
+RHO_CFC114 <- function() {
+ .Call('_hector_RHO_CFC114', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for CFC-115
+#' @export
+RHO_CFC115 <- function() {
+ .Call('_hector_RHO_CFC115', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for carbon tetrachloride
+#' @export
+RHO_CCL4 <- function() {
+ .Call('_hector_RHO_CCL4', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for trichloroethane '
+#' @export
+RHO_CH3CCL3 <- function() {
+ .Call('_hector_RHO_CH3CCL3', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-22
+#' @export
+RHO_HCFC22 <- function() {
+ .Call('_hector_RHO_HCFC22', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HFC-141b
+#' @export
+RHO_HCFC141B <- function() {
+ .Call('_hector_RHO_HCFC141B', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for HCFC-142b
+#' @export
+RHO_HCFC142B <- function() {
+ .Call('_hector_RHO_HCFC142B', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for halon-1211 '
+#' @export
+RHO_HALON1211 <- function() {
+ .Call('_hector_RHO_HALON1211', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for halon-1301
+#' @export
+RHO_HALON1301 <- function() {
+ .Call('_hector_RHO_HALON1301', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for halon-2402 '
+#' @export
+RHO_HALON2402 <- function() {
+ .Call('_hector_RHO_HALON2402', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for chloromethane
+#' @export
+RHO_CH3CL <- function() {
+ .Call('_hector_RHO_CH3CL', PACKAGE = 'hector')
+}
+
+#' @describeIn rho a radiative forcing efficiency for user-specified preindustrial concentration (Wm-2 pptv-1) for bromomethane
+#' @export
+RHO_CH3BR <- function() {
+ .Call('_hector_RHO_CH3BR', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CF4 <- function() {
+ .Call('_hector_DELTA_CF4', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_C2F6 <- function() {
+ .Call('_hector_DELTA_C2F6', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HFC23 <- function() {
+ .Call('_hector_DELTA_HFC23', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing '
+#' @export
+DELTA_HFC32 <- function() {
+ .Call('_hector_DELTA_HFC32', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HFC4310 <- function() {
+ .Call('_hector_DELTA_HFC4310', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HFC125 <- function() {
+ .Call('_hector_DELTA_HFC125', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from tratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HFC134A <- function() {
+ .Call('_hector_DELTA_HFC134A', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HFC143A <- function() {
+ .Call('_hector_DELTA_HFC143A', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HFC227EA <- function() {
+ .Call('_hector_DELTA_HFC227EA', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HFC245FA <- function() {
+ .Call('_hector_DELTA_HFC245FA', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_SF6 <- function() {
+ .Call('_hector_DELTA_SF6', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CFC11 <- function() {
+ .Call('_hector_DELTA_CFC11', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CFC12 <- function() {
+ .Call('_hector_DELTA_CFC12', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CFC113 <- function() {
+ .Call('_hector_DELTA_CFC113', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CFC114 <- function() {
+ .Call('_hector_DELTA_CFC114', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CFC115 <- function() {
+ .Call('_hector_DELTA_CFC115', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CCL4 <- function() {
+ .Call('_hector_DELTA_CCL4', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CH3CCL3 <- function() {
+ .Call('_hector_DELTA_CH3CCL3', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HCFC22 <- function() {
+ .Call('_hector_DELTA_HCFC22', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HCFC141B <- function() {
+ .Call('_hector_DELTA_HCFC141B', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HCFC142B <- function() {
+ .Call('_hector_DELTA_HCFC142B', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HALON1211 <- function() {
+ .Call('_hector_DELTA_HALON1211', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HALON1301 <- function() {
+ .Call('_hector_DELTA_HALON1301', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_HALON2402 <- function() {
+ .Call('_hector_DELTA_HALON2402', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CH3CL <- function() {
+ .Call('_hector_DELTA_CH3CL', PACKAGE = 'hector')
+}
+
+#' @describeIn delta the tropospheric adjustments used to convert from stratospheric-temperature adjusted radiative forcing to effective radiative forcing
+#' @export
+DELTA_CH3BR <- function() {
+ .Call('_hector_DELTA_CH3BR', PACKAGE = 'hector')
+}
+
+#' @describeIn forcings Radiative forcing efficiency for doubling of CO2
+#' @export
+Q_CO2 <- function() {
+ .Call('_hector_Q_CO2', PACKAGE = 'hector')
+}
+
#' @describeIn haloemiss Emissions for CF4
#' @export
EMISSIONS_CF4 <- function() {
@@ -396,7 +770,7 @@ EMISSIONS_HCFC22 <- function() {
.Call('_hector_EMISSIONS_HCFC22', PACKAGE = 'hector')
}
-#' @describeIn haloemiss Emissions for HCFC-141b
+#' @describeIn haloemiss Emissions for HcFC-141b
#' @export
EMISSIONS_HCFC141B <- function() {
.Call('_hector_EMISSIONS_HCFC141B', PACKAGE = 'hector')
@@ -596,8 +970,8 @@ CH3BR_CONSTRAIN <- function() {
#' @rdname methane
#' @export
-ATMOSPHERIC_CH4 <- function() {
- .Call('_hector_ATMOSPHERIC_CH4', PACKAGE = 'hector')
+CONCENTRATIONS_CH4 <- function() {
+ .Call('_hector_CONCENTRATIONS_CH4', PACKAGE = 'hector')
}
#' @describeIn constraints CH4 concentration constraint \code{"ppbv CH4"}
@@ -618,6 +992,12 @@ RF_CH4 <- function() {
.Call('_hector_RF_CH4', PACKAGE = 'hector')
}
+#' @describeIn delta Radiative forcing tropospheric adjustment for CH4
+#' @export
+DELTA_CH4 <- function() {
+ .Call('_hector_DELTA_CH4', PACKAGE = 'hector')
+}
+
#' @rdname methane
#' @export
EMISSIONS_CH4 <- function() {
@@ -644,8 +1024,8 @@ LIFETIME_STRAT <- function() {
#' @describeIn concentrations Atmospheric N2O concentration
#' @export
-ATMOSPHERIC_N2O <- function() {
- .Call('_hector_ATMOSPHERIC_N2O', PACKAGE = 'hector')
+CONCENTRATIONS_N2O <- function() {
+ .Call('_hector_CONCENTRATIONS_N2O', PACKAGE = 'hector')
}
#' @describeIn concentrations Preindustrial atmospheric N2O concentration
@@ -680,8 +1060,8 @@ PREINDUSTRIAL_O3 <- function() {
#' @describeIn concentrations Atmospheric ozone concentration
#' @export
-ATMOSPHERIC_O3 <- function() {
- .Call('_hector_ATMOSPHERIC_O3', PACKAGE = 'hector')
+CONCENTRATIONS_O3 <- function() {
+ .Call('_hector_CONCENTRATIONS_O3', PACKAGE = 'hector')
}
#' @describeIn emissions Emissions for NOx compounds (\code{"Tg N"})
@@ -708,10 +1088,16 @@ EMISSIONS_OC <- function() {
.Call('_hector_EMISSIONS_OC', PACKAGE = 'hector')
}
+#' @describeIn emissions Emissions for NH3 (\code{"Tg"})
+#' @export
+EMISSIONS_NH3 <- function() {
+ .Call('_hector_EMISSIONS_NH3', PACKAGE = 'hector')
+}
+
#' @describeIn ocean Atmosphere-ocean carbon flux
#' @export
-OCEAN_CFLUX <- function() {
- .Call('_hector_OCEAN_CFLUX', PACKAGE = 'hector')
+OCEAN_UPTAKE <- function() {
+ .Call('_hector_OCEAN_UPTAKE', PACKAGE = 'hector')
}
#' @describeIn ocean Ocean total carbon pool
@@ -732,6 +1118,12 @@ OCEAN_C_LL <- function() {
.Call('_hector_OCEAN_C_LL', PACKAGE = 'hector')
}
+#' @describeIn ocean Ocean surface or mixed layer carbon pool
+#' @export
+OCEAN_C_ML <- function() {
+ .Call('_hector_OCEAN_C_ML', PACKAGE = 'hector')
+}
+
#' @describeIn ocean Intermediate ocean carbon pool
#' @export
OCEAN_C_IO <- function() {
@@ -744,6 +1136,18 @@ OCEAN_C_DO <- function() {
.Call('_hector_OCEAN_C_DO', PACKAGE = 'hector')
}
+#' @describeIn ocean Preindustrial surface ocean carbon pool
+#' @export
+OCEAN_PREIND_C_SURF <- function() {
+ .Call('_hector_OCEAN_PREIND_C_SURF', PACKAGE = 'hector')
+}
+
+#' @describeIn ocean Preindustrial intermediate+deep ocean carbon pool
+#' @export
+OCEAN_PREIND_C_ID <- function() {
+ .Call('_hector_OCEAN_PREIND_C_ID', PACKAGE = 'hector')
+}
+
#' @describeIn ocean Thermohaline overturning
#' @export
TT <- function() {
@@ -768,28 +1172,34 @@ TID <- function() {
.Call('_hector_TID', PACKAGE = 'hector')
}
-#' @describeIn ocean High-latitude Ph
+#' @describeIn ocean High-latitude pH
#' @export
PH_HL <- function() {
.Call('_hector_PH_HL', PACKAGE = 'hector')
}
-#' @describeIn ocean Low-latitude Ph
+#' @describeIn ocean Low-latitude pH
#' @export
PH_LL <- function() {
.Call('_hector_PH_LL', PACKAGE = 'hector')
}
+#' @describeIn ocean Ocean surface pH
+#' @export
+PH <- function() {
+ .Call('_hector_PH', PACKAGE = 'hector')
+}
+
#' @describeIn ocean Atmosphere-ocean carbon flux, high-latitude
#' @export
-ATM_OCEAN_FLUX_HL <- function() {
- .Call('_hector_ATM_OCEAN_FLUX_HL', PACKAGE = 'hector')
+HL_OCEAN_UPTAKE <- function() {
+ .Call('_hector_HL_OCEAN_UPTAKE', PACKAGE = 'hector')
}
#' @describeIn ocean Atmosphere-ocean carbon flux, low-latitude
#' @export
-ATM_OCEAN_FLUX_LL <- function() {
- .Call('_hector_ATM_OCEAN_FLUX_LL', PACKAGE = 'hector')
+LL_OCEAN_UPTAKE <- function() {
+ .Call('_hector_LL_OCEAN_UPTAKE', PACKAGE = 'hector')
}
#' @describeIn ocean Partial pressure of CO2, high-latitude
@@ -804,28 +1214,40 @@ PCO2_LL <- function() {
.Call('_hector_PCO2_LL', PACKAGE = 'hector')
}
+#' @describeIn ocean Ocean surface partial pressure of CO2
+#' @export
+PCO2 <- function() {
+ .Call('_hector_PCO2', PACKAGE = 'hector')
+}
+
#' @describeIn ocean Dissolved inorganic carbon, high-latitude
#' @export
DIC_HL <- function() {
.Call('_hector_DIC_HL', PACKAGE = 'hector')
}
+#' @describeIn ocean Ocean surface dissolved inorganic carbon
+#' @export
+DIC <- function() {
+ .Call('_hector_DIC', PACKAGE = 'hector')
+}
+
#' @describeIn ocean Dissolved inorganic carbon, low-latitude
#' @export
DIC_LL <- function() {
.Call('_hector_DIC_LL', PACKAGE = 'hector')
}
-#' @describeIn ocean Ocean temperature, high-latitude
+#' @describeIn ocean Absolute ocean surface temperature, high-latitude (deg C)
#' @export
-TEMP_HL <- function() {
- .Call('_hector_TEMP_HL', PACKAGE = 'hector')
+SST_HL <- function() {
+ .Call('_hector_SST_HL', PACKAGE = 'hector')
}
-#' @describeIn ocean Ocean temperature, low-latitude
+#' @describeIn ocean Absolute ocean surface temperature, low-latitude (deg C)
#' @export
-TEMP_LL <- function() {
- .Call('_hector_TEMP_LL', PACKAGE = 'hector')
+SST_LL <- function() {
+ .Call('_hector_SST_LL', PACKAGE = 'hector')
}
#' @describeIn ocean Carbonate concentration, low-latitude
@@ -840,10 +1262,10 @@ CO3_HL <- function() {
.Call('_hector_CO3_HL', PACKAGE = 'hector')
}
-#' @rdname carboncycle
+#' @describeIn ocean Ocean surface carbonate concentration
#' @export
-LAND_CFLUX <- function() {
- .Call('_hector_LAND_CFLUX', PACKAGE = 'hector')
+CO3 <- function() {
+ .Call('_hector_CO3', PACKAGE = 'hector')
}
#' @rdname carboncycle
@@ -854,8 +1276,8 @@ NBP <- function() {
#' @rdname carboncycle
#' @export
-ATMOSPHERIC_CO2 <- function() {
- .Call('_hector_ATMOSPHERIC_CO2', PACKAGE = 'hector')
+CONCENTRATIONS_CO2 <- function() {
+ .Call('_hector_CONCENTRATIONS_CO2', PACKAGE = 'hector')
}
#' @rdname carboncycle
@@ -864,6 +1286,12 @@ NPP <- function() {
.Call('_hector_NPP', PACKAGE = 'hector')
}
+#' @rdname carboncycle
+#' @export
+RH <- function() {
+ .Call('_hector_RH', PACKAGE = 'hector')
+}
+
#' @describeIn parameters Preindustrial CO2 concentration (\code{"ppmv CO2"})
#' @export
PREINDUSTRIAL_CO2 <- function() {
@@ -872,8 +1300,8 @@ PREINDUSTRIAL_CO2 <- function() {
#' @rdname carboncycle
#' @export
-ATMOSPHERIC_C <- function() {
- .Call('_hector_ATMOSPHERIC_C', PACKAGE = 'hector')
+ATMOSPHERIC_CO2 <- function() {
+ .Call('_hector_ATMOSPHERIC_CO2', PACKAGE = 'hector')
}
#' @rdname carboncycle
@@ -882,112 +1310,156 @@ FFI_EMISSIONS <- function() {
.Call('_hector_FFI_EMISSIONS', PACKAGE = 'hector')
}
+#' @rdname carboncycle
+#' @export
+DACCS_UPTAKE <- function() {
+ .Call('_hector_DACCS_UPTAKE', PACKAGE = 'hector')
+}
+
#' @rdname carboncycle
#' @export
LUC_EMISSIONS <- function() {
.Call('_hector_LUC_EMISSIONS', PACKAGE = 'hector')
}
+#' @rdname carboncycle
+#' @export
+LUC_UPTAKE <- function() {
+ .Call('_hector_LUC_UPTAKE', PACKAGE = 'hector')
+}
+
#' @describeIn parameters CO2 fertilization factor (\code{"(unitless)"})
-#' @param biome Biome for which to retrieve parameter. If missing or
-#' `""`, default to `"global"`.
+#' @param biome Biome for which to retrieve parameter. If missing or `""`, default to `"global"`.
#' @export
BETA <- function(biome = "") {
.Call('_hector_BETA', PACKAGE = 'hector', biome)
}
#' @describeIn parameters Heterotrophic respiration temperature sensitivity factor (\code{"(unitless)"})
-#' @inheritParams BETA
#' @export
Q10_RH <- function(biome = "") {
.Call('_hector_Q10_RH', PACKAGE = 'hector', biome)
}
#' @describeIn parameters Biome-specific warming factor (`(unitless)`)
-#' @inheritParams BETA
#' @export
WARMINGFACTOR <- function(biome = "") {
.Call('_hector_WARMINGFACTOR', PACKAGE = 'hector', biome)
}
-#' @describeIn carboncycle Constrain atmospheric CO2 concentration (\code{"(ppmv CO2)"})
+#' @describeIn carboncycle Constrain atmospheric CO2 concentration (\code{"(ppmv CO2)"})
#' @export
CO2_CONSTRAIN <- function() {
.Call('_hector_CO2_CONSTRAIN', PACKAGE = 'hector')
}
+#' @describeIn carboncycle Constrain net biome production (land-atmosphere flux) (\code{"(PgC/yr)"})
+#' @export
+NBP_CONSTRAIN <- function() {
+ .Call('_hector_NBP_CONSTRAIN', PACKAGE = 'hector')
+}
+
#' @describeIn parameters NPP fraction to vegetation (\code{"(unitless)"})
-#' @inheritParams BETA
#' @export
F_NPPV <- function(biome = "") {
.Call('_hector_F_NPPV', PACKAGE = 'hector', biome)
}
#' @describeIn parameters NPP fraction to detritus (\code{"(unitless)"})
-#' @inheritParams BETA
#' @export
F_NPPD <- function(biome = "") {
.Call('_hector_F_NPPD', PACKAGE = 'hector', biome)
}
#' @describeIn parameters Litter fraction to detritus (\code{"(unitless)"})
-#' @inheritParams BETA
#' @export
F_LITTERD <- function(biome = "") {
.Call('_hector_F_LITTERD', PACKAGE = 'hector', biome)
}
-#' @describeIn parameters LUC fraction to vegetation (\code{"(unitless)"})
-#' @export
-F_LUCV <- function() {
- .Call('_hector_F_LUCV', PACKAGE = 'hector')
-}
-
-#' @describeIn parameters LUC fraction to detritus (\code{"(unitless)"})
-#' @export
-F_LUCD <- function() {
- .Call('_hector_F_LUCD', PACKAGE = 'hector')
-}
-
#' @describeIn carboncycle Vegetation C pool (`"Pg C"`)
-#' @inheritParams BETA
+#' @param biome Name of biome (leave empty for global)
#' @export
VEG_C <- function(biome = "") {
.Call('_hector_VEG_C', PACKAGE = 'hector', biome)
}
#' @describeIn carboncycle Vegetation detritus C pool (`"Pg C"`)
-#' @inheritParams BETA
+#' @param biome Name of biome (leave empty for global)
#' @export
DETRITUS_C <- function(biome = "") {
.Call('_hector_DETRITUS_C', PACKAGE = 'hector', biome)
}
#' @describeIn carboncycle Soil C pool (`"Pg C"`)
-#' @inheritParams BETA
+#' @param biome Name of biome (leave empty for global)
#' @export
SOIL_C <- function(biome = "") {
.Call('_hector_SOIL_C', PACKAGE = 'hector', biome)
}
-#' @describeIn carboncycle Initial net primary productivity (NPP)
-#' flux (`"Pg C year^-1"`)
-#' @inheritParams BETA
+#' @describeIn carboncycle Permafrost C pool (`"Pg C"`)
+#' @param biome Name of biome (leave empty for global)
#' @export
-NPP_FLUX0 <- function(biome = "") {
- .Call('_hector_NPP_FLUX0', PACKAGE = 'hector', biome)
+PERMAFROST_C <- function(biome = "") {
+ .Call('_hector_PERMAFROST_C', PACKAGE = 'hector', biome)
}
-#' @rdname so2
+#' @describeIn carboncycle Thawed permafrost C pool (`"Pg C"`)
+#' @param biome Name of biome (leave empty for global)
#' @export
-NATURAL_SO2 <- function() {
- .Call('_hector_NATURAL_SO2', PACKAGE = 'hector')
+THAWEDP_C <- function(biome = "") {
+ .Call('_hector_THAWEDP_C', PACKAGE = 'hector', biome)
}
-#' @rdname so2
+#' @describeIn carboncycle Fraction of permafrost still frozen (\code{"(unitless)"})
+#' @param biome Name of biome (leave empty for global)
+#' @export
+FRAC_FROZEN <- function(biome = "") {
+ .Call('_hector_FRAC_FROZEN', PACKAGE = 'hector', biome)
+}
+
+#' @describeIn carboncycle Fraction of thawed permafrost that is static (\code{"(unitless)"})
+#' @param biome Name of biome (leave empty for global)
+#' @export
+FRAC_STATIC <- function(biome = "") {
+ .Call('_hector_FRAC_STATIC', PACKAGE = 'hector', biome)
+}
+
+#' @describeIn carboncycle Permafrost thaw mu parameter (\code{"(unitless)"})
+#' @param biome Name of biome (leave empty for global)
+#' @note See Woodard et al. (2021)
+#' @export
+PERMAFROST_MU <- function(biome = "") {
+ .Call('_hector_PERMAFROST_MU', PACKAGE = 'hector', biome)
+}
+
+#' @describeIn carboncycle Permafrost thaw sigma parameter (\code{"(unitless)"})
+#' @param biome Name of biome (leave empty for global)
+#' @note See Woodard et al. (2021)
+#' @export
+PERMAFROST_SIGMA <- function(biome = "") {
+ .Call('_hector_PERMAFROST_SIGMA', PACKAGE = 'hector', biome)
+}
+
+#' @describeIn carboncycle Methane fraction of permafrost decomposition (\code{"(unitless)"})
+#' @param biome Name of biome (leave empty for global)
#' @export
-Y2000_SO2 <- function() {
- .Call('_hector_Y2000_SO2', PACKAGE = 'hector')
+FRAC_DECOMP_CH4 <- function(biome = "") {
+ .Call('_hector_FRAC_DECOMP_CH4', PACKAGE = 'hector', biome)
+}
+
+#' @rdname carboncycle
+#' @export
+EARTH_C <- function() {
+ .Call('_hector_EARTH_C', PACKAGE = 'hector')
+}
+
+#' @describeIn carboncycle Initial net primary productivity (NPP)flux (`"Pg C year^-1"`)
+#' @param biome Name of biome (leave empty for global)
+#' @export
+NPP_FLUX0 <- function(biome = "") {
+ .Call('_hector_NPP_FLUX0', PACKAGE = 'hector', biome)
}
#' @rdname so2
@@ -1020,34 +1492,40 @@ VOLCANIC_SCALE <- function() {
.Call('_hector_VOLCANIC_SCALE', PACKAGE = 'hector')
}
-#' @describeIn temperature Global mean temperature
+#' @describeIn temperature Global mean air temperature anomaly
+#' @export
+GLOBAL_TAS <- function() {
+ .Call('_hector_GLOBAL_TAS', PACKAGE = 'hector')
+}
+
+#' @describeIn temperature Average sea surface temperature anomaly
#' @export
-GLOBAL_TEMP <- function() {
- .Call('_hector_GLOBAL_TEMP', PACKAGE = 'hector')
+SST <- function() {
+ .Call('_hector_SST', PACKAGE = 'hector')
}
-#' @describeIn temperature Equilibrium global temperature
+#' @describeIn temperature Average air temperature anomaly over the ocean
#' @export
-GLOBAL_TEMPEQ <- function() {
- .Call('_hector_GLOBAL_TEMPEQ', PACKAGE = 'hector')
+OCEAN_TAS <- function() {
+ .Call('_hector_OCEAN_TAS', PACKAGE = 'hector')
}
-#' @describeIn temperature Average ocean surface temperature anomaly
+#' @describeIn temperature Average air temperature anomaly over land, land surface temperature and air temperature over land are assumed to be equivalent.
#' @export
-OCEAN_SURFACE_TEMP <- function() {
- .Call('_hector_OCEAN_SURFACE_TEMP', PACKAGE = 'hector')
+LAND_TAS <- function() {
+ .Call('_hector_LAND_TAS', PACKAGE = 'hector')
}
-#' @describeIn temperature Average ocean air temperature anomaly
+#' @describeIn parameters Land-Ocean Warming Ratio (\code{"(unitless)"}), by default set to 0 meaning that the land ocean warming ratio is an emergent property of Hector's temperature component otherwise the user defined land ocean warming ratio will be used.
#' @export
-OCEAN_AIR_TEMP <- function() {
- .Call('_hector_OCEAN_AIR_TEMP', PACKAGE = 'hector')
+LO_WARMING_RATIO <- function() {
+ .Call('_hector_LO_WARMING_RATIO', PACKAGE = 'hector')
}
-#' @describeIn temperature Average land temperature anomaly
+#' @describeIn constraints Constrain global mean temperature (\code{"(degC)"})
#' @export
-LAND_AIR_TEMP <- function() {
- .Call('_hector_LAND_AIR_TEMP', PACKAGE = 'hector')
+TAS_CONSTRAIN <- function() {
+ .Call('_hector_TAS_CONSTRAIN', PACKAGE = 'hector')
}
#' @describeIn parameters Ocean heat diffusivity (\code{"cm2/s"})
@@ -1074,23 +1552,19 @@ HEAT_FLUX <- function() {
.Call('_hector_HEAT_FLUX', PACKAGE = 'hector')
}
-#' @describeIn msgtype Character used to separate biome from variable name
-BIOME_SPLIT_CHAR <- function() {
- .Call('_hector_BIOME_SPLIT_CHAR', PACKAGE = 'hector')
-}
-
newcore_impl <- function(inifile, loglevel, suppresslogging, name) {
.Call('_hector_newcore_impl', PACKAGE = 'hector', inifile, loglevel, suppresslogging, name)
}
-#' Shutdown a hector instance
+#' Shut down a hector instance
#'
-#' Shutting down an instance will free the instance itself and all of the objects it created. Any attempted
-#' operation on the instance after that will raise an error.
+#' Shutting down an instance will free the instance itself and all of the
+#' objects it created. Any attempted operation on the instance after that will
+#' raise an error.
#'
#' @section Caution:
-#' This function should be called as \code{mycore <- shutdown(mycore)} so that the change
-#' from active to inactive will be recorded in the caller.
+#' This function should be called as \code{mycore <- shutdown(mycore)} so that
+#' the change from active to inactive will be recorded in the caller.
#'
#' @param core Handle to a Hector instance
#' @return The Hector instance handle
@@ -1102,16 +1576,15 @@ shutdown <- function(core) {
#' Reset a Hector instance to an earlier date
#'
-#' Resetting the model returns it to its state at a previous time. If the requested time
-#' is before the model start date (any value will do; conventionally zero is used), then
-#' the spinup will be rerun, and the model will be
-#' left ready to run at the start date. (By contrast, resetting \emph{to} the start
-#' date leaves the model ready to run at the start date, but without having rerun the
-#' spinup.)
+#' Resetting the model returns it to its state at a previous time. If the
+#' requested time is before the model start date, then the spinup will be
+#' rerun, and the model will be left ready to run at the start date. (By
+#' contrast, resetting \emph{to} the start date leaves the model ready to run
+#' at the start date, but without having rerun the spinup.)
#'
#' @param core Handle for the Hector instance that is to be reset.
-#' @param date Date to reset to. The default is to reset to the model start date with
-#' a rerun of the spinup.
+#' @param date Date to reset to. The default is to reset to the model start
+#' date with a rerun of the spinup.
#' @family main user interface functions
#' @export
reset <- function(core, date = 0) {
@@ -1120,12 +1593,12 @@ reset <- function(core, date = 0) {
#' Run the Hector climate model
#'
-#' Run Hector up through the specified time. This function does not return the results
-#' of the run. To get results, run \code{fetch}.
+#' Run Hector up through the specified time. This function does not return the
+#' results of the run. To get results, run \code{fetch}.
#'
#' @param core Handle to the Hector instance that is to be run.
-#' @param runtodate Date to run to. The default is to run to the end date configured
-#' in the input file used to initialize the core.
+#' @param runtodate Date to run to. The default is to run to the end date
+#' configured in the input file used to initialize the core.
#' @return The Hector instance handle
#' @export
#' @family main user interface functions
@@ -1141,6 +1614,14 @@ getdate <- function(core) {
.Call('_hector_getdate', PACKAGE = 'hector', core)
}
+#' Retrieve the tracking data for a Hector instance
+#'
+#' @param core Handle to the Hector instance.
+#' @export
+get_tracking_data_impl <- function(core) {
+ .Call('_hector_get_tracking_data_impl', PACKAGE = 'hector', core)
+}
+
#' Retrieve the current list of biomes for a Hector instance
#'
#' @param core Handle to the Hector instance from which to retrieve
@@ -1183,33 +1664,27 @@ rename_biome <- function(core, oldname, newname) {
#' Send a message to a Hector instance
#'
#' Messages are the mechanism used to get data from Hector model components and
-#' to set values within components.
-#'
-#' A message comprises a type (e.g. GETDATA to retrieve data from a component, or SETDATA to
-#' set data in a component), a capability, which identifies the information to be operated
-#' on (e.g. Atmospheric CO2 concentration, or global total radiative forcing), and an optional
+#' to set values within components. A message comprises a type (e.g. GETDATA
+#' to retrieve data from a component, or SETDATA to set data in a component),
+#' a capability, which identifies the information to be operated on (e.g.
+#' Atmospheric CO2 concentration, or global total radiative forcing), and an optional
#' structure of extra data (comprising a date and a numerical value with units).
-#'
-#' The arguments to this function are organized in a slightly more R-friendly way. The message
-#' type and capability are each passed as a single string. The date portion of the extra
-#' data is passed as a numeric vector (one message will be generated for each date). The value
-#' portion of the extra data is a numeric vector with a length of either 1 or the same length
-#' as the date vector. The units portion is a single string (we don't support sending a vector
-#' of values with heterogeneous units in a single call.
-#'
-#' Either the date or the value (or both) may be NA. The date should be NA in cases where the
-#' parameter being referenced doesn't change with time. The value should be NA in cases where
-#' the optional data will be ignored.
+#' The arguments to this function are organized in a slightly more R-friendly
+#' way. The message type and capability are each passed as a single string.
+#' The date portion of the extra data is passed as a numeric vector (one
+#' message will be generated for each date). The value portion of the extra
+#' data is a numeric vector with a length of either 1 or the same length as the
+#' date vector.The units portion is a single string (we don't support sending a
+#' vector of values with heterogeneous units in a single call. Either the date
+#' or the value (or both) may be NA. The date should be NA in cases where the
+#' parameter being referenced doesn't change with time. The value should be NA in cases
+#' where the optional data will be ignored.
#'
#' @param core a Hector instance
#' @param msgtype (String) type of message. Usually either GETDATA or SETDATA
-#' @param capability (String) capability being targeted by the message. The core will use
-#' this information to look up the component to route the message to.
-#' @param date (NumericVector) Date for which to set/get the variable. Use NA if there is
-#' no applicable date.
-#' @param value (NumericVector) Numeric portion of the optional data (in case of setting
-#' a value this will be the value to set). The length of this vector should match that of
-#' the time, or it should be length 1 (in which case it will be recycled).
+#' @param capability (String) capability being targeted by the message
+#' @param date (NumericVector or NA) Date for which to set/get the variable
+#' @param value (NumericVector) Numeric value of the optional data
#' @param unit (String) Unit for the value vector.
#' @export
sendmessage <- function(core, msgtype, capability, date, value, unit) {
diff --git a/R/aadoc.R b/R/aadoc.R
index c26e71241..b23a73ea9 100644
--- a/R/aadoc.R
+++ b/R/aadoc.R
@@ -20,7 +20,7 @@ NULL
#'
#' @section Note:
#' Because these identifiers are provided as \code{#define} macros in the hector code,
-#' these identifiers are provided in the R interface as function. Therefore,
+#' these identifiers are provided in the R interface as functions. Therefore,
#' these objects must be called to use them; \emph{e.g.}, \code{GETDATA()}
#' instead of the more natural looking \code{GETDATA}.
#'
@@ -30,14 +30,44 @@ NULL
#' Identifiers for capabilities in the Hector forcing component
#'
#' These identifiers specify forcing values that can be provided by hector via
-#' the forcing component. All of the values corresponding to these identifiers
+#' the forcing component. All of the values corresponding to these identifiers
#' are read-only (\emph{i.e.}, they can only appear in \code{\link{GETDATA}}
#' messages.)
#'
#' @inheritSection msgtype Note
#'
#' @name forcings
-#' @seealso \link{haloforcings} for forcings from halocarbons.
+#' @seealso \link{haloforcings} for forcings from halocarbons and \link{rho} for
+#' parameters related to radiative forcing efficiency.
+#' @family capability identifiers
+NULL
+
+#' Identifiers for Hector forcing component parameters
+#'
+#' These identifiers specify radiative forcing efficiency in hector these values
+#' can be read and/or set by hectors forcing and halocarbon components.
+#' the forcing component.
+#'
+#' @inheritSection msgtype Note
+#'
+#' @name rho
+#' @seealso \link{haloforcings} for forcings from halocarbons and \link{forcings} forcing
+#' values provided from the hector forcing component.
+#' @family capability identifiers
+NULL
+
+#' Identifiers for Hector forcing component parameters
+#'
+#' These identifiers specify the tropospheric adjustments for the
+#' stratospheric-temperature adjusted radiative forcings.
+#' These values must be a number between -1 and 1, and
+#' can be read and/or set by hectors forcing and halocarbon components.
+#'
+#' @inheritSection msgtype Note
+#'
+#' @name delta
+#' @seealso \link{haloforcings} for forcings from halocarbons and \link{forcings} forcing
+#' values provided from the hector forcing component.
#' @family capability identifiers
NULL
@@ -49,22 +79,28 @@ NULL
#' @section Output variables:
#' These variables can be read using the \code{\link{GETDATA}} message type:
#' \describe{
-#' \item{ATMOSPHERIC_CO2}{Atmospheric CO2 concentration}
-#' \item{ATMOSPHERIC_C}{Atmospheric carbon pool}
-#' \item{LAND_CFLUX}{Annual global C flux from atmosphere into the land. A
-#' positive value means a net flux from atmosphere into land (i.e. land is a
-#' net carbon sink), while a negative value means a net flux from land into
-#' the atmosphere (i.e. land is a net carbon source)}
-#' \item{NBP}{Net biome production (synonymous with \code{LAND_CFLUX}). Note
-#' that despite the name, this is currently a globally-averaged variable.}
+#' \item{CONCENTRATIONS_CO2}{Atmospheric CO2 concentration}
+#' \item{ATMOSPHERIC_CO2}{Atmospheric CO2 in units of C}
+#' \item{NBP}{Net biome production. Annual global C flux from atmosphere into
+#' the land. A positive value means a net flux from atmosphere into land
+#' (i.e. land is a net carbon sink), while a negative value means a net flux
+#' from land into the atmosphere (i.e. land is a net carbon source). Note
+#' that despite the name--which follows disciplinary convention, see Chapin
+#' et al. 2006--this is currently a globally-averaged variable.}
#' \item{FFI_EMISSIONS}{Fossil fuel and industrial emissions}
#' \item{LUC_EMISSIONS}{Land use change emissions}
+#' \item{NPP}{Net primary production}
+#' \item{RH}{Heterotrophic respiration}
+#' \item{EARTH_C}{Earth pool}
#' }
#' @section Input variables:
#' \describe{
#' \item{FFI_EMISSIONS}{Fossil fuel and industrial emissions (\code{"Pg C/yr"})}
#' \item{LUC_EMISSIONS}{Land use change emissions (\code{"Pg C/yr"})}
#' \item{CO2_CONSTRAIN}{Prescribed atmospheric CO2 concentration (\code{"ppmv CO2"})}
+#' \item{NBP_CONSTRAIN}{Prescribed net biome production (land-atmosphere C flux) (\code{"Pg C/yr"})}
+#' \item{DACCS_UPTAKE}{Direct air carbon capture and storage}
+#' \item{LUC_UPTAKE}{Land use change uptake}
#' }
#' @inheritSection msgtype Note
#' @name carboncycle
@@ -76,7 +112,7 @@ NULL
#' Identifiers for halocarbon forcings
#'
#' These identifiers specify forcing values that can be provided by hector via
-#' one of the myriad halocarbon components. All of the values corresponding to
+#' one of the myriad halocarbon components. All of the values corresponding to
#' these identifiers are read-only (\emph{i.e.}, they can only appear in
#' \code{\link{GETDATA}} messages.) The forcings returned are the
#' \emph{relative} forcings, with the base year (typically 1750) values
@@ -91,9 +127,9 @@ NULL
#' Identifiers for halocarbon emissions
#'
-#' These identifiers correspond to emissions values for halocarbons. They are
+#' These identifiers correspond to emissions values for halocarbons. They are
#' (for now) write only, meaning they can only appear in \code{\link{SETDATA}}
-#' messages. In all cases, the expected input units are gigagrams
+#' messages. In all cases, the expected input units are gigagrams
#' (\code{"Gg"}).
#'
#' @inheritSection msgtype Note
@@ -114,14 +150,15 @@ NULL
#' @family capability identifiers
NULL
-#' Identifiers for concentration constraints
+#' Identifiers for constraints
#'
-#' These identifiers correspond to concentration constraints.
+#' These identifiers correspond to Hector's constraint capabilities
#'
#' @inheritSection msgtype Note
#'
#' @name constraints
#' @family capability identifiers
+#' @seealso haloconstrains
NULL
#' Identifiers for quantities in the methane component
@@ -132,17 +169,18 @@ NULL
#' @section Output variables:
#' These variables can be read from the methane component.
#' \describe{
-#' \item{ATMOSPHERIC_CH4}{Atmospheric methane concentration}
+#' \item{CONCENTRATIONS_CH4}{Atmospheric methane concentration}
#' \item{PREINDUSTRIAL_CH4}{Preindustrial methane concentration}
#' }
#'
#'
#' @section Input variables:
-#' These variables can be set in the methane component. The expected units string is given after
-#' each description.
+#' These variables can be set in the methane component. The expected units
+#' string is given after each description.
#' \describe{
#' \item{EMISSIONS_CH4}{Methane emissions (\code{"Tg CH4"})}
#' \item{PREINDUSTRIAL_CH4}{Preindustrial methane concentration (\code{"ppbv CH4"})}
+#' \item{CH4_CONSTRAIN}{N2O concentration constraint (\code{"ppbv CH4"})}
#' \item{NATURAL_CH4}{Natural methane emissions (\code{"Tg CH4"})}
#' \item{LIFETIME_SOIL}{Time scale for methane loss into soil (\code{"Years"})}
#' \item{LIFETIME_STRAT}{Time scale for methane loss into stratosphere (\code{"Years"})}
@@ -215,14 +253,14 @@ NULL
#' Identifiers for model parameters
#'
#' These identifiers correspond to settable parameters that change the model
-#' behavior and are subject to uncertainty. All of these can be set using the
-#' \code{\link{SETDATA}} message type. Changing any of these parameters will
+#' behavior and are subject to uncertainty. All of these can be set using the
+#' \code{\link{SETDATA}} message type. Changing any of these parameters will
#' typically invalidate the hector core's internal state; therefore, after
#' setting one or more of these values you should call \code{\link{reset}} before
-#' attempting to run the model again. This will rerun the spinup and produce a
-#' new internally consistent state. Attempting to run the model without resetting
-#' first will usually produce an error (often with a message about failing to conserve
-#' mass).
+#' attempting to run the model again. This will rerun the spinup and produce a
+#' new internally consistent state. Attempting to run the model without resetting
+#' first will usually produce an error (often with a message about failing to
+#' conserve mass).
#'
#' @inheritSection msgtype Note
#' @name parameters
@@ -238,3 +276,39 @@ NULL
#' @name temperature
#' @family capability identifiers
NULL
+
+#' A data.frame containing information on all of the Hector inputs listed in
+#' an ini file created by save-input-params.R.
+#'
+#' @format A data.frame of 8 columns and 222 rows.
+#' \describe{
+#' \item{section}{String of the section of the ini file of a parameter}
+#' \item{parameter}{String of the parameter name}
+#' \item{biome.specific}{String of whether or not the parameter is biome-specific}
+#' \item{time.variant}{String of whether or not the parameter is time-variant}
+#' \item{required}{String of wheterh or not the parameter is required}
+#' \item{default}{String of the default value of the parameter}
+#' \item{units}{String of the parameter units}
+#' \item{description}{String of a brief description of the parameter from the ini file}
+#' }
+"inputstable"
+
+#' A data.frame containing information on all of the Hector variable created by units-data.R
+#' used within the getunits function.
+#'
+#' @format A data.frame of 2 columns and 114 rows.
+#' \describe{
+#' \item{variable}{String of the hector variable}
+#' \item{units}{String of the unit value}
+#' }
+"unitstable"
+
+
+#' A data.frame containing information R hector function name and hector string names.
+#'
+#' @format A data.frame of 2 columns and 239 rows.
+#' \describe{
+#' \item{fxn}{String of the R hector function name}
+#' \item{string}{String of variable name}
+#' }
+"fxntable"
diff --git a/R/biome.R b/R/biome.R
index 5f15882e9..3f45b171c 100644
--- a/R/biome.R
+++ b/R/biome.R
@@ -5,6 +5,7 @@
#' @param veg_c0 Initial vegetation C pool
#' @param detritus_c0 Initial detritus C pool
#' @param soil_c0 Initial soil C pool
+#' @param permafrost_c0 Initial permafrost C pool
#' @param npp_flux0 Initial net primary productivity
#' @param warmingfactor Temperature multiplier (default =
#' `1.0`)
@@ -17,26 +18,23 @@
#' @author Alexey Shiklomanov
#' @export
create_biome <- function(core, biome,
- veg_c0, detritus_c0, soil_c0,
+ veg_c0, detritus_c0, soil_c0, permafrost_c0,
npp_flux0,
- warmingfactor = 1,
- beta = 0.36,
- q10_rh = 2.0,
- f_nppv = 0.35,
- f_nppd = 0.60,
- f_litterd = 0.98) {
- create_biome_impl(core, biome)
- setvar(core, 0, VEG_C(biome), veg_c0, "Pg C")
- setvar(core, 0, DETRITUS_C(biome), detritus_c0, "Pg C")
- setvar(core, 0, SOIL_C(biome), soil_c0, "Pg C")
- setvar(core, NA, NPP_FLUX0(biome), npp_flux0, "Pg C/yr")
- setvar(core, NA, WARMINGFACTOR(biome), warmingfactor, NA)
- setvar(core, NA, BETA(biome), beta, NA)
- setvar(core, NA, Q10_RH(biome), q10_rh, NA)
- setvar(core, NA, F_NPPV(biome), f_nppv, NA)
- setvar(core, NA, F_NPPD(biome), f_nppd, NA)
- setvar(core, NA, F_LITTERD(biome), f_litterd, NA)
- invisible(core)
+ warmingfactor, beta, q10_rh,
+ f_nppv, f_nppd, f_litterd) {
+ create_biome_impl(core, biome)
+ setvar(core, 0, VEG_C(biome), veg_c0, "Pg C")
+ setvar(core, 0, DETRITUS_C(biome), detritus_c0, "Pg C")
+ setvar(core, 0, SOIL_C(biome), soil_c0, "Pg C")
+ setvar(core, 0, PERMAFROST_C(biome), permafrost_c0, "Pg C")
+ setvar(core, NA, NPP_FLUX0(biome), npp_flux0, "Pg C/yr")
+ setvar(core, NA, WARMINGFACTOR(biome), warmingfactor, NA)
+ setvar(core, NA, BETA(biome), beta, NA)
+ setvar(core, NA, Q10_RH(biome), q10_rh, NA)
+ setvar(core, NA, F_NPPV(biome), f_nppv, NA)
+ setvar(core, NA, F_NPPD(biome), f_nppd, NA)
+ setvar(core, NA, F_LITTERD(biome), f_litterd, NA)
+ invisible(core)
}
#' Create new biomes by splitting up an existing biome
@@ -48,17 +46,17 @@ create_biome <- function(core, biome,
#' @param old_biome Name of biome that will be split up
#' @param new_biomes Names of biomes to be created
#' @param fveg_c Fractions of vegetation C distributed to each biome
-#' in `new_biomes`. Must be the same length as `new_biomes`. Default
+#' in \code{new_biomes}; must be the same length as it. Default
#' is to split vegetation C evenly between all biomes.
#' @param fdetritus_c Fractions of detritus C distributed to each
-#' biome. Defaults to the same value as `fveg_c`.
+#' biome. Defaults to the same value as \code{fveg_c}.
#' @param fsoil_c Fractions of soil C distributed to each biome.
-#' Defaults to the same value as `fveg_c`.
+#' Defaults to the same value as \code{fveg_c}.
+#' @param fpermafrost_c Fraction of permafrost C distributed to each
+#' biome. Defaults to the same value as \code{fveg_c}.
#' @param fnpp_flux0 Fraction of initial NPP flux distributed to each
-#' biome. Defaults to the same value as `fveg_c`.
-#' @param ... Additional biome-specific parameters, as set by
-#' [create_biome()]. Note that these are passed to [create_biome()]
-#' via [base::mapply()], so they can be vectorized across biomes.
+#' biome. Defaults to the same value as \code{fveg_c}.
+#' @param ... Additional biome parameters passed to \code{\link{create_biome}}.
#' @export
split_biome <- function(core,
old_biome,
@@ -66,47 +64,67 @@ split_biome <- function(core,
fveg_c = rep(1 / length(new_biomes), length(new_biomes)),
fdetritus_c = fveg_c,
fsoil_c = fveg_c,
+ fpermafrost_c = fveg_c,
fnpp_flux0 = fveg_c,
...) {
- stopifnot(
- length(old_biome) == 1,
- old_biome %in% get_biome_list(core),
- !any(new_biomes %in% get_biome_list(core)),
- length(fveg_c) == length(new_biomes),
- length(fdetritus_c) == length(new_biomes),
- length(fsoil_c) == length(new_biomes),
- length(fnpp_flux0) == length(new_biomes),
- sum(fveg_c) == 1, all(fveg_c > 0),
- sum(fdetritus_c) == 1, all(fdetritus_c > 0),
- sum(fsoil_c) == 1, all(fsoil_c > 0),
- sum(fnpp_flux0) == 1, all(fnpp_flux0 > 0)
- )
+ stopifnot(
+ length(old_biome) == 1,
+ old_biome %in% get_biome_list(core),
+ !any(new_biomes %in% get_biome_list(core)),
+ length(fveg_c) == length(new_biomes),
+ length(fdetritus_c) == length(new_biomes),
+ length(fsoil_c) == length(new_biomes),
+ length(fpermafrost_c) == length(new_biomes),
+ length(fnpp_flux0) == length(new_biomes),
+ sum(fveg_c) == 1, all(fveg_c > 0),
+ sum(fdetritus_c) == 1, all(fdetritus_c > 0),
+ sum(fsoil_c) == 1, all(fsoil_c > 0),
+ sum(fpermafrost_c) == 1, all(fpermafrost_c >= 0),
+ sum(fnpp_flux0) == 1, all(fnpp_flux0 > 0)
+ )
- current_values <- get_biome_inits(core, old_biome)
+ # If user supplied values in ... for warmingfactor, etc., use thos
+ # Otherwise use the old biome's values
+ cv <- get_biome_inits(core, old_biome) # current values
+ dots <- list(...)
+ # We can't use ifelse for this because return shape may differ
+ pick <- function(x, y) { if (is.null(x)) y else x } # nolint
+ warmingfactor <- pick(dots$warmingfactor, cv[["warmingfactor"]])
+ beta <- pick(dots$beta, cv[["beta"]])
+ q10_rh <- pick(dots$q10_rh, cv[["q10_rh"]])
+ f_nppv <- pick(dots$f_nppv, cv[["f_nppv"]])
+ f_nppd <- pick(dots$f_nppd, cv[["f_nppd"]])
+ f_litterd <- pick(dots$f_litterd, cv[["f_litterd"]])
- # This allows users to split the `global` biome without having to
- # rename it first. Otherwise, we hit an error about using non-global
- # biomes when a "global" biome is present.
- if (old_biome == "global") {
- invisible(rename_biome(core, "global", "_zzz"))
- old_biome <- "_zzz"
- }
+ # This allows users to split the `global` biome without having to
+ # rename it first. Otherwise, we hit an error about using non-global
+ # biomes when a "global" biome is present.
+ if (old_biome == "global") {
+ invisible(rename_biome(core, "global", "_zzz"))
+ old_biome <- "_zzz"
+ }
- mapply(
- create_biome,
- biome = new_biomes,
- veg_c0 = current_values[["veg_c"]] * fveg_c,
- detritus_c0 = current_values[["detritus_c"]] * fdetritus_c,
- soil_c0 = current_values[["soil_c"]] * fsoil_c,
- npp_flux0 = current_values[["npp_flux0"]] * fnpp_flux0,
- ...,
- MoreArgs = list(core = core)
- )
+ mapply(
+ create_biome,
+ biome = new_biomes,
+ veg_c0 = cv[["veg_c"]] * fveg_c,
+ detritus_c0 = cv[["detritus_c"]] * fdetritus_c,
+ soil_c0 = cv[["soil_c"]] * fsoil_c,
+ permafrost_c0 = cv[["permafrost_c"]] * fpermafrost_c,
+ npp_flux0 = cv[["npp_flux0"]] * fnpp_flux0,
+ warmingfactor = warmingfactor,
+ beta = beta,
+ q10_rh = q10_rh,
+ f_nppv = f_nppv,
+ f_nppd = f_nppd,
+ f_litterd = f_litterd,
+ MoreArgs = list(core = core)
+ )
- delete_biome_impl(core, old_biome)
+ delete_biome_impl(core, old_biome)
- reset(core, 0)
- invisible(core)
+ reset(core, 0)
+ invisible(core)
}
#' Retrieve the initial conditions and parameters for a given biome
@@ -118,23 +136,28 @@ split_biome <- function(core,
#' @return Named numeric vector of biome initial conditions and parameters
#' @author Alexey Shiklomanov
get_biome_inits <- function(core, biome) {
- # `fetchvars` requires date to be between start and end date, so
- # we need to call the lower-level `sendmessage` method here.
- current_data_1 <- rbind.data.frame(
- sendmessage(core, GETDATA(), VEG_C(biome), 0, NA, ""),
- sendmessage(core, GETDATA(), DETRITUS_C(biome), 0, NA, ""),
- sendmessage(core, GETDATA(), SOIL_C(biome), 0, NA, "")
- )
- current_data_2 <- fetchvars(core, NA, c(
- NPP_FLUX0(biome),
- BETA(biome),
- WARMINGFACTOR(biome)
- ))[, -1]
- current_data <- rbind.data.frame(current_data_1, current_data_2)
- current_values <- current_data[["value"]]
- names(current_values) <- gsub(paste0(biome, "."), "",
- current_data[["variable"]],
- fixed = TRUE
- )
- current_values
+ # `fetchvars` requires date to be between start and end date, so
+ # we need to call the lower-level `sendmessage` method here.
+ current_data_1 <- rbind.data.frame(
+ sendmessage(core, GETDATA(), VEG_C(biome), 0, NA, ""),
+ sendmessage(core, GETDATA(), DETRITUS_C(biome), 0, NA, ""),
+ sendmessage(core, GETDATA(), SOIL_C(biome), 0, NA, ""),
+ sendmessage(core, GETDATA(), PERMAFROST_C(biome), 0, NA, "")
+ )
+ current_data_2 <- fetchvars(core, NA, c(
+ NPP_FLUX0(biome),
+ F_LITTERD(biome),
+ F_NPPD(biome),
+ F_NPPV(biome),
+ BETA(biome),
+ Q10_RH(biome),
+ WARMINGFACTOR(biome)
+ ))[, -1]
+ current_data <- rbind.data.frame(current_data_1, current_data_2)
+ current_values <- current_data[["value"]]
+ names(current_values) <- gsub(paste0(biome, BIOME_SPLIT_CHAR()), "",
+ current_data[["variable"]],
+ fixed = TRUE
+ )
+ current_values
}
diff --git a/R/fxns.R b/R/fxns.R
new file mode 100644
index 000000000..ccc01a37a
--- /dev/null
+++ b/R/fxns.R
@@ -0,0 +1,22 @@
+#' Get the hector function associated with a specific string
+#'
+#' This function provides the Hector function that returns a the Hector string
+#' @param str String name to find the Hector function for
+#' @return Hector function name
+#' @export
+#' @seealso getunits
+#' @examples
+#' getfxn("beta")
+#' getfxn("q10_rh")
+getfxn <- function(str) {
+
+ rows <- match(str, hector::fxntable$string)
+ rslt <- hector::fxntable$fxn[rows]
+ if (any(is.na(rows))) {
+ warning(
+ "Functions for the following are not found: ",
+ paste(str[is.na(rslt)], collapse = ", ")
+ )
+ }
+ as.character(rslt)
+}
diff --git a/R/hector.R b/R/hector.R
index eda7184db..246a68a0b 100644
--- a/R/hector.R
+++ b/R/hector.R
@@ -10,12 +10,8 @@ NULL
#' To run a scenario, you will need a scenario input file. Several examples are
#' included in the \code{input} directory, which you can find with the
#' expression \code{system.file('input', package='hector')}. The input files
-#' have names like \code{'hector_rcpNN.ini'}, where \code{NN} is one of
-#' \code{26}, \code{45}, \code{60}, or \code{85}. Example outputs for these
-#' scenarios are in the \code{output} directory, which you can find in a similar
-#' way. Their names are \code{'sample_outputstream_rcpNN.csv'} Note, however,
-#' that these outputs were rounded to 4 significant digits, so you might see
-#' some discrepancies with your outputs unless you similarly round them.
+#' have names like \code{'hector_sspNNN.ini'}, where \code{NNN} is one of
+#' \code{119}, \code{126}, \code{245}, \code{370}, \code{434}, \code{460}, or \code{ssp585}.
#'
#' There is a quickstart wrapper called \code{\link{runscenario}}, which takes
#' an input file as an argument, runs the scenario, and returns the results in a
@@ -59,11 +55,11 @@ NULL
#' @return Data frame containing Hector output for default variables
#' @export
runscenario <- function(infile) {
- core <- newcore(infile)
- run(core)
- d <- fetchvars(core, seq(startdate(core), enddate(core)))
- shutdown(core)
- d
+ core <- newcore(infile)
+ run(core)
+ d <- fetchvars(core, seq(startdate(core), enddate(core)))
+ shutdown(core)
+ d
}
@@ -83,13 +79,35 @@ runscenario <- function(infile) {
#' @family main user interface functions
#' @export
newcore <- function(inifile, loglevel = 0, suppresslogging = TRUE,
- name = "unnamed hector core") {
- hcore <- newcore_impl(normalizePath(inifile), loglevel, suppresslogging, name)
- class(hcore) <- c("hcore", class(hcore))
- reg.finalizer(hcore, hector::shutdown)
- hcore
+ name = "Unnamed Hector core") {
+ hcore <- newcore_impl(normalizePath(inifile), loglevel, suppresslogging, name)
+ class(hcore) <- c("hcore", class(hcore))
+ reg.finalizer(hcore, hector::shutdown)
+ hcore
}
+#' Retrieve the tracking data for a Hector instance
+#'
+#' @param core Handle to the Hector instance.
+#' @importFrom utils read.csv
+#' @return A \code{\link{data.frame}} with the tracking data. Columns include
+#' \code{year} (integer), \code{component} (character), \code{pool_name} (character),
+#' \code{pool_value} (double), \code{pool_units} (character),
+#' \code{source_name} (character), and \code{source_fraction} (double). The
+#' fractions will always sum to 1 for a given pool and year.
+#' @note The \code{pool_name}, \code{pool_value}, and \code{pool_units} names
+#' differ from those used in the model's standard output stream (\code{variable},
+#' \code{value}, and \code{units} respectively).
+#' @family main user interface functions
+#' @export
+get_tracking_data <- function(core) {
+ td <- get_tracking_data_impl(core)
+ if (td != "") {
+ read.csv(textConnection(td), stringsAsFactors = FALSE)
+ } else {
+ data.frame() # throw error instead?
+ }
+}
#### Utility functions
### The elements of an hcore object are
@@ -102,37 +120,37 @@ newcore <- function(inifile, loglevel = 0, suppresslogging = TRUE,
#' @rdname hectorutil
#' @export
isactive <- function(core) {
- if (!inherits(core, "hcore")) {
- stop("Object supplied is not an hcore class instance.")
- }
- chk_core_valid(core)
+ if (!inherits(core, "hcore")) {
+ stop("Object supplied is not an hcore class instance.")
+ }
+ chk_core_valid(core)
}
#' \strong{startdate}: Report the start date for a Hector instance
#' @rdname hectorutil
#' @export
startdate <- function(core) {
- if (!inherits(core, "hcore")) {
- stop("Object supplied is not an hcore class instance.")
- }
- core$strtdate
+ if (!inherits(core, "hcore")) {
+ stop("Object supplied is not an hcore class instance.")
+ }
+ core$strtdate
}
#' \strong{enddate}: Report the end date for a Hector instance
#' @rdname hectorutil
#' @export
enddate <- function(core) {
- if (!inherits(core, "hcore")) {
- stop("Object supplied is not an hcore class instance.")
- }
- core$enddate
+ if (!inherits(core, "hcore")) {
+ stop("Object supplied is not an hcore class instance.")
+ }
+ core$enddate
}
#' \strong{getname}: Report the name for a Hector instance
#' @rdname hectorutil
#' @export
getname <- function(core) {
- core$name
+ core$name
}
@@ -146,26 +164,24 @@ getname <- function(core) {
NULL
#' @describeIn methods Format method
-#' @inheritParams methods
#' @export
format.hcore <- function(x, ...) {
- if (!isactive(x)) {
- "Hector core (INACTIVE)"
- }
- else {
- cdate <- getdate(x)
- sprintf(
- "Hector core:\t%s\nStart date:\t%d\nEnd date:\t%d\nCurrent date:\t%d\nInput file:\t%s",
- x$name,
- as.integer(x$strtdate), as.integer(x$enddate), as.integer(cdate),
- x$inifile
- )
- }
+ if (!isactive(x)) {
+ "Hector core (INACTIVE)"
+ } else {
+ cdate <- getdate(x)
+ sprintf(
+ paste0("Hector core:\t%s\nStart date:\t%d\nEnd date:\t%d\n",
+ "Current date:\t%d\nInput file:\t%s\n"),
+ x$name,
+ as.integer(x$strtdate), as.integer(x$enddate), as.integer(cdate),
+ x$inifile
+ )
+ }
}
#' @describeIn methods Print method
-#' @inheritParams methods
#' @export
print.hcore <- function(x, ...) {
- cat(format(x, ...))
+ cat(format(x, ...))
}
diff --git a/R/messages.R b/R/messages.R
index 376249c4a..5aae09c4d 100644
--- a/R/messages.R
+++ b/R/messages.R
@@ -1,7 +1,7 @@
#### Code for interacting with the hector messaging system
-default_fetchvars <- c(ATMOSPHERIC_CO2, RF_TOTAL, RF_CO2, GLOBAL_TEMP)
+default_fetchvars <- c(CONCENTRATIONS_CO2, RF_TOTAL, RF_CO2, GLOBAL_TAS)
#' Fetch results from a running Hector core
#'
@@ -24,8 +24,10 @@ default_fetchvars <- c(ATMOSPHERIC_CO2, RF_TOTAL, RF_CO2, GLOBAL_TEMP)
#' \link{ocean}, \link{so2}, \link{temperature}, \link{parameters}
#'
#' @param core Hector core object
-#' @param dates Vector of dates to fetch. This will be automatically trimmed to
+#' @param dates Vector of dates to fetch; this will be automatically trimmed to
#' dates that are between the start date and the latest date currently run.
+#' Set to \code{NA} to return data with no associated dates such as
+#' model \link{parameters}.
#' @param vars List (or vector) of capability strings defining the variables to
#' be fetched in the result.
#' @param scenario Optional scenario name. If not specified, the name element
@@ -39,6 +41,9 @@ fetchvars <- function(core, dates, vars = NULL, scenario = NULL) {
f()
})
)
+ if (anyNA(dates)) {
+ stop("The default vars (", paste(vars, collapse = ", "), ") all require dates")
+ }
}
if (is.null(scenario)) {
@@ -46,11 +51,16 @@ fetchvars <- function(core, dates, vars = NULL, scenario = NULL) {
}
strt <- startdate(core)
- end <- getdate(core)
+ current <- getdate(core)
- valid <- dates >= strt & dates <= end
+ valid <- dates >= strt & dates <= current
dates <- dates[valid]
+ if (length(dates) == 0) {
+ stop("None of these dates are valid for this core (start=",
+ strt, ", current=", current, ")")
+ }
+
rslt <- do.call(
rbind,
lapply(vars, function(v) {
diff --git a/R/sysdata.rda b/R/sysdata.rda
deleted file mode 100644
index d3e181a0e..000000000
Binary files a/R/sysdata.rda and /dev/null differ
diff --git a/R/units.R b/R/units.R
index 7684912c2..ff7b303b4 100644
--- a/R/units.R
+++ b/R/units.R
@@ -9,8 +9,8 @@
#' @export
getunits <- function(vars) {
## NB the unitstable data structure is included as internal package data.
- rows <- match(vars, unitstable$variable)
- units <- unitstable$units[rows]
+ rows <- match(vars, hector::unitstable$variable)
+ units <- hector::unitstable$units[rows]
if (any(is.na(units))) {
warning(
"Units entries for the following variables not found: ",
diff --git a/README.Rmd b/README.Rmd
new file mode 100644
index 000000000..699337550
--- /dev/null
+++ b/README.Rmd
@@ -0,0 +1,94 @@
+---
+output: github_document
+---
+
+
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>",
+ fig.path = "man/figures/README-",
+ out.width = "100%"
+)
+library(hector)
+library(ggplot2)
+```
+
+# hector
+
+[](https://zenodo.org/badge/latestdoi/22892935) [](https://github.com/JGCRI/hector/actions/workflows/unit-testing.yaml) [](https://github.com/JGCRI/hector/actions/workflows/command-line.yaml) [](https://github.com/JGCRI/hector/actions/workflows/R-CMD-check.yaml) [](https://codecov.io/gh/JGCRI/hector)
+
+This is the repository for **Hector**, an open source, object-oriented, simple
+global climate carbon-cycle model that runs very quickly while still
+representing the most critical global scale earth system processes.
+Hector is a simple climate model (SCM, also known as a reduced-complexity climate model),
+a class of models that are extremely versatile with a wide
+range of applications. Due to their computational efficiency, SCMs can easily
+be coupled to other models and used to design scenarios, emulate more complex
+climate models, and conduct uncertainty analyses.
+
+```{r tas_plot, echo=FALSE, fig.width=8, fig.height=4}
+
+# The variable naps and dates of variables to save.
+vars_to_plot <- GLOBAL_TAS()
+dates_to_plot <- 1850:2100
+
+# Color palette used by the IPCC
+SSP_COLORS <- c("ssp119" = "#00a9cf", "ssp126" = "#003466", "ssp245" = "#f69320",
+ "ssp370" = "#df0000", "ssp434" = "#2274ae","ssp460" = "#b0724e",
+ "ssp585"= "#980002", "ssp534-overshoot" = "grey", "historical" = "#000000",
+ "historical"="#92397a")
+
+# Set up and run hector.
+ini_files <- list.files(file.path("inst", "input"), pattern = "ini", full.names = TRUE)
+hector_tas_results <- do.call(lapply(ini_files, function(f){
+ name <- gsub(pattern = "hector_|.ini", x = basename(path = f), replacement = "")
+ hc <- newcore(f, name = name)
+ run(hc)
+ out <- fetchvars(hc, dates_to_plot, vars = vars_to_plot)
+ return(out)
+}), what = "rbind")
+
+# Modify the results data frame.
+hector_tas_results$scenario <- ifelse(hector_tas_results$scenario == "ssp534-over",
+ "ssp534-overshoot", hector_tas_results$scenario)
+hector_tas_results$scenario <- ifelse(hector_tas_results$year <= 2016, "historical",
+ hector_tas_results$scenario)
+ggplot(hector_tas_results) +
+ geom_line(aes(year, value, color = scenario), size = 1) +
+ theme_bw(base_size = 15) +
+ labs(color = NULL, x = NULL, y = expression("Temperature Anomaly ("~degree~"C)")) +
+ scale_color_manual(values = SSP_COLORS)
+```
+
+Hector's output for global mean air temperature change for eight Shared Socioeconomic Pathways (SSPs).
+
+## Installation
+
+The `hector` R package can be installed using the `remotes::install_github`
+function. More detailed installation instructions, including how to set up
+Hector as a command line executable, can be found [here](articles/BuildHector.html).
+
+```r
+remotes::install_github('jgcri/hector')
+library(hector)
+```
+
+## Tools and Software That Work with Hector
+
+* [GCAM](https://github.com/JGCRI/gcam-core): Hector can be used as the climate component in [GCAM](http://jgcri.github.io/gcam-doc/)
+* [pyhector](https://github.com/openclimatedata/pyhector): a Python
+interface to Hector
+* [fldgen](https://github.com/JGCRI/fldgen): a spatially resolved temperature & precipitation emulator for CMIP5 ESMs
+* [HectorUI](https://jgcri.shinyapps.io/HectorUI/): run Hector in a web interface!
+
+## Contributing to Hector
+
+The Hector team welcomes and values community contributions, but please see
+our [Contribution Guide](articles/ContributionsGuide.html) and note by contributing
+to this project, you agree to abide to our [Contributor Code of Conduct](CODE_OF_CONDUCT.html)
+
+***
+
+This research was supported by the U.S. Department of Energy, Office of Science, as part of research in Multi-Sector Dynamics, Earth and Environmental System Modeling Program. The Pacific Northwest National Laboratory is operated for DOE by Battelle Memorial Institute under contract DE-AC05-76RL01830.
diff --git a/README.md b/README.md
index d1caca815..6e1060bc5 100644
--- a/README.md
+++ b/README.md
@@ -1,28 +1,65 @@
-
-
-
+
+
+
+# hector
+
+[](https://zenodo.org/badge/latestdoi/22892935)
+[](https://github.com/JGCRI/hector/actions/workflows/unit-testing.yaml)
+[](https://github.com/JGCRI/hector/actions/workflows/command-line.yaml)
+[](https://github.com/JGCRI/hector/actions/workflows/R-CMD-check.yaml)
[](https://codecov.io/gh/JGCRI/hector)
-
-Hector
-======
+This is the repository for **Hector**, an open source, object-oriented,
+simple global climate carbon-cycle model that runs very quickly while
+still representing the most critical global scale earth system
+processes. Hector is a simple climate model (SCM, also known as a
+reduced-complexity climate model), a class of models that are extremely
+versatile with a wide range of applications. Due to their computational
+efficiency, SCMs can easily be coupled to other models and used to
+design scenarios, emulate more complex climate models, and conduct
+uncertainty analyses.
-This is the repository for **Hector**, an open source, object-oriented, simple global climate carbon-cycle model. It runs essentially instantaneously while still representing the most critical global scale earth system processes, and is one of a class of models heavily used for for emulating complex climate models and uncertainty analyses. For example, Hector's global temperature rise for the RCP 8.5 scenario, compared to observations and other model results, looks like this:
+
-
+Hector’s output for global mean air temperature change for eight Shared
+Socioeconomic Pathways (SSPs).
-The primary link to Hector model documentation is the [online manual](https://jgcri.github.io/hector/articles/manual), which is included in the repository in the `vignettes/manual` directory.
-The code is also documented with [Doxygen](http://doxygen.org)-style comments. A formal model description paper ([Hartin et al. 2015](http://www.geosci-model-dev.net/8/939/2015/gmd-8-939-2015.html)) documents its science internals and performance relative to observed data, the [CMIP5](http://cmip-pcmdi.llnl.gov/cmip5/) archive, and the reduced-complexity [MAGICC](http://www.magicc.org) model (as of [version 1.0](https://github.com/JGCRI/hector/tree/v1.0)). In addition, we have developed two package vignettes demonstrating the [basics of the Hector R interface](http://jgcri.github.io/hector/articles/intro-to-hector.html) and an example application of [solving for an emissions pathway](http://jgcri.github.io/hector/articles/hector_apply.html).
+## Installation
-This research was supported by the U.S. Department of Energy, Office of Science, as part of research in Multi-Sector Dynamics, Earth and Environmental System Modeling Program. The Pacific Northwest National Laboratory is operated for DOE by Battelle Memorial Institute under contract DE-AC05-76RL01830.
+The `hector` R package can be installed using the
+`remotes::install_github` function. More detailed installation
+instructions, including how to set up Hector as a command line
+executable, can be found [here](articles/BuildHector.html).
+
+``` r
+remotes::install_github('jgcri/hector')
+library(hector)
+```
## Tools and Software That Work with Hector
-* [GCAM](https://github.com/JGCRI/gcam-core): Hector can be used as the climate component in [GCAM](http://jgcri.github.io/gcam-doc/).
-* [pyhector](https://github.com/openclimatedata/pyhector): a Python
- interface to Hector.
-* [HectorUI](https://jgcri.shinyapps.io/HectorUI/): run Hector in a web interface!
+- [GCAM](https://github.com/JGCRI/gcam-core): Hector can be used as the
+ climate component in [GCAM](http://jgcri.github.io/gcam-doc/)
+- [pyhector](https://github.com/openclimatedata/pyhector): a Python
+ interface to Hector
+- [fldgen](https://github.com/JGCRI/fldgen): a spatially resolved
+ temperature & precipitation emulator for CMIP5 ESMs
+- [HectorUI](https://jgcri.shinyapps.io/HectorUI/): run Hector in a web
+ interface!
+
+## Contributing to Hector
+
+The Hector team welcomes and values community contributions, but please
+see our [Contribution Guide](articles/ContributionsGuide.html) and note
+by contributing to this project, you agree to abide to our [Contributor
+Code of Conduct](CODE_OF_CONDUCT.html)
- ## Contributing to Hector
+------------------------------------------------------------------------
- The Hector team welcomes and values community contributions but please see our [Contribution Guide](KRD-UPDATE).
+This research was supported by the U.S. Department of Energy, Office of
+Science, as part of research in Multi-Sector Dynamics, Earth and
+Environmental System Modeling Program. The Pacific Northwest National
+Laboratory is operated for DOE by Battelle Memorial Institute under
+contract DE-AC05-76RL01830.
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 588842d36..6634bc739 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -1,50 +1,43 @@
-template:
- params:
- docsearch:
- api_key: b2aa343d0c9e9ed33c9582908f3acaf8
- index_name: hector
url: https://jgcri.github.io/hector/
+template:
+ bootstrap: 5
+development:
+ mode: auto
+
navbar:
- type: default
+ structure:
+ left: [reference, articles]
+ right: [search, github]
+
left:
- icon: fa-home fa-lg
href: "index.html"
- text: Manual
- href: "articles/manual/index.html"
- - text: Vignettes
+ href: "articles/manual.html"
+ - text: Getting Started
+ menu:
+ - text: "Building Hector"
+ href: articles/BuildHector.html
+ - text: "Intro to Hector R interface"
+ href: articles/hector.html
+ - text: "Documentation manuscripts & tutorials"
+ href: articles/Hector-Wider-World.html
+ - text: Examples
menu:
- - text: "A tour of the Hector R interface"
- href: articles/intro-to-hector.html
+ - text: "Example: Basic run and simple sensitivity anlaysis"
+ href: articles/hector.html
- text: "Example: Using Hector to solve for an emissions pathway"
- href: articles/hector_apply.html
+ href: articles/ex_hector_apply.html
- text: "Example: Running Hector with multiple biomes"
- href: articles/multiple-biomes.html
+ href: articles/ex_multiple-biomes.html
+ - text: "Example: Carbon tracking with Hector"
+ href: articles/ex_carbon_tracking.html
+ - text: "Example: Changing Hector's land ocean warming ratio parameter"
+ href: articles/ex_land_ocean_warming.html
- text: Reference
href: "reference/index.html"
+ - text: News
+ href: "news/index.html"
right:
- icon: fa-github fa-lg
href: "https://github.com/JGCRI/hector"
-
-reference:
- - title: Running Hector
- contents:
- - newcore
- - methods
- - run
- - reset
- - shutdown
- - runscenario
- - title: Setting and retrieving data
- contents:
- - fetchvars
- - setvar
- - sendmessage
- - isactive
- - getdate
- - startdate
- - enddate
- - getname
- - getunits
- - title: Variable and component identifiers
- contents:
- - matches("[_A-Z]+")
diff --git a/changelog.txt b/changelog.txt
deleted file mode 100644
index c5f110222..000000000
--- a/changelog.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-Hector 2.3.0
-============
-* Constrain atmospheric CO2 concentration to be equal to the
- preindustrial concentration during the model spinup. The result of
- this is that the concentration at the beginning of the simulation
- will be equal to the value specified in the `PREINDUSTRIAL_CO2`
- parameter, which was not the case previously.
-
-Hector 2.2.2
-============
-* Fix bug that was causing requests for H2O forcing in the R interface
- to return N2O forcing instead (the model internals were
- unaffected).
-* Fix bug that was causing API requests for halocarbon forcing to
- return absolute forcing values, rather than values relative to the
- base year (which is what is done for all other forcings).
-* Add missing RF_VOL (volcanic forcing) dependency to forcing component. In practice the
- missing dependency had no effect because the forcing component
- already had a dependency on the SO2 component, which also provides
- the volcanic forcing, but in the event that we ever split them up,
- this will ensure that the dependency graph is still valid.
-
-(All 2.2.2 changes merged in PR #303)
-
-Hector 2.2.1
-============
-* Report global averages for land temperature, ocean air
- temperature, and ocean surface temperature.
-* Fix bug that prevented CH4 emissions from being read.
-
-Hector 2.2.0
-============
-* Add a new parameter: VOLCANIC_SCALE. This parameter adjusts the
- strength of the response to volcanic forcing. (PR #291)
-* Add getname function to return the name of a Hector core.
-
-
-Hector 2.1.0
-============
-* Add reset() function to the API. Calling this function resets a
- hector core to an earlier time, rerunning the spinup if
- appropriate. (PR #243)
-
-
-Hector 2.0.0
-============
-* Incorporated 1-D diffusive ocean heat model as new temperature component (DOECLIM) (PR #206)
-* Bugfix: double counting halocarbon radiative forcing (PR #201)
-* Bugfix: re-enabled CO2 concentration constraint (PR #163)
-* Various changes to internals to support calling Hector from external code like pyhector
-* Component loggers are now optional (PR #218)
-* Renamed anthro emissions to ffi emisisons (fossil fuel industrial) (PR #116)
-
-
-Hector 1.1.2
-============
-
-* Add libhector target OS X and Windows project files (it was already
- available in the Linux build). This library library is used when
- you want to link Hector to an outside program.
-
-Hector 1.1.1
-============
-
-* Fix OS X build
-* Update sample output files
-* Add GPL license
-
-Hector 1.1
-===========
-
-* API for linking with external models.
-
-* Backend R scripts faster and cleaner.
-
-* Minor bug fixes and documentation updates.
-
-
-Hector 1.0
-===========
-
-* First release. Corresponds to Hartin et al. (2015), http://www.geosci-model-dev.net/8/939/2015/gmd-8-939-2015.pdf.
diff --git a/data-raw/generate-comp-data.R b/data-raw/generate-comp-data.R
index 75a3e016f..a417bbb00 100644
--- a/data-raw/generate-comp-data.R
+++ b/data-raw/generate-comp-data.R
@@ -9,7 +9,7 @@
devtools::load_all()
# Create the output directory.
-out_dir <- here::here("tests", "testthat", "compdata")
+out_dir <- file.path("tests", "testthat", "compdata")
dir.create(out_dir, showWarnings = FALSE)
# Determine the version of Hector and the git commit, that generates the comparison data.
@@ -19,30 +19,20 @@ hector_version <- packageVersion("hector")
hector_commit <- system("git rev-parse --short HEAD", intern = TRUE)
-vars_to_save <- c(ATMOSPHERIC_CO2(), GLOBAL_TEMP(), RF_TOTAL(), RF_CO2(), HEAT_FLUX(), OCEAN_C(), PH_HL())
-dates_to_save <- 1850:1950
-
-
-# During this old new test we will look at results for two scenarios, a concentration and
-# emission driven runs.
-
-# The first scenario to run is the constrained RCP 4.5
-ini <- here::here("inst", "input", "hector_rcp45_constrained.ini")
-hc <- newcore(ini)
-run(hc, max(dates_to_save))
-hector_rcp45_constrained <- fetchvars(hc, scenario = basename(ini), dates = dates_to_save, vars = vars_to_save)
-hector_rcp45_constrained$version <- hector_version # Add the Hector version.
-hector_rcp45_constrained$commit <- hector_commit
+vars_to_save <- c(CONCENTRATIONS_CO2(), GLOBAL_TAS(), RF_TOTAL(), RF_CO2(), HEAT_FLUX(),
+ OCEAN_C(), PH_HL(), ATMOSPHERIC_CO2(), SST())
+dates_to_save <- 1745:2300
# Second run.
-ini <- here::here("inst", "input", "hector_rcp45.ini")
+ini <- file.path("inst", "input", "hector_ssp245.ini")
hc <- newcore(ini)
run(hc, max(dates_to_save))
-hector_rcp45 <- fetchvars(hc, scenario = basename(ini), dates = dates_to_save, vars = vars_to_save)
-hector_rcp45$version <- hector_version # Add the Hector version.
-hector_rcp45$commit <- hector_commit
+hector_ssp245 <- fetchvars(hc, scenario = basename(ini), dates = dates_to_save, vars = vars_to_save)
+hector_ssp245$version <- hector_version # Add the Hector version.
+hector_ssp245$commit <- hector_commit
# Save the comparison data for the unit tests.
-comp_data <- rbind(hector_rcp45_constrained, hector_rcp45)
+comp_data <- hector_ssp245
out_file <- file.path(out_dir, "hector_comp.csv")
write.csv(comp_data, file = out_file, row.names = FALSE)
+message("All done.")
diff --git a/data-raw/input_params.csv b/data-raw/input_params.csv
new file mode 100644
index 000000000..475e4764d
--- /dev/null
+++ b/data-raw/input_params.csv
@@ -0,0 +1,234 @@
+section,parameter,biome-specific,time-variant,required,default,units,description
+core,run_name,n,n,y,,(unitless),
+core,startDate,n,n,y,1745,year,
+core,endDate,n,n,y,2300,year,
+core,trackingDate,n,n,y,9999,year,year to start tracking (only carbon currently)
+core,do_spinup,n,n,y,1,(unitless),"if 1, spin up model before running (default=1)"
+core,max_spinup,n,n,y,2000,(unitless),maximum steps allowed for spinup (default=2000)
+ocean,enabled,n,n,y,1,(unitless),putting 'enabled=0' will disable any component
+ocean,spinup_chem,n,n,y,0,(unitless),run surface chemistry during spinup phase?
+ocean,tt,n,n,y,7.20E+07,m3 s-1,thermohaline circulation
+ocean,tu,n,n,y,4.90E+07,m3 s-1,high latitude overturning
+ocean,twi,n,n,y,1.25E+07,m3 s-1,warm-intermediate exchange
+ocean,tid,n,n,y,2.00E+08,m3 s-1,intermediate-deep exchange
+ocean,preind_surface_c,n,n,n,900,Pg C,surface ocean carbon
+ocean,preind_interdeep_c,n,n,n,37100,Pg C,intermediate + deep ocean carbon
+simpleNbox,atmos_co2,n,n,y,588.071,Pg C,
+simpleNbox,C0,n,n,y,277.15,Pg C,preindustrial CO2 from table 7.SM.1 IPCC AR6
+simpleNbox,boreal.veg_c,y,n,y,100,Pg C,
+simpleNbox,tropical.veg_c,y,n,y,450,Pg C,
+simpleNbox,veg_c,n,n,y,550,Pg C,vegetation
+simpleNbox,boreal.detritus_c,y,n,y,15,Pg C,
+simpleNbox,tropical.detritus_c,y,n,y,45,Pg C,
+simpleNbox,detritus_c,n,n,y,55,Pg C,detritus
+simpleNbox,boreal.soil_c,y,n,y,1200,Pg C,
+simpleNbox,tropical.soil_c,y,n,y,578,Pg C,
+simpleNbox,soil_c,n,n,y,1782,Pg C,soil
+simpleNbox,boreal.permafrost_c,y,n,n,865,Pg C,permafrost
+simpleNbox,tropical.permafrost_c,y,n,n,0,Pg C,permafrost
+simpleNbox,permafrost_c,n,n,n,0,Pg C,permafrost
+simpleNbox,boreal.npp_flux0,y,n,y,5,Pg C yr-1,
+simpleNbox,tropical.npp_flux0,y,n,y,45,Pg C yr-1,
+simpleNbox,npp_flux0,n,n,y,56.2,Pg C yr-1,net primary production
+simpleNbox,f_nppv,n,n,y,0.35,(unitless),Fraction of NPP to vegetation
+simpleNbox,f_nppd,n,n,y,0.6,(unitless),Fraction of NPP to detritus (balance to soil)
+simpleNbox,f_litterd,n,n,y,0.98,(unitless),Fraction of litter flux to detritus (balance to soil)
+simpleNbox,ffi_emissions,n,y,y,"""(csv)""",Pg C yr-1,Anthropogenic contributions: emissions
+simpleNbox,daccs_uptake,n,y,y,"""(csv)""",Pg C yr-1,Anthropogenic contributions: direct air carbon capture and storage
+simpleNbox,luc_emissions,n,y,y,"""(csv)""",Pg C yr-1,Anthropogenic contributions: land use change
+simpleNbox,luc_uptake,n,y,y,"""(csv)""",Pg C yr-2,Anthropogenic contributions: land use change
+simpleNbox,CO2_constrain,n,y,n,"""(csv)""",ppmv,atmospheric CO2 constraint
+simpleNbox,NBP_constrain,n,y,n,"""(csv)""",Pg C yr-1,net biome production (land-atmosphere C flux) constaint
+simpleNbox,beta,n,n,y,0.36,(unitless),
+simpleNbox,q10_rh,n,n,y,2,(unitless),respiration response Q10
+simpleNbox,boreal.warmingfactor,y,n,n,1.2,(unitless),biome-specific warming factors
+simpleNbox,RF_albedo,n,n,y,"""(csv)""",W m-2,albedo effect
+simpleNbox,permafrost_c,y,n,y,0,Pg C,Preindustrial permafrost carbon pool
+simpleNbox,fpf_static,y,n,n,0.74,(unitless),fraction of permafrost that is static (non-labile)
+simpleNbox,rh_ch4_frac,y,n,n,0.023,(unitless),fraction of thawed permafrost decomposed as CH4
+simpleNbox,pf_mu,y,n,n,1.67,(unitless),permafrost thaw parameter; see Woodard et al. 2021
+simpleNbox,pf_sigma,y,n,n,0.986,(unitless),permafrost thaw parameter; see Woodard et al. 2021
+carbon-cycle-solver,eps_abs,n,n,y,1.00E-06,(unitless),solution tolerance
+carbon-cycle-solver,eps_rel,n,n,y,1.00E-06,(unitless),solution tolerance
+carbon-cycle-solver,dt,n,n,y,0.25,(unitless),default time step
+carbon-cycle-solver,eps_spinup,n,n,y,0.001,Pg C,"spinup tolerance (drift), Pg C"
+so2,SO2_emissions,n,y,y,"""(csv)""",,emissions time series
+so2,SV,n,y,y,"""(csv)""",,volcanic radiative forcing time series
+CH4,M0,n,n,y,731.41,ppb,"preindustrial methane IPCC AR6 Table 7.SM.1, the CH4 forcing equations is calibrated to a M0 of 731.41 ppb"
+CH4,Tsoil,n,n,y,160,years,CH4 loss to soil
+CH4,Tstrat,n,n,y,120,years,CH4 loss to stratosphere
+CH4,UC_CH4,n,n,y,2.78,Tg CH4 ppb-1,unit conversion between emissions and concentrations
+CH4,CH4N,n,n,y,341,,best fit
+CH4,CH4_emissions,n,y,y,"""(csv)""",,emissions time series
+CH5,CH4_constrain,n,y,n,"""(csv)""",,CH4 concentration constraint
+OH,NOX_emissions,n,y,y,"""(csv)""",,emissions time series
+OH,CO_emissions,n,y,y,"""(csv)""",,emissions time series
+OH,NMVOC_emissions,n,y,y,"""(csv)""",,emissions time series
+OH,TOH0,n,n,y,6.6,years,initial OH lifetime
+OH,CNOX,n,n,y,0.0042,,coefficient for NOX
+OH,CCO,n,n,y,-1.05E-04,,coefficient for CO
+OH,CNMVOC,n,n,y,-3.15E-04,,coefficient for NMVOC (non methane VOC)
+OH,CCH4,n,n,y,-0.32,,coefficient for CH4
+ozone,PO3,n,n,y,30,,preindustrial O3 concentration
+ozone,NOX_emissions,n,y,y,"""(csv)""",,emissions time series
+ozone,CO_emissions,n,y,y,"""(csv)""",,emissions time series
+ozone,NMVOC_emissions,n,y,y,"""(csv)""",,emissions time series
+N2O,N0,n,n,y,273.87,ppb,preindustrial nitrous oxide from IPCC AR6 table 7.SM.1
+N2O,UC_N2O,n,n,y,4.8,TgN ppbv-1,unit conversion between emissions and concentrations
+N2O,TN2O0,n,n,y,132,years,initial lifetime of N2O
+N2O,N2O_natural_emissions,n,y,y,9.5,,default natural emissions based on a best fit to IPCC AR6 N2O RF
+N2O,N2O_emissions,n,y,y,"""(csv)""",,emissions time series
+N2O,N2O_constrain,n,y,n,"""(csv)""",,N2O concentration constraint
+forcing,baseyear,n,n,y,1750,,"when to start reporting; by definition, all F=0 in this year"
+forcing,RF_tot_constrain,n,y,n,"""(csv)""",,"If supplied, the model will use these data, ignoring what it calculates"
+forcing,delta_co2,n,n,y,0.05,(unitless),forcing tropospheric adjustments for CO2 (7.3.2.1 of IPCC AR6)
+forcing,delta_ch4,n,n,y,-0.14,(unitless),forcing tropospheric adjustments for CH4 (7.3.2.2 of IPCC AR6)
+forcing,delta_n2o,n,n,y,0.07,(unitless),forcing tropospheric adjustments for N2O (7.3.2.3 of IPCC AR6)
+forcing,rho_bc,n,n,y,0.0508,W yr m-2 C Tg-1,IPCC AR6 radiative efficiency BC (7.SM.1.3 of IPCC AR6)
+forcing,rho_oc,n,n,y,-0.00621,W yr m-2 C Tg-1,IPCC AR6 radiative efficiency OC (7.SM.1.3.1 of IPCC AR6)
+forcing,rho_so2,n,n,y,-7.24E-06,W yr m-2 S Gg-1,IPCC AR6 radiative efficiency SO2 (7.SM.1.3.1 of IPCC AR6)
+forcing,rho_nh3,n,n,y,-0.00208,W yr m-2 NH3 Tg-1,IPCC AR6 radiative efficiency NH3 (7.SM.1.3.1 of IPCC AR6)
+forcing,RF_misc,n,n,n,"""(csv)""",,Miscellaneous radiative forcings default set to 0
+forcing,RF_misc,n,n,y,0,,"Miscellaneous radiative forcings default set to 0, or read in from a input table, may be used to read in additional forcings not modeled by Hector (i.e. solar, bc on snow , contrails from)"
+temperature,S,n,n,y,3,degC,equilibrium climate sensitivity for 2xCO2
+temperature,diff,n,n,y,2.3,cm2 s-1,ocean heat diffusivity
+temperature,alpha,n,n,y,1,(unitless),scaling factor for aerosol forcing
+temperature,volscl,n,n,y,1,(unitless),scaling factor for volcanic forcing
+temperature,qco2,n,n,y,3.75,,CO2 RF (7.3.2 of IPCC AR6)
+temperature,tas_constrain,n,y,n,"""(csv)""",,"Optional global temperature constraint; If supplied, the model will use these data, ignoring what it calculates"
+bc,BC_emissions,n,y,y,"""(csv)""",,
+oc,OC_emissions,n,y,y,"""(csv)""",,
+nh3,NH3_emissions,n,y,y,"""(csv)""",,
+CF4_halocarbon,tau,n,n,y,50000,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CF4_halocarbon,rho_CF4,n,n,y,9.90E-05,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CF4_halocarbon,delta_CF4,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CF4_halocarbon,H0,n,n,y,35,pptv,preindustrial concentration
+CF4_halocarbon,molarMass,n,n,y,88.0043,g,molar mass
+CF4_halocarbon,CF4_emissions,n,y,y,"""(csv)""",,
+C2F6_halocarbon,tau,n,n,y,10000,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+C2F6_halocarbon,rho_C2F6,n,n,y,2.61E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+C2F6_halocarbon,delta_C2F6,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+C2F6_halocarbon,molarMass,n,n,y,138.01,g,molar mass
+C2F6_halocarbon,C2F6_emissions,n,y,y,"""(csv)""",,
+HFC23_halocarbon,tau,n,n,y,228,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HFC23_halocarbon,rho_HFC23,n,n,y,1.91E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HFC23_halocarbon,delta_HFC23,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HFC23_halocarbon,molarMass,n,n,y,70,g,molar mass
+HFC23_halocarbon,HFC23_emissions,n,y,y,"""(csv)""",,
+HFC32_halocarbon,tau,n,n,y,5.4,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HFC32_halocarbon,rho_HFC32,n,n,y,1.11E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HFC32_halocarbon,delta_HFC32,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HFC32_halocarbon,molarMass,n,n,y,52,g,molar mass
+HFC32_halocarbon,HFC32_emissions,n,y,y,"""(csv)""",,
+HFC4310_halocarbon,tau,n,n,y,17,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HFC4310_halocarbon,rho_HFC4310,n,n,y,3.57E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HFC4310_halocarbon,delta_HFC4310,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HFC4310_halocarbon,molarMass,n,n,y,252,g,molar mass
+HFC4310_halocarbon,HFC4310_emissions,n,y,y,"""(csv)""",,
+HFC125_halocarbon,tau,n,n,y,30,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HFC125_halocarbon,rho_HFC125,n,n,y,2.34E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HFC125_halocarbon,delta_HFC125,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HFC125_halocarbon,molarMass,n,n,y,120.02,g,molar mass
+HFC125_halocarbon,HFC125_emissions,n,y,y,"""(csv)""",,
+HFC134a_halocarbon,tau,n,n,y,14,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HFC134a_halocarbon,rho_HFC134a,n,n,y,1.67E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HFC134a_halocarbon,delta_HFC134a,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HFC134a_halocarbon,molarMass,n,n,y,102.02,g,molar mass
+HFC134a_halocarbon,HFC134a_emissions,n,y,y,"""(csv)""",,
+HFC143a_halocarbon,tau,n,n,y,51,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HFC143a_halocarbon,rho_HFC143a,n,n,y,1.68E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HFC143a_halocarbon,delta_HFC143a,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HFC143a_halocarbon,molarMass,n,n,y,84.04,g,molar mass
+HFC143a_halocarbon,HFC143a_emissions,n,y,y,"""(csv)""",,
+HFC227ea_halocarbon,tau,n,n,y,36,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HFC227ea_halocarbon,rho_HFC227ea,n,n,y,2.73E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HFC227ea_halocarbon,delta_HFC227ea,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HFC227ea_halocarbon,molarMass,n,n,y,170.03,g,molar mass
+HFC227ea_halocarbon,HFC227ea_emissions,n,y,y,"""(csv)""",,
+HFC245fa_halocarbon,tau,n,n,y,7.9,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HFC245fa_halocarbon,rho_HFC245fa,n,n,y,2.45E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HFC245fa_halocarbon,delta_HFC245fa,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HFC245fa_halocarbon,molarMass,n,n,y,134,g,molar mass
+HFC245fa_halocarbon,HFC245fa_emissions,n,y,y,"""(csv)""",,
+SF6_halocarbon,tau,n,n,y,3200,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+SF6_halocarbon,rho_SF6,n,n,y,5.67E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+SF6_halocarbon,delta_SF6,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+SF6_halocarbon,molarMass,n,n,y,146.06,g,molar mass
+SF6_halocarbon,SF6_emissions,n,y,y,"""(csv)""",,
+CFC11_halocarbon,tau,n,n,y,52,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CFC11_halocarbon,rho_CFC11,n,n,y,2.59E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CFC11_halocarbon,delta_CFC11,n,n,y,0.13,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CFC11_halocarbon,molarMass,n,n,y,137.35,g,molar mass
+CFC11_halocarbon,CFC11_emissions,n,y,y,"""(csv)""",,
+CFC12_halocarbon,tau,n,n,y,102,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CFC12_halocarbon,rho_CFC12,n,n,y,3.20E-03,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CFC12_halocarbon,delta_CFC12,n,n,y,0.13,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CFC12_halocarbon,molarMass,n,n,y,120.9,g,molar mass
+CFC12_halocarbon,CFC12_emissions,n,y,y,"""(csv)""",,
+CFC113_halocarbon,tau,n,n,y,93,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CFC113_halocarbon,rho_CFC113,n,n,y,3.01E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CFC113_halocarbon,delta_CFC113,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CFC113_halocarbon,molarMass,n,n,y,187.35,g,molar mass
+CFC113_halocarbon,CFC113_emissions,n,y,y,"""(csv)""",,
+CFC114_halocarbon,tau,n,n,y,189,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CFC114_halocarbon,rho_CFC114,n,n,y,3.14E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CFC114_halocarbon,delta_CFC114,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CFC114_halocarbon,molarMass,n,n,y,170.9,g,molar mass
+CFC114_halocarbon,CFC114_emissions,n,y,y,"""(csv)""",,
+CFC115_halocarbon,tau,n,n,y,540,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CFC115_halocarbon,rho_CFC115,n,n,y,2.46E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CFC115_halocarbon,delta_CFC115,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CFC115_halocarbon,molarMass,n,n,y,154.45,g,molar mass
+CFC115_halocarbon,CCl4_emissions,n,y,y,"""(csv)""",,
+CCl4_halocarbon,tau,n,n,y,32,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CCl4_halocarbon,rho_CCl4,n,n,y,1.66E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CCl4_halocarbon,delta_CCl4,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CCl4_halocarbon,molarMass,n,n,y,153.8,g,molar mass
+CCl4_halocarbon,CFC115_emissions,n,y,y,"""(csv)""",,
+CH3CC13_halocarbon,tau,n,n,y,5,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CH3CC13_halocarbon,rho_CH3CCl3,n,n,y,6.50E-05,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CH3CC13_halocarbon,delta_CH3CCl3,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CH3CC13_halocarbon,molarMass,n,n,y,133.35,g,molar mass
+CH3CC13_halocarbon,CH3CCl3_emissions,n,y,y,"""(csv)""",,
+halon1211_halocarbon,tau,n,n,y,16,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+halon1211_halocarbon,rho_halon1211,n,n,y,3.00E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+halon1211_halocarbon,delta_halon1211,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+halon1211_halocarbon,molarMass,n,n,y,165.35,g,molar mass
+halon1211_halocarbon,halon1211_emissions,n,y,y,"""(csv)""",,
+halon1301_halocarbon,tau,n,n,y,72,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+halon1301_halocarbon,rho_halon1301,n,n,y,2.99E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+halon1301_halocarbon,delta_halon1301,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+halon1301_halocarbon,molarMass,n,n,y,148.9,g,molar mass
+halon1301_halocarbon,halon1301_emissions,n,y,y,"""(csv)""",,
+halon2402_halocarbon,tau,n,n,y,28,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+halon2402_halocarbon,rho_halon2402,n,n,y,3.12E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+halon2402_halocarbon,delta_halon2402,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+halon2402_halocarbon,molarMass,n,n,y,259.8,g,molar mass
+halon2402_halocarbon,halon2402_emissions,n,y,y,"""(csv)""",,
+HCF22_halocarbon,tau,n,n,y,11.9,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HCF22_halocarbon,rho_HCFC22,n,n,y,2.14E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HCF22_halocarbon,delta_HCFC22,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HCF22_halocarbon,molarMass,n,n,y,86.45,g,molar mass
+HCF22_halocarbon,HCFC22_emissions,n,y,y,"""(csv)""",,
+HCFC141b_halocarbon,tau,n,n,y,9.4,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HCFC141b_halocarbon,rho_HCFC141b,n,n,y,1.61E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HCFC141b_halocarbon,delta_HCFC141b,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HCFC141b_halocarbon,molarMass,n,n,y,116.9,g,molar mass
+HCFC141b_halocarbon,HCFC141b_emissions,n,y,y,"""(csv)""",,
+HCFC142b_halocarbon,tau,n,n,y,18,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+HCFC142b_halocarbon,rho_HCFC142b,n,n,y,1.93E-04,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+HCFC142b_halocarbon,delta_HCFC142b,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+HCFC142b_halocarbon,molarMass,n,n,y,100.45,g,molar mass
+HCFC142b_halocarbon,HCFC142b_emissions,n,y,y,"""(csv)""",,
+CH3Cl_halocarbon,tau,n,n,y,0.9,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CH3Cl_halocarbon,rho_CH3Cl,n,n,y,5.00E-06,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CH3Cl_halocarbon,delta_CH3Cl,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CH3Cl_halocarbon,H0,n,n,y,504,pptv,"preindustrial concentration, from Saito et al 2007 GRL"
+CH3Cl_halocarbon,molarMass,n,n,y,50.45,g,molar mass
+CH3Cl_halocarbon,CH3Cl_emissions,n,y,y,"""(csv)""",,
+CH3Br_halocarbon,tau,n,n,y,0.8,years,lifetime in years (Table 7.SM.7 IPPC AR6)
+CH3Br_halocarbon,rho_CH3Br,n,n,y,4.00E-06,W m-2 ppt-1,radiative efficiencies (Table 7.SM.7 IPPC AR6)
+CH3Br_halocarbon,delta_CH3Br,n,n,y,0,(unitless),tropospheric adjustments scalar (7.3.2.4 IPCC AR6)
+CH3Br_halocarbon,H0,n,n,y,5.8,pptv,"preindustrial concentration, from Saltzman et al 2004 JGR"
+CH3Br_halocarbon,molarMass,n,n,y,50.45,g,molar mass
+CH3Br_halocarbon,CH3Br_emissions,n,y,y,"""(csv)""",,
diff --git a/data-raw/lookup-data.R b/data-raw/lookup-data.R
new file mode 100644
index 000000000..28df6fae4
--- /dev/null
+++ b/data-raw/lookup-data.R
@@ -0,0 +1,39 @@
+# Generate the table of Hector strings and functions for the look up table.
+# Load the hector package
+devtools::load_all()
+
+# Helper function to evaluate an export R function
+# Args
+# n: name of the function
+# Returns: string output from the function
+hector_eval_func <- function(n) {
+ print(n)
+ assertthat::assert_that(is.character(n))
+ x <- match.fun(gsub(x = n, pattern = "\\()", replacement = ""))
+ assertthat::assert_that(is.function(x))
+ x()
+}
+
+# Read ini the contents of the rcpp file, this is written with the working
+# directory set to the root directory of the Hector repository/package.
+lines <- readLines("./src/rcpp_constants.cpp")
+
+# Specific functions to exclude
+# TODO is there a way to make this not hard coded?
+lines <- lines[!grepl(
+ pattern = "GETDATA|SETDATA|BIOME_SPLIT_CHAR|RFADJ_PREFIX|RF_PREFIX",
+ x = lines)]
+
+# Identify the lines of the code where the R function names are defined.
+conditions <- (grepl("^String ", x = lines) & !grepl("^ ", x = lines))
+string_names <- lines[conditions]
+string_names <- gsub(pattern = "\\(String", replacement = "()", x = string_names)
+
+# Parse out the function names, evaluate the function then store results in
+# a table.
+fxn_names <- unlist(lapply(string_names, function(s) {
+ unlist(strsplit(s, split = " "))[2]}))
+fxn_vals <- unlist(lapply(fxn_names, hector_eval_func))
+fxntable <- data.frame(fxn = fxn_names, string = fxn_vals)
+
+usethis::use_data(fxntable, internal = FALSE, overwrite = TRUE)
diff --git a/data-raw/save-input-params.R b/data-raw/save-input-params.R
new file mode 100644
index 000000000..09dfc7aed
--- /dev/null
+++ b/data-raw/save-input-params.R
@@ -0,0 +1,9 @@
+# Since this script will only be run occasionally while actively developing Hector, use
+# devtools::load_all() instead of loading the built Hector package.
+devtools::load_all()
+
+# Read in the input parameter csv file
+inputstable <- read.csv("./data-raw/input_params.csv")
+
+# Save as an object in the package
+usethis::use_data(inputstable, internal = FALSE, overwrite = TRUE)
diff --git a/data-raw/units-data.R b/data-raw/units-data.R
index 5db6e0773..d742e19f3 100644
--- a/data-raw/units-data.R
+++ b/data-raw/units-data.R
@@ -4,59 +4,88 @@
# variables missing).
devtools::load_all()
-hvars <- c(
- ECS(), PREINDUSTRIAL_CO2(), Q10_RH(), BETA(), AERO_SCALE(), VOLCANIC_SCALE(), DIFFUSIVITY(),
- FFI_EMISSIONS(), LUC_EMISSIONS(),
- EMISSIONS_BC(), EMISSIONS_N2O(), EMISSIONS_NOX(), EMISSIONS_CO(),
- EMISSIONS_NMVOC(), EMISSIONS_OC(), NAT_EMISSIONS_N2O(),
- EMISSIONS_CH4(), PREINDUSTRIAL_CH4(), NATURAL_CH4(), LIFETIME_SOIL(), LIFETIME_STRAT(),
- EMISSIONS_SO2(), VOLCANIC_SO2(), CO2_CONSTRAIN(),
- CH4_CONSTRAIN(), N2O_CONSTRAIN()
-)
-
-
-hunits <- c(
- "degC", "ppmv CO2", "(unitless)", "(unitless)", "(unitless)", "(unitless)", "cm2/s",
- "Pg C/yr", "Pg C/yr",
- "Tg", "Tg N", "Tg N", "Tg CO",
- "Tg NMVOC", "Tg", "Tg N",
- "Tg CH4", "ppbv CH4", "Tg CH4", "Years", "Years",
- "Gg S", "W/m2", "ppmv CO2",
- "ppbv CH4", "ppbv N2O"
-)
-
-
-haloemis <- c(
- EMISSIONS_CF4(), EMISSIONS_C2F6(), EMISSIONS_HFC23(),
- EMISSIONS_HFC32(), EMISSIONS_HFC4310(), EMISSIONS_HFC125(),
- EMISSIONS_HFC134A(), EMISSIONS_HFC143A(), EMISSIONS_HFC227EA(),
- EMISSIONS_HFC245FA(), EMISSIONS_SF6(), EMISSIONS_CFC11(),
- EMISSIONS_CFC12(), EMISSIONS_CFC113(), EMISSIONS_CFC114(),
- EMISSIONS_CFC115(), EMISSIONS_CCL4(), EMISSIONS_CH3CCL3(),
- EMISSIONS_HCFC22(), EMISSIONS_HCFC141B(), EMISSIONS_HCFC142B(),
- EMISSIONS_HALON1211(), EMISSIONS_HALON1301(),
- EMISSIONS_HALON2402(), EMISSIONS_CH3CL(), EMISSIONS_CH3BR()
-)
-halounits <- "Gg"
-
-haloconstrain <- c(
- CF4_CONSTRAIN(), C2F6_CONSTRAIN(), HFC23_CONSTRAIN(),
- HFC32_CONSTRAIN(), HFC4310_CONSTRAIN(), HFC125_CONSTRAIN(),
- HFC134A_CONSTRAIN(), HFC143A_CONSTRAIN(), HFC227EA_CONSTRAIN(),
- HFC245FA_CONSTRAIN(), SF6_CONSTRAIN(), CFC11_CONSTRAIN(),
- CFC12_CONSTRAIN(), CFC113_CONSTRAIN(), CFC114_CONSTRAIN(),
- CFC115_CONSTRAIN(), CCL4_CONSTRAIN(), CH3CCL3_CONSTRAIN(),
- HCFC22_CONSTRAIN(), HCFC141B_CONSTRAIN(), HCFC142B_CONSTRAIN(),
- HALON1211_CONSTRAIN(), HALON1301_CONSTRAIN(), HALON2402_CONSTRAIN(),
- CH3CL_CONSTRAIN(), CH3BR_CONSTRAIN()
-)
-haloconstrain_units <- "pptv"
-
-
-unitstable <- rbind(
- data.frame(variable = hvars, units = hunits),
- data.frame(variable = haloemis, units = halounits),
- data.frame(variable = haloconstrain, units = haloconstrain_units)
-)
-
-usethis::use_data(unitstable, internal = TRUE, overwrite = TRUE)
+simpleNbox_vars <- c(PREINDUSTRIAL_CO2(), NPP_FLUX0(),
+ FFI_EMISSIONS(), DACCS_UPTAKE(), LUC_EMISSIONS(), LUC_UPTAKE(),
+ CO2_CONSTRAIN(), NBP_CONSTRAIN(), BETA(), Q10_RH())
+simpleNbox_uni <- c("ppmv CO2", "Pg C/yr", "Pg C/yr", "Pg C/yr", "Pg C/yr",
+ "Pg C/yr", "ppmv CO2", "Pg C/yr", "(unitless)", "(unitless)")
+
+ocean_vars <- c(TT(), TU(), TWI(), TID(), OCEAN_PREIND_C_SURF(), OCEAN_PREIND_C_ID())
+ocean_uni <- c("m3/s", "m3/s", "m3/s", "m3/s", "Pg C", "Pg C")
+
+so2_vars <- c(EMISSIONS_SO2(), VOLCANIC_SO2())
+so2_uni <- c("Gg S", "W/m2")
+
+ch4_vars <- c(PREINDUSTRIAL_CH4(), NATURAL_CH4(), EMISSIONS_CH4(), CH4_CONSTRAIN(),
+ LIFETIME_SOIL(), LIFETIME_STRAT())
+ch4_uni <- c("ppbv CH4", "Tg CH4", "Tg CH4", "ppbv CH4", "Years", "Years")
+
+oh_vars <- c(EMISSIONS_NOX(), EMISSIONS_CO(), EMISSIONS_NMVOC())
+oh_uni <- c("Tg N", "Tg CO", "Tg NMVOC")
+
+n2o_vars <- c(EMISSIONS_N2O(), N2O_CONSTRAIN(), NAT_EMISSIONS_N2O(), PREINDUSTRIAL_N2O())
+n2o_uni <- c("Tg N", "ppbv N2O", "Tg N", "ppbv N2O")
+
+forcing_vars <- c(DELTA_CO2(), DELTA_CH4(), DELTA_N2O(), RHO_BC(),
+ RHO_OC(), RHO_SO2(), RHO_NH3(), RF_ALBEDO(), RF_MISC())
+forcing_uni <- c("(unitless)", "(unitless)", "(unitless)", "W/m2/Tg",
+ "W/m2/Tg", "W/m2/Gg", "W/m2/Tg", "W/m2", "W/m2")
+
+temp_vars <- c(ECS(), DIFFUSIVITY(), AERO_SCALE(), VOLCANIC_SCALE(),
+ Q_CO2(), TAS_CONSTRAIN(), LO_WARMING_RATIO())
+temp_uni <- c("degC", "cm2/s", "(unitless)", "(unitless)", "W/m2",
+ "degC", "(unitless)")
+
+misc_emiss_vars <- c(EMISSIONS_BC(), EMISSIONS_OC(), EMISSIONS_NH3())
+misc_emiss_uni <- c("Tg", "Tg", "Tg")
+
+haloemis_vars <- c(EMISSIONS_CF4(), EMISSIONS_C2F6(), EMISSIONS_HFC23(),
+ EMISSIONS_HFC32(), EMISSIONS_HFC4310(), EMISSIONS_HFC125(),
+ EMISSIONS_HFC134A(), EMISSIONS_HFC143A(), EMISSIONS_HFC227EA(),
+ EMISSIONS_HFC245FA(), EMISSIONS_SF6(), EMISSIONS_CFC11(),
+ EMISSIONS_CFC12(), EMISSIONS_CFC113(), EMISSIONS_CFC114(),
+ EMISSIONS_CFC115(), EMISSIONS_CCL4(), EMISSIONS_CH3CCL3(),
+ EMISSIONS_HCFC22(), EMISSIONS_HCFC141B(), EMISSIONS_HCFC142B(),
+ EMISSIONS_HALON1211(), EMISSIONS_HALON1301(),
+ EMISSIONS_HALON2402(), EMISSIONS_CH3CL(), EMISSIONS_CH3BR())
+haloemis_uni <- "Gg"
+
+haloconstrain_vars <- c(CF4_CONSTRAIN(), C2F6_CONSTRAIN(), HFC23_CONSTRAIN(),
+ HFC32_CONSTRAIN(), HFC4310_CONSTRAIN(), HFC125_CONSTRAIN(),
+ HFC134A_CONSTRAIN(), HFC143A_CONSTRAIN(), HFC227EA_CONSTRAIN(),
+ HFC245FA_CONSTRAIN(), SF6_CONSTRAIN(), CFC11_CONSTRAIN(),
+ CFC12_CONSTRAIN(), CFC113_CONSTRAIN(), CFC114_CONSTRAIN(),
+ CFC115_CONSTRAIN(), CCL4_CONSTRAIN(), CH3CCL3_CONSTRAIN(),
+ HCFC22_CONSTRAIN(), HCFC141B_CONSTRAIN(), HCFC142B_CONSTRAIN(),
+ HALON1211_CONSTRAIN(), HALON1301_CONSTRAIN(), HALON2402_CONSTRAIN(),
+ CH3CL_CONSTRAIN(), CH3BR_CONSTRAIN())
+haloconstrain_uni <- "pptv"
+
+halodeltas_vars <- c(DELTA_CF4(), DELTA_C2F6(), DELTA_HFC23(), DELTA_HFC32(),
+ DELTA_HFC4310(), DELTA_HFC125(), DELTA_HFC134A(), DELTA_HFC143A(),
+ DELTA_HFC227EA(), DELTA_HFC245FA(), DELTA_SF6(), DELTA_CFC11(),
+ DELTA_CFC12(), DELTA_CFC113(), DELTA_CFC114(), DELTA_CFC115(),
+ DELTA_CCL4(), DELTA_CH3CCL3(), DELTA_HCFC22(), DELTA_HCFC141B(),
+ DELTA_HCFC142B(), DELTA_HALON1211(), DELTA_HALON1301(),
+ DELTA_HALON2402(), DELTA_CH3CL(), DELTA_CH3BR(), DELTA_CH4(),
+ DELTA_CO2())
+halodeltas_uni <- "(unitless)"
+
+misc_var <- c(TRACKING_DATE())
+misc_uni <- c("(unitless)")
+
+unitstable <- rbind(data.frame(variable = simpleNbox_vars, units = simpleNbox_uni),
+ data.frame(variable = ocean_vars, units = ocean_uni),
+ data.frame(variable = so2_vars, units = so2_uni),
+ data.frame(variable = ch4_vars, units = ch4_uni),
+ data.frame(variable = oh_vars, units = oh_uni),
+ data.frame(variable = n2o_vars, units = n2o_uni),
+ data.frame(variable = forcing_vars, units = forcing_uni),
+ data.frame(variable = temp_vars, units = temp_uni),
+ data.frame(variable = misc_emiss_vars, units = misc_emiss_uni),
+ data.frame(variable = haloemis_vars, units = haloemis_uni),
+ data.frame(variable = haloconstrain_vars, units = haloconstrain_uni),
+ data.frame(variable = halodeltas_vars, units = halodeltas_uni),
+ data.frame(variable = misc_var, units = misc_uni))
+
+usethis::use_data(unitstable, internal = FALSE, overwrite = TRUE)
diff --git a/data/fxntable.rda b/data/fxntable.rda
new file mode 100644
index 000000000..c3ecf4ce2
Binary files /dev/null and b/data/fxntable.rda differ
diff --git a/data/inputstable.rda b/data/inputstable.rda
new file mode 100644
index 000000000..de3ca53bb
Binary files /dev/null and b/data/inputstable.rda differ
diff --git a/data/unitstable.rda b/data/unitstable.rda
new file mode 100644
index 000000000..67ee825dd
Binary files /dev/null and b/data/unitstable.rda differ
diff --git a/inst/CITATION b/inst/CITATION
deleted file mode 100644
index 19a920ab5..000000000
--- a/inst/CITATION
+++ /dev/null
@@ -1,17 +0,0 @@
-bibentry('Article',
- header =
- 'When using Hector in your research, please cite the following model documentation paper:',
- key = 'hartin2015simple',
- title =
- 'A simple object-oriented and open-source model for scientific and policy analyses of the global climate system--Hector v1.0',
- author =
- 'Corinne A Hartin and Pralit Patel and Adria Schwarber and Robert Link and Ben Bond-Lamberty',
- journal = 'Geoscientific Model Development',
- volume = 8,
- number = 4,
- pages = '939--955',
- year = 2015,
- publisher = 'Copernicus GmbH',
- footer =
- 'Hector development was supported by the U.S. Department of Energy, Office of Science, as part of research in Multi-Sector Dynamics, Earth and Environmental System Modeling Program. The Pacific Northwest National Laboratory is operated for DOE by Battelle Memorial Institute under contract DE-AC05-76RL01830.'
- )
diff --git a/inst/WORDLIST b/inst/WORDLIST
new file mode 100644
index 000000000..29d5ccfe5
--- /dev/null
+++ b/inst/WORDLIST
@@ -0,0 +1,366 @@
+ACC
+ACI
+Acidification
+AddNewVariable
+AddTSeries
+Anthropogenic
+Aragón
+Arora
+Battelle
+Biogeosciences
+Biome
+Biota
+Bopp
+Brovkin
+Bugfix
+BuildHector
+CCL
+CCl
+CESM
+CMD
+CMIP
+Caud
+Cflux
+Chapin
+Cramer
+DOECLIM
+DOECLIM’s
+DOI
+Delmotte
+Dev
+Doxygen
+Dube
+DummyModelComponent
+Durand
+Dynam
+EF
+EMGC
+ESCIMO
+ESMs
+Elmar
+Evanoff
+FBC
+FC
+FCCl
+FCF
+FCFC
+FCH
+FCO
+FH
+FHCF
+FHFC
+FN
+FO
+FOC
+FSO
+FaIR
+FadjC
+FadjCCl
+FadjCF
+FadjCFC
+FadjCH
+FadjHCFC
+FadjHFC
+FadjSF
+Fadjhalon
+Feedbacks
+Fhalon
+Forcings
+Frac
+Friedlingstein
+Ftalbedo
+Ftot
+Fvol
+GCAM
+GETDATA
+GHG
+GHGs
+GL
+GMST
+GPP
+GREB
+GSL
+GTEST
+GTESTLIB
+Geophys
+Geosci
+Gg
+Gieseke
+Github
+Goldfarb
+Gomis
+Googletest
+HCCFC
+HCF
+HCFC
+HCO
+HFC
+HL
+Hajima
+HcFC
+HectorUI
+Hectordata
+Heterotrophic
+Homebrew
+INI
+IPCC
+InputFiles
+Intercomparison
+Interpretable
+JCLI
+Kainuma
+Kala
+Kato
+Kawamiya
+Knorr
+Knorr's
+Kravitz
+Kriegler
+LUC
+Lamberty
+Leitzell
+Lenton
+Liddicoat
+Lonnoy
+MAGICC
+MCE
+Mahowald
+Makefile
+Masson
+Maycock
+McElroy
+Meinshausen
+MimiHECTOR
+Monash
+Moufouma
+Mulugetta
+Mundra
+NBP
+NMVOC
+NOx
+NPP
+NewVar
+Nicholls
+NumericVector
+OC
+ORCID
+OSX
+Okia
+OmegaAr
+OmegaCa
+PCO
+PNNL
+PPMv
+PRs
+PgC
+Ph
+PhDKriegler
+Pidcock
+Pirani
+Pre
+Preindustrial
+Péan
+Pörtner
+RCM
+RCMIP
+RCMs
+RCP
+RCPs
+RDCEP
+RL
+Radiative
+Rcpp
+Reick
+Revelle
+Roelandt
+Roxygen
+Rstudio
+Rtools
+SCM
+SCMs
+SETDATA
+SPP
+SSP
+SSPs
+STL
+STRAT
+Sarmiento
+Schwarber
+Segschneider
+Shevliakova
+Shukla
+Skea
+Solecki
+Sriver
+Syst
+TAS
+TROP
+Tellus
+Tg
+Tgav
+Thermohaline
+Tignor
+Tjiputra
+Toggweiler
+Uncommenting
+Universit
+Universität
+Wairiu
+Waldhoff
+Walkthrough
+Watanabe
+Waterfield
+Westhoff
+Wilner
+Xcode
+Yelek
+Yu
+Zhai
+Zhou
+Zickfeld
+aci
+acidification
+addd
+al
+albedo
+anthro
+anthropogenic
+ar
+aragnoite
+aragonite
+atm
+atmos
+bc
+bg
+biome
+biome's
+biomes
+bool
+bromomethane
+carboncycle
+chloromethane
+codebase
+codecov
+const
+cpp
+csv
+dC
+de
+degC
+doi
+downwelling
+ds
+dt
+dx
+edenh
+enddate
+et
+feedbacks
+fetchvars
+ffi
+ffiEmissions
+filesystem
+fldgen
+forcer
+forcings
+foring
+frac
+fveg
+getData
+getdate
+getname
+gigagrams
+github
+gmd
+googletest
+halocarbon
+halocarbons
+haloconstrains
+haloemiss
+haloforcings
+halono
+hc
+heatflux
+hectorui
+heterotrophic
+hexafluoride
+hpp
+http
+https
+iD
+ini
+init
+intercomparison
+ipcc
+isactive
+larc
+ld
+litterfall
+loglevel
+lucEmissions
+lv
+macOS
+makefiles
+mapply
+multiforcing
+mynasadata
+nasa
+nd
+newname
+nitrous
+npp
+ns
+nv
+oc
+oldname
+outputstream
+pCO
+params
+pik
+potsdam
+ppbv
+ppmv
+pptv
+pre
+preindustrial
+prepareToRun
+pyhector
+quickstart
+radiative
+registerCapability
+registerDependency
+rh
+roxygen
+runToDate
+semiempirical
+setData
+shutDown
+simpleNbox
+spinup
+ssp
+sst
+startdate
+strat
+stringmaps
+subclasses
+subunit
+tas
+tetrachloride
+trichloroethane
+trop
+tropospheric
+tseries
+ttps
+tuneable
+uatm
+umol
+uncommenting
+unitless
+unitval
+unitvals
+vd
+vectorized
+wg
+wheterh
+www
+zenodo
diff --git a/inst/include/INIReader.h b/inst/include/INIReader.h
index 0cf035304..1436da603 100644
--- a/inst/include/INIReader.h
+++ b/inst/include/INIReader.h
@@ -15,33 +15,32 @@ namespace Hector {
// Read an INI file into easy-to-access name/value pairs. (Note that I've gone
// for simplicity here rather than speed, but it should be pretty decent.)
-class INIReader
-{
+class INIReader {
public:
- // Construct INIReader and parse given filename. See ini.h for more info
- // about the parsing.
- INIReader(std::string filename);
+ // Construct INIReader and parse given filename. See ini.h for more info
+ // about the parsing.
+ INIReader(std::string filename);
- // Return the result of ini_parse(), i.e., 0 on success, line number of
- // first error on parse error, or -1 on file open error.
- int ParseError();
+ // Return the result of ini_parse(), i.e., 0 on success, line number of
+ // first error on parse error, or -1 on file open error.
+ int ParseError();
- // Get a string value from INI file, returning default_value if not found.
- std::string Get(std::string section, std::string name,
- std::string default_value);
+ // Get a string value from INI file, returning default_value if not found.
+ std::string Get(std::string section, std::string name,
+ std::string default_value);
- // Get an integer (long) value from INI file, returning default_value if
- // not found.
- long GetInteger(std::string section, std::string name, long default_value);
+ // Get an integer (long) value from INI file, returning default_value if
+ // not found.
+ long GetInteger(std::string section, std::string name, long default_value);
private:
- int _error;
- std::map _values;
- static std::string MakeKey(std::string section, std::string name);
- static int ValueHandler(void* user, const char* section, const char* name,
- const char* value);
+ int _error;
+ std::map _values;
+ static std::string MakeKey(std::string section, std::string name);
+ static int ValueHandler(void *user, const char *section, const char *name,
+ const char *value);
};
-}
+} // namespace Hector
-#endif // __INIREADER_H__
+#endif // __INIREADER_H__
diff --git a/inst/include/avisitor.hpp b/inst/include/avisitor.hpp
index cc7132234..a57d59e77 100644
--- a/inst/include/avisitor.hpp
+++ b/inst/include/avisitor.hpp
@@ -1,5 +1,5 @@
/* Hector -- A Simple Climate Model
- Copyright (C) 2014-2015 Battelle Memorial Institute
+ Copyright (C) 2022 Battelle Memorial Institute
Please see the accompanying file LICENSE.md for additional licensing
information.
@@ -14,6 +14,8 @@
*
*/
+#include
+
namespace Hector {
// Forward declare all visitable subclasses.
@@ -30,6 +32,7 @@ class N2OComponent;
class TemperatureComponent;
class BlackCarbonComponent;
class OrganicCarbonComponent;
+class NH3Component;
class OceanComponent;
class SulfurComponent;
class OzoneComponent;
@@ -40,41 +43,53 @@ class OzoneComponent;
*/
class AVisitor {
public:
- inline virtual ~AVisitor();
+ inline virtual ~AVisitor();
+
+ //------------------------------------------------------------------------------
+ /*! \brief Determine if the visitor needs to collect data at the given model
+ * date.
+ * \param date The model date which just finished solving.
+ * \return True if the visitor wants to visit at date.
+ */
+ virtual bool shouldVisit(const bool in_spinup, const double date) = 0;
+
+ //------------------------------------------------------------------------------
+ /*! \brief Allow visitors to reset their data upon a core reset.
+ * \param reset_date The date to reset to.
+ */
+ virtual void reset(const double reset_date) {}
- //------------------------------------------------------------------------------
- /*! \brief Determine if the visitor needs to collect data at the given model
- * date.
- * \param date The model date which just finished solving.
- * \return True if the visitor wants to visit at date.
- */
- virtual bool shouldVisit( const bool in_spinup, const double date ) = 0;
+ //------------------------------------------------------------------------------
+ /*! \brief Update the Tracking Data output if applicable.
+ * \param tracking_out The Tracking Data output stream to place results into.
+ */
+ virtual void outputTrackingData(std::ostream &tracking_out) const {}
- //------------------------------------------------------------------------------
- // Add a visit for all visitable subclasses here.
- // TODO: should we create a .cpp for these?
- virtual void visit( Core* core ) {}
- virtual void visit( DummyModelComponent* c ) {}
- virtual void visit( ForcingComponent* c ) {}
- virtual void visit( slrComponent* c ) {}
- virtual void visit( CarbonCycleSolver* c ) {}
- virtual void visit( SimpleNbox* c ) {}
- virtual void visit( HalocarbonComponent* c ) {}
- virtual void visit( OHComponent* c ) {}
- virtual void visit( CH4Component* c ) {}
- virtual void visit( N2OComponent* c ) {}
- virtual void visit( TemperatureComponent* c ) {}
- virtual void visit( BlackCarbonComponent* c ) {}
- virtual void visit( OrganicCarbonComponent* c ) {}
- virtual void visit( OceanComponent* c ) {}
- virtual void visit( SulfurComponent* c ) {}
- virtual void visit( OzoneComponent* c ) {}
+ //------------------------------------------------------------------------------
+ // Add a visit for all visitable subclasses here.
+ // TODO: should we create a .cpp for these?
+ virtual void visit(Core *core) {}
+ virtual void visit(DummyModelComponent *c) {}
+ virtual void visit(ForcingComponent *c) {}
+ virtual void visit(slrComponent *c) {}
+ virtual void visit(CarbonCycleSolver *c) {}
+ virtual void visit(SimpleNbox *c) {}
+ virtual void visit(HalocarbonComponent *c) {}
+ virtual void visit(OHComponent *c) {}
+ virtual void visit(CH4Component *c) {}
+ virtual void visit(N2OComponent *c) {}
+ virtual void visit(TemperatureComponent *c) {}
+ virtual void visit(BlackCarbonComponent *c) {}
+ virtual void visit(OrganicCarbonComponent *c) {}
+ virtual void visit(NH3Component *c) {}
+ virtual void visit(OceanComponent *c) {}
+ virtual void visit(SulfurComponent *c) {}
+ virtual void visit(OzoneComponent *c) {}
};
// Inline methods
-AVisitor::~AVisitor() {
-}
+AVisitor::~AVisitor() {}
-}
+} // namespace Hector
#endif // AVISITOR_H
diff --git a/inst/include/bc_component.hpp b/inst/include/bc_component.hpp
index cbfd04607..4868f8067 100644
--- a/inst/include/bc_component.hpp
+++ b/inst/include/bc_component.hpp
@@ -1,5 +1,5 @@
/* Hector -- A Simple Climate Model
- Copyright (C) 2014-2015 Battelle Memorial Institute
+ Copyright (C) 2022 Battelle Memorial Institute
Please see the accompanying file LICENSE.md for additional licensing
information.
@@ -29,46 +29,44 @@ namespace Hector {
class BlackCarbonComponent : public IModelComponent {
public:
- BlackCarbonComponent();
- ~BlackCarbonComponent();
+ BlackCarbonComponent();
+ ~BlackCarbonComponent();
- // IModelComponent methods
- virtual std::string getComponentName() const;
+ // IModelComponent methods
+ virtual std::string getComponentName() const;
- virtual void init( Core* core );
+ virtual void init(Core *core);
- virtual unitval sendMessage( const std::string& message,
- const std::string& datum,
- const message_data info=message_data() );
+ virtual unitval sendMessage(const std::string &message,
+ const std::string &datum,
+ const message_data info = message_data());
- virtual void setData( const std::string& varName,
- const message_data& data );
+ virtual void setData(const std::string &varName, const message_data &data);
- virtual void prepareToRun();
+ virtual void prepareToRun();
- virtual void run( const double runToDate );
+ virtual void run(const double runToDate);
- virtual void reset(double time);
+ virtual void reset(double time);
- virtual void shutDown();
+ virtual void shutDown();
- // IVisitable methods
- virtual void accept( AVisitor* visitor );
+ // IVisitable methods
+ virtual void accept(AVisitor *visitor);
private:
- virtual unitval getData( const std::string& varName,
- const double date );
+ virtual unitval getData(const std::string &varName, const double date);
- //! Emissions time series
- tseries BC_emissions;
+ //! Emissions time series
+ tseries BC_emissions;
- //! logger
- Logger logger;
+ //! logger
+ Logger logger;
- Core *core;
- double oldDate;
+ Core *core;
+ double oldDate;
};
-}
+} // namespace Hector
#endif // BLACK_CARBON_COMPONENT_H
diff --git a/inst/include/carbon-cycle-model.hpp b/inst/include/carbon-cycle-model.hpp
index eed4e750b..ac27d1c94 100644
--- a/inst/include/carbon-cycle-model.hpp
+++ b/inst/include/carbon-cycle-model.hpp
@@ -1,8 +1,8 @@
- /* Hector -- A Simple Climate Model
- Copyright (C) 2014-2015 Battelle Memorial Institute
+/* Hector -- A Simple Climate Model
+ Copyright (C) 2022 Battelle Memorial Institute
- Please see the accompanying file LICENSE.md for additional licensing
- information.
+ Please see the accompanying file LICENSE.md for additional licensing
+ information.
*/
#ifndef CARBON_CYCLE_MODEL_HPP_
#define CARBON_CYCLE_MODEL_HPP_
@@ -16,17 +16,18 @@
#include
-#include "imodel_component.hpp"
#include "core.hpp"
-#include "unitval.hpp"
#include "h_util.hpp"
+#include "imodel_component.hpp"
+#include "unitval.hpp"
// CO2 ppmv in molar mass dimension
-// 1 ppm by volume of atmosphere CO2 = 2.13 Gt C, from http://cdiac.ornl.gov/pns/convert.html
+// 1 ppm by volume of atmosphere CO2 = 2.13 Gt C, from
+// http://cdiac.ornl.gov/pns/convert.html
// and Wigley (1993)
// So to convert 1 Pg C to 1 ppmv CO2...
-#define PGC_TO_PPMVCO2 (1.0/2.13)
-#define PPMVCO2_TO_PGC (1.0/PGC_TO_PPMVCO2)
+#define PGC_TO_PPMVCO2 (1.0 / 2.13)
+#define PPMVCO2_TO_PGC (1.0 / PGC_TO_PPMVCO2)
// Signal from model to the solver that, while we haven't failed,
// need to stash C values and re-try reaching next timestep
@@ -47,96 +48,95 @@ namespace Hector {
class CarbonCycleModel : public IModelComponent {
public:
- CarbonCycleModel( int ncpools=0 ) : nc( ncpools ) {}
- virtual ~CarbonCycleModel() {}
- // We will want to put some data accessor methods here, but it's not
- // clear what would be appropriate.
-
- int ncpool() const { return nc; }
-
- // IModelComponent methods
- std::string getComponentName() const { return std::string( CCS_COMPONENT_NAME ); }
-
- virtual void init( Core* core );
-
- // The model interface, as seen by the solver
-
- //! Copy the values of the carbon pools into the input array,
- //! stripping off units as necessary.
- virtual void getCValues( double t, double c[] ) = 0;
-
- //! Calculate the derivatives of the carbon pool values and store in
- //! dcdt.
- //! \details The function calcderivs is evaluating is dc/dt =
- //! F(c; t, params). c and t are passed in; params can be any state
- //! that is stored in the class's member variables.
- virtual int calcderivs( double t, const double c[], double dcdt[] ) const = 0;
-
- //! Calculate updates to the model's "slowly varying" variables.
-
- //! \details The model is allowed to have certain variables that are
- //! assumed to be expensive enough that we want to calculate them
- //! only once per time step and slowly varying enough that we can
- //! get away with doing so (e.g. temperature). The solver calls
- //! this function when necessary to perform that update. The
- //! variables should be updated with the c and t values passed in,
- //! as these will generally be different from the last time variable
- //! the model saw from the core.
- virtual void slowparameval( double t, const double c[] ) = 0;
-
- //! Copy the C values back into the model, restore units, etc.
- virtual void stashCValues( double t, const double c[] ) = 0;
-
- //! Record the final state at the end of a time step
-
- //! \details This method should copy all state variables into a
- //! time-indexed array. Mostly this will allow the object to
- //! reset to a previous time, but the object may also use these
- //! arrays to provide other components with data from the entire
- //! history of the run. If a carbon cycle class stores
- //! time-indexed values in the course of its normal operation,
- //! then there might not be any need to do this copying. In that
- //! case, the class can inherit the default implementation of the
- //! method, which does nothing.
- virtual void record_state(double t) {}
-
- // Create, delete, and rename biomes. These must be defined here
- // because some C cycle models (e.g. the ocean C cycle component)
- // will not have biomes, but are members of the `CarbonCycleModel`
- // class. For more details and reference implementation, see the
- // `SimpleNBox` model.
- inline
- virtual void createBiome(const std::string& biome) {
- H_THROW("`createBiome` is not defined for this component.")
- }
- inline
- virtual void deleteBiome(const std::string& biome) {
- H_THROW("`deleteBiome` is not defined for this component.")
- };
- inline
- virtual void renameBiome(const std::string& oldname, const std::string& newname){
- H_THROW("`renameBiome` is not defined for this component.")
- }
+ CarbonCycleModel(int ncpools = 0) : nc(ncpools) {}
+ virtual ~CarbonCycleModel() {}
+ // We will want to put some data accessor methods here, but it's not
+ // clear what would be appropriate.
+
+ int ncpool() const { return nc; }
+
+ // IModelComponent methods
+ std::string getComponentName() const {
+ return std::string(CCS_COMPONENT_NAME);
+ }
+
+ virtual void init(Core *core);
+
+ // The model interface, as seen by the solver
+
+ //! Copy the values of the carbon pools into the input array,
+ //! stripping off units as necessary.
+ virtual void getCValues(double t, double c[]) = 0;
+
+ //! Calculate the derivatives of the carbon pool values and store in
+ //! dcdt.
+ //! \details The function calcderivs is evaluating is dc/dt =
+ //! F(c; t, params). c and t are passed in; params can be any state
+ //! that is stored in the class's member variables.
+ virtual int calcderivs(double t, const double c[], double dcdt[]) const = 0;
+
+ //! Calculate updates to the model's "slowly varying" variables.
+
+ //! \details The model is allowed to have certain variables that are
+ //! assumed to be expensive enough that we want to calculate them
+ //! only once per time step and slowly varying enough that we can
+ //! get away with doing so (e.g. temperature). The solver calls
+ //! this function when necessary to perform that update. The
+ //! variables should be updated with the c and t values passed in,
+ //! as these will generally be different from the last time variable
+ //! the model saw from the core.
+ virtual void slowparameval(double t, const double c[]) = 0;
+
+ //! Copy the C values back into the model, restore units, etc.
+ virtual void stashCValues(double t, const double c[]) = 0;
+
+ //! Record the final state at the end of a time step
+
+ //! \details This method should copy all state variables into a
+ //! time-indexed array. Mostly this will allow the object to
+ //! reset to a previous time, but the object may also use these
+ //! arrays to provide other components with data from the entire
+ //! history of the run. If a carbon cycle class stores
+ //! time-indexed values in the course of its normal operation,
+ //! then there might not be any need to do this copying. In that
+ //! case, the class can inherit the default implementation of the
+ //! method, which does nothing.
+ virtual void record_state(double t) {}
+
+ // Create, delete, and rename biomes. These must be defined here
+ // because some C cycle models (e.g. the ocean C cycle component)
+ // will not have biomes, but are members of the `CarbonCycleModel`
+ // class. For more details and reference implementation, see the
+ // `SimpleNBox` model.
+ inline virtual void createBiome(const std::string &biome) {
+ H_THROW("`createBiome` is not defined for this component.")
+ }
+ inline virtual void deleteBiome(const std::string &biome){
+ H_THROW("`deleteBiome` is not defined for this component.")};
+ inline virtual void renameBiome(const std::string &oldname,
+ const std::string &newname) {
+ H_THROW("`renameBiome` is not defined for this component.")
+ }
protected:
- //! Number of carbon pools in the model.
- //! \details nc must be constant over the life of the calculation.
- //! Often it will be known from the moment the model is
- //! instantiated, but we leave open the possibility that it might be
- //! affected by some user settable parameters (e.g. number of deep
- //! ocean boxes).
- int nc;
-
- // Time
- double ODEstartdate; //!< Date tracking
-
- //! logger for use by subclasses
- Logger logger;
-
- //! Pointers to the core
- Core *core;
+ //! Number of carbon pools in the model.
+ //! \details nc must be constant over the life of the calculation.
+ //! Often it will be known from the moment the model is
+ //! instantiated, but we leave open the possibility that it might be
+ //! affected by some user settable parameters (e.g. number of deep
+ //! ocean boxes).
+ int nc;
+
+ // Time
+ double ODEstartdate; //!< Date tracking
+
+ //! logger for use by subclasses
+ Logger logger;
+
+ //! Pointers to the core
+ Core *core;
};
-}
+} // namespace Hector
#endif
diff --git a/inst/include/carbon-cycle-solver.hpp b/inst/include/carbon-cycle-solver.hpp
index 68bd0aeef..0ef7e5b12 100644
--- a/inst/include/carbon-cycle-solver.hpp
+++ b/inst/include/carbon-cycle-solver.hpp
@@ -1,5 +1,5 @@
/* Hector -- A Simple Climate Model
- Copyright (C) 2014-2015 Battelle Memorial Institute
+ Copyright (C) 2022 Battelle Memorial Institute
Please see the accompanying file LICENSE.md for additional licensing
information.
@@ -16,14 +16,14 @@
#include
-#include "logger.hpp"
#include "carbon-cycle-model.hpp"
#include "h_util.hpp"
+#include "logger.hpp"
#define MAX_CARBON_MODEL_RETRIES 8
namespace Hector {
-
+
/*! \brief The carbon cycle solver component
*
* The strategy in this solver is to write the carbon cycle as
@@ -45,93 +45,93 @@ namespace Hector {
*
*/
class CarbonCycleSolver : public IModelComponent {
-
+
public:
- CarbonCycleSolver();
- virtual ~CarbonCycleSolver();
-
- //! Return a carbon pool value. Components will know which one they want.
- double cpool( int i ) const { return c[ i ]; }
-
-
- // IModelComponent methods
- std::string getComponentName() const { return std::string( CCS_COMPONENT_NAME ); }
-
- virtual void init( Core* core );
-
- virtual unitval sendMessage( const std::string& message,
- const std::string& datum,
- const message_data info=message_data() );
-
- virtual void setData( const std::string& varName,
- const message_data& data );
-
- virtual void prepareToRun();
-
- virtual void run( const double runToDate );
-
- virtual bool run_spinup( const int step );
-
- virtual void reset(double date);
-
- virtual void shutDown();
-
-
- // IVisitable methods
- virtual void accept( AVisitor* visitor );
-
+ CarbonCycleSolver();
+ virtual ~CarbonCycleSolver();
+
+ //! Return a carbon pool value. Components will know which one they want.
+ double cpool(int i) const { return c[i]; }
+
+ // IModelComponent methods
+ std::string getComponentName() const {
+ return std::string(CCS_COMPONENT_NAME);
+ }
+
+ virtual void init(Core *core);
+
+ virtual unitval sendMessage(const std::string &message,
+ const std::string &datum,
+ const message_data info = message_data());
+
+ virtual void setData(const std::string &varName, const message_data &data);
+
+ virtual void prepareToRun();
+
+ virtual void run(const double runToDate);
+
+ virtual bool run_spinup(const int step);
+
+ virtual void reset(double date);
+
+ virtual void shutDown();
+
+ // IVisitable methods
+ virtual void accept(AVisitor *visitor);
+
private:
- virtual unitval getData( const std::string& varName,
- const double valueIndex );
-
- //! Number of variables to integrate
- int nc;
- //! Array of carbon pools (and such other vars as need to be integrated)
- std::vector c;
- //! time counter
- double t;
-
- //settable parameters
- //! Absolute error tolerance for integration
- double eps_abs;
- //! Relative error tolerance for integration
- double eps_rel;
- //! Default stepsize (years) -- the integrator will adjust this as required
- double dt;
-
- unitval eps_spinup; //! spinup epsilon (drift/tolerance), Pg C
-
- struct bad_derivative_exception {
- bad_derivative_exception(const int status):errorFlag(status) { }
- int errorFlag;
- };
- // A functor to provide callbacks for the ODE solver.
- struct ODEEvalFunctor {
- ODEEvalFunctor( CarbonCycleModel* cmodel, double* time ):modelptr(cmodel), t(time) { }
- void operator()( const std::vector& y, std::vector& dydt, double t );
- void operator()( const std::vector& y, double t );
- CarbonCycleModel* modelptr;
- double* t;
- };
-
- void failure( int stat, double t0, double tmid );
-
- bool in_spinup;
-
- // Pointers to other components
- Core *core;
- CarbonCycleModel *cmodel;
-
- //! Logger for solver
- Logger logger;
-
- //! Internal working space
- std::vector c_original;
- std::vector c_old;
- std::vector c_new;
- std::vector dcdt;
+ virtual unitval getData(const std::string &varName, const double valueIndex);
+
+ //! Number of variables to integrate
+ int nc;
+ //! Array of carbon pools (and such other vars as need to be integrated)
+ std::vector c;
+ //! time counter
+ double t;
+
+ // settable parameters
+ //! Absolute error tolerance for integration
+ double eps_abs;
+ //! Relative error tolerance for integration
+ double eps_rel;
+ //! Default stepsize (years) -- the integrator will adjust this as required
+ double dt;
+
+ unitval eps_spinup; //! spinup epsilon (drift/tolerance), Pg C
+
+ struct bad_derivative_exception {
+ bad_derivative_exception(const int status) : errorFlag(status) {}
+ int errorFlag;
+ };
+ // A functor to provide callbacks for the ODE solver.
+ struct ODEEvalFunctor {
+ ODEEvalFunctor(CarbonCycleModel *cmodel, double *time)
+ : modelptr(cmodel), t(time) {}
+ void operator()(const std::vector &y, std::vector &dydt,
+ double t);
+ void operator()(const std::vector &y, double t);
+ CarbonCycleModel *modelptr;
+ double *t;
+ };
+
+ void failure(int stat, double t0, double tmid);
+
+ bool in_spinup;
+
+ // Pointers to other components
+ Core *core;
+ CarbonCycleModel *cmodel;
+
+ //! Logger for solver
+ Logger logger;
+
+ //! Internal working space
+ std::vector c_original;
+ std::vector c_old;
+ std::vector c_new;
+ std::vector dcdt;
};
-}
+} // namespace Hector
#endif
diff --git a/inst/include/ch4_component.hpp b/inst/include/ch4_component.hpp
index ce36d0811..c68580ee1 100644
--- a/inst/include/ch4_component.hpp
+++ b/inst/include/ch4_component.hpp
@@ -1,5 +1,5 @@
/* Hector -- A Simple Climate Model
- Copyright (C) 2014-2015 Battelle Memorial Institute
+ Copyright (C) 2022 Battelle Memorial Institute
Please see the accompanying file LICENSE.md for additional licensing
information.
@@ -28,52 +28,50 @@ namespace Hector {
class CH4Component : public IModelComponent {
public:
- CH4Component();
- ~CH4Component();
+ CH4Component();
+ ~CH4Component();
- // IModelComponent methods
- virtual std::string getComponentName() const;
+ // IModelComponent methods
+ virtual std::string getComponentName() const;
- virtual void init( Core* core );
+ virtual void init(Core *core);
- virtual unitval sendMessage( const std::string& message,
- const std::string& datum,
- const message_data info=message_data() );
+ virtual unitval sendMessage(const std::string &message,
+ const std::string &datum,
+ const message_data info = message_data());
- virtual void setData( const std::string& varName,
- const message_data& data );
+ virtual void setData(const std::string &varName, const message_data &data);
- virtual void prepareToRun();
+ virtual void prepareToRun();
- virtual void run( const double runToDate );
+ virtual void run(const double runToDate);
- virtual void reset(double time);
+ virtual void reset(double time);
- virtual void shutDown();
+ virtual void shutDown();
- // IVisitable methods
- virtual void accept( AVisitor* visitor );
+ // IVisitable methods
+ virtual void accept(AVisitor *visitor);
- private:
- virtual unitval getData( const std::string& varName,
- const double date );
- //! emissions time series
- tseries CH4_emissions;
- tseries CH4; // CH4 concentrations, ppbv CH4
- tseries CH4_constrain; // CH4 concentration constraint, ppbv CH4
- unitval M0; // preindustrial methane, ppbv CH4
- unitval UC_CH4; // conversion factor between emissions and concentration
- unitval CH4N; // annual natural emissions, Tg CH4/yr
- unitval Tsoil; // annual CH4 loss to soil, Tg CH4/yr
- unitval Tstrat; // annual CH4 loss to stratosphere, Tg CH4/yr
+private:
+ virtual unitval getData(const std::string &varName, const double date);
+ //! emissions time series
+ tseries CH4_emissions;
+ tseries CH4; // CH4 concentrations, ppbv CH4
+ tseries CH4_constrain; // CH4 concentration constraint, ppbv CH4
+ unitval M0; // preindustrial methane, ppbv CH4
+ unitval UC_CH4; // conversion factor between emissions and concentration
+ unitval CH4N; // annual natural emissions, Tg CH4/yr
+ unitval Tsoil; // lifetime of soil sink, yr
+ unitval Tstrat; // lifetime of tropospheric sink, yr
- // logger
- Logger logger;
+ // logger
+ Logger logger;
- Core *core;
- double oldDate;
+ Core *core;
+ double oldDate;
};
-}
+} // namespace Hector
#endif // CH4_COMPONENT_H
diff --git a/inst/include/component_data.hpp b/inst/include/component_data.hpp
index 1b177a089..9174f8452 100644
--- a/inst/include/component_data.hpp
+++ b/inst/include/component_data.hpp
@@ -1,5 +1,5 @@
/* Hector -- A Simple Climate Model
- Copyright (C) 2014-2015 Battelle Memorial Institute
+ Copyright (C) 2022 Battelle Memorial Institute
Please see the accompanying file LICENSE.md for additional licensing
information.
@@ -15,322 +15,399 @@
*/
#include "component_names.hpp"
-// ------------------- names of data being passed between components -------------------------
+// ------------------- names of data being passed between components
+// -------------------------
// Note names in INI input need to match these.
// core
-#define D_RUN_NAME "run_name"
-#define D_START_DATE "startDate"
-#define D_END_DATE "endDate"
-#define D_DO_SPINUP "do_spinup"
-#define D_MAX_SPINUP "max_spinup"
-#define D_ENABLED "enabled"
-#define D_OUTPUT_ENABLED "output"
+#define D_RUN_NAME "run_name"
+#define D_START_DATE "startDate"
+#define D_END_DATE "endDate"
+#define D_TRACKING_DATE "trackingDate"
+#define D_DO_SPINUP "do_spinup"
+#define D_MAX_SPINUP "max_spinup"
+#define D_ENABLED "enabled"
+#define D_OUTPUT_ENABLED "output"
// bc component
-#define D_EMISSIONS_BC "BC_emissions"
+#define D_EMISSIONS_BC "BC_emissions"
// carbon cycle solver
-#define D_CCS_EPS_ABS "eps_abs"
-#define D_CCS_EPS_REL "eps_rel"
-#define D_CCS_DT "dt"
-#define D_EPS_SPINUP "eps_spinup"
+#define D_CCS_EPS_ABS "eps_abs"
+#define D_CCS_EPS_REL "eps_rel"
+#define D_CCS_DT "dt"
+#define D_EPS_SPINUP "eps_spinup"
// forcing component
-#define D_RF_PREFIX "F"
-#define D_RF_TOTAL D_RF_PREFIX "tot"
-#define D_RF_T_ALBEDO D_RF_PREFIX "talbedo"
-#define D_FTOT_CONSTRAIN D_RF_PREFIX "tot_constrain"
-#define D_RF_BASEYEAR "baseyear"
-#define D_RF_CO2 D_RF_PREFIX "CO2"
-#define D_RF_N2O D_RF_PREFIX "N2O"
-#define D_RF_H2O_STRAT D_RF_PREFIX "H2O_strat"
-#define D_RF_O3_TROP D_RF_PREFIX "O3_trop"
-#define D_RF_BC D_RF_PREFIX "BC"
-#define D_RF_OC D_RF_PREFIX "OC"
-#define D_RF_SO2d D_RF_PREFIX "SO2d"
-#define D_RF_SO2i D_RF_PREFIX "SO2i"
-#define D_RF_SO2 D_RF_PREFIX "SO2"
-#define D_RF_VOL D_RF_PREFIX "vol" // forcing from volcanic so2
-#define D_RF_halocarbons D_RF_PREFIX "halocarbons"
+#define D_RF_PREFIX "RF_"
+#define D_RF_TOTAL D_RF_PREFIX "tot"
+#define D_RF_T_ALBEDO D_RF_PREFIX "albedo"
+#define D_FTOT_CONSTRAIN D_RF_PREFIX "tot_constrain"
+#define D_RF_BASEYEAR "baseyear"
+#define D_RF_CO2 D_RF_PREFIX "CO2"
+#define D_RF_N2O D_RF_PREFIX "N2O"
+#define D_RF_H2O_STRAT D_RF_PREFIX "H2O_strat"
+#define D_RF_O3_TROP D_RF_PREFIX "O3_trop"
+#define D_RF_BC D_RF_PREFIX "BC"
+#define D_RF_OC D_RF_PREFIX "OC"
+#define D_RF_NH3 D_RF_PREFIX "NH3"
+#define D_RF_SO2 D_RF_PREFIX "SO2"
+#define D_RF_ACI D_RF_PREFIX "aci" // forcing from aerosol-cloud interactions
+#define D_RF_VOL D_RF_PREFIX "vol" // forcing from volcanic so2
+#define D_RF_halocarbons D_RF_PREFIX "halocarbons"
+#define D_RF_MISC D_RF_PREFIX "misc" // miscellaneous radiative forcings
+#define D_QCO2 "qco2" // 2×CO2 RF
+#define D_DELTA_CH4 "delta_ch4" // forcing ch4 adjustment
+#define D_DELTA_N2O "delta_n2o" // forcing n2o adjustment
+#define D_DELTA_CO2 "delta_co2" // forcing co2 adjustment
+#define D_RHO_BC "rho_bc" // BC radiative efficiency
+#define D_RHO_OC "rho_oc" // BC radiative efficiency
+#define D_RHO_SO2 "rho_so2" // SO2 radiative efficiency
+#define D_RHO_NH3 "rho_nh3" // NH3 radiative efficiency
// halocarbon components
-#define D_RF_CF4 D_RF_PREFIX CF4_COMPONENT_BASE
-#define D_RF_C2F6 D_RF_PREFIX C2F6_COMPONENT_BASE
-#define D_RF_HFC23 D_RF_PREFIX HFC23_COMPONENT_BASE
-#define D_RF_HFC32 D_RF_PREFIX HFC32_COMPONENT_BASE
-#define D_RF_HFC4310 D_RF_PREFIX HFC4310_COMPONENT_BASE
-#define D_RF_HFC125 D_RF_PREFIX HFC125_COMPONENT_BASE
-#define D_RF_HFC134a D_RF_PREFIX HFC134a_COMPONENT_BASE
-#define D_RF_HFC143a D_RF_PREFIX HFC143a_COMPONENT_BASE
-#define D_RF_HFC227ea D_RF_PREFIX HFC227ea_COMPONENT_BASE
-#define D_RF_HFC245fa D_RF_PREFIX HFC245fa_COMPONENT_BASE
-#define D_RF_SF6 D_RF_PREFIX SF6_COMPONENT_BASE
-#define D_RF_CFC11 D_RF_PREFIX CFC11_COMPONENT_BASE
-#define D_RF_CFC12 D_RF_PREFIX CFC12_COMPONENT_BASE
-#define D_RF_CFC113 D_RF_PREFIX CFC113_COMPONENT_BASE
-#define D_RF_CFC114 D_RF_PREFIX CFC114_COMPONENT_BASE
-#define D_RF_CFC115 D_RF_PREFIX CFC115_COMPONENT_BASE
-#define D_RF_CCl4 D_RF_PREFIX CCl4_COMPONENT_BASE
-#define D_RF_CH3CCl3 D_RF_PREFIX CH3CCl3_COMPONENT_BASE
-#define D_RF_HCFC22 D_RF_PREFIX HCFC22_COMPONENT_BASE
-#define D_RF_HCFC141b D_RF_PREFIX HCFC141b_COMPONENT_BASE
-#define D_RF_HCFC142b D_RF_PREFIX HCFC142b_COMPONENT_BASE
-#define D_RF_halon1211 D_RF_PREFIX halon1211_COMPONENT_BASE
-#define D_RF_halon1301 D_RF_PREFIX halon1301_COMPONENT_BASE
-#define D_RF_halon2402 D_RF_PREFIX halon2402_COMPONENT_BASE
-#define D_RF_CH3Cl D_RF_PREFIX CH3Cl_COMPONENT_BASE
-#define D_RF_CH3Br D_RF_PREFIX CH3Br_COMPONENT_BASE
+#define D_RF_CF4 D_RF_PREFIX CF4_COMPONENT_BASE
+#define D_RF_C2F6 D_RF_PREFIX C2F6_COMPONENT_BASE
+#define D_RF_HFC23 D_RF_PREFIX HFC23_COMPONENT_BASE
+#define D_RF_HFC32 D_RF_PREFIX HFC32_COMPONENT_BASE
+#define D_RF_HFC4310 D_RF_PREFIX HFC4310_COMPONENT_BASE
+#define D_RF_HFC125 D_RF_PREFIX HFC125_COMPONENT_BASE
+#define D_RF_HFC134a D_RF_PREFIX HFC134a_COMPONENT_BASE
+#define D_RF_HFC143a D_RF_PREFIX HFC143a_COMPONENT_BASE
+#define D_RF_HFC227ea D_RF_PREFIX HFC227ea_COMPONENT_BASE
+#define D_RF_HFC245fa D_RF_PREFIX HFC245fa_COMPONENT_BASE
+#define D_RF_SF6 D_RF_PREFIX SF6_COMPONENT_BASE
+#define D_RF_CFC11 D_RF_PREFIX CFC11_COMPONENT_BASE
+#define D_RF_CFC12 D_RF_PREFIX CFC12_COMPONENT_BASE
+#define D_RF_CFC113 D_RF_PREFIX CFC113_COMPONENT_BASE
+#define D_RF_CFC114 D_RF_PREFIX CFC114_COMPONENT_BASE
+#define D_RF_CFC115 D_RF_PREFIX CFC115_COMPONENT_BASE
+#define D_RF_CCl4 D_RF_PREFIX CCl4_COMPONENT_BASE
+#define D_RF_CH3CCl3 D_RF_PREFIX CH3CCl3_COMPONENT_BASE
+#define D_RF_HCFC22 D_RF_PREFIX HCFC22_COMPONENT_BASE
+#define D_RF_HCFC141b D_RF_PREFIX HCFC141b_COMPONENT_BASE
+#define D_RF_HCFC142b D_RF_PREFIX HCFC142b_COMPONENT_BASE
+#define D_RF_halon1211 D_RF_PREFIX halon1211_COMPONENT_BASE
+#define D_RF_halon1301 D_RF_PREFIX halon1301_COMPONENT_BASE
+#define D_RF_halon2402 D_RF_PREFIX halon2402_COMPONENT_BASE
+#define D_RF_CH3Cl D_RF_PREFIX CH3Cl_COMPONENT_BASE
+#define D_RF_CH3Br D_RF_PREFIX CH3Br_COMPONENT_BASE
// Adjusted (i.e., relative) halocarbon forcings
// Forcings are tracked relative to the base year forcings, but the
// halocarbon components don't know that. These capabilities allow
// a caller to fetch the adjusted values from the forcing component.
-#define D_RFADJ_PREFIX "Fadj"
-#define D_RFADJ_CF4 D_RFADJ_PREFIX CF4_COMPONENT_BASE
-#define D_RFADJ_C2F6 D_RFADJ_PREFIX C2F6_COMPONENT_BASE
-#define D_RFADJ_HFC23 D_RFADJ_PREFIX HFC23_COMPONENT_BASE
-#define D_RFADJ_HFC32 D_RFADJ_PREFIX HFC32_COMPONENT_BASE
-#define D_RFADJ_HFC4310 D_RFADJ_PREFIX HFC4310_COMPONENT_BASE
-#define D_RFADJ_HFC125 D_RFADJ_PREFIX HFC125_COMPONENT_BASE
-#define D_RFADJ_HFC134a D_RFADJ_PREFIX HFC134a_COMPONENT_BASE
-#define D_RFADJ_HFC143a D_RFADJ_PREFIX HFC143a_COMPONENT_BASE
-#define D_RFADJ_HFC227ea D_RFADJ_PREFIX HFC227ea_COMPONENT_BASE
-#define D_RFADJ_HFC245fa D_RFADJ_PREFIX HFC245fa_COMPONENT_BASE
-#define D_RFADJ_SF6 D_RFADJ_PREFIX SF6_COMPONENT_BASE
-#define D_RFADJ_CFC11 D_RFADJ_PREFIX CFC11_COMPONENT_BASE
-#define D_RFADJ_CFC12 D_RFADJ_PREFIX CFC12_COMPONENT_BASE
-#define D_RFADJ_CFC113 D_RFADJ_PREFIX CFC113_COMPONENT_BASE
-#define D_RFADJ_CFC114 D_RFADJ_PREFIX CFC114_COMPONENT_BASE
-#define D_RFADJ_CFC115 D_RFADJ_PREFIX CFC115_COMPONENT_BASE
-#define D_RFADJ_CCl4 D_RFADJ_PREFIX CCl4_COMPONENT_BASE
-#define D_RFADJ_CH3CCl3 D_RFADJ_PREFIX CH3CCl3_COMPONENT_BASE
-#define D_RFADJ_HCFC22 D_RFADJ_PREFIX HCFC22_COMPONENT_BASE
-#define D_RFADJ_HCFC141b D_RFADJ_PREFIX HCFC141b_COMPONENT_BASE
-#define D_RFADJ_HCFC142b D_RFADJ_PREFIX HCFC142b_COMPONENT_BASE
-#define D_RFADJ_halon1211 D_RFADJ_PREFIX halon1211_COMPONENT_BASE
-#define D_RFADJ_halon1301 D_RFADJ_PREFIX halon1301_COMPONENT_BASE
-#define D_RFADJ_halon2402 D_RFADJ_PREFIX halon2402_COMPONENT_BASE
-#define D_RFADJ_CH3Cl D_RFADJ_PREFIX CH3Cl_COMPONENT_BASE
-#define D_RFADJ_CH3Br D_RFADJ_PREFIX CH3Br_COMPONENT_BASE
-#define N_HALO_FORCINGS 26
-
+#define D_RFADJ_PREFIX "Fadj"
+#define D_RFADJ_CF4 D_RFADJ_PREFIX CF4_COMPONENT_BASE
+#define D_RFADJ_C2F6 D_RFADJ_PREFIX C2F6_COMPONENT_BASE
+#define D_RFADJ_HFC23 D_RFADJ_PREFIX HFC23_COMPONENT_BASE
+#define D_RFADJ_HFC32 D_RFADJ_PREFIX HFC32_COMPONENT_BASE
+#define D_RFADJ_HFC4310 D_RFADJ_PREFIX HFC4310_COMPONENT_BASE
+#define D_RFADJ_HFC125 D_RFADJ_PREFIX HFC125_COMPONENT_BASE
+#define D_RFADJ_HFC134a D_RFADJ_PREFIX HFC134a_COMPONENT_BASE
+#define D_RFADJ_HFC143a D_RFADJ_PREFIX HFC143a_COMPONENT_BASE
+#define D_RFADJ_HFC227ea D_RFADJ_PREFIX HFC227ea_COMPONENT_BASE
+#define D_RFADJ_HFC245fa D_RFADJ_PREFIX HFC245fa_COMPONENT_BASE
+#define D_RFADJ_SF6 D_RFADJ_PREFIX SF6_COMPONENT_BASE
+#define D_RFADJ_CFC11 D_RFADJ_PREFIX CFC11_COMPONENT_BASE
+#define D_RFADJ_CFC12 D_RFADJ_PREFIX CFC12_COMPONENT_BASE
+#define D_RFADJ_CFC113 D_RFADJ_PREFIX CFC113_COMPONENT_BASE
+#define D_RFADJ_CFC114 D_RFADJ_PREFIX CFC114_COMPONENT_BASE
+#define D_RFADJ_CFC115 D_RFADJ_PREFIX CFC115_COMPONENT_BASE
+#define D_RFADJ_CCl4 D_RFADJ_PREFIX CCl4_COMPONENT_BASE
+#define D_RFADJ_CH3CCl3 D_RFADJ_PREFIX CH3CCl3_COMPONENT_BASE
+#define D_RFADJ_HCFC22 D_RFADJ_PREFIX HCFC22_COMPONENT_BASE
+#define D_RFADJ_HCFC141b D_RFADJ_PREFIX HCFC141b_COMPONENT_BASE
+#define D_RFADJ_HCFC142b D_RFADJ_PREFIX HCFC142b_COMPONENT_BASE
+#define D_RFADJ_halon1211 D_RFADJ_PREFIX halon1211_COMPONENT_BASE
+#define D_RFADJ_halon1301 D_RFADJ_PREFIX halon1301_COMPONENT_BASE
+#define D_RFADJ_halon2402 D_RFADJ_PREFIX halon2402_COMPONENT_BASE
+#define D_RFADJ_CH3Cl D_RFADJ_PREFIX CH3Cl_COMPONENT_BASE
+#define D_RFADJ_CH3Br D_RFADJ_PREFIX CH3Br_COMPONENT_BASE
+#define N_HALO_FORCINGS 26
// halocarbon emissions
-#define D_EMISSIONS_CF4 CF4_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_C2F6 C2F6_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HFC23 HFC23_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HFC32 HFC32_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HFC4310 HFC4310_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HFC125 HFC125_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HFC134a HFC134a_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HFC143a HFC143a_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HFC227ea HFC227ea_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HFC245fa HFC245fa_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_SF6 SF6_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_CFC11 CFC11_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_CFC12 CFC12_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_CFC113 CFC113_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_CFC114 CFC114_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_CFC115 CFC115_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_CCl4 CCl4_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_CH3CCl3 CH3CCl3_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HCFC22 HCFC22_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HCFC141b HCFC141b_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_HCFC142b HCFC142b_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_halon1211 halon1211_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_halon1301 halon1301_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_halon2402 halon2402_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_CH3Cl CH3Cl_COMPONENT_BASE EMISSIONS_EXTENSION
-#define D_EMISSIONS_CH3Br CH3Br_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CF4 CF4_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_C2F6 C2F6_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HFC23 HFC23_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HFC32 HFC32_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HFC4310 HFC4310_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HFC125 HFC125_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HFC134a HFC134a_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HFC143a HFC143a_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HFC227ea HFC227ea_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HFC245fa HFC245fa_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_SF6 SF6_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CFC11 CFC11_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CFC12 CFC12_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CFC113 CFC113_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CFC114 CFC114_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CFC115 CFC115_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CCl4 CCl4_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CH3CCl3 CH3CCl3_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HCFC22 HCFC22_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HCFC141b HCFC141b_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_HCFC142b HCFC142b_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_halon1211 halon1211_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_halon1301 halon1301_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_halon2402 halon2402_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CH3Cl CH3Cl_COMPONENT_BASE EMISSIONS_EXTENSION
+#define D_EMISSIONS_CH3Br CH3Br_COMPONENT_BASE EMISSIONS_EXTENSION
// halocarbon concentration constraints
-#define D_CONSTRAINT_CF4 CF4_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_C2F6 C2F6_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HFC23 HFC23_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HFC32 HFC32_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HFC4310 HFC4310_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HFC125 HFC125_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HFC134a HFC134a_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HFC143a HFC143a_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HFC227ea HFC227ea_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HFC245fa HFC245fa_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_SF6 SF6_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_CFC11 CFC11_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_CFC12 CFC12_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_CFC113 CFC113_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_CFC114 CFC114_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_CFC115 CFC115_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_CCl4 CCl4_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_CH3CCl3 CH3CCl3_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HCFC22 HCFC22_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HCFC141b HCFC141b_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_HCFC142b HCFC142b_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_halon1211 halon1211_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_halon1301 halon1301_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_halon2402 halon2402_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_CH3Cl CH3Cl_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
-#define D_CONSTRAINT_CH3Br CH3Br_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CF4 CF4_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_C2F6 C2F6_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HFC23 HFC23_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HFC32 HFC32_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HFC4310 HFC4310_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HFC125 HFC125_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HFC134a HFC134a_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HFC143a HFC143a_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HFC227ea HFC227ea_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HFC245fa HFC245fa_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_SF6 SF6_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CFC11 CFC11_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CFC12 CFC12_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CFC113 CFC113_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CFC114 CFC114_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CFC115 CFC115_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CCl4 CCl4_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CH3CCl3 CH3CCl3_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HCFC22 HCFC22_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HCFC141b HCFC141b_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_HCFC142b HCFC142b_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_halon1211 \
+ halon1211_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_halon1301 \
+ halon1301_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_halon2402 \
+ halon2402_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CH3Cl CH3Cl_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+#define D_CONSTRAINT_CH3Br CH3Br_COMPONENT_BASE CONC_CONSTRAINT_EXTENSION
+
+#define D_PREINDUSTRIAL_HC "H0"
+#define D_HC_CONCENTRATION "hc_concentration"
+#define D_HC_EMISSION "hc_emission"
+#define D_HC_TAU "tau"
+#define D_HC_MOLARMASS "molarMass"
+
+// specify the rho used by halocarbon component so that speicifc rhos can be
+// adjusted using the R wrapper
+// rho used by halocarbon component
+#define D_HCRHO_PREFIX "rho_"
+#define D_HCRHO_CF4 D_HCRHO_PREFIX CF4_COMPONENT_BASE
+#define D_HCRHO_C2F6 D_HCRHO_PREFIX C2F6_COMPONENT_BASE
+#define D_HCRHO_HFC23 D_HCRHO_PREFIX HFC23_COMPONENT_BASE
+#define D_HCRHO_HFC32 D_HCRHO_PREFIX HFC32_COMPONENT_BASE
+#define D_HCRHO_HFC4310 D_HCRHO_PREFIX HFC4310_COMPONENT_BASE
+#define D_HCRHO_HFC125 D_HCRHO_PREFIX HFC125_COMPONENT_BASE
+#define D_HCRHO_HFC134a D_HCRHO_PREFIX HFC134a_COMPONENT_BASE
+#define D_HCRHO_HFC143a D_HCRHO_PREFIX HFC143a_COMPONENT_BASE
+#define D_HCRHO_HFC227ea D_HCRHO_PREFIX HFC227ea_COMPONENT_BASE
+#define D_HCRHO_HFC245fa D_HCRHO_PREFIX HFC245fa_COMPONENT_BASE
+#define D_HCRHO_SF6 D_HCRHO_PREFIX SF6_COMPONENT_BASE
+#define D_HCRHO_CFC11 D_HCRHO_PREFIX CFC11_COMPONENT_BASE
+#define D_HCRHO_CFC12 D_HCRHO_PREFIX CFC12_COMPONENT_BASE
+#define D_HCRHO_CFC113 D_HCRHO_PREFIX CFC113_COMPONENT_BASE
+#define D_HCRHO_CFC114 D_HCRHO_PREFIX CFC114_COMPONENT_BASE
+#define D_HCRHO_CFC115 D_HCRHO_PREFIX CFC115_COMPONENT_BASE
+#define D_HCRHO_CCl4 D_HCRHO_PREFIX CCl4_COMPONENT_BASE
+#define D_HCRHO_CH3CCl3 D_HCRHO_PREFIX CH3CCl3_COMPONENT_BASE
+#define D_HCRHO_HCFC22 D_HCRHO_PREFIX HCFC22_COMPONENT_BASE
+#define D_HCRHO_HCFC141b D_HCRHO_PREFIX HCFC141b_COMPONENT_BASE
+#define D_HCRHO_HCFC142b D_HCRHO_PREFIX HCFC142b_COMPONENT_BASE
+#define D_HCRHO_halon1211 D_HCRHO_PREFIX halon1211_COMPONENT_BASE
+#define D_HCRHO_halon1301 D_HCRHO_PREFIX halon1301_COMPONENT_BASE
+#define D_HCRHO_halon2402 D_HCRHO_PREFIX halon2402_COMPONENT_BASE
+#define D_HCRHO_CH3Cl D_HCRHO_PREFIX CH3Cl_COMPONENT_BASE
+#define D_HCRHO_CH3Br D_HCRHO_PREFIX CH3Br_COMPONENT_BASE
-#define D_PREINDUSTRIAL_HC "H0"
-#define D_HC_CONCENTRATION "hc_concentration"
-#define D_HC_EMISSION "hc_emission"
-#define D_HC_TAU "tau"
-#define D_HC_RHO "rho"
-#define D_HC_MOLARMASS "molarMass"
+// specify the DELTA used by halocarbon component by the tropospheric
+// adjustments for the stratospheric-temperature adjusted radiative forcing.
+#define D_HCDELTA_PREFIX "delta_"
+#define D_HCDELTA_CF4 D_HCDELTA_PREFIX CF4_COMPONENT_BASE
+#define D_HCDELTA_C2F6 D_HCDELTA_PREFIX C2F6_COMPONENT_BASE
+#define D_HCDELTA_HFC23 D_HCDELTA_PREFIX HFC23_COMPONENT_BASE
+#define D_HCDELTA_HFC32 D_HCDELTA_PREFIX HFC32_COMPONENT_BASE
+#define D_HCDELTA_HFC4310 D_HCDELTA_PREFIX HFC4310_COMPONENT_BASE
+#define D_HCDELTA_HFC125 D_HCDELTA_PREFIX HFC125_COMPONENT_BASE
+#define D_HCDELTA_HFC134a D_HCDELTA_PREFIX HFC134a_COMPONENT_BASE
+#define D_HCDELTA_HFC143a D_HCDELTA_PREFIX HFC143a_COMPONENT_BASE
+#define D_HCDELTA_HFC227ea D_HCDELTA_PREFIX HFC227ea_COMPONENT_BASE
+#define D_HCDELTA_HFC245fa D_HCDELTA_PREFIX HFC245fa_COMPONENT_BASE
+#define D_HCDELTA_SF6 D_HCDELTA_PREFIX SF6_COMPONENT_BASE
+#define D_HCDELTA_CFC11 D_HCDELTA_PREFIX CFC11_COMPONENT_BASE
+#define D_HCDELTA_CFC12 D_HCDELTA_PREFIX CFC12_COMPONENT_BASE
+#define D_HCDELTA_CFC113 D_HCDELTA_PREFIX CFC113_COMPONENT_BASE
+#define D_HCDELTA_CFC114 D_HCDELTA_PREFIX CFC114_COMPONENT_BASE
+#define D_HCDELTA_CFC115 D_HCDELTA_PREFIX CFC115_COMPONENT_BASE
+#define D_HCDELTA_CCl4 D_HCDELTA_PREFIX CCl4_COMPONENT_BASE
+#define D_HCDELTA_CH3CCl3 D_HCDELTA_PREFIX CH3CCl3_COMPONENT_BASE
+#define D_HCDELTA_HCFC22 D_HCDELTA_PREFIX HCFC22_COMPONENT_BASE
+#define D_HCDELTA_HCFC141b D_HCDELTA_PREFIX HCFC141b_COMPONENT_BASE
+#define D_HCDELTA_HCFC142b D_HCDELTA_PREFIX HCFC142b_COMPONENT_BASE
+#define D_HCDELTA_halon1211 D_HCDELTA_PREFIX halon1211_COMPONENT_BASE
+#define D_HCDELTA_halon1301 D_HCDELTA_PREFIX halon1301_COMPONENT_BASE
+#define D_HCDELTA_halon2402 D_HCDELTA_PREFIX halon2402_COMPONENT_BASE
+#define D_HCDELTA_CH3Cl D_HCDELTA_PREFIX CH3Cl_COMPONENT_BASE
+#define D_HCDELTA_CH3Br D_HCDELTA_PREFIX CH3Br_COMPONENT_BASE
// methane component
-#define D_ATMOSPHERIC_CH4 "CH4"
-#define D_PREINDUSTRIAL_CH4 "M0"
-#define D_RF_CH4 "FCH4"
-#define D_EMISSIONS_CH4 "CH4_emissions"
-#define D_CONSTRAINT_CH4 "CH4_constrain"
-#define D_NATURAL_CH4 "CH4N"
-#define D_CONVERSION_CH4 "UC_CH4"
-#define D_LIFETIME_SOIL "Tsoil"
-#define D_LIFETIME_STRAT "Tstrat"
+#define D_CH4_CONC "CH4" CONCENTRATION_EXTENSION
+#define D_PREINDUSTRIAL_CH4 "M0"
+#define D_RF_CH4 "FCH4"
+#define D_EMISSIONS_CH4 "CH4_emissions"
+#define D_CONSTRAINT_CH4 "CH4_constrain"
+#define D_NATURAL_CH4 "CH4N"
+#define D_CONVERSION_CH4 "UC_CH4"
+#define D_LIFETIME_SOIL "Tsoil"
+#define D_LIFETIME_STRAT "Tstrat"
// n2o component
-#define D_ATMOSPHERIC_N2O "N2O"
-#define D_PREINDUSTRIAL_N2O "N0"
-#define D_EMISSIONS_N2O "N2O_emissions"
-#define D_CONSTRAINT_N2O "N2O_constrain"
-#define D_CONVERSION_N2O "UC_N2O"
-#define D_INITIAL_LIFETIME_N2O "TN2O0"
-#define D_NAT_EMISSIONS_N2O "N2O_natural_emissions"
-#define D_TAU_N2O "TAU_N2O"
+#define D_N2O_CONC "N2O" CONCENTRATION_EXTENSION
+#define D_PREINDUSTRIAL_N2O "N0"
+#define D_EMISSIONS_N2O "N2O_emissions"
+#define D_CONSTRAINT_N2O "N2O_constrain"
+#define D_CONVERSION_N2O "UC_N2O"
+#define D_INITIAL_LIFETIME_N2O "TN2O0"
+#define D_NAT_EMISSIONS_N2O "N2O_natural_emissions"
+#define D_TAU_N2O "TAU_N2O"
// oh component
-#define D_LIFETIME_OH "TAU_OH"
-#define D_INITIAL_LIFETIME_OH "TOH0"
-#define D_COEFFICENT_NOX "CNOX"
-#define D_COEFFICENT_CH4 "CCH4"
-#define D_COEFFICENT_NMVOC "CNMVOC"
-#define D_COEFFICENT_CO "CCO"
+#define D_LIFETIME_OH "TAU_OH"
+#define D_INITIAL_LIFETIME_OH "TOH0"
+#define D_COEFFICENT_NOX "CNOX"
+#define D_COEFFICENT_CH4 "CCH4"
+#define D_COEFFICENT_NMVOC "CNMVOC"
+#define D_COEFFICENT_CO "CCO"
-//o3 component
-#define D_PREINDUSTRIAL_O3 "PO3"
-#define D_ATMOSPHERIC_O3 "O3"
-#define D_ATMOSPHERIC_EM_CH4 "CH4"
-#define D_EMISSIONS_NOX "NOX_emissions"
-#define D_EMISSIONS_CO "CO_emissions"
-#define D_EMISSIONS_NMVOC "NMVOC_emissions"
-//Do not redefine Ma though it is used for o3 component
-//#define D_EMISSIONS_O3 "O3_concentration"
+// o3 component
+#define D_PREINDUSTRIAL_O3 "PO3"
+#define D_ATMOSPHERIC_O3 "O3" CONCENTRATION_EXTENSION
+#define D_ATMOSPHERIC_EM_CH4 "CH4"
+#define D_EMISSIONS_NOX "NOX_emissions"
+#define D_EMISSIONS_CO "CO_emissions"
+#define D_EMISSIONS_NMVOC "NMVOC_emissions"
// oc component
-#define D_EMISSIONS_OC "OC_emissions"
-
-// ocean component
-#define D_OCEAN_CFLUX "atm_ocean_flux"
-#define D_OCEAN_C "ocean_c"
-#define D_TT "tt"
-#define D_TU "tu"
-#define D_TWI "twi"
-#define D_TID "tid"
-#define D_CIRC_TOPT "circ_Topt"
-#define D_CIRC_T50_HIGH "circ_T50_high"
-#define D_CIRC_T50_LOW "circ_T50_low"
-#define D_HL_DO "HL_DO_Cflux"
-#define D_PH_HL "pH_HL"
-#define D_PH_LL "pH_LL"
-#define D_ATM_OCEAN_FLUX_HL "atm_ocean_flux_HL"
-#define D_ATM_OCEAN_FLUX_LL "atm_ocean_flux_LL"
-#define D_PCO2_HL "PCO2_HL"
-#define D_PCO2_LL "PCO2_LL"
-#define D_DIC_HL "DIC_HL"
-#define D_DIC_LL "DIC_LL"
-#define D_P0_LL "p0_LL"
-#define D_CARBON_HL "carbon_HL"
-#define D_CARBON_LL "carbon_LL"
-#define D_CARBON_IO "carbon_IO"
-#define D_CARBON_DO "carbon_DO"
-#define D_OMEGACA_HL "OmegaCa_HL"
-#define D_OMEGACA_LL "OmegaCa_LL"
-#define D_OMEGAAR_HL "OmegaAr_HL"
-#define D_OMEGAAR_LL "OmegaAr_LL"
-#define D_TEMP_HL "Temp_HL"
-#define D_TEMP_LL "Temp_LL"
-#define D_SPINUP_CHEM "spinup_chem"
+#define D_EMISSIONS_OC "OC_emissions"
-//#define D_SPECIFIC_HEAT "cp"
+// nh3 component
+#define D_EMISSIONS_NH3 "NH3_emissions"
-#define D_CO3_LL "CO3_LL"
-#define D_CO3_HL "CO3_HL"
-#define D_ATM_OCEAN_CONSTRAIN "atm_ocean_constrain"
-#define D_TIMESTEPS "ocean_timesteps"
-#define D_REVELLE_HL "Revelle_HL"
-#define D_REVELLE_LL "Revelle_LL"
+// ocean component
+#define D_OCEAN_C_UPTAKE "ocean_uptake"
+#define D_OCEAN_C "ocean_c"
+#define D_TT "tt"
+#define D_TU "tu"
+#define D_TWI "twi"
+#define D_TID "tid"
+#define D_HL_DO "HL_downwelling"
+#define D_PH_HL "HL_pH"
+#define D_PH_LL "LL_pH"
+#define D_PH "pH"
+#define D_ATM_OCEAN_FLUX_HL "HL_ocean_uptake"
+#define D_ATM_OCEAN_FLUX_LL "LL_ocean_uptake"
+#define D_PCO2_HL "HL_PCO2"
+#define D_PCO2_LL "LL_PCO2"
+#define D_PCO2 "PCO2"
+#define D_DIC_HL "HL_DIC"
+#define D_DIC_LL "LL_DIC"
+#define D_DIC "DIC"
+#define D_CARBON_HL "HL_ocean_c"
+#define D_CARBON_LL "LL_ocean_c"
+#define D_CARBON_ML "ML_ocean_c"
+#define D_CARBON_IO "IO_ocean_c"
+#define D_CARBON_DO "DO_ocean_c"
+#define D_CARBON_PRE_SURF "preind_surface_c"
+#define D_CARBON_PRE_ID "preind_interdeep_c"
+#define D_OMEGACA_HL "HL_OmegaCa"
+#define D_OMEGACA_LL "LL_OmegaCa"
+#define D_OMEGAAR_HL "HL_OmegaAr"
+#define D_OMEGAAR_LL "LL_OmegaAr"
+#define D_TEMP_HL "HL_sst"
+#define D_TEMP_LL "LL_sst"
+#define D_SPINUP_CHEM "spinup_chem"
+#define D_CO3_LL "LL_CO3"
+#define D_CO3_HL "HL_CO3"
+#define D_CO3 "CO3"
+#define D_TIMESTEPS "ocean_timesteps"
+#define D_REVELLE_HL "HL_Revelle"
+#define D_REVELLE_LL "LL_Revelle"
// SimpleNbox component
-#define D_LAND_CFLUX "atm_land_flux"
-#define D_ATMOSPHERIC_CO2 "Ca"
-#define D_PREINDUSTRIAL_CO2 "C0"
-#define D_ATMOSPHERIC_C "atmos_c"
+#define D_NBP "NBP"
+#define D_CO2_CONC "CO2" CONCENTRATION_EXTENSION
+#define D_PREINDUSTRIAL_CO2 "C0"
+#define D_ATMOSPHERIC_CO2 "atmos_co2"
#define D_ATMOSPHERIC_C_RESIDUAL "atmos_c_residual"
-#define D_EARTHC "earth_c"
-#define D_VEGC "veg_c"
-#define D_DETRITUSC "detritus_c"
-#define D_SOILC "soil_c"
-#define D_FFI_EMISSIONS "ffi_emissions"
-#define D_LUC_EMISSIONS "luc_emissions"
-#define D_CO2FERT "co2fert"
-#define D_TEMPFERTD "detritus_tempfert"
-#define D_TEMPFERTS "soil_tempfert"
-#define D_Q10_RH "q10_rh"
-#define D_NPP "npp"
-#define D_RH "rh"
-#define D_F_NPPV "f_nppv"
-#define D_F_NPPD "f_nppd"
-#define D_F_LITTERD "f_litterd"
-#define D_F_LUCV "f_lucv"
-#define D_F_LUCD "f_lucd"
-#define D_NPP_FLUX0 "npp_flux0"
-#define D_CO2_CONSTRAIN "CO2_constrain"
-#define D_BETA "beta"
-//#define D_SIGMA "sigma"
-#define D_WARMINGFACTOR "warmingfactor"
+#define D_EARTHC "earth_c"
+#define D_VEGC "veg_c"
+#define D_DETRITUSC "detritus_c"
+#define D_SOILC "soil_c"
+#define D_PERMAFROSTC "permafrost_c"
+#define D_THAWEDPC "thawedp_c"
+#define D_FFI_EMISSIONS "ffi_emissions"
+#define D_DACCS_UPTAKE "daccs_uptake"
+#define D_LUC_EMISSIONS "luc_emissions"
+#define D_LUC_UPTAKE "luc_uptake"
+#define D_TEMPFERTD "detritus_tempfert"
+#define D_TEMPFERTS "soil_tempfert"
+#define D_Q10_RH "q10_rh"
+#define D_NPP "NPP"
+#define D_RH "RH"
+#define D_RH_DETRITUS "rh_det"
+#define D_RH_SOIL "rh_soil"
+#define D_RH_THAWEDP "rh_thawedp"
+#define D_F_NPPV "f_nppv"
+#define D_F_NPPD "f_nppd"
+#define D_F_LITTERD "f_litterd"
+#define D_NPP_FLUX0 "npp_flux0"
+#define D_BETA "beta"
+#define D_WARMINGFACTOR "warmingfactor"
+#define D_F_FROZEN "f_frozen"
+#define D_RH_CH4 "rh_ch4"
+#define D_RH_CH4_FRAC "rh_ch4_frac"
+#define D_PF_SIGMA "pf_sigma"
+#define D_PF_MU "pf_mu"
+#define D_FPF_STATIC "fpf_static"
+
+// Constraints
+#define D_CO2_CONSTRAIN "CO2_constrain"
+#define D_TAS_CONSTRAIN "tas_constrain"
+#define D_NBP_CONSTRAIN "NBP_constrain"
// slr component
-#define D_SL_RC "sl_rc"
-#define D_SLR "slr"
-#define D_SL_RC_NO_ICE "sl_rc_no_ice"
-#define D_SLR_NO_ICE "slr_no_ice"
+#define D_SL_RC "sl_rc"
+#define D_SLR "slr"
+#define D_SL_RC_NO_ICE "sl_rc_no_ice"
+#define D_SLR_NO_ICE "slr_no_ice"
// so2 component
-#define D_NATURAL_SO2 "SN"
-#define D_2000_SO2 "S0"
-#define D_EMISSIONS_SO2 "SO2_emissions"
-#define D_VOLCANIC_SO2 "SV"
+#define D_EMISSIONS_SO2 "SO2_emissions"
+#define D_VOLCANIC_SO2 "SV"
// temperature component
-#define D_ECS "S"
-#define D_GLOBAL_TEMP "Tgav"
-#define D_LAND_AIR_TEMP "Tgav_land"
-#define D_OCEAN_SURFACE_TEMP "Tgav_ocean_ST"
-#define D_OCEAN_AIR_TEMP "Tgav_ocean_air"
-#define D_GLOBAL_TEMPEQ "Tgaveq"
-#define D_TGAV_CONSTRAIN "tgav_constrain"
-#define D_SO2D_B "so2d_b"
-#define D_SO2I_B "so2i_b"
-#define D_OC_B "oc_b"
-#define D_BC_B "bc_b"
-
-// temperature component
-#define D_DIFFUSIVITY "diff"
-#define D_AERO_SCALE "alpha"
-#define D_VOLCANIC_SCALE "volscl"
-#define D_FLUX_MIXED "flux_mixed"
-#define D_FLUX_INTERIOR "flux_interior"
-#define D_HEAT_FLUX "heatflux"
-
-// ------------------- messages being passed between components -------------------------
+#define D_ECS "S"
+#define D_GLOBAL_TAS "global_tas"
+#define D_LAND_TAS "land_tas"
+#define D_SST "sst"
+#define D_OCEAN_TAS "ocean_tas"
+#define D_LO_WARMING_RATIO "lo_warming_ratio"
+#define D_DIFFUSIVITY "diff"
+#define D_AERO_SCALE "alpha"
+#define D_VOLCANIC_SCALE "volscl"
+#define D_FLUX_MIXED "heatflux_mixed"
+#define D_FLUX_INTERIOR "heatflux_interior"
+#define D_HEAT_FLUX "heatflux"
-#define M_GETDATA "getData"
-#define M_SETDATA "setData"
+// ------------------- messages being passed between components
+// -------------------------
-#define M_DUMP_TO_DEEP_OCEAN "deepOceanCarbonDump"
+#define M_GETDATA "getData"
+#define M_SETDATA "setData"
+#define M_DUMP_TO_DEEP_OCEAN "deepOceanCarbonDump"
#endif
diff --git a/inst/include/component_names.hpp b/inst/include/component_names.hpp
index fb4d78d0b..1b4dc6ea8 100644
--- a/inst/include/component_names.hpp
+++ b/inst/include/component_names.hpp
@@ -1,5 +1,5 @@
/* Hector -- A Simple Climate Model
- Copyright (C) 2014-2015 Battelle Memorial Institute
+ Copyright (C) 2022 Battelle Memorial Institute
Please see the accompanying file LICENSE.md for additional licensing
information.
@@ -23,7 +23,7 @@
#define SIMPLENBOX_COMPONENT_NAME "simpleNbox"
#define CH4_COMPONENT_NAME "CH4"
-#define OH_COMPONENT_NAME "OH"
+#define OH_COMPONENT_NAME "OH"
#define N2O_COMPONENT_NAME "N2O"
#define TEMPERATURE_COMPONENT_NAME "temperature"
@@ -34,9 +34,9 @@
* The name of a HC emissions var is X_COMPONENT_BASE + EMISSIONS_EXTENSION
***/
#define HALOCARBON_EXTENSION "_halocarbon"
-#define EMISSIONS_EXTENSION "_emissions"
-#define CONCENTRATION_EXTENSION "_concentration"
-#define CONC_CONSTRAINT_EXTENSION "_constrain"
+#define EMISSIONS_EXTENSION "_emissions"
+#define CONCENTRATION_EXTENSION "_concentration"
+#define CONC_CONSTRAINT_EXTENSION "_constrain"
#define CF4_COMPONENT_BASE "CF4"
#define C2F6_COMPONENT_BASE "C2F6"
#define HFC23_COMPONENT_BASE "HFC23"
@@ -83,8 +83,8 @@
#define CCl4_COMPONENT_NAME CCl4_COMPONENT_BASE HALOCARBON_EXTENSION
#define CH3CCl3_COMPONENT_NAME CH3CCl3_COMPONENT_BASE HALOCARBON_EXTENSION
#define HCFC22_COMPONENT_NAME HCFC22_COMPONENT_BASE HALOCARBON_EXTENSION
-#define HCFC141b_COMPONENT_NAME HCFC141b_COMPONENT_BASE HALOCARBON_EXTENSION
-#define HCFC142b_COMPONENT_NAME HCFC142b_COMPONENT_BASE HALOCARBON_EXTENSION
+#define HCFC141b_COMPONENT_NAME HFC141b_COMPONENT_BASE HALOCARBON_EXTENSION
+#define HCFC142b_COMPONENT_NAME HFC142b_COMPONENT_BASE HALOCARBON_EXTENSION
#define halon1211_COMPONENT_NAME halon1211_COMPONENT_BASE HALOCARBON_EXTENSION
#define halon1301_COMPONENT_NAME halon1301_COMPONENT_BASE HALOCARBON_EXTENSION
#define halon2402_COMPONENT_NAME halon2402_COMPONENT_BASE HALOCARBON_EXTENSION
@@ -93,9 +93,10 @@
#define BLACK_CARBON_COMPONENT_NAME "bc"
#define ORGANIC_CARBON_COMPONENT_NAME "oc"
+#define NH3_COMPONENT_NAME "nh3"
#define SULFUR_COMPONENT_NAME "so2"
-#define FORCING_COMPONENT_NAME "forcing"
+#define FORCING_COMPONENT_NAME "forcing"
#define SLR_COMPONENT_NAME "slr"
#define OZONE_COMPONENT_NAME "ozone"
diff --git a/inst/include/core.hpp b/inst/include/core.hpp
index d41de8ec3..43b83366b 100644
--- a/inst/include/core.hpp
+++ b/inst/include/core.hpp
@@ -1,5 +1,5 @@
/* Hector -- A Simple Climate Model
- Copyright (C) 2014-2015 Battelle Memorial Institute
+ Copyright (C) 2022 Battelle Memorial Institute
Please see the accompanying file LICENSE.md for additional licensing
information.
@@ -10,18 +10,18 @@
* core.h - The core model which will manage model components
* hector
*
- * Created by Pralit on 10/29/10.
+ * Created by Pralit on 10/29/2010.
*
*/
+#include
#include