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 find_type_instabilities #961

Merged
merged 3 commits into from
May 23, 2023
Merged

Add find_type_instabilities #961

merged 3 commits into from
May 23, 2023

Conversation

davidanthoff
Copy link
Collaborator

@davidanthoff davidanthoff commented May 20, 2023

Usage is:

Mimi.find_type_instabilities(m, :compname)

and that will call code_warntype on the run_timestep method for that component.

In theory one can also use this with https://github.com/JuliaDebug/Cthulhu.jl by doing

Mimi.find_type_instabilities(m, :compname, Cthulhu.descend)

but in practice that doesn't seem to work together with our way of generating these run_timestep methods from our macro.

I would suggest we don't document this for now and don't consider it part of the "public" API, until we have figured out whether this is actually working well or not. We might also try to get this to work with Cthulhu properly.

@codecov
Copy link

codecov bot commented May 20, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.28 ⚠️

Comparison is base (91a71f1) 85.12% compared to head (4bdae7a) 84.85%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #961      +/-   ##
==========================================
- Coverage   85.12%   84.85%   -0.28%     
==========================================
  Files          40       41       +1     
  Lines        4041     4054      +13     
==========================================
  Hits         3440     3440              
- Misses        601      614      +13     
Flag Coverage Δ
unittests 84.85% <0.00%> (-0.28%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Mimi.jl 100.00% <ø> (ø)
src/utils/diagnostics.jl 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@lrennels lrennels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting an error because the values of the dim_dict are nothing for the components, so altered the access to data structures ... I think this will work better but need to double check time

@davidanthoff
Copy link
Collaborator Author

I only tried this after running the model, maybe at that point the dims are there? But if we can get this to work without running, even better.

@lrennels
Copy link
Collaborator

Interesting, at first I was doing

m = get_model
Mimi.build!(m)

to get a built model but not run it because the migration model is just so slow, but I also tried it with a run MimiGIVE and got the same error? Did yours work for a run model?

p = typeof(mi.comps_dict[comp].parameters)
d = typeof(NamedTuple(name => (name == :time ? timesteps(clock) : collect(values(dim))) for (name, dim) in dim_dict))

tool(f, (p, v, d, Int))
Copy link
Collaborator

@lrennels lrennels May 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to put a AbstractTimestep type ie. Mimi.FixedTimestep{1750, 1, 2300} in t to get better results ... I experimented it with it and I think it works well.

We should be able to get that from the clock or something, that is parameterized by the Timestep type I think, I'll take a look tomorrow.

@lrennels lrennels self-requested a review May 22, 2023 20:05
Copy link
Collaborator

@lrennels lrennels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidanthoff looks good, I've tested it quite a bit in practice and it's extremely helpful! Agree on keeping it out of docs and mostly with developers until we're certain the kinks are worked out.

@davidanthoff davidanthoff merged commit d9dab70 into master May 23, 2023
@davidanthoff davidanthoff deleted the type-instabilities branch May 23, 2023 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants