-
Notifications
You must be signed in to change notification settings - Fork 299
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
Allow collapsing to N dominant PFTs #457
Comments
Initial target for this is ability to say, at runtime, "I want to just run with the dominant N PFT(s) in each grid cell" (rather than all PFTs). We're not sure if we also want the bare land PFT in each grid cell. Some old CLM4 (or earlier) code used to do something like this (I think in SubgridMod??). @dlawrenncar asks how this would combine with collapsing crops from 78 to 16? Our initial thought is we would do the crop collapsing first, then pick the dominant N PFTs, treating all crop as one. Then this could be extended to turn off special landunits if their area is below some threshold. There may also be subtleties with how this works in transient mode. We might want to start by not accommodating transient. |
Gathering additional details. Received by email from @dlawrenncar: Received by email from @billsacks: |
Notes that should not clutter this page, I will gather here: |
I'm renaming this issue to be specific to allowing N dominant PFTs; I'll open separate issues for the other desired features. |
@slevisconsulting - I'm responding to some of your initial comments in the google doc here (so that these thoughts are easier for me to find later):
I like your thought. I had been stuck in the mode of thinking about what (I think) was in place a number of years ago, but your suggestion is better. With your suggestion, it's likely that no changes will be needed in subgridMod and initGridCellsMod.
I have been a little uneasy with the fact that
Yeah, at least for now let's assume that this new collapsing cannot be combined with transient runs (and add an error-check preventing that), because it seems like it will be a little messy to allow their combination - possibly requiring some rearrangement of dyn_subgrid code. |
I guess it is fine to assume that collapsing cannot be combined with
transient runs for now, but I was hoping that this might be a means to
speed up CTSM-climate configuration as well by reducing the max number of
PFTs represented in any grid cell, which would require having the
capability for this to work with transient runs as well.
…On Thu, Nov 29, 2018 at 3:18 PM Bill Sacks ***@***.***> wrote:
@slevisconsulting <https://github.com/slevisconsulting> - I'm responding
to some of your initial comments in the google doc here (so that these
thoughts are easier for me to find later):
1. My intuition tells me to start with subroutine surfrd_veg_all in
surfrdMod.F90.
Right after…
call collapse_crop_types (also called in subroutine dyncrop_interp for
transient runs)
add
call collapse_all_pfts (I doubt that NWP will perform transient runs)
...to perform a similar “collapse” for the pfts that are left.
... some text omitted ...
1. Bill expects changes in subgridMod, initGridCellsMod, and possibly
elsewhere.
I like your thought. I had been stuck in the mode of thinking about what
(I think) was in place a number of years ago, but your suggestion is
better. With your suggestion, it's likely that no changes will be needed in
subgridMod and initGridCellsMod.
The new subroutine will need to return updated
wt_lunit(begg:endg,istsoil)
wt_lunit(begg:endg,istcrop)
wt_nat_patch(begg:endg,:)
wt_cft(begg:endg,:)
fert_cft(begg:endg,:)
I have been a little uneasy with the fact that fert_cft is updated in
this same collapse routine: This design makes it hard to add additional
fields that should be collapsed, and makes the current collapse routine
harder to understand because it's doing multiple things. This is not just a
theoretical issue: we'll need to do this for irrigation method (see #565
<#565>) (this will use a slightly
different method since it's a discrete rather than continuous field, but it
will follow similar logic). I haven't given this much thought, but what I
think would be cleanest is if the main collapse routine returns the
information needed to collapse fert_cft and any similar field, then there
is a separate routine that takes that information and applies it to any
field – so you can call that separate routine on fert_cft or any other
field that needs similar collapsing. However, I recognize that that would
require more rework, so I'm okay if you don't want to tackle that change
right now, and we can come back to it later, if you prefer.
I doubt that NWP will perform transient runs
Yeah, at least for now let's assume that this new collapsing cannot be
combined with transient runs (and add an error-check preventing that),
because it seems like it will be a little messy to allow their combination
- possibly requiring some rearrangement of dyn_subgrid code.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#457 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AUAcVEuAELGoiPb0h0VqYgXgBUmMLb-Qks5u0F0wgaJpZM4VkJ4Q>
.
|
@slevisconsulting based on @dlawrenncar 's comment, maybe we should at least consider what it would take to combine this with transient. I don't think it will be terrible, and if it's wanted in the near future anyway, it might be easiest just to go ahead and do it now. Let me know if you want to look at this together or if you want to just take an initial look yourself. |
@billsacks thank you for validating my intuition about where to start :-) I like your recommendation regarding fert_cft and other variables and will try to tackle the way that you suggested. I'm happy to consider combining with transient. I do not see that as changing my starting point, ie adding call collapse_all_pfts in surfrdMod.F90. Once the non-transient changes work, I can also add call collapse_all_pfts in subroutine dynpft_interp for transient cases. Does that sound right? |
@billsacks I've started writing the code for this. In subroutine collapse_all_pfts I need to sort pfts and cfts to determine the dominant ones. This raises the question whether we have a function in the model for sorting. I did not find one when I searched in my branch. Do you know of one? If not, no problem. |
We do have access to LAPACK in CTSM and there's a subroutine called lasrt in there. There might be other home grown sort routines as well. Since, your lists are going to be short, it doesn't matter too much what algorithm is used. But, good to use something that's well done and already vetted... |
I agree with your starting point. However, I don't think transient will be quite that simple, because right now |
Regarding sorting, @ekluzek 's suggestion of using lasrt seems like a good one. I hadn't realized that existed, but seeing http://www.netlib.org/lapack/explore-3.1.1-html/dlasrt.f.html#DLASRT.1 this seems like as good a choice as any. |
This could be useful for ESCOMP#457
Actually, regarding sort: I realized that most out-of-the-box sorting routines (including this lapack one) won't do exactly what you want: Most sorting routines just sort the data, but don't tell you the resulting dominant indices into the data. So I think it's easier to roll our own here rather than trying to dig up a routine that does exactly what we want. I just whipped something up: see billsacks@15bf89c . If this will work for you, you can merge my branch (find_k_max_indices) into yours. |
I added a commit to my branch and turned it into a PR for easier reviewing: see #583 |
@billsacks two questions about merging your branch into mine:
|
I think it's possible to do a merge when you have uncommitted changes, but it's not recommended. From
The general recommendation is to either (1) commit or (2) stash your changes before merging. Regarding option (2): have you used
If you don't want to deal with
First, if you haven't added my fork as a remote, you'll need
Then, note that I have pushed a second commit. The easiest thing is:
|
Ok, merge complete. (I was only conceptually aware of git stash before.) Thanks! |
Nothing committed, yet. Here's a quick summary of work so far:
Subr. collapse_all_pfts: Subr. collapse_crop_var sets the passed crop variable to 0 where is_pft_known_to_model has been changed to .false. |
Updates and discussion will continue in #588. |
For the record: I tested gnu standard testing with the calling order reversed and it PASSed. However, you are correct @billsacks that I need to rework these. So in the end reordering the calls is not relevant. |
For the initial NWP configuration, we're pointing to a surface dataset that @barlage made manually. Eventually we want to be able to support this configuration out-of-the-box, both so (1) users can easily create their own datasets and set up runs equivalent to this at their own resolution, and (2) we can easily recreate this surface dataset for testing purposes as input requirements change.
One key aspect of this is allowing the model to just run with the dominant N PFTs in each grid cell (where N may often be 1). This could be done either at runtime or at mksurfdata_map time. Based on discussion yesterday, it seemed like doing this particular piece at runtime might be easiest and most useful, but either way could be done (note that, for NWP applications, it will be typical for users to create their own surface datasets for their own particular grid, rather than relying on out-of-the-box surface datasets -- so setting these kinds of things at mksurfdata_map time becomes more reasonable).
Other things we may want for this are:
Using higher thresholds for whether special landunits are present. For example, maybe lake is only present if it takes up 10% or more of the grid cell? We may want these thresholds to be selectable via the mksurfdata_map namelist (currently I think they're hardcoded in mksurfdata_map). (Update 2018-11-29: moved to Allow zeroing out special landunits if their area is below some threshold #581 .)
Turning off some things that take a long time to generate - such as the surface topographic variability and glacier elevation classes. We could have options to just use constant, pre-defined values for these. (Update 2018-11-29: moved to Allow turning off pieces of mksurfdata_esmf that take a long time to generate #582 .)
The text was updated successfully, but these errors were encountered: