the Creative Commons Attribution 4.0 License.
the Creative Commons Attribution 4.0 License.
mesas.py v1.0: A flexible Python package for modeling solute transport and transit times using StorAge Selection functions
Abstract. StorAge Selection transport theory has recently emerged as a framework for representing material transport through a control volume. It can be seen as a generalization of transit time theories and lumped parameter models to allow for arbitrary time-variability of the rate of material flow in and out of the control volume, and in the transport dynamics. SAS is currently the state-of-the-art approach to interpreting tracer transport. Here we present mesas.py, a Python package implementing the SAS framework. mesas.py allows SAS functions to be specified using several built-in common distributions, as a piecewise-linear CDF, or as a weighted sum of any number of such distributions. The distribution parameters and weights used to combine them can be allowed to vary in time, allowing SAS functions of arbitrary complexity to be specified. mesas.py simulates tracer transport using a novel mass tracking scheme and can account for first order reactions and fractionation. We present a number of analytical solutions to the governing equations and use these to validate the code. For a benchmark problem the timestep-averaging approach of the mesas.py implementation provides a 15 × reduction in mass balance errors compared to a previous implementation of SAS.
-
Notice on discussion status
The requested preprint has a corresponding peer-reviewed final revised paper. You are encouraged to refer to the final revised version.
-
Preprint
(786 KB)
-
The requested preprint has a corresponding peer-reviewed final revised paper. You are encouraged to refer to the final revised version.
- Preprint
(786 KB) - Metadata XML
- BibTeX
- EndNote
- Final revised paper
Journal article(s) based on this preprint
Interactive discussion
Status: closed
-
RC1: 'Comment on egusphere-2022-1262', Paolo Benettin, 19 Jan 2023
The paper by Harman and Xu Fei is a great contribution to the field of hydrology and solute transport. The software they describe in the manuscript is well packaged, fully-documented and it is flexible to several possible user needs. The code is shown to provide accurate numerical solutions against meaningful benchmarks. The paper clearly illustrates the model capabilities and provides the readers with novel benchmark analytical and discretized solutions. I only have minor suggestions for improvement; therefore, I am glad to recommend the paper for publication on GMD after minor revisions.
Minor points
- Unfortunately, I was not able to install the latest version on any windows machine. I tried many times to conda-install mesas on a fresh, base Anaconda environment, but I got environment inconsistency problems. Conda automatically iterated over previous mesas version and the first version that it was able to install was version 0.2021.0909. It would be great if this issue could be checked before the paper is accepted.
- The authors stress in the abstract that the mesas implementation “provides a 15x reduction in mass balance errors compared to a previous implementation of SAS” (i.e. the tran-SAS implementation). While this is true, it also seems to be an unbalanced selection of the results, since for other metrics and parameters the difference is not always as large. Figure 3e shows that the difference between the two implementation is the largest for k=1, but there are also values of k for which the two implementations have identical performances. There is no doubt that mesas is generally more accurate than the Euler-Forward-based implementation of tran-SAS, but I think it would be fair to: 1) compare the computational times in addition to the numerical accuracy; 2) if possible, make a comparison with the higher-order implementation of tran-SAS.
Detailed comments
29: “sophisticated”, I am not sure how to interpret this word in this context
46: here it is mentioned that “solute/tracer storage and outflow rates as part of the solution, not through a subsequent convolution integral”, but I find this sentence possibly inaccurate. Solute storage rates do not need a convolution integral while for solute outflow rates it seems to me that equation (13) is in fact a convolution-like equation.
114: In some circumstances, small quantities of chloride can be taken up by plants, so I would not assume the concentration in the evapoconcentration “must” necessarily be 0. See Xu, G., H. Magen, J. Tarchitzky, and U. Kafkafi (1999), Advances in chloride nutrition of plants,Adv. Agron.,68, 97–150, doi:10.1016/S0065-2113(08)60844-5
150—156 (Eq 15—17): I don’t get the notation using the delta symbol δ instead of the traditional d. Why can one not jump from Eq. (15) to Eq. (17) simply by diving by dT?
182: “The accuracy of the results obtained this way may be poor”. Can you expand on why? A user would want to understand this.
183: I’d suggest to remove “Uniform” from the section’s title because one may be induced to think that there is a uniform CDF available in the code
Table 4 is very useful
368-378: In figure 1r the error seems to be nonstationary and fast-growing. Perhaps a longer simulation test is needed in this case to quantify the correct error magnitude.
398 (Figure 2): I find it a bit confusing to present in the same figure a benchmark comparison and a demonstration of the model solution for different parameters. I recommend to separate these subplots into different figures.
Technical corrections & Typos
40: implementation
103: for clarity, consider spelling out C_Q instead of starting the sentence with “it”
141: whose with
171: Sm
Table 2 and 3: these different tables have the same caption: is this on purporse? If yes, perhaps it will be good to rename them to 2a and 2b upon article production
Figure 3: There are no subplot indices a), b) etc… in the figure.
Figure 3 caption: “an high-accuracy”
Citation: https://doi.org/10.5194/egusphere-2022-1262-RC1 -
AC1: 'Response to reviewers', Ciaran Harman, 30 Jul 2023
The comment was uploaded in the form of a supplement: https://egusphere.copernicus.org/preprints/2022/egusphere-2022-1262/egusphere-2022-1262-AC1-supplement.pdf
-
RC2: 'Comment on egusphere-2022-1262', Anonymous Referee #2, 03 Mar 2023
The manuscript provides a comprehensive walkthrough of mesas, a program that utilizes the StorAge Selection (SAS) function to simulate time-varying transport dynamics. It is well-written and strikes a good balance between technical specifics and instructions for users.
Despite the manuscript being well-written, I encountered difficulties in reviewing it due to the problem in installing the program, as stated in comment #1. As a reviewer for the GMD journal, I understand the importance of testing the program and hence, I must defer making any recommendations until I can successfully install and run the program. Additionally, I have provided some suggestions for improvement in comment #2.
1. Installation failed
*My Mac has an M1 processor and Python 3.10.9 installed.
Conda
In L50-51 on page 2, the authors mentioned that the program could be installed through conda, with the code available on conda-forge. However, despite following the instructions and attempting to install the mesas package through "conda install -c conda-forge mesas", an error occurred. The error message read as follows: "PackagesNotFoundError: The following packages are not available from current channels: - mesas".
GitHub
Despite my attempts to manually install the program by following the instructions provided on the GitHub channel (L442), the installation process failed. While I was able to successfully compile the Fortran code, I encountered issues while attempting to install mesas using either "Python setup.py install" or pip. In the former case, I received "7 warnings and 9 errors generated" while in the latter, the error message read "ERROR: Failed building editable for mesas. Failed to build mesas. ERROR: Could not build wheels for mesas, which is required to install pyproject.toml-based projects".
Zenodo
In addition, I attempted to install the program using the source code available on Zenodo (L442). The absence of CMakeLists.txt in cdflib90 prevented me from compiling the Fortran code. Running "python setup.py install" resulted in the error message "Fatal Error: Cannot open module file 'cdf_gamma_mod.mod' for reading at (1): No such file or directory".
2. Minor comments
- Potential issues with the pre-determined shape of the SAS functions: If I understand it correctly, the shape of the SAS function must be determined a priori in mesas before simulating the dynamics. There are some issues with such a priori determination (e.g., Harman, 2019). I think mentioning the issues would be beneficial for potential users.
- The required version of python must be specified.
- L77: a outflow -> an outflow
- L111-L128: It would be beneficial if the authors could offer guidance on how to simulate isotopic fractionation using alpha_q. Although L115-118 alludes to the possibility of accounting for isotopic fractionation using alpha_q, it is unclear how to define the variable to accomplish this.
- L131: (11) -> (11).
- L132-135: Providing descriptions for the practical necessity of T_{max} would be useful.
- L137: Would be easier to read if the number of equations and the number of unknowns were provided.
- L208: Please define S_i(t).
- Section 3.2.1: The example on page 12 uses two pdfs for the discharge SAS function, but it wasn't clear how the weight of each pdf was considered.
Citation: https://doi.org/10.5194/egusphere-2022-1262-RC2 -
AC1: 'Response to reviewers', Ciaran Harman, 30 Jul 2023
The comment was uploaded in the form of a supplement: https://egusphere.copernicus.org/preprints/2022/egusphere-2022-1262/egusphere-2022-1262-AC1-supplement.pdf
-
AC1: 'Response to reviewers', Ciaran Harman, 30 Jul 2023
The comment was uploaded in the form of a supplement: https://egusphere.copernicus.org/preprints/2022/egusphere-2022-1262/egusphere-2022-1262-AC1-supplement.pdf
Interactive discussion
Status: closed
-
RC1: 'Comment on egusphere-2022-1262', Paolo Benettin, 19 Jan 2023
The paper by Harman and Xu Fei is a great contribution to the field of hydrology and solute transport. The software they describe in the manuscript is well packaged, fully-documented and it is flexible to several possible user needs. The code is shown to provide accurate numerical solutions against meaningful benchmarks. The paper clearly illustrates the model capabilities and provides the readers with novel benchmark analytical and discretized solutions. I only have minor suggestions for improvement; therefore, I am glad to recommend the paper for publication on GMD after minor revisions.
Minor points
- Unfortunately, I was not able to install the latest version on any windows machine. I tried many times to conda-install mesas on a fresh, base Anaconda environment, but I got environment inconsistency problems. Conda automatically iterated over previous mesas version and the first version that it was able to install was version 0.2021.0909. It would be great if this issue could be checked before the paper is accepted.
- The authors stress in the abstract that the mesas implementation “provides a 15x reduction in mass balance errors compared to a previous implementation of SAS” (i.e. the tran-SAS implementation). While this is true, it also seems to be an unbalanced selection of the results, since for other metrics and parameters the difference is not always as large. Figure 3e shows that the difference between the two implementation is the largest for k=1, but there are also values of k for which the two implementations have identical performances. There is no doubt that mesas is generally more accurate than the Euler-Forward-based implementation of tran-SAS, but I think it would be fair to: 1) compare the computational times in addition to the numerical accuracy; 2) if possible, make a comparison with the higher-order implementation of tran-SAS.
Detailed comments
29: “sophisticated”, I am not sure how to interpret this word in this context
46: here it is mentioned that “solute/tracer storage and outflow rates as part of the solution, not through a subsequent convolution integral”, but I find this sentence possibly inaccurate. Solute storage rates do not need a convolution integral while for solute outflow rates it seems to me that equation (13) is in fact a convolution-like equation.
114: In some circumstances, small quantities of chloride can be taken up by plants, so I would not assume the concentration in the evapoconcentration “must” necessarily be 0. See Xu, G., H. Magen, J. Tarchitzky, and U. Kafkafi (1999), Advances in chloride nutrition of plants,Adv. Agron.,68, 97–150, doi:10.1016/S0065-2113(08)60844-5
150—156 (Eq 15—17): I don’t get the notation using the delta symbol δ instead of the traditional d. Why can one not jump from Eq. (15) to Eq. (17) simply by diving by dT?
182: “The accuracy of the results obtained this way may be poor”. Can you expand on why? A user would want to understand this.
183: I’d suggest to remove “Uniform” from the section’s title because one may be induced to think that there is a uniform CDF available in the code
Table 4 is very useful
368-378: In figure 1r the error seems to be nonstationary and fast-growing. Perhaps a longer simulation test is needed in this case to quantify the correct error magnitude.
398 (Figure 2): I find it a bit confusing to present in the same figure a benchmark comparison and a demonstration of the model solution for different parameters. I recommend to separate these subplots into different figures.
Technical corrections & Typos
40: implementation
103: for clarity, consider spelling out C_Q instead of starting the sentence with “it”
141: whose with
171: Sm
Table 2 and 3: these different tables have the same caption: is this on purporse? If yes, perhaps it will be good to rename them to 2a and 2b upon article production
Figure 3: There are no subplot indices a), b) etc… in the figure.
Figure 3 caption: “an high-accuracy”
Citation: https://doi.org/10.5194/egusphere-2022-1262-RC1 -
AC1: 'Response to reviewers', Ciaran Harman, 30 Jul 2023
The comment was uploaded in the form of a supplement: https://egusphere.copernicus.org/preprints/2022/egusphere-2022-1262/egusphere-2022-1262-AC1-supplement.pdf
-
RC2: 'Comment on egusphere-2022-1262', Anonymous Referee #2, 03 Mar 2023
The manuscript provides a comprehensive walkthrough of mesas, a program that utilizes the StorAge Selection (SAS) function to simulate time-varying transport dynamics. It is well-written and strikes a good balance between technical specifics and instructions for users.
Despite the manuscript being well-written, I encountered difficulties in reviewing it due to the problem in installing the program, as stated in comment #1. As a reviewer for the GMD journal, I understand the importance of testing the program and hence, I must defer making any recommendations until I can successfully install and run the program. Additionally, I have provided some suggestions for improvement in comment #2.
1. Installation failed
*My Mac has an M1 processor and Python 3.10.9 installed.
Conda
In L50-51 on page 2, the authors mentioned that the program could be installed through conda, with the code available on conda-forge. However, despite following the instructions and attempting to install the mesas package through "conda install -c conda-forge mesas", an error occurred. The error message read as follows: "PackagesNotFoundError: The following packages are not available from current channels: - mesas".
GitHub
Despite my attempts to manually install the program by following the instructions provided on the GitHub channel (L442), the installation process failed. While I was able to successfully compile the Fortran code, I encountered issues while attempting to install mesas using either "Python setup.py install" or pip. In the former case, I received "7 warnings and 9 errors generated" while in the latter, the error message read "ERROR: Failed building editable for mesas. Failed to build mesas. ERROR: Could not build wheels for mesas, which is required to install pyproject.toml-based projects".
Zenodo
In addition, I attempted to install the program using the source code available on Zenodo (L442). The absence of CMakeLists.txt in cdflib90 prevented me from compiling the Fortran code. Running "python setup.py install" resulted in the error message "Fatal Error: Cannot open module file 'cdf_gamma_mod.mod' for reading at (1): No such file or directory".
2. Minor comments
- Potential issues with the pre-determined shape of the SAS functions: If I understand it correctly, the shape of the SAS function must be determined a priori in mesas before simulating the dynamics. There are some issues with such a priori determination (e.g., Harman, 2019). I think mentioning the issues would be beneficial for potential users.
- The required version of python must be specified.
- L77: a outflow -> an outflow
- L111-L128: It would be beneficial if the authors could offer guidance on how to simulate isotopic fractionation using alpha_q. Although L115-118 alludes to the possibility of accounting for isotopic fractionation using alpha_q, it is unclear how to define the variable to accomplish this.
- L131: (11) -> (11).
- L132-135: Providing descriptions for the practical necessity of T_{max} would be useful.
- L137: Would be easier to read if the number of equations and the number of unknowns were provided.
- L208: Please define S_i(t).
- Section 3.2.1: The example on page 12 uses two pdfs for the discharge SAS function, but it wasn't clear how the weight of each pdf was considered.
Citation: https://doi.org/10.5194/egusphere-2022-1262-RC2 -
AC1: 'Response to reviewers', Ciaran Harman, 30 Jul 2023
The comment was uploaded in the form of a supplement: https://egusphere.copernicus.org/preprints/2022/egusphere-2022-1262/egusphere-2022-1262-AC1-supplement.pdf
-
AC1: 'Response to reviewers', Ciaran Harman, 30 Jul 2023
The comment was uploaded in the form of a supplement: https://egusphere.copernicus.org/preprints/2022/egusphere-2022-1262/egusphere-2022-1262-AC1-supplement.pdf
Peer review completion
Journal article(s) based on this preprint
Viewed
HTML | XML | Total | BibTeX | EndNote | |
---|---|---|---|---|---|
521 | 237 | 27 | 785 | 14 | 16 |
- HTML: 521
- PDF: 237
- XML: 27
- Total: 785
- BibTeX: 14
- EndNote: 16
Viewed (geographical distribution)
Country | # | Views | % |
---|
Total: | 0 |
HTML: | 0 |
PDF: | 0 |
XML: | 0 |
- 1
Esther Xu Fei
The requested preprint has a corresponding peer-reviewed final revised paper. You are encouraged to refer to the final revised version.
- Preprint
(786 KB) - Metadata XML