|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Go to the source code of this file.
Functions | |
| PetscInt | CreateVTKFileFromMetadata (const char *filename, const VTKMetaData *meta, MPI_Comm comm) |
| Creates and writes a VTK file (either .vts or .vtp) from a populated metadata struct. | |
| PetscErrorCode | PrepareOutputCoordinates (UserCtx *user, PetscScalar **out_coords, PetscInt *out_nx, PetscInt *out_ny, PetscInt *out_nz, PetscInt *out_npoints) |
| Creates a C array of coordinates corresponding to a subsampled (legacy-style) grid. | |
| PetscErrorCode | PrepareOutputEulerianFieldData (UserCtx *user, Vec field_vec, PetscInt num_components, PetscScalar **out_data) |
| Creates a C array of field data corresponding to a subsampled (legacy-style) grid. | |
| PetscErrorCode | BeginStructuredVTKOutput (UserCtx *user, VTKMetaData *meta) |
| Begins one structured VTK file: clears the metadata and builds its coordinates. | |
| PetscErrorCode | AppendStructuredVTKField (UserCtx *user, VTKMetaData *meta, const char *name, Vec field_vec, PetscInt components) |
| Adds one point-data field to a structured VTK file being assembled. | |
| PetscErrorCode | FinishStructuredVTKOutput (VTKMetaData *meta, const char *filename) |
| Writes an assembled structured VTK file and releases its buffers. | |
| PetscErrorCode | PrepareOutputParticleData (UserCtx *user, PostProcessParams *pps, VTKMetaData *meta, PetscInt *p_n_total) |
| Gathers, subsamples, and prepares all particle data for VTK output. | |
| PetscInt CreateVTKFileFromMetadata | ( | const char * | filename, |
| const VTKMetaData * | meta, | ||
| MPI_Comm | comm | ||
| ) |
Creates and writes a VTK file (either .vts or .vtp) from a populated metadata struct.
| [in] | filename | The output file name. |
| [in] | meta | Pointer to a VTKMetaData structure containing all necessary fields. |
| [in] | comm | The MPI communicator. |
Creates and writes a VTK file (either .vts or .vtp) from a populated metadata struct.
Creates a VTK file from prepared metadata and field payloads.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/vtk_io.h.
Definition at line 149 of file vtk_io.c.
| PetscErrorCode PrepareOutputCoordinates | ( | UserCtx * | user, |
| PetscScalar ** | out_coords, | ||
| PetscInt * | out_nx, | ||
| PetscInt * | out_ny, | ||
| PetscInt * | out_nz, | ||
| PetscInt * | out_npoints | ||
| ) |
Creates a C array of coordinates corresponding to a subsampled (legacy-style) grid.
This function gathers the full, distributed grid coordinates onto rank 0. On rank 0, it then allocates a new, smaller C array and copies only the coordinates for the nodes within the range [0..IM-2, 0..JM-2, 0..KM-2]. This produces a contiguous array of points for a grid of size (IM-1)x(JM-1)x(KM-1), matching the legacy output. The output arrays are only allocated and valid on rank 0.
| [in] | user | The UserCtx containing the grid information (DM, IM/JM/KM). |
| [out] | out_coords | On rank 0, a pointer to the newly allocated C array for coordinate data. NULL on other ranks. |
| [out] | out_nx | The number of points in the x-dimension for the new grid (IM-1). |
| [out] | out_ny | The number of points in the y-dimension for the new grid (JM-1). |
| [out] | out_nz | The number of points in the z-dimension for the new grid (KM-1). |
| [out] | out_npoints | The total number of points in the new grid. |
Creates a C array of coordinates corresponding to a subsampled (legacy-style) grid.
Local to this translation unit.
Definition at line 241 of file vtk_io.c.
| PetscErrorCode PrepareOutputEulerianFieldData | ( | UserCtx * | user, |
| Vec | field_vec, | ||
| PetscInt | num_components, | ||
| PetscScalar ** | out_data | ||
| ) |
Creates a C array of field data corresponding to a subsampled (legacy-style) grid.
This function gathers a full, distributed PETSc vector to rank 0. On rank 0, it then allocates a new, smaller C array and copies only the data components for nodes within the range [0..IM-2, 0..JM-2, 0..KM-2]. This produces a contiguous data array that perfectly matches the point ordering of the subsampled coordinates. The output array is only allocated and valid on rank 0.
| [in] | user | The UserCtx for grid information. |
| [in] | field_vec | The full-sized PETSc vector containing the field data (e.g., user->P_nodal). |
| [in] | num_components | The number of components for this field (1 for scalar, 3 for vector). |
| [out] | out_data | On rank 0, a pointer to the newly allocated C array for the field data. NULL on other ranks. |
Creates a C array of field data corresponding to a subsampled (legacy-style) grid.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/vtk_io.h.
Definition at line 377 of file vtk_io.c.
| PetscErrorCode BeginStructuredVTKOutput | ( | UserCtx * | user, |
| VTKMetaData * | meta | ||
| ) |
Begins one structured VTK file: clears the metadata and builds its coordinates.
Every Eulerian VTK file is assembled the same way — coordinates, then a set of point-data fields, then the write. This trio exists so the two producers share that shape instead of restating it, and so the buffers each producer allocates are released in one place rather than in neither.
| [in] | user | Block context supplying the grid. |
| [out] | meta | Metadata to initialize. |
Begins one structured VTK file: clears the metadata and builds its coordinates.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/vtk_io.h.
Definition at line 308 of file vtk_io.c.
| PetscErrorCode AppendStructuredVTKField | ( | UserCtx * | user, |
| VTKMetaData * | meta, | ||
| const char * | name, | ||
| Vec | field_vec, | ||
| PetscInt | components | ||
| ) |
Adds one point-data field to a structured VTK file being assembled.
Skips the field with a warning when the file is already at its field limit, so a long output list degrades rather than corrupting the metadata.
| [in] | user | Block context supplying the grid. |
| [in,out] | meta | Metadata to append to. |
| [in] | name | Field name as it will appear in the file. |
| [in] | field_vec | Nodal vector holding the values. |
| [in] | components | One for a scalar, three for a vector. |
Adds one point-data field to a structured VTK file being assembled.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/vtk_io.h.
Definition at line 326 of file vtk_io.c.
| PetscErrorCode FinishStructuredVTKOutput | ( | VTKMetaData * | meta, |
| const char * | filename | ||
| ) |
Writes an assembled structured VTK file and releases its buffers.
| [in,out] | meta | Metadata to write and then release. |
| [in] | filename | Destination path. |
Writes an assembled structured VTK file and releases its buffers.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/vtk_io.h.
Definition at line 354 of file vtk_io.c.
| PetscErrorCode PrepareOutputParticleData | ( | UserCtx * | user, |
| PostProcessParams * | pps, | ||
| VTKMetaData * | meta, | ||
| PetscInt * | p_n_total | ||
| ) |
Gathers, subsamples, and prepares all particle data for VTK output.
This function is a COLLECTIVE operation. All ranks must enter it. The heavy lifting (memory allocation, subsampling) is performed only on rank 0.
| [in] | user | The UserCtx containing the DMSwarm. |
| [in] | pps | The PostProcessParams struct for configuration. |
| [out] | meta | A pointer to the VTKMetaData struct to be populated (on rank 0). |
| [out] | p_n_total | On rank 0, the total number of particles before subsampling. |
Gathers, subsamples, and prepares all particle data for VTK output.
Local to this translation unit.
Definition at line 486 of file vtk_io.c.