YAC 3.12.0
Yet Another Coupler
Loading...
Searching...
No Matches
generate_cubed_sphere.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "generate_cubed_sphere.h"
#include "generate_reg2d.h"
#include "geometry.h"
#include "ppm/ppm_xfuncs.h"
#include "io_utils.h"
#include <netcdf.h>
Include dependency graph for generate_cubed_sphere.c:

Go to the source code of this file.

Functions

void yac_generate_cubed_sphere_grid_information (unsigned n, unsigned *num_cells, unsigned *num_vertices, double **x_vertices, double **y_vertices, double **z_vertices, unsigned **cell_to_vertex, unsigned **face_id)
 
struct yac_basic_grid_data yac_generate_cubed_sphere_grid (unsigned n)
 
struct yac_basic_gridyac_generate_cubed_sphere_basic_grid (char const *name, size_t n)
 
static void decompose_domain_simple (unsigned n, int size, int *cell_owner)
 
static void decompose_domain_2d (unsigned n, int size, int *cell_owner)
 
static void decompose_domain (unsigned n, int size, int *cell_owner)
 
void yac_generate_part_cube_grid_information (unsigned n, unsigned *nbr_vertices, unsigned *nbr_cells, unsigned **num_vertices_per_cell, unsigned **cell_to_vertex, double **x_vertices, double **y_vertices, double **x_cells, double **y_cells, int **global_cell_id, int **cell_core_mask, int **global_corner_id, int **corner_core_mask, int rank, int size)
 
void yac_write_cubed_sphere_grid (unsigned n, char const *filename)
 

Function Documentation

◆ decompose_domain()

static void decompose_domain ( unsigned n,
int size,
int * cell_owner )
static

Definition at line 556 of file generate_cubed_sphere.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decompose_domain_2d()

static void decompose_domain_2d ( unsigned n,
int size,
int * cell_owner )
static

Definition at line 519 of file generate_cubed_sphere.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decompose_domain_simple()

static void decompose_domain_simple ( unsigned n,
int size,
int * cell_owner )
static

Definition at line 511 of file generate_cubed_sphere.c.

Here is the caller graph for this function:

◆ yac_generate_cubed_sphere_basic_grid()

struct yac_basic_grid * yac_generate_cubed_sphere_basic_grid ( char const * name,
size_t n )

Creates a cubed sphere grid with n subdivisions and given name

Parameters
[in]namename of the grid
[in]nnumber of subdivisions of the cubed sphere grid
Returns
yac_basic_grid holding a cubed sphere grid
See also
yac_generate_cubed_sphere_grid_information for details

Definition at line 502 of file generate_cubed_sphere.c.

Here is the call graph for this function:

◆ yac_generate_cubed_sphere_grid()

struct yac_basic_grid_data yac_generate_cubed_sphere_grid ( unsigned n)

Creates a cubed sphere grid with n subdivisions

Parameters
[in]nnumber of subdivisions of the cubed sphere grid
Returns
yac_basic_grid_data containing data for a cubed sphere grid
See also
yac_generate_cubed_sphere_grid_information for details

Definition at line 456 of file generate_cubed_sphere.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_generate_cubed_sphere_grid_information()

void yac_generate_cubed_sphere_grid_information ( unsigned n,
unsigned * num_cells,
unsigned * num_vertices,
double ** x_vertices,
double ** y_vertices,
double ** z_vertices,
unsigned ** vertices_of_cell,
unsigned ** face_id )

Creates a cubed sphere grid with n subdivisions

This routine is based on Matlab code provided by Mike Hobson and written by Mike Rezny (both from MetOffice)

Parameters
[in]nnumber of subdivisions of the cubed sphere grid
[out]num_cellsnumber of cells in the grid
[out]num_verticesnumber of vertices in the grid
[out]x_verticesx coordinate of vertices
[out]y_verticesy coordinate of vertices
[out]z_verticesz coordinate of vertices
[out]vertices_of_cellvertex indices for each cell
[out]face_idid for orientation of face w.r.t cube faces (unused)
Remarks
Vertex coordinates are provided in Cartesian coordinates on a unit sphere, with the center of the sphere being the origin of the coordinate system.

Definition at line 19 of file generate_cubed_sphere.c.

Here is the caller graph for this function:

◆ yac_generate_part_cube_grid_information()

void yac_generate_part_cube_grid_information ( unsigned n,
unsigned * nbr_vertices,
unsigned * nbr_cells,
unsigned ** num_vertices_per_cell,
unsigned ** cell_to_vertex,
double ** x_vertices,
double ** y_vertices,
double ** x_cells,
double ** y_cells,
int ** global_cell_id,
int ** cell_core_mask,
int ** global_corner_id,
int ** corner_core_mask,
int rank,
int size )

Creates a cubed sphere grid with n subdivisions decomposed for a given number of ranks

Parameters
[in]nnumber of subdivisions of the cubed sphere grid
[out]nbr_verticesnumber of vertices in the grid
[out]nbr_cellsnumber of cells in the grid
[out]num_vertices_per_cellnumber of vertices per cell
[out]cell_to_vertexvertex indices for each cell
[out]x_verticeslongitudes of vertices in radians
[out]y_verticeslatitudes of vertices in radians
[out]x_cellslongitudes of cell center in radians
[out]y_cellslatitudes of cell center in radians
[out]global_cell_idglobal cell IDs
[out]cell_core_maskcell core mask
[out]global_corner_idglobal corner IDs
[out]corner_core_maskcorner core mask
[in]rankid of this rank
[in]sizetotal number of ranks
See also
yac_generate_cubed_sphere_grid_information for details

Definition at line 565 of file generate_cubed_sphere.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_write_cubed_sphere_grid()

void yac_write_cubed_sphere_grid ( unsigned n,
char const * filename )

Creates a cubed sphere grid with n subdivisions and writes it to a netCDF file using an ICON-grid-file like layout.

Parameters
[in]nnumber of subdivisions of the cubed sphere grid
[in]filenamefile name
See also
yac_generate_cubed_sphere_grid_information for details

Definition at line 755 of file generate_cubed_sphere.c.

Here is the call graph for this function: