NCAR / musica

Multi-Scale Infrastructure for Chemistry Modeling
https://wiki.ucar.edu/display/MUSICA/MUSICA+Home
Apache License 2.0
3 stars 2 forks source link

Allow TUV-x grid data to be updated through the API #120

Closed mattldawson closed 4 weeks ago

mattldawson commented 1 month ago

Add the ability for host applications to update grid data at runtime.

Acceptance Criteria

Ideas

type :: grid_t type(cptr) :: ptr ! Pointer to specific grid in tuvx_core%gridwarehouse end type

- Add `internal_get_grids_tuvx` function to `module tuvx_interface`:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

function internal_get_grids_tuvx(tuvx) result(grids)
  use iso_c_binding, only: c_ptr, c_f_pointer
  type(c_ptr), intent(in) :: tuvx
  type(grid_map_t) :: grids

  type(core_t), pointer :: core

  call c_f_pointer(tuvx, core)
  grids%ptr_ = c_loc( core%grid_warehouse_ )

end function internal_get_grids_tuvx

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

- do something similar for `grid_t` that looks up grids by name and units
- add `grid_t::update_edges()` and `grid_t::update_mid_points()`
- a user could do something like this:

tuvx => tuvx_t( config_path ) grids = tuvx%create_grids( ) grid = grids%get( "height", "m" ) call grid%update_edges( new_edge_data_array ) call grid%update_mid_points( new_mid_point_data_array )



![image](https://github.com/NCAR/musica/assets/13836216/2dff242c-68dc-409c-8666-95530ade460e)