Skip to content

Commit 0e47bf5

Browse files
authored
Update documentation for TChem-atm version 2 release. (#75)
* Update documentation for TChem-atm version 2 release. * addressing Sam's comments. * Fixing file name.
1 parent 94417b7 commit 0e47bf5

File tree

10 files changed

+113
-22
lines changed

10 files changed

+113
-22
lines changed

docs/SIMPOL_example.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# **SIMPOL mass transfer**
2+
3+
Scripts to run and plot the outputs of this example are located at: `$TCHEM_INSTALL_PATH/examples/runs/atmospheric_chemistry/Simpol`. The bash script to run this case is shown below:
4+
5+
```bash
6+
exec=$TCHEM_INSTALL_PATH/examples/TChem_AerosolChemistry.x
7+
8+
run_this="$exec --chemfile=config_gas.yaml \
9+
--aerofile=test_SIMPOL_phase_transfer.yaml \
10+
--inputfile_particles=scenario_conditions_particle.yaml \
11+
--outputfile=full_gas.dat \
12+
--time-iterations-per-interval=10 \
13+
--max-time-iterations=100\
14+
--tol-time=1e-3 \
15+
--atol-time=1e-12 \
16+
--dtmin=1e-20 \
17+
--dtmax=10\
18+
--tend=1000 \
19+
--atol-newton=1e-12 \
20+
--rtol-newton=1e-8 \
21+
--max-newton-iterations=20 \
22+
--max-time-iterations=200000"
23+
24+
echo $run_this
25+
eval $run_this
26+
```
27+
Here, the `TChem_AerosolChemistry.x` executable is a box model that integrates (in time) a list of species using the mechanism file specified in the `chemfile` and aerosol species specified in the `aerofile`.
28+
29+
TChem-atm provides executables for CVODE, `$TCHEM_INSTALL_PATH/examples/TChem_AerosolChemistry_CVODE.x`, and Kokkos-Kernels, $`TCHEM_INSTALL_PATH/examples/TChem_AerosolChemistry_KokkosKernels.x`.
30+
31+
The time profiles for ethanol and its aqueous solution are depicted in the figures below. These profiles were generated using TChem-atm, employing ODE solvers such as Tines, Kokkos-kernels (BDF), and Sundials (CVODE). For the purpose of code-to-code verification, we additionally showcase profiles derived from CAMP.
32+
33+
![TChem-atm vs CAMP](figures/simpol_ethanol.png)
34+
35+
36+
![TChem-atm vs CAMP](figures/simpol_ethanol_aq.png)

docs/examples.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[Carbon Bond 05](CB5_example.md)
22

33
[UCI Chemistry for E3SM Version 3](UCI_example.md)
4+
5+
6+
[SIMPOL](SIMPOL_example.md)

docs/figures/RHS_gas_aerosol.png

11.4 KB
Loading

docs/figures/simpol_ethanol.png

21 KB
Loading

docs/figures/simpol_ethanol_aq.png

18 KB
Loading

docs/index.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# **Overview**
22

3-
Tchem-atm is a chemistry solver for problems in atmospheric chemistry.
3+
TChem-atm is a chemistry solver for problems in atmospheric chemistry.
44
TChem-atm computes source terms and Jacobian matrices for chemical systems. It is a performance-portable software toolkit designed for complex kinetic mechanisms.
55

66
Software Design:
@@ -9,16 +9,15 @@ Software Design:
99
* [Kokkos](https://github.com/kokkos/kokkos.git) programming model for performance portability.
1010
* CMake build system.
1111
* Numerical and SACADO analytic Jacobian calculations for all models.
12-
* Coupling to external ODE solvers, e.g., [Tines](https://github.com/sandialabs/Tines), [Sundials](https://computing.llnl.gov/projects/sundials) (CVODE).
12+
* Coupling to external ODE solvers, e.g., [Tines](https://github.com/sandialabs/Tines), [Sundials](https://computing.llnl.gov/projects/sundials) (CVODE), [Kokkos-kernels](https://github.com/kokkos/kokkos-kernels)(BDF).
13+
* Continuous integration with GitHub Actions.
14+
* Code coverage with Codecov.
15+
* Online documentation deployed with GitHub Actions.
16+
* Docker support.
1317

1418
![TChem](figures/TChem_atm.png)
1519

16-
TChem-atm is configured using a YAML input file to construct the internal representation of the kinetic model, containing relevant parameters for the computation of chemical source terms.
17-
It computes reaction constants and rates of progress for all reactions and calculates the net production rate, or source terms, for all chemical species.
18-
TChem-atm automatically calculates the Jacobian matrix for source terms using either finite differences (numerical Jacobian) or automatic differentiation (analytical Jacobian via SACADO).
19-
Furthermore, the computation of the source term and associated Jacobian is independent of the time integration solver in TChem-atm.
20-
As such, TChem-atm provides an interface for time-stepping solutions (Box model) for the Tines and CVODE libraries.
21-
Finally, TChem-atm features a batched interface for all of the above calculations.
20+
TChem-atm is configured using a YAML input file to construct the internal representation of the kinetic model, containing relevant parameters for the computation of chemical source terms. It computes reaction constants and rates of progress for all reactions and calculates the net production rate, or source terms, for all chemical species. Furthermore, it provides an interface for gas-aerosol interactions that allows coupling with aerosol models. TChem-atm automatically calculates the Jacobian matrix for source terms using either finite differences (numerical Jacobian) or automatic differentiation (analytical Jacobian via SACADO). Furthermore, the computation of the source term and associated Jacobian is independent of the time integration solver in TChem-atm. As such, TChem-atm provides an interface for time-stepping solutions (Box model) for the Tines, CVODE, and Kokkos-kernels libraries. Finally, TChem-atm features a batched interface for all of the above calculations.
2221

2322
# **Citations**
2423

docs/input.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ species:
5050
5151
A description of the reaction types currently implemented in TChem-atm is presented in [Methodology section](methodology.md). In addition, a set of examples of input files is presented under `/src/examples/runs/atmopheric_chemistry`.
5252

53+
## **Gas-Aerosol Chemistry Input File**
54+
55+
To execute a gas-aerosol case in TChem-atm, one needs an input file with the aerosol mechanisms, `aerofile`, and a file where scenario particle information is given, `inputfile_particles`. The aerosol mechanism utilizes a YAML file and follows to the [CAMP format](https://github.com/open-atmos/camp). The scenario particle information follows this format:
56+
57+
```yaml
58+
particles:
59+
initial_state:
60+
species_name_1:
61+
initial_value: [1.0e-8]
62+
species_name_2:
63+
initial_value: [1.4e-2]
64+
num_concentration:
65+
initial_value: [1.3e6]
66+
67+
```
68+
In this structure, `species_name_1` denotes the initial concentration of species 1 within a single particle. It's important to note that the initial composition for species 1 is consistent across all particles.
69+
70+
Additionally, to incorporate gas-phase reactions into the simulation, a gas reaction mechanism can be seamlessly integrated into the gas-aerosol case.
5371
<!-- Future work -->
5472
<!-- ## Gas-Particle chemistry input file. -->
5573

docs/installation.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ TChem-atm requires the following third-party libraries:
1515
* [Sundials](https://github.com/LLNL/sundials.git)
1616
* [Gtest](https://github.com/google/googletest.git)
1717
* [Skywalker](https://github.com/eagles-project/skywalker.git)
18+
* [Kokkos-kernels](https://github.com/kokkos/kokkos-kernels)
1819

1920
These third-party libraries are submodules in TChem-atm.
2021
Thus, we can initialize them (i.e., download and update) using the following command:
@@ -39,27 +40,43 @@ To build/install with CUDA `ON` or `OFF`, use the flag:
3940
CUDA="ON" # Set to ON/OFF to compile TChem-atm with or without NVIDIA-GPUs support.
4041
```
4142

42-
Additionally, specify the root directory for installing/building the third-party libraries:
43+
To build/install with HIP `ON` or `OFF`, use the flag:
4344

4445
```bash
45-
ROOT=/path/to/tchem-atm/.
46+
HIP="ON" # Set to ON/OFF to compile TChem-atm with or without AMD-GPUs support.
4647
```
4748

48-
This script initializes the submodules and installs/builds the third-party libraries in the `$ROOT/HOST` or `$ROOT/DEVICE` directory, depending on whether `CUDA=OFF` or `CUDA=ON` is chosen.
49-
Since Kokkos can be installed/built with both CUDA `ON` or `OFF`, this script installs it in both `$ROOT/HOST` and `$ROOT/DEVICE`, while the other libraries are installed in `$ROOT/HOST`. Therefore, one must run this script using `CUDA=OFF` to install all third-party libraries and run it a second time with `CUDA=ON` if an NVIDIA GPU is available.
49+
Note that both CUDA and HIP cannot be enabled simultaneously.
5050

51-
## **Building and installing TChem-atm and Tines**
52-
The script `scripts/build_script.sh` builds and installs TChem-atm and Tines. Similarly to the script for third-party libraries, in `scripts/build_script.sh`, one must provide the same compiler information and CUDA flag.
51+
To enable OpenMP.
5352

54-
<!-- ```bash
55-
MY_CC=gcc # C++ compiler
56-
MY_CXX=g++ # C++ compiler
57-
MY_FC=gfortran # Fortran compiler
53+
```bash
54+
OPENMP="ON"
55+
```
56+
57+
The following path specifies the location of the TChem-atm source code.
58+
59+
```bash
60+
TCHEM_REPOSITORY_PATH=/path/to/tchem-atm/.
5861
```
59-
To build/install with CUDA ON (or OFF), use:
6062

61-
`CUDA="ON" # Set to ON/OFF to compile TChem with NVIDIA-GPUs` -->
63+
Determine whether to install OpenBLAS using this script.
64+
```bash
65+
INSTALL_OPENBLAS="ON"
66+
```
67+
68+
This script initializes submodules and manages the installation/building of third-party libraries within the `$PWD/HOST`, `$PWD/CUDA`, or `$PWD/HIP` directories, based on the selected settings: `CUDA/HIP=OFF`, `CUDA=ON`, or `HIP=ON`. Given that Kokkos and Kokkos-kernels support installation/building with both `CUDA` and `HIP` enabled (`ON`) or disabled (`OFF`), the script ensures their deployment in both `$PWD/HOST` and the relevant GPU-specific directories (`$PWD/CUDA` or `$PWD/HIP`). Other libraries, however, are exclusively installed in `$PWD/HOST`. To accommodate all third-party libraries, execute this script initially with `CUDA=OFF`. For systems equipped with NVIDIA or AMD GPUs, a subsequent run with CUDA=`ON` or `HIP=ON`, respectively, is necessary to leverage GPU-specific installations.
69+
70+
71+
## **Building and installing TChem-atm and Tines**
72+
73+
The script `scripts/build_script.sh` builds and installs TChem-atm and Tines. Similarly to the script for third-party libraries, in `scripts/build_script.sh`, one must provide the same compiler information and CUDA/HIP flag.
6274

6375
In addition, this script adds the option to turn `SACADO="ON"` or `SACADO="OFF"` to enable or disable the SACADO library's automatic differentiation capability.
6476

65-
The installation path for the third-party libraries is specified by `INSTALL_BASE_HOST`, and `ROOT=/path/to/tchem-atm` is where TChem-atm and Tines are installed. If CUDA is `ON`, libraries will be installed in the `ROOT/DEVICE` directory. Otherwise, they will be installed in the `ROOT/HOST` directory.
77+
If OpenBLAS is included as part of a module; `USE_THIS_OPENBLAS="MODULE"`.
78+
79+
The installation path for the third-party libraries is specified by `INSTALL_BASE_HOST`, and `ROOT=/path/to/tchem-atm` is where TChem-atm and Tines are installed. If CUDA is `ON`, libraries will be installed in the `ROOT/CUDA` directory. If HIP is `ON`, libraries will be installed in the `ROOT/HIP` directory. Otherwise, they will be installed in the `ROOT/HOST` directory.
80+
81+
Finally, To select the build type `BUILD_TYPE`, choose either `DEBUG` or `RELEASE`.
82+

docs/methodology.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ where $N_{\text{spec}}$ is the number of species, ${k_f}_i$ is the reaction cons
3434

3535
<!-- Note that in $\eee{}$`s CAMPP solver, only forward reaction calculations are employed, and the single reaction constant values depend on the type of reaction. -->
3636

37+
## **Aerosol-Gas interations**
38+
39+
TChem-atm facilitates the construction of source terms (or RHS) for gas-aerosol cases. In these cases, the RHS is constructed as follows:
40+
41+
![RHS of gas-aerosol](figures/RHS_gas_aerosol.png)
42+
43+
Where, the first part of the RHS corresponds to the concentration of gas species. Then, the concentration of each particle is appended. Currently, TChem-atm supports the [SIMPOL mass transfer](methodology.md#simpol-mass-transfer).
44+
3745
## **Reaction Types**
3846

3947
Currently, TChem-atm can reproduce gas chemistry for two complex reaction mechanisms: the gas chemistry of $\eee{}$ v3, i.e., the UCI chemistry system (University of California Irvine), and the Carbon Bond 2005 chemical mechanism, which is well-formulated for urban to remote tropospheric conditions ([Dawson](https://gmd.copernicus.org/articles/15/3663/2022/),[Yarwood](https://www.camx.com/Files/CB05_Final_Report_120805.pdf)).
@@ -182,7 +190,9 @@ $$
182190
2HO_2 \rightarrow H_2O_2
183191
$$
184192

193+
<!--
185194
**Note: from here, onward, the equations and variable names don't agree, so I would make sure to provide a map between the corresponding quantities.**
195+
-->
186196

187197
```yaml
188198
- MUSICA_name: R34
@@ -361,6 +371,14 @@ The `reaction_list` gives the index of the reactions for which this modifier is
361371

362372
Future work will convert `reaction_list` from a list of indices to reaction IDs, as will `photolysis_reaction_index`. Thus, one does not need to know the index of each reaction before running a TChem simulation.
363373

374+
## **Gas-Aerosol Reaction Types**
375+
376+
### SIMPOL mass transfer
377+
378+
It calculates the evaporation rate of organic species that partition between the gas and aerosol phase, based on the parameterization by [Pankow and Asher (2008)](https://acp.copernicus.org/articles/8/2773/2008/acp-8-2773-2008.html).
379+
380+
TChem-atm utilizes a YAML file and follows to the [CAMP format](https://github.com/open-atmos/camp) to specify SIMPOL types.
381+
364382
<!--Future work-->
365383
<!-- ## Gas and Particle interaction
366384

src/examples/runs/atmospheric_chemistry/Simpol/runModelKK.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ exec=$TCHEM_INSTALL_PATH/examples/TChem_AerosolChemistry_KokkosKernels.x
33
run_this="$exec --chemfile=config_gas.yaml \
44
--aerofile=test_SIMPOL_phase_transfer.yaml \
55
--inputfile_particles=scenario_conditions_particle.yaml \
6-
--outputfile=full_gas_KK.dat \
6+
--outputfile=full_gas_kk.dat \
77
--time-iterations-per-interval=10 \
88
--tol-time=1e-3 \
99
--atol-time=1e-12 \

0 commit comments

Comments
 (0)