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

Initial API for data transfers between main program and libtrixi #43

Open
sloede opened this issue Jul 5, 2023 · 1 comment
Open

Initial API for data transfers between main program and libtrixi #43

sloede opened this issue Jul 5, 2023 · 1 comment

Comments

@sloede
Copy link
Member

sloede commented Jul 5, 2023

Here are some initial thoughts for an API that would allow one to do more than just control the main time integration loop from outside. The idea is to keep this initial post updated (by anyone) with the results of the subsequent discussion.

Basic querying

Functions to get basic information from Trixi.jl.

int trixi_ndims(int handle);         // Return number of spatial dimensions
int trixi_nelements(int handle);     // Return number of elements (cells)
int trixi_polydeg(int handle);       // Return polynomial degree of DGSEM approximation
int trixi_nvariables(int handle);    // Return number of (conservative) variables
int trixi_ndofs(int handle);         // Return total number of degrees of freedom
int trixi_ndofs_element(int handle); // Return number of degrees of freedom for one element

Raw data exchange

Direct access to solution data u.

void trixi_load_u(double* u, int handle);        // Load data from Trixi.jl into `u`
void trixi_store_u(const double* u, int handle); // Store data from `u` in Trixi.jl

Block-structured data exchange

DGSEM has >> 1 degrees of freedom (DOF) per element. However, other programs might not care for our Gauss node distribution and just want equidistant data (a.k.a. finite-volume-type block-structured data), e.g., 8x8x8 cell-centered values per element. Thus we provide convenience functions that allow loading and storing in such block-structured format and do the conversion to Gauss nodes internally.

void trixi_set_blocksize(int blocksize, int handle);   // Set 1D block size
int  trixi_get_blocksize(int handle);                  // Get 1D block size
int  trixi_ndofs_block(int handle);                    // Return total #DOFs for block-structured data
void trixi_load_u_block(double* u, int handle);        // Load block-structured data from Trixi.jl
void trixi_store_u_block(const double* u, int handle); // Store block structured data in Trixi.jl
@benegee
Copy link
Collaborator

benegee commented Oct 20, 2023

Current status

Basic querying

  • int trixi_ndims(int handle); // Return number of spatial dimensions
  • int trixi_nelements(int handle); // Return number of elements (cells) on local MPI rank
  • int trixi_nelements_global(int handle); // Return global number of element (cells)
  • int trixi_nvariables(int handle); // Return number of (conservative) variables
  • int trixi_polydeg(int handle); // Return polynomial degree of DGSEM approximation
  • int trixi_ndofs(int handle); // Return total number of degrees of freedom
  • int trixi_ndofs_element(int handle); // Return number of degrees of freedom for one element

Data exchange

Piecewise constant

  • void trixi_load_cell_averages(double * data, int handle);
    Compute cell-wise averages and load into u`.
    This needs to be changed: not a single array for all variables, but individual arrays for each variable
  • void trixi_store_cell_averages(double * data, int handle);
    Store cell-wise averages for Trixi, e.g. a velocity field for a transport problem.

DG aware

  • Data would need to be interpolated to Gauss nodes. This could be done using a finer mesh, i.e. n^d finite-volume-type cells are used to set up a DG polynomial on a single cell with n^d DOFs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants