noaa-oar-arl / canopy-app

Stand-alone/column canopy codes and parameterizations
MIT License
6 stars 7 forks source link

[Chemistry] Adding Chemical Production/Loss Processes to Canopy-App in Some Way #59

Open drnimbusrain opened 1 year ago

drnimbusrain commented 1 year ago

There is an idea by Zach to add more complex canopy chemistry and related processes (e.g., CRFs, soil processes, etc.) to canopy-app by use of python-based surrogate/ML tools to avoid computational slowdown. This high-level idea could be achieved by calling python random forest or gradient-boosted (XGBoost) tools from the main canopy-app Fortran routines.

@zmoon Can you elaborate a bit more on ideas to help push this forward?

zmoon commented 1 year ago

The idea would be to run a 1-D canopy-chemistry model like ACCESS or FORCAsT for many different conditions (meteo and background chemical state, canopy parameters, etc.). Then train a ML model, e.g. random forest or XGBoost, to predict something X, e.g. terpene in-canopy chemical processed fraction. Then in canopy-app Fortran, the trained model can be loaded [^1] and used to calculate X.

[^1]: e.g. https://github.com/christophkeller/fortran2xgb

drnimbusrain commented 1 year ago

@zmoon What about the ACCESS Box model approach...it would be awesome if you could help with this component (and radiation) in the future!! Thanks..

zmoon commented 1 year ago

What are you suggesting to do with the box model? Use to make the training data instead of 1-D canopy-chem model?

drnimbusrain commented 1 year ago

What are you suggesting to do with the box model? Use to make the training data instead of 1-D canopy-chem model?

Realized, I never responded. Yes, use ACCESS to train of course, but I think you already suggested that.

Overall, I think this ML approach is a way forward rather than implementing a relatively lean chemical model/solver into canopy-app, but I am concerned with the robustness and ability to train to get correct fractions. Plus, I am always concerned with having to retrain model for the virtually unlimited, and always changing environmental conditions.

drnimbusrain commented 1 year ago

@MaggieMarvin I wonder if you are interested in helping with this part, in conjunction with advancing the biogenic emissions. For example, how were you planning on integrating canopy-app with your F0AM model (understood that its in MATLAB)?

Could this work be included to advance a relatively simple chemistry or run across a range of conditions where the outputs are used to train ML in canopy-app? See Zach's initial comments above. Ultimately, I wonder if the F0AM model could be easily run across range of conditions (e.g., background chemistry, weather, canopy etc.) to get the 'X' that Zach has referred to above. You probably would be doing this anyway for your canopy-app comparisons/evaluations using F0AM model.

MaggieMarvin commented 1 year ago

Yes, this sounds interesting to me! I was thinking of using emission output from canopy-app as input for F0AM to produce mixing ratios on a point by point basis. Emissions are unofficially supported, since F0AM is a 0-D model, but could be approximated as a 0th order reaction. There's a possibility of representing deposition too. And yes, F0AM can be run across a range of conditions, or we could use it to test some simple chemistry - it's very easy to change existing mechanisms or build new ones with F0AM.

drnimbusrain commented 1 year ago

Ultimately, @MaggieMarvin, comparison/offline coupling with F0AM is a great start, and somehow we would like to expand use of simplified chemical solvers pertinent to the canopy so that we can in some way approximate the chemical production/losses at each level in canopy-app. This will be pivotal in its offline mode, but also may be useful when coupled into larger UFS at some point.

drnimbusrain commented 1 year ago

Tools for ML to Fortran Interface: https://github.com/christophkeller/fortran2xgb https://github.com/pplonski/keras2cpp https://github.com/scientific-computing/FKB

drnimbusrain commented 10 months ago

Could also add simple, efficient chemistry scheme to canopy-app directly, as has been done in LES canopy studies: Clifton et al. (2022): https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2022MS003078 Fuentes et al. (2022): https://www.sciencedirect.com/science/article/abs/pii/S1352231022001595