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

Add model usage tutorial #296

Open
kmdeck opened this issue Aug 9, 2023 · 0 comments
Open

Add model usage tutorial #296

kmdeck opened this issue Aug 9, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@kmdeck
Copy link
Member

kmdeck commented Aug 9, 2023

We removed our old model_usage tutorial because it conflicted with changes we had to make as well as being outside of the land surface modeling field. Add a new tutorial demonstrating the ClimaLSM Model framework

@kmdeck kmdeck added the enhancement New feature or request label Aug 9, 2023
@kmdeck kmdeck mentioned this issue Aug 9, 2023
1 task
bors bot added a commit that referenced this issue Aug 9, 2023
292: dss buffer r=kmdeck a=kmdeck

## Purpose 
See #288

Substantive changes are in shared_utilities: models.jl, utils.jl, ClimaLSM.jl,src/standalone/Vegetation/Canopy.jl, and  src/standalone/Bucket/Bucket.jl.

We had to remove a tutorial but will be rewriting it and adding it back in #296 

## To-do
[X] handle 2d vs 3d buffer
[X] write unit test for new functions, and added tests to make sure the aux state was properly made for standalone models, integrated models, and the bucket model.
[] have all integrations use dss (separate PR)


## Content
1. Adding the dss buffer to the aux state. We have three methods for `initalize_aux`, and one special method for `initialize`, so four files have changes.
- src/shared_utilities/models.jl: since `initialize_vars` no longer returns a field vector, convert the output to a FieldVector within `initialize_prognostic`, but not in `initialize_auxiliary`. Updated docs for `initialize_auxiliary`. In `initialize_auxiliary`, add the dss buffer to `p`. This is the default `initialize_auxiliary` method.
- src/ClimaLSM.jl: in `initialize_auxiliary` method for AbstractLandModels, cycle through the (unique) domains of the component models and add the corresponding buffers (at most, this should add a 3d buffer and a 2d buffer for the surface of that 3d domain)
- src/standalone/Bucket/Bucket.jl: in the method for `initialize` here, add in the call to add_dss_to_aux. The Bucket model has to be made with an LSM domain, which has the surface and subsurface attributes. 
- - src/standalone/Vegetation/Canopy.jl: in the method for `initialize_auxiliary` here, add in the call to add_dss_to_aux. 
`@juliasloan25` these would be good for you to review

2. Update the existing shared utilities tests for dss. I also wanted to test the `initialize_auxiliary` was doing the correct thing for: the bucket model, standalone models (default method), and land surface models. i did this somewhat lazily, by adding in additional tests to existing files which already make `p` for these models, rather than by making a new test file with a dummy LSM, dummy standalone model, etc. `@juliasloan25` these would be good for you to review

3. Changes ClimaLSM.dss! to use the buffer [shared_utilities/utilities.jl] `@akshaysridhar` these would be good for you to review

4. creates the add_dss_buffer_to_aux function `@akshaysridhar` these would be good for you to review

Review checklist

I have:
- followed the codebase contribution guide: https://clima.github.io/ClimateMachine.jl/latest/Contributing/
- followed the style guide: https://clima.github.io/ClimateMachine.jl/latest/DevDocs/CodeStyle/
- followed the documentation policy: https:/CliMA/policies/wiki/Documentation-Policy
- checked that this PR does not duplicate an open PR.

In the Content, I have included 
- relevant unit tests, and integration tests, 
- appropriate docstrings on all functions, structs, and modules, and included relevant documentation.
----
- [x] I have read and checked the items on the review checklist.


Co-authored-by: kmdeck <[email protected]>
mitraA90 pushed a commit that referenced this issue Dec 22, 2023
292: dss buffer r=kmdeck a=kmdeck

## Purpose 
See #288

Substantive changes are in shared_utilities: models.jl, utils.jl, ClimaLSM.jl,src/standalone/Vegetation/Canopy.jl, and  src/standalone/Bucket/Bucket.jl.

We had to remove a tutorial but will be rewriting it and adding it back in #296 

## To-do
[X] handle 2d vs 3d buffer
[X] write unit test for new functions, and added tests to make sure the aux state was properly made for standalone models, integrated models, and the bucket model.
[] have all integrations use dss (separate PR)


## Content
1. Adding the dss buffer to the aux state. We have three methods for `initalize_aux`, and one special method for `initialize`, so four files have changes.
- src/shared_utilities/models.jl: since `initialize_vars` no longer returns a field vector, convert the output to a FieldVector within `initialize_prognostic`, but not in `initialize_auxiliary`. Updated docs for `initialize_auxiliary`. In `initialize_auxiliary`, add the dss buffer to `p`. This is the default `initialize_auxiliary` method.
- src/ClimaLSM.jl: in `initialize_auxiliary` method for AbstractLandModels, cycle through the (unique) domains of the component models and add the corresponding buffers (at most, this should add a 3d buffer and a 2d buffer for the surface of that 3d domain)
- src/standalone/Bucket/Bucket.jl: in the method for `initialize` here, add in the call to add_dss_to_aux. The Bucket model has to be made with an LSM domain, which has the surface and subsurface attributes. 
- - src/standalone/Vegetation/Canopy.jl: in the method for `initialize_auxiliary` here, add in the call to add_dss_to_aux. 
`@juliasloan25` these would be good for you to review

2. Update the existing shared utilities tests for dss. I also wanted to test the `initialize_auxiliary` was doing the correct thing for: the bucket model, standalone models (default method), and land surface models. i did this somewhat lazily, by adding in additional tests to existing files which already make `p` for these models, rather than by making a new test file with a dummy LSM, dummy standalone model, etc. `@juliasloan25` these would be good for you to review

3. Changes ClimaLSM.dss! to use the buffer [shared_utilities/utilities.jl] `@akshaysridhar` these would be good for you to review

4. creates the add_dss_buffer_to_aux function `@akshaysridhar` these would be good for you to review

Review checklist

I have:
- followed the codebase contribution guide: https://clima.github.io/ClimateMachine.jl/latest/Contributing/
- followed the style guide: https://clima.github.io/ClimateMachine.jl/latest/DevDocs/CodeStyle/
- followed the documentation policy: https:/CliMA/policies/wiki/Documentation-Policy
- checked that this PR does not duplicate an open PR.

In the Content, I have included 
- relevant unit tests, and integration tests, 
- appropriate docstrings on all functions, structs, and modules, and included relevant documentation.
----
- [x] I have read and checked the items on the review checklist.


Co-authored-by: kmdeck <[email protected]>
@kmdeck kmdeck mentioned this issue Jul 2, 2024
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant