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

Add debug switch to capgen (30 hours) #325

Closed
gold2718 opened this issue Sep 29, 2020 · 3 comments · Fixed by #512
Closed

Add debug switch to capgen (30 hours) #325

gold2718 opened this issue Sep 29, 2020 · 3 comments · Fixed by #512
Assignees
Labels

Comments

@gold2718
Copy link
Collaborator

Add a new option to capgen, --debug, that, when selected, will cause capgen to generate code to test access to "optional" input variables.
The idea is to be able to generate an error before calling a physics scheme.
For the first pass, the only generated check is to test access to a variable which has the active keyword in its metadata. The test would be performed when the active clause is .true. as in the example below (copied from the 29 September meeting minutes):

[ntwa]
  standard_name = index_for_water_friendly_aerosols
  long_name = tracer index for water friendly aerosol
  units = index
  dimensions = ()
  type = integer
...
[qgrs(:,:,index_for_water_friendly_aerosols)]
  standard_name = water_friendly_aerosol_number_concentration
  long_name = number concentration of water-friendly aerosols
  units = kg-1
  dimensions = (horizontal_dimension,vertical_dimension)
  active = (index_for_water_friendly_aerosols > 0)
  type = real
  kind = kind_phys

--> in the cap:

if (ntwa > 0) then
   dummy = sum(qgrs(:,:,ntwa))
end if
! now call subroutine that does something with qgrs(:,:,ntwa) ...
@gold2718 gold2718 added enhancement capgen bugs, requests, etc. that involve ccpp_capgen labels Sep 29, 2020
@gold2718 gold2718 self-assigned this Sep 29, 2020
@climbfuji
Copy link
Collaborator

For the sake of completeness, the default value for the attribute active (if not specified in the metadata) is .true., i.e. all these variables should be checked prior to entering a scheme.

@climbfuji
Copy link
Collaborator

We should test array allocations and dimensions for all arrays that are supposed to be present, i.e. also those that have an implicit/default active = true value. Doesn't cost anything more.

@climbfuji
Copy link
Collaborator

Closed via #512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: main (Done)
2 participants