/* * This is another option of writing gcrm data in damsel * we create vertices and treat the geodesic grid as an unstructured grid. * The problem here is that for layers we need to define edges as well. * And then there are two types of variables - grid and non-grid. * We need to tag each vertex or edge with corresponding grid/non-grid variables. */ #include #include #include #include "mpi.h" #include "damsel.h" #define FILENAME "output/gcrm1.h5" /*Some scalars for global attributes, will tag the container of collection with corners, edges and cells*/ int layers = 256; int interfaces = 257; int cells = 1000;//40962; int corners = 2000; //81920; int edges = 3000; //122880; int cellcorners = 6; int celledges = 6; int endpoints = 2; int cellneighbors = 6; //int tag_data[] = {layers, interfaces, cells, corners, edges, cellcorners, celledges, endpoints, cellneighbors}; float cell_lat_data[1000]; float edge_lat_data[3000]; float corner_lat_data[2000]; float cell_pressure[1000][6]; //number of cells and cell corners //float corner_temp[][]; //float edge_denst[][]; /*Function to define different containers of cells, corners, etc*/ damsel_container *create_containers(damsel_model model); /*These two functions for defining/setting tags on the collection with all the corners, edges and cells*/ damsel_err_t define_grid_dim_tags(damsel_model model, damsel_handle *tag_handles); damsel_err_t set_grid_dim_tags(damsel_container container, int tag_data[], damsel_handle tag_handles[]); /*These two functions are for defining/setting longitude and latitude on all cells, corners and edges*/ /*In this test we are only specifying latitude values, there will be the same steps for longitudes*/ damsel_err_t define_lat_tags(damsel_model model, damsel_handle *lat_tag_handles); damsel_err_t set_lat_tags(damsel_container *container, damsel_handle *lat_tag_handles); /*These functions are for defining/setting a solution variable on cells*/ damsel_err_t define_cell_tags(damsel_model model, damsel_data_type dt, damsel_handle *cell_tag_handles); damsel_err_t set_cell_tags(damsel_container *container, damsel_handle *cell_tag_handles); int main(int argc, char **argv) { int res; // damsel_handle tag_handles[9]; //for global attributes like number of cells etc, We may not need them but I am defining them in any case damsel_handle cell_tag_handles[3]; damsel_handle lat_tag_handles[3]; //damsel_handle edge_coll_handle = 101; //damsel_handle corner_coll_handle = 102; //damsel_handle grid_coll_handle = 103; damsel_container *cec_container; // int tag_data[] = {layers, interfaces, cells, corners, edges, cellcorners, celledges, endpoints, cellneighbors}; int i, j; for(i=0;i