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

Avoid associate statements using index of 0? #58

Open
mnlevy1981 opened this issue May 6, 2016 · 0 comments
Open

Avoid associate statements using index of 0? #58

mnlevy1981 opened this issue May 6, 2016 · 0 comments

Comments

@mnlevy1981
Copy link
Collaborator

In both set_surface_forcing and its associated diagnostics routine, we have large associate statements that include blocks of code pointing at specific elements of arrays. For example

    associate(                                                                                  &
         ind_diag          => marbl_surface_forcing_diag_ind,                                   &
         ind_forc          => surface_forcing_ind,                                              &

         diags             => surface_forcing_diags%diags(:),                                   &
         xkw               => surface_input_forcings(:,surface_forcing_ind%xkw_id),             &
         xco2              => surface_input_forcings(:,surface_forcing_ind%xco2_id),            &
         xco2_alt_co2      => surface_input_forcings(:,surface_forcing_ind%xco2_alt_co2_id),    &
         ap_used           => surface_input_forcings(:,surface_forcing_ind%atm_pressure_id),    &
         ifrac             => surface_input_forcings(:,surface_forcing_ind%ifrac_id),           &
         dust_flux_in      => surface_input_forcings(:,surface_forcing_ind%dust_flux_id),       &

As we move to a more flexible codebase, it is possible that some of these surface_forcing_ind elements will be 0 (if, for example, we want to run without the "alternate CO2" computations, surface_forcing_ind%xco2_alt_co2_id=0). I thought we ran into an issue at one point where a compiler complained about associating to something out of the bounds of the array, but I don't remember the specifics... so I'm creating this issue ticket as a place to leave comments if it comes up again.

I believe @klindsay28 is working on a branch of the code where surface_forcing_ind%iron_flux_id=0 - can you please leave a comment and let us know if any of the big three compilers (Intel, GNU, NAG) complains?

Two possible work-arounds:

  1. Nested associate statements (would need to see how compilers react to that, as well)
  2. Pointers instead of associate statements (would need to set up target attribute in a lot of data types)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant