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

How should we order indices in tracer_local? #319

Open
mnlevy1981 opened this issue Sep 11, 2018 · 2 comments
Open

How should we order indices in tracer_local? #319

mnlevy1981 opened this issue Sep 11, 2018 · 2 comments

Comments

@mnlevy1981
Copy link
Collaborator

Currently tracer_local is dimension(tracer_cnt, km). Is this what we want? In some subroutines, such as compute_autotroph_elemental_ratios() it would be advantageous to have have km be the inner-most dimension, while that might not be the case for other subroutines.

As I work through #53 and #316 I'll keep an eye out for examples of subroutines where the current ordering is preferable and update this issue accordingly.

@mnlevy1981
Copy link
Collaborator Author

@klindsay28 a starting point could be to keep both tracer_local and its transpose in memory and pass the optimal dimension ordering to each routine. This can help us track which routines are better-suited for each memory layout

@matt-long suggests this will be easier to test once we have a stand-alone driver testing interior_tendency_compute() because it will be faster to build / run

@mnlevy1981
Copy link
Collaborator Author

mnlevy1981 commented Oct 31, 2018

With the changes from #318 in place, we should swap the dimensions of all the PFT-specific variables as well. For example, compute_Pprime() would be more efficient with the following change:

     !  Compute Pprime for all autotrophs, used for loss terms
     do auto_ind = 1, autotroph_cnt
       where (temperature < autotroph_settings(auto_ind)%temp_thres)
         C_loss_thres = f_loss_thres * autotroph_settings(auto_ind)%loss_thres2
       else where
         C_loss_thres = f_loss_thres * autotroph_settings(auto_ind)%loss_thres
       end where
-      Pprime(auto_ind,:) = max(autotroph_local%C(auto_ind,:) - C_loss_thres, c0)
+      Pprime(:,auto_ind) = max(autotroph_local%C(:,auto_ind) - C_loss_thres, c0)
     end do

This specific example would require changing the constructor for both autotroph_local_type and autotroph_derived_terms_type.

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