Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft aerosol classes #209

Draft
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

mattldawson
Copy link
Collaborator

@mattldawson mattldawson commented Feb 25, 2025

Adds an initial implementation of the abstract aerosol classes from CAM along with a stub aerosol model.

closes #205

I'll leave this in draft while we iterate on the design. This makes a few modifications to the CAM aerosol classes' virtual functions including:

  • returning optical properties for all grid cells and wavelength bins
  • having the aerosol model state own its own data, as opposed to it being managed externally
  • specifying a wavelength grid for optical properties to be returned on

This design should also support concurrent use of multiple aerosol models and/or multiple state objects for a single aerosol model instance.

The best place to start reviewing this is probably in test/musica/aerosol/mock_host.F90, which shows how a simple host model might use the aerosol classes with a radiation package.

@gold2718 - let me know if you think this structure will work for your use case. Feel free to request changes or submit PRs to my dev branch. We could also set up a meeting to discuss needs in more detail.

Is this an answer-changing PR? If so, is it a new physics package, algorithm change, tuning change, etc?
no

If yes to the above question, describe how this code was validated with the new/modified features:
n/a

boulderdaze and others added 3 commits February 26, 2025 11:30
Originator(s): @boulderdaze

Summary (include the keyword ['closes', 'fixes', 'resolves'] and issue
number):

- Reworked the CMake script for the case where the MUSICA library is
linked from the installed version.
- Updated MUSICA index mapping API.
- Updated Dockerfile for MUSICA.

Describe any changes made to the namelist: N/A

List all files eliminated and why: Please refer to the `Files changed`
tab

List all files added and what they do: Please refer to the `Files
changed` tab

List all existing files that have been modified, and describe the
changes: Please refer to the `Files changed` tab

List any test failures: N/A

Is this a science-changing update? New physics package, algorithm
change, tuning changes, etc? No
@peverwhee
Copy link
Collaborator

Thanks @mattldawson! I'm curious about how the aerosol_model_t and aerosol_state_t objects relate/will relate to the objects that Francis has been working on in CAM?

I guess I expected that the abstract classes would be the same as those in CAM (e.g. aerosol_state_mod.F90 and aerosol_properties_mod.F90)

But I also have an admittedly limited understanding of how this all works and will work in the future.

@mattldawson
Copy link
Collaborator Author

mattldawson commented Feb 26, 2025

Thanks @mattldawson! I'm curious about how the aerosol_model_t and aerosol_state_t objects relate/will relate to the objects that Francis has been working on in CAM?

I guess I expected that the abstract classes would be the same as those in CAM (e.g. aerosol_state_mod.F90 and aerosol_properties_mod.F90)

But I also have an admittedly limited understanding of how this all works and will work in the future.

The aerosol_model_t corresponds to the one in aerosol_properties_mod and the aerosol_state_t class to the one in aerosol_state_mod.

The reason we need new classes in this repo is that the current implementations of the aerosol classes (for MAM and CARMA) include CAM dependencies in the aerosol functions (state, pbuf, rad_constituents, etc.). In order to get that code to build in CAM-SIMA we would need to port ALL of the aerosol functions at once (including the functions needed for radiation, cloud activation, ice nucleation, deposition, etc.).

So, instead, we can create these two new stub classes and gradually move the aerosol functions into them one at a time (removing them from the existing modules as we remove the CAM dependencies), starting with just the radiation interface. Does this make sense?

@peverwhee
Copy link
Collaborator

Thanks @mattldawson! I'm curious about how the aerosol_model_t and aerosol_state_t objects relate/will relate to the objects that Francis has been working on in CAM?
I guess I expected that the abstract classes would be the same as those in CAM (e.g. aerosol_state_mod.F90 and aerosol_properties_mod.F90)
But I also have an admittedly limited understanding of how this all works and will work in the future.

The aerosol_model_t corresponds to the one in aerosol_properties_mod and the aerosol_state_t class to the one in aerosol_state_mod.

The reason we need new classes in this repo is that the current implementations of the aerosol classes (for MAM and CARMA) include CAM dependencies in the aerosol functions (state, pbuf, rad_constituents, etc.). In order to get that code to build in CAM-SIMA we would need to port ALL of the aerosol functions at once (including the functions needed for radiation, cloud activation, ice nucleation, deposition, etc.).

So, instead, we can create these two new stub classes and gradually move the aerosol functions into them one at a time (removing them from the existing modules as we remove the CAM dependencies), starting with just the radiation interface. Does this make sense?

Thank for elaborating. I definitely understand building things up piece by piece, but what I'm still a bit confused by is why the procedures/classes have different names. Won't this make incorporating the work that Francis has already done more complicated?

@mattldawson
Copy link
Collaborator Author

mattldawson commented Feb 27, 2025

Thanks @mattldawson! I'm curious about how the aerosol_model_t and aerosol_state_t objects relate/will relate to the objects that Francis has been working on in CAM?
I guess I expected that the abstract classes would be the same as those in CAM (e.g. aerosol_state_mod.F90 and aerosol_properties_mod.F90)
But I also have an admittedly limited understanding of how this all works and will work in the future.

The aerosol_model_t corresponds to the one in aerosol_properties_mod and the aerosol_state_t class to the one in aerosol_state_mod.
The reason we need new classes in this repo is that the current implementations of the aerosol classes (for MAM and CARMA) include CAM dependencies in the aerosol functions (state, pbuf, rad_constituents, etc.). In order to get that code to build in CAM-SIMA we would need to port ALL of the aerosol functions at once (including the functions needed for radiation, cloud activation, ice nucleation, deposition, etc.).
So, instead, we can create these two new stub classes and gradually move the aerosol functions into them one at a time (removing them from the existing modules as we remove the CAM dependencies), starting with just the radiation interface. Does this make sense?

Thank for elaborating. I definitely understand building things up piece by piece, but what I'm still a bit confused by is why the procedures/classes have different names. Won't this make incorporating the work that Francis has already done more complicated?

We could definitely give them similar names (I just went with model instead of properties because I thought it would make the simultaneous use of different aerosol models like @gold2718 suggested a little clearer). But, the module names will have to be (at least slightly) different because they will be being used simultaneously until all the aerosol functionality is finished in CAM-SIMA.

I don't expect that renaming of functions or classes will make incorporating Francis's work that difficult. There's often only one or at most a few functions involved in the interface to any particular physics scheme. Removing the CAM dependencies from the code will also very likely mean changing some of the function arguments, so there will probably always be some changes to the function signatures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants