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

subroutine keyword arguments #306

Closed
davegill opened this issue Jun 19, 2020 · 7 comments
Closed

subroutine keyword arguments #306

davegill opened this issue Jun 19, 2020 · 7 comments
Assignees
Labels
capgen bugs, requests, etc. that involve ccpp_capgen capgen-unification

Comments

@davegill
Copy link
Contributor

One can use any order of the input arguments if those arguments are specified by their dummy name. However, for CCPP usage, this variable ordering is not important for automatically generated code.

However, in support of optional arguments to CCPP-ized routines (#305 Support for optional arguments to CCPP-ized physics schemes), the subroutine keyword arguments will be invaluable. Without keyword argument support, optional arguments are severely restricted in use.

@davegill
Copy link
Contributor Author

@climbfuji @grantfirl @gold2718 @cacraigucar
If we use the vertical mixing example, a routine can be written that includes a few extra slots for additional arrays of arrays: chemistry, tracers, etc.

If host models do not have those fields at compile-time, those arguments can be absent in the constructed call.

Therefore the scheme is portable to host models either with or without those variables.

@climbfuji
Copy link
Collaborator

@davegill We already had quite some discussion around this ... since I will be out the next two meetings, we should schedule something earlier than July 9 to get you up to speed.

@grantfirl @gold2718 @cacraigucar

@gold2718
Copy link
Collaborator

@climbfuji, This issue is really only necessary when considering #305. Still, it might be an interesting option that would make the generated caps longer but perhaps more readable in that each local variable name of the scheme would be shown in the call statement making it easy to see how the CCPP is calling that scheme.
My thinking is that this could be introduced as an option to capgen.

@climbfuji
Copy link
Collaborator

@climbfuji, This issue is really only necessary when considering #305. Still, it might be an interesting option that would make the generated caps longer but perhaps more readable in that each local variable name of the scheme would be shown in the call statement making it easy to see how the CCPP is calling that scheme.
My thinking is that this could be introduced as an option to capgen.

Note that ccpp_prebuild.py always uses keyword arguments. This is almost necessary, because local names in subroutines often/almost always differ from the host model names and it makes it much easier to read what goes to where.

@gold2718
Copy link
Collaborator

@climbfuji, it sounds like you would prefer that this 'feature' just be added to capgen. Do you agree?

@gold2718 gold2718 self-assigned this Jun 19, 2020
@gold2718 gold2718 added the capgen bugs, requests, etc. that involve ccpp_capgen label Jun 19, 2020
@climbfuji
Copy link
Collaborator

@climbfuji, it sounds like you would prefer that this 'feature' just be added to capgen. Do you agree?

Yes, please.

@gold2718 gold2718 added this to the capgen unification milestone Oct 6, 2020
@gold2718 gold2718 removed this from the capgen unification milestone Nov 24, 2020
gold2718 pushed a commit to gold2718/ccpp-framework that referenced this issue Jan 29, 2021
Fix to allow comment lines within a metadata variable entry
Catch duplicate host model variables entered via DDT (NCAR#333)
Always use dummy argument names in subroutine calls (NCAR#306)
Ignore optional Fortran variables that are not in metadata (NCAR#346)
gold2718 pushed a commit that referenced this issue Feb 2, 2021
Catch duplicate host model variables entered via DDT (#333)
Always use dummy argument names in subroutine calls (#306)
Ignore optional Fortran variables that are not in metadata (#346)
@gold2718
Copy link
Collaborator

gold2718 commented Feb 9, 2021

This was fixed by #347 but a typo in the "fixes" line prevented automatic closure.

@gold2718 gold2718 closed this as completed Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
capgen bugs, requests, etc. that involve ccpp_capgen capgen-unification
Projects
None yet
Development

No branches or pull requests

3 participants