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

Move btran2 to just inside of Fire model #1144

Closed
ekluzek opened this issue Sep 10, 2020 · 0 comments · Fixed by #1150, #1151 or #1155
Closed

Move btran2 to just inside of Fire model #1144

ekluzek opened this issue Sep 10, 2020 · 0 comments · Fixed by #1150, #1151 or #1155
Assignees
Labels
bfb bit-for-bit code health improving internal code structure to make easier to maintain (sustainability)

Comments

@ekluzek
Copy link
Collaborator

ekluzek commented Sep 10, 2020

btran2 is a bit of data in EnergyFluxes type that's just used as an alternative to btran for the Li Fire model. A scientific question would be could the fire model be tuned to use the regular value as well as the new PHS formulation? But, that would be an involved effort.

In the meantime, since this is just for use by the Li Fire model, it would be good to isolate it to just inside the fire model. Right now it's data in EnergyFluxes, it's initialized in CanopyFluxes, and then calculated in SoilMoistStress%calc_root_moist_stress_clm45default. And then it's only use is in CNFireLi2014Mod and CNFireLi2016Mod. clmfates_interfaceMod.F90 also uses it, but actually just sets it to a missing value, so it must not be used within FATES.

The calculation just involves this bit of code which is fairly well contained.

            s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8)

            call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf)

            smp_node_lf = max(smpsc(patch%itype(p)), smp_node_lf)
            btran2(p)   = btran2(p) +rootfr(p,j)*max(0._r8,min((smp_node_lf - smpsc(patch%itype(p))) / &
                    (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8))

So, s_node, smp_node_lf would be local variables. h2osoi_vol, watsat, soil_water_retention_curve, soilstate_inst, smpsc, rootfr, smpso are then passed into the subroutine for calculating it. So it needs the types: waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, and pftcon sent in. btran0 is a parameter in CanopyFluxes that is used for initialization, but it's just set to 0.0_r8, so I don't know that a big effort needs to be made to use it for btran2.

Note, #889 has some adjustments to the above, but if it's made to be inside LiFire model it'll be more straightforward to handle those changes without adding an extra switch for it outside of the existing fire_method switch.

@ekluzek ekluzek added code health improving internal code structure to make easier to maintain (sustainability) tag: simple bfb labels Sep 10, 2020
@ekluzek ekluzek self-assigned this Sep 10, 2020
@samsrabin samsrabin added simple bfb bit-for-bit labels Aug 8, 2024
samsrabin pushed a commit to samsrabin/CTSM that referenced this issue Sep 17, 2024
Revised quadratic equation solver for handling exceptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bfb bit-for-bit code health improving internal code structure to make easier to maintain (sustainability)
Projects
None yet
2 participants