HCJung-jbnu / Autocoding

0 stars 0 forks source link

GOcean API: python API #6

Closed HyunChaeJung closed 1 year ago

HyunChaeJung commented 1 year ago

[Kernel 코드의 metadata]

The detail for grid properties. There are four entries:

1) The name used in a kernel declaration.

2) The string required to dereference the property from the field.

A {0} is replaced with the name of the field variable

3) The type of the property: must be 'scalar' or 'array'.

4) The intrinsic type of the property: must be 'integer' or 'real'.

The following values are used by PSyclone, and are therefore required:

go_grid_xstop, go_grid_ystop,

gogrid{internal,whole}{inner,outer}{start,stop}

Details about the grid properties and their usage can be found in the

PSyclone documentation at:

https://psyclone.readthedocs.io/en/stable/gocean1p0.html#argument-metadata-meta-args

grid-properties = go_grid_xstop: {0}%%grid%%subdomain%%internal%%xstop: scalar: integer, go_grid_ystop: {0}%%grid%%subdomain%%internal%%ystop: scalar: integer, go_grid_data: {0}%%data: array: real, go_grid_internal_inner_stop: {0}%%internal%%xstop: scalar: integer, go_grid_internal_outer_stop: {0}%%internal%%ystop: scalar: integer, go_grid_whole_inner_stop: {0}%%whole%%xstop: scalar: integer, go_grid_whole_outer_stop: {0}%%whole%%ystop: scalar: integer, go_grid_internal_inner_start: {0}%%internal%%xstart: scalar: integer, go_grid_internal_outer_start: {0}%%internal%%ystart: scalar: integer, go_grid_whole_inner_start: {0}%%whole%%xstart: scalar: integer, go_grid_whole_outer_start: {0}%%whole%%ystart: scalar: integer, go_grid_area_t: {0}%%grid%%area_t: array: real, go_grid_area_u: {0}%%grid%%area_u: array: real, go_grid_area_v: {0}%%grid%%area_v: array: real, go_grid_mask_t: {0}%%grid%%tmask: array: integer, go_grid_dx_t: {0}%%grid%%dx_t: array: real, go_grid_dx_u: {0}%%grid%%dx_u: array: real, go_grid_dx_v: {0}%%grid%%dx_v: array: real, go_grid_dy_t: {0}%%grid%%dy_t: array: real, go_grid_dy_u: {0}%%grid%%dy_u: array: real, go_grid_dy_v: {0}%%grid%%dy_v: array: real, go_grid_lat_u: {0}%%grid%%gphiu: array: real, go_grid_lat_v: {0}%%grid%%gphiv: array: real, go_grid_dx_const: {0}%%grid%%dx: scalar: real, go_grid_dy_const: {0}%%grid%%dy: scalar: real, go_grid_nx: {0}%%grid%%nx: scalar: integer, go_grid_ny: {0}%%grid%%ny: scalar: integer, go_grid_x_min_index: {0}%%grid%%subdomain%%internal%%xstart: scalar: integer, go_grid_x_max_index: {0}%%grid%%subdomain%%internal%%xstop: scalar: integer, go_grid_y_min_index: {0}%%grid%%subdomain%%internal%%ystart: scalar: integer, go_grid_y_max_index: {0}%%grid%%subdomain%%internal%%ystop: scalar: integer


- GO_I_SCALAR, GO_R_SCALAR

무차원 integer = GO_I_SCALAR, 무차원 real = GO_R_SCALAR


- iterates_over의 기능
<img width="465" alt="image" src="https://user-images.githubusercontent.com/89285343/158769412-221a0500-c19d-422c-b241-53caf7420c32.png">

- grid_offset, GO_CU/CV/CT/CF, 의 기능

def setup_bounds(): '''Populates the GOLoop._bounds_lookup dictionary. This is used by PSyclone to look up the loop boundaries for each loop it creates.'''

    for grid_offset in SUPPORTED_OFFSETS:
        GOLoop._bounds_lookup[grid_offset] = {}
        for gridpt_type in VALID_FIELD_GRID_TYPES:
            GOLoop._bounds_lookup[grid_offset][gridpt_type] = {}
            for itspace in VALID_ITERATES_OVER:
                GOLoop._bounds_lookup[grid_offset][gridpt_type][
                    itspace] = {}

    # Loop bounds for a mesh with NE offset
    GOLoop._bounds_lookup['go_offset_ne']['go_ct']['go_all_pts'] = \
        {'inner': {'start': "{start}-1", 'stop': "{stop}+1"},
         'outer': {'start': "{start}-1", 'stop': "{stop}+1"}}
    GOLoop._bounds_lookup['go_offset_ne']['go_ct']['go_internal_pts'] = \
        {'inner': {'start': "{start}", 'stop': "{stop}"},
         'outer': {'start': "{start}", 'stop': "{stop}"}}
    GOLoop._bounds_lookup['go_offset_ne']['go_cu']['go_all_pts'] = \
        {'inner': {'start': "{start}-1", 'stop': "{stop}"},
         'outer': {'start': "{start}-1", 'stop': "{stop}+1"}}
    GOLoop._bounds_lookup['go_offset_ne']['go_cu']['go_internal_pts'] = \
        {'inner': {'start': "{start}", 'stop': "{stop}-1"},
         'outer': {'start': "{start}", 'stop': "{stop}"}}
    GOLoop._bounds_lookup['go_offset_ne']['go_cv']['go_all_pts'] = \
        {'inner': {'start': "{start}-1", 'stop': "{stop}+1"},
         'outer': {'start': "{start}-1", 'stop': "{stop}"}}
    GOLoop._bounds_lookup['go_offset_ne']['go_cv']['go_internal_pts'] = \
        {'inner': {'start': "{start}", 'stop': "{stop}"},
         'outer': {'start': "{start}", 'stop': "{stop}-1"}}
    GOLoop._bounds_lookup['go_offset_ne']['go_cf']['go_all_pts'] = \
        {'inner': {'start': "{start}-1", 'stop': "{stop}"},
         'outer': {'start': "{start}-1", 'stop': "{stop}"}}
    GOLoop._bounds_lookup['go_offset_ne']['go_cf']['go_internal_pts'] = \
        {'inner': {'start': "{start}-1", 'stop': "{stop}-1"},
         'outer': {'start': "{start}-1", 'stop': "{stop}-1"}}
    # Loop bounds for a mesh with SW offset
    GOLoop._bounds_lookup['go_offset_sw']['go_ct']['go_all_pts'] = \
        {'inner': {'start': "{start}-1", 'stop': "{stop}+1"},
         'outer': {'start': "{start}-1", 'stop': "{stop}+1"}}
    GOLoop._bounds_lookup['go_offset_sw']['go_ct']['go_internal_pts'] = \
        {'inner': {'start': "{start}", 'stop': "{stop}"},
         'outer': {'start': "{start}", 'stop': "{stop}"}}
    GOLoop._bounds_lookup['go_offset_sw']['go_cu']['go_all_pts'] = \
        {'inner': {'start': "{start}-1", 'stop': "{stop}+1"},
         'outer': {'start': "{start}-1", 'stop': "{stop}+1"}}
    GOLoop._bounds_lookup['go_offset_sw']['go_cu']['go_internal_pts'] = \
        {'inner': {'start': "{start}", 'stop': "{stop}+1"},
         'outer': {'start': "{start}", 'stop': "{stop}"}}
    GOLoop._bounds_lookup['go_offset_sw']['go_cv']['go_all_pts'] = \
        {'inner': {'start': "{start}-1", 'stop': "{stop}+1"},
         'outer': {'start': "{start}-1", 'stop': "{stop}+1"}}
    GOLoop._bounds_lookup['go_offset_sw']['go_cv']['go_internal_pts'] = \
        {'inner': {'start': "{start}", 'stop': "{stop}"},
         'outer': {'start': "{start}", 'stop': "{stop}+1"}}
    GOLoop._bounds_lookup['go_offset_sw']['go_cf']['go_all_pts'] = \
        {'inner': {'start': "{start}-1", 'stop': "{stop}+1"},
         'outer': {'start': "{start}-1", 'stop': "{stop}+1"}}
    GOLoop._bounds_lookup['go_offset_sw']['go_cf']['go_internal_pts'] = \
        {'inner': {'start': "{start}", 'stop': "{stop}+1"},
         'outer': {'start': "{start}", 'stop': "{stop}+1"}}