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

capgen must implement active metadata keyword (20 hours) #328

Closed
gold2718 opened this issue Oct 6, 2020 · 3 comments
Closed

capgen must implement active metadata keyword (20 hours) #328

gold2718 opened this issue Oct 6, 2020 · 3 comments
Assignees
Labels
capgen bugs, requests, etc. that involve ccpp_capgen capgen-unification enhancement

Comments

@gold2718
Copy link
Collaborator

gold2718 commented Oct 6, 2020

capgen must implement the active metadata keyword to allow the framework to skip unit conversions and block data transfer (e.g., for init and final phases).

@gold2718 gold2718 added enhancement capgen bugs, requests, etc. that involve ccpp_capgen labels Oct 6, 2020
@gold2718 gold2718 added this to the capgen unification milestone Oct 6, 2020
@gold2718 gold2718 self-assigned this Oct 6, 2020
@climbfuji climbfuji changed the title capgen must implement active metedata keyword capgen must implement active metadata keyword Mar 2, 2021
@gold2718
Copy link
Collaborator Author

If active is .false., do not attempt to access the underlying array (e.g., for unit conversion).
In debug mode (see #325), also generate code to attempt to access the array in order to trap bad data or non-allocated arrays.

@climbfuji
Copy link
Collaborator

That's correct - right now, we have the following scenarios.

The host model

  • allocates variables only under certain conditions
  • allocates them with different size, for example the 2006 and 2015 ozone parameterizations have different sizes for the ozone arrays)
  • initializes a variable to NaN and never updates it, because it is not used

The framework must avoid touching or reading those variables in the auto-generated caps when doing unit conversions, blocked data conversions etc. With the debug flags enabled for the code generator, the code should also check if arrays that are supposed to be allocated are allocated (to the correct size). This is something I am currently implementing in ccpp_prebuild.py for debugging an issue on Expanse.

Here is an example for a variable that is conditionally allocated by the host model and that needs to be converted from blocked data to contiguous data for the physics init phase:

GFS_typedefs.meta

[sncovr_ice]
  standard_name = surface_snow_area_fraction_over_ice
  long_name = surface snow area fraction over ice
  units = frac
  dimensions = (horizontal_loop_extent)
  type = real
  kind = kind_phys
  active = (control_for_land_surface_scheme == identifier_for_ruc_land_surface_scheme)

Auto-generated cap

      if ((GFS_Control%lsm == GFS_Control%lsm_ruc)) then
        ! Allocate local variable to copy blocked data GFS_Data(nb)%Sfcprop%sncovr_ice into a contiguous array
        allocate(sncovr_ice_local(one:GFS_Control%ncols))
        ib = 1
        do nb=1,GFS_Control%nblks
          sncovr_ice_local(ib:ib+GFS_Control%blksz(nb)-1) = GFS_Data(nb)%Sfcprop%sncovr_ice
          ib = ib+GFS_Control%blksz(nb)
        end do
      end if

@gold2718 gold2718 changed the title capgen must implement active metadata keyword capgen must implement active metadata keyword (20 hours) Oct 18, 2021
@dustinswales
Copy link
Collaborator

Completed as part of #512

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 enhancement
Projects
Status: main (Done)
Development

No branches or pull requests

3 participants