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

Fix NaNs in nonlinear solver #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

simone-silvestri
Copy link
Collaborator

@simone-silvestri simone-silvestri commented Aug 9, 2024

When h = 0, the internal flux is zero and does not depend on the input temperature.
For this reason, a root solver cannot find a solution for T, which ends up being NaN.

Copy link
Member

@glwagner glwagner left a comment

Choose a reason for hiding this comment

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

Are we sure this is valid for all kinds of thermodynamics models we might implement?

@glwagner
Copy link
Member

glwagner commented Aug 9, 2024

I think maybe rather than putting this check in, we should avoid solving for surface temperature if the thickness is 0. How about that?

@glwagner
Copy link
Member

glwagner commented Aug 9, 2024

But we already have

and

if consolidated_ice # slab is consolidated and has an independent surface temperature
Tu⁻ = @inbounds Tu[i, j, k]
Tuⁿ = top_surface_temperature(i, j, grid, top_heat_bc, Tu⁻, Qi, Qu, clock, model_fields)
else # slab is unconsolidated and does not have an independent surface temperature
Tuⁿ = bottom_temperature(i, j, grid, bottom_heat_bc, liquidus)
end

Can you start by adding a test that shows what the problem is?

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.

2 participants