HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Write a vector field, stored as an array, to file. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <basic.h>
#include <arrayfunctions.h>
#include <mpivars.h>
#include <hypar.h>
Go to the source code of this file.
Functions | |
static int | WriteArraySerial (int, int, int *, int *, int, double *, double *, void *, void *, char *) |
static int | WriteArrayParallel (int, int, int *, int *, int, double *, double *, void *, void *, char *) |
int | WriteArray (int ndims, int nvars, int *dim_global, int *dim_local, int ghosts, double *x, double *u, void *s, void *m, char *fname_root) |
Write a vector field, stored as an array, to file.
Definition in file WriteArray.c.
|
static |
Function to write out a vector field, stored as an array, and its associated Cartesian grid to a file in serial mode. It will allocate the global domain on rank 0, so do not use for big problems for which the entire global domain will not fit on one node. This approach is also not very scalable.
ndims | Number of spatial dimensions |
nvars | Number of variables per grid point |
dim_global | Integer array of size ndims with global grid size in each dimension |
dim_local | Integer array of size ndims with local grid size in each dimension |
ghosts | Number of ghost points |
x | Array of spatial coordinates (i.e. the grid) |
u | Vector field to write |
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
fname_root | Filename root (extension is added automatically). For unsteady output, a numerical index is added that is the same as for the solution output files. |
Definition at line 74 of file WriteArray.c.
|
static |
Write a vector field, stored as an array, and its associated Cartesian grid to a file in parallel. All the MPI ranks are divided into IO groups, each with a group leader that writes out the data for the ranks in its group. The number of groups (and thus, the number of ranks participating in file I/O) is given by MPIVariables::N_IORanks. The group leader receives the local data from each rank in its group, and writes it out to the corresponding file.
This approach has been observed to be very scalable (with up to ~500,000 MPI ranks). The number of MPI ranks participating in file I/O (MPIVariables::N_IORanks) should be set to the number of I/O nodes available on a HPC platform, given the number of compute nodes the simulation is running on.
ndims | Number of spatial dimensions |
nvars | Number of variables per grid point |
dim_global | Integer array of size ndims with global grid size in each dimension |
dim_local | Integer array of size ndims with local grid size in each dimension |
ghosts | Number of ghost points |
x | Array of spatial coordinates (i.e. the grid) |
u | Vector field to write |
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
fname_root | Filename root (extension is added automatically). For unsteady output, a numerical index is added that is the same as for the solution output files. |
Definition at line 194 of file WriteArray.c.
int WriteArray | ( | int | ndims, |
int | nvars, | ||
int * | dim_global, | ||
int * | dim_local, | ||
int | ghosts, | ||
double * | x, | ||
double * | u, | ||
void * | s, | ||
void * | m, | ||
char * | fname_root | ||
) |
Write out a vector field, stored as an array, to file: wrapper function that calls the appropriate function depending on output mode (HyPar::output_mode). The output file format is determined by HyPar::op_file_format
ndims | Number of spatial dimensions |
nvars | Number of variables per grid point |
dim_global | Integer array of size ndims with global grid size in each dimension |
dim_local | Integer array of size ndims with local grid size in each dimension |
ghosts | Number of ghost points |
x | Array of spatial coordinates (i.e. the grid) |
u | Vector field to write |
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
fname_root | Filename root (extension is added automatically). For unsteady output, a numerical index is added that is the same as for the solution output files. |
Definition at line 27 of file WriteArray.c.