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

Make surface flux fully explicit #3670

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

Make surface flux fully explicit #3670

wants to merge 1 commit into from

Conversation

szy21
Copy link
Member

@szy21 szy21 commented Mar 2, 2025

Purpose

Surface flux is now used as a boundary condition for vertical diffusion tendency. When using implicit diffusion, it causes errors in conservation as surface flux is accumulated in the explicit stage, but is updated in the implicit stage. This PR moves surface flux to fully explicit by adding an explicit boundary source and setting the boundary condition of diffusion flux to 0 (except for tke, which is treated slightly differently now but we are not considering tke in conservation). This should be ok as we don't take into account any Jacobian of surface flux in the implicit solver now.

Closes #3587

To-do

Content


  • I have read and checked the items on the review checklist.

@szy21 szy21 force-pushed the zs/exp_sfc_flux branch 2 times, most recently from 71b2f5c to fd035dc Compare March 2, 2025 08:59
@szy21
Copy link
Member Author

szy21 commented Mar 2, 2025

@dennisYatunin I don't really want to create a new surface_fllux_model for this. Ideally I want to reuse sfc_setup, but I also don't want to make it more complicated. I can't use sfc_setup directly right now because I want no surface flux tendency for NoSurface (which is what I added in the PR), but I need to have surface flux for PrescribedSurface (for coupler). Right now they both set sfc_steup to nothing. Do you see an easy way to make it work? Otherwise I'm fine with what I have.

@szy21 szy21 force-pushed the zs/exp_sfc_flux branch 3 times, most recently from 8b0dbf0 to a88092a Compare March 2, 2025 18:52
@szy21 szy21 marked this pull request as ready for review March 2, 2025 18:53
@szy21 szy21 force-pushed the zs/exp_sfc_flux branch 5 times, most recently from 84537d0 to 0d0b16e Compare March 2, 2025 21:35
@szy21 szy21 force-pushed the zs/exp_sfc_flux branch from 0d0b16e to cc323a3 Compare March 2, 2025 21:52
@Sbozzolo
Copy link
Member

Sbozzolo commented Mar 3, 2025

Could you please make sure to document the feature you added?

The surface conditions code is incredibly messy and we must improve clarity.

@@ -561,6 +564,7 @@ Base.@kwdef struct AtmosModel{
sfc_temperature::ST = nothing
insolation::IN = nothing
surface_model::SM = nothing
surface_flux_model::SFM = nothing
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer we didn't introduce yet another "surface" model setting. It adds complexity and confusion and makes coupling harder.

All the configurations related to the surface should be in a single place (this should include sfc_temperature and surface_albedo) so that we can easily understand and control them, without worrying about interdependencies and interactions.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we can avoid a new surface model. Right now whether we apply surface flux or not is controlled by vertical diffusion, which is not ideal. So we need something else to specify it. This is different from sfc_setup as there are some cases where we want to have surface flux (for EDMF updraft calculations), but we don't want to apply the tendency. We may be able to incorporate it within sfc_setup, but that will make surface conditions more complicated. I will talk with Dennis to see what would be the easiest and not too confusing way for this.

@szy21
Copy link
Member Author

szy21 commented Mar 3, 2025

Could you please make sure to document the feature you added?

The surface conditions code is incredibly messy and we must improve clarity.

Yes, I will add it once I finalize the interface with Dennis.

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.

Fix conservation with ARS
2 participants