Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Output variables that are conditionally available #2

Open
rmcd-mscb opened this issue Mar 30, 2020 · 2 comments
Open

Output variables that are conditionally available #2

rmcd-mscb opened this issue Mar 30, 2020 · 2 comments
Assignees

Comments

@rmcd-mscb
Copy link
Collaborator

rmcd-mscb commented Mar 30, 2020

@mdpiper There are some variables that are conditionally allocated. After talking with Parker I think I'm going to just take them out of the BMI. However for the sake of argument would something like this work fine in a bmi function?

      case('gw_upslope')
        if(this%model%control_data%cascadegw_flag%value > 0) then !Mark will this conditional work here?
            size = sizeof(this%model%model_simulation%groundwater%gw_upslope(1)) 
            bmi_status = BMI_SUCCESS
        else
            size = -1
            bmi_status = BMI_FAILURE
        endif
@mdpiper
Copy link
Collaborator

mdpiper commented Mar 30, 2020

Definitely! Or you could use allocated().

@rmcd-mscb
Copy link
Collaborator Author

Thanks Mark, I'm adding @pnorton-usgs for the sake of conversation. In this case gw_upslope does not have the allocatable attribute so allocated() doesn't work. so using cascadegw_flag would be the test.

Aside: The cascade module is not implemented in PRMS6 yet and Parker suggests removing vars associated with the cascade module for now and perhaps that's the best solution. However if the cascade module is implemented we'd still need conditional to return the value.

Regardless of the aside - I'm wondering, fully acknowledging my Fortran limitations, if gw_upslope, and others like it should have an allocatable attribute? Intel's take is that unless a var needs to be represented as just a pointer, if the var can use ALLOCATABLE it should (https://software.intel.com/en-us/forums/intel-fortran-compiler/topic/276711). If I'm off base here I'm sorry and apologize for taking your time :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants