Skip to content

Add nwp physics option #451

Closed
Closed

Description

@ekluzek

We need to add a new physics option that for now I'm calling ctsm-nwp1_0 that's based on clm5_0 physics, but flags a few specific namelist items that are important for the NWP (Numerical Weather Prediction) configuration for CTSM.

I think the way to do this is to have it retain the model comparison features for clm series (so it would be assigned a value of 5.0), but also have specific namelist items check the exact string and be set accordingly.

In the long run with the python version we'll probably want a more general solution. But, we want a quick and dirty version that will work in the current environment that will allow a new physics setting.

@billsacks

Activity

  1. added
    enhancementnew capability or improved behavior of existing capability
    priority: highHigh priority to fix/merge soon, e.g., because it is a problem in important configurations
    investigationNeeds to be verified and more investigation into what's going on.
    on Jul 26, 2018
  2. removed
    investigationNeeds to be verified and more investigation into what's going on.
    on Jul 27, 2018
  3. billsacks commented on Jul 27, 2018

    @billsacks
    Member

    I was looking into how we use the numeric comparisons in CLMBuildNamelist, by searching for uses of as_long() (and then I did a quick search for other uses of phys or physv to see if I missed anything). It looks like, for the most part, this is just used to distinguish between clm4.0 and anything later (since clm4.0 uses a different code base). So, unless there's some other use of the numeric comparisons that I'm not aware of, it seems like this task will become much easier and cleaner if we first remove clm4.0 support.

    Here are some exceptions, where we use the numeric comparisons in different ways. As I note below, I think all three of these exceptions are unnecessary:

    (1)

      # These should NOT be set for CLM5.0 and beyond
      if ( $physv->as_long() > $physv->as_long("clm4_5") ) {
         foreach my $var ( "origflag", "h2osfcflag", "oldfflag" ) {
            my $val = $nl->get_value($var);
            if ( defined($val) ) {
               $log->fatal_error( "ERROR:: $var=$val is deprecated and can only be used with CLM4.5" );
            }
         }
      }

    but I think we can just remove that one error-check to keep things simpler.

    (2)

        my $var = "jmaxb1";
        if ( $physv->as_long() >= $physv->as_long("clm5_0") && &value_is_true( $nl_flags->{'use_luna'} ) ) {
           add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
                         'use_luna'=>$nl_flags->{'use_luna'} );
        }

    I would (somewhat naively) argue that this logic is wrong: it seems like this should just depend on use_luna without considering the phys version number. For example, if you want to run with mostly clm4_5 but turn on luna, my guess is that jmaxb1 should be added to the namelist, too. This feeling is supported by the following lines, which check for physv >= clm4_5, not clm5_0:

        my $val = $nl->get_value($var);
        if ( $physv->as_long() >= $physv->as_long("clm4_5") && ! &value_is_true( $nl_flags->{'use_luna'} ) ) {
           if ( defined($val) ) {
              $log->fatal_error("Cannot set $var when use_luna is NOT on" );
           }
        }
    

    (3)

      if ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'bgc_mode'} ne "sp" ) {
        # When FUN is on and it's clm5_0 get a default value
        if ( &value_is_true( $nl->get_value('use_fun') ) && $physv->as_long() >= $physv->as_long("clm5_0")) {
           add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults,
                       $nl, 'br_root', 'phys'=>$nl_flags->{'phys'},
                       'use_fun'=>$nl->get_value('use_fun'),
                       'use_cn'=>$nl_flags->{'use_cn'} );
        }

    As with (2), I'd argue that this shouldn't be checking for physv >= clm5_0: it should just be checking if use_fun is on.

  4. billsacks commented on Jul 27, 2018

    @billsacks
    Member

    @ekluzek - given my previous comment, my sense is that, if we first remove clm4.0 support (which I could plan to do soon for this purpose), we can remove the need for numeric comparisons. Can you let me know if you agree with this, or if I'm missing something?

    So I'd propose the following plan of attack, where I would do (1) - (3) in the next few weeks, and you (possibly together with me) would do (4) - (5) in the next few months:

    1. Remove clm4.0 support

    2. Remove numeric comparison ability for now

    3. Add nwp support, using exact string match

    4. Convert to python

    5. Add back in numeric comparison option, allowing this in the defaults xml file (Allow namelist defaults to apply for phys versions greater than or less than a given version #454 )

    How does that sound to you?

  5. self-assigned this
    on Jul 27, 2018
  6. billsacks commented on Jul 27, 2018

    @billsacks
    Member

    And to be clear: I'm thinking that, with my proposed plan, we would not need the "nwp1.0" option to "inherit" from "clm5_0".

  7. billsacks commented on Jul 27, 2018

    @billsacks
    Member

    See #456 for discussion on what should be done with this phys option.

  8. ekluzek commented on Jul 27, 2018

    @ekluzek
    ContributorAuthor

    @billsacks I looked at the code some as well. And I think you are right, primarily the physics mode is used to distinguish out clm4_0. That's how it's actually used.

    I looked a little bit into the exceptions that you list. The first group ( "origflag", "h2osfcflag", "oldfflag" ) is a way to deprecate options that should be heading towards removal.

    "jmaxb1" is more complicated and probably needs more investigation. This check as it is, does go back at least until r200. It's likely it just needs to be tied to use_luna rather than clm5_0. But, we should figure that out for sure.

    But, the sequence you give also makes sense to me.

  9. billsacks commented on Jan 3, 2019

    @billsacks
    Member

    @ekluzek I plan to start tackling this soon. Regarding your last comment: who would be the appropriate person to weigh in on the jmaxb1 logic?

  10. ekluzek commented on Jan 3, 2019

    @ekluzek
    ContributorAuthor

    @billsacks @rosiealice and @wwieder would be two people to check with about Jmaxb1. It is local to LunaMod, so really is tied to use_luna=T.

  11. billsacks commented on Jan 3, 2019

    @billsacks
    Member

    @rosiealice or @wwieder can one of you please confirm my feelings in point (2) in this comment

    #451 (comment)

    i.e., is it correct that the presence of jmaxb1 in the namelist should only be tied to whether use_luna is true – so that it's included even if running with clm4_5 physics if use_luna is set to true?

  12. rosiealice commented on Jan 3, 2019

    @rosiealice
    Contributor
  13. billsacks commented on Jan 3, 2019

    @billsacks
    Member

    @rosiealice sorry, I'm having trouble interpreting your answer. I think the takeaway here is that I can change

        if ( $physv->as_long() >= $physv->as_long("clm5_0") && &value_is_true( $nl_flags->{'use_luna'} ) ) {
           add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
                         'use_luna'=>$nl_flags->{'use_luna'} );
        }

    to simply

        if ( &value_is_true( $nl_flags->{'use_luna'} ) ) {
           add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
                         'use_luna'=>$nl_flags->{'use_luna'} );
        }

    (Which I want to do to support the addition of an NWP physics option.)

    But let me know if I'm misinterpreting your answer.

  14. rosiealice commented on Jan 3, 2019

    @rosiealice
    Contributor
  15. billsacks commented on Jan 3, 2019

    @billsacks
    Member

    Yes, good enough for me - thanks. (For the record: I'm going to go ahead with my proposed change.)

    At some point I'd like to have more discussion about your point (2):

    1. LUNA is only ever true in CLM5. It can't be true in CLM4.5

    This statement doesn't work for me, because (in my mind) the physics option (clm4_5 vs. clm5_0) just sets a suite of default parameter values, which can then be overridden. So, in principle, one should be able to set up a CLM45 case, then change all of the individual namelist options that depend on the physics option to end up with a case that is identical to a CLM50 case.

    So the relevant question for me is: What CLM4.5 option(s) is LUNA incompatible with?

    This isn't a purely academic question: It's relevant, for example, as we introduce an NWP option that is something of a hybrid between CLM4.5 and CLM5.0: we'll need to determine if LUNA is compatible with this NWP physics option.

  16. rosiealice commented on Jan 3, 2019

    @rosiealice
    Contributor
  17. added a commit that references this issue on May 1, 2019
    b1418ae
  18. added a commit that references this issue on Aug 26, 2019
  19. added a commit that references this issue on Sep 30, 2019
    7965ce0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementnew capability or improved behavior of existing capabilitypriority: highHigh priority to fix/merge soon, e.g., because it is a problem in important configurations

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions