PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
Loading...
Searching...
No Matches
postprocessor.h
Go to the documentation of this file.
1#ifndef POSTPROCESSOR_H
2#define POSTPROCESSOR_H
3
4#include "io.h"
5#include "variables.h"
6#include "logging.h"
7#include "ParticleSwarm.h"
8#include "interpolation.h"
9#include "grid.h"
10#include "setup.h"
11#include "Metric.h"
13#include "vtk_io.h"
14/* --------------------------------------------------------------------
15 postprocessor.h
16
17 This header declares the interface for the post-processing executable
18 or library. Typically, you'd have a function that runs your main
19 post-processing routine, or you might declare other helper functions.
20
21 Here, we declare a single function: PostprocessMain,
22 which could be your main entry point if you want to call it from
23 another place (or you might just put main() in postprocess.c).
24
25*/
26
27/**
28 * @brief Creates a new, dedicated DMSwarm for post-processing tasks.
29 *
30 * This function is called once at startup. It creates an empty DMSwarm and
31 * associates it with the same grid DM as the primary swarm and registers all the required fields.
32 * @param user The UserCtx where user->post_swarm will be created.
33 * @param pps The PostProcessParams containing the particle_pipeline string for field registration.
34 * @return PetscErrorCode
35 */
36PetscErrorCode SetupPostProcessSwarm(UserCtx* user, PostProcessParams* pps);
37
38/**
39 * @brief Orchestrates the writing of a combined, multi-field VTK file for a single time step.
40 *
41 * This function is the primary driver for generating output. It performs these steps:
42 * 1. Prepares the subsampled coordinate array required for the legacy grid format.
43 * 2. Parses the user-requested list of fields from the configuration.
44 * 3. For each field, prepares a corresponding subsampled data array.
45 * 4. Assembles all prepared arrays into a single VTKMetaData struct.
46 * 5. Calls the low-level VTK writer to generate the final .vts file.
47 * 6. Frees all temporary memory allocated during the preparation phase.
48 *
49 * @param user The UserCtx for the finest grid level.
50 * @param pps The post-processing configuration struct.
51 * @param ti The current time step index.
52 * @return PetscErrorCode
53 */
54PetscErrorCode WriteEulerianFile(UserCtx* user, PostProcessParams* pps, PetscInt ti);
55
56/**
57 * @brief Parses the processing pipeline string and executes the requested kernels.
58 * @param user The UserCtx containing the data to be transformed.
59 * @param config The PostProcessConfig containing the pipeline string.
60 * @return PetscErrorCode
61 */
63
64
65/**
66 * @brief Parses and executes the particle pipeline using a robust two-pass approach.
67 *
68 * This function ensures correctness and efficiency by separating field registration
69 * from kernel execution.
70 *
71 * PASS 1 (Registration): The pipeline string is parsed to identify all new fields
72 * that will be created. These fields are registered with the DMSwarm.
73 *
74 * Finalize: After Pass 1, DMSwarmFinalizeFieldRegister is called exactly once if
75 * any new fields were added, preparing the swarm's memory layout.
76 *
77 * PASS 2 (Execution): The pipeline string is parsed again, and this time the
78 * actual compute kernels are executed, filling the now-valid fields.
79 *
80 * @param user The UserCtx containing the DMSwarm.
81 * @param pps The PostProcessParams struct containing the particle_pipeline string.
82 * @return PetscErrorCode
83 */
85
86/**
87 * @brief Writes particle data to a VTP file using the Prepare-Write-Cleanup pattern.
88 */
89PetscErrorCode WriteParticleFile(UserCtx* user, PostProcessParams* pps, PetscInt ti);
90
91#endif /* POSTPROCESSOR_H */
92
Header file for Particle Motion and migration related functions.
Public interface for grid, solver, and metric setup routines.
Public interface for data input/output routines.
Logging utilities and macros for PETSc-based applications.
PetscErrorCode EulerianDataProcessingPipeline(UserCtx *user, PostProcessParams *pps)
Parses the processing pipeline string and executes the requested kernels.
PetscErrorCode WriteEulerianFile(UserCtx *user, PostProcessParams *pps, PetscInt ti)
Orchestrates the writing of a combined, multi-field VTK file for a single time step.
PetscErrorCode ParticleDataProcessingPipeline(UserCtx *user, PostProcessParams *pps)
Parses and executes the particle pipeline using a robust two-pass approach.
PetscErrorCode WriteParticleFile(UserCtx *user, PostProcessParams *pps, PetscInt ti)
Writes particle data to a VTP file using the Prepare-Write-Cleanup pattern.
PetscErrorCode SetupPostProcessSwarm(UserCtx *user, PostProcessParams *pps)
Creates a new, dedicated DMSwarm for post-processing tasks.
Main header file for a complex fluid dynamics solver.
Holds all configuration parameters for a post-processing run.
Definition variables.h:443
User-defined context containing data specific to a single computational grid level.
Definition variables.h:630