Skip to content

Conversation

@glwagner
Copy link
Member

@glwagner glwagner commented Dec 1, 2025

This PR starts implementing an alternative to StaticEnergyThermodynamics that uses the potential temperature density as a prognostic variable. This is a precursor to also supporting EntropyThermodynamics. It depends on #216 and #217

@glwagner glwagner marked this pull request as draft December 1, 2025 05:28
@glwagner glwagner changed the title [WIP] Implement a PotentialTemperature formulation [WIP] Implement a PotentialTemperatureThermodynamics formulation Dec 1, 2025
@glwagner glwagner marked this pull request as ready for review December 4, 2025 22:09
@testset "Time-stepping AtmosphereModel with $thermo_name thermodynamics" begin
formulation = AnelasticFormulation(reference_state, thermodynamics=thermo_name)
model = AtmosphereModel(grid; thermodynamic_constants=constants, formulation)
thermo_type = eval(Symbol(thermo_name, :Thermodynamics))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not passing the concrete object in the for loop instead of using eval? 🥲

Copy link
Member Author

@glwagner glwagner Dec 4, 2025

Choose a reason for hiding this comment

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

Fair question... I tentantiavely decided to make the user interface with Symbols. The reason is because, within the user interface, the materialization of the "Thermodynamics" object requires information that is passed to the AtmosphereModel constructor.

The objective is to allow this to be a one line change to switch between formulations.

In the test, I want to stress that user interface. But this is def up for debate.

Copy link
Member Author

Choose a reason for hiding this comment

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

Another option is to use stub objects, eg

thermodynamics = PotentialTemperatureThermodynamics()

and then later we call

formulation = materialize_formulation(user_formulation, grid, user_boundary_conditions)

navidcy and others added 5 commits December 6, 2025 11:24
we need a show method because the output is humungus; then we can make a doctest?
Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com>
@glwagner
Copy link
Member Author

glwagner commented Dec 6, 2025

we are close!

Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com>
@giordano
Copy link
Collaborator

giordano commented Dec 6, 2025

Finally all green, only sad thing is that coverage dropped from 74% to 68%, lots of new code is untested: #218 (comment)

@glwagner
Copy link
Member Author

glwagner commented Dec 6, 2025

I can add tests here\

@navidcy navidcy self-requested a review December 6, 2025 12:10
Copy link
Member

@navidcy navidcy left a comment

Choose a reason for hiding this comment

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

Should we add something in the docs describing this alternative formulation?

@glwagner
Copy link
Member Author

glwagner commented Dec 6, 2025

@giordano looks like we have better code coverage now! We can keep working on this in the future.

@glwagner glwagner merged commit d2abe9d into main Dec 6, 2025
11 checks passed
@glwagner glwagner deleted the glw/potential-temperature branch December 6, 2025 14:53
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.

4 participants