PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
Loading...
Searching...
No Matches
postprocessing_kernels.h
Go to the documentation of this file.
1#ifndef POSTPROCESSING_KERNELS_H
2#define POSTPROCESSING_KERNELS_H
3
4#include "variables.h"
5#include "logging.h"
6#include "io.h" // For the UpdateLocalGhosts function prototype
7
8// Function prototypes for post-processing kernels
9
10PetscErrorCode ComputeNodalAverage(UserCtx* user, const char* in_field_name, const char* out_field_name);
11PetscErrorCode ComputeQCriterion(UserCtx* user);
12PetscErrorCode NormalizeRelativeField(UserCtx* user, const char* relative_field_name);
13
14// Add more post-processing kernel prototypes as needed
15// =========================================================================
16// Dimensionalization Kernels
17// =========================================================================
18/**
19 * @brief Scales a specified field from non-dimensional to dimensional units in-place.
20 *
21 * This function acts as a dispatcher. It takes the string name of a field,
22 * identifies the corresponding PETSc Vec object and the correct physical
23 * scaling factor (e.g., U_ref for velocity, P_ref for pressure), and then
24 * performs an in-place VecScale operation. It correctly handles the different
25 * physical dimensions of Cartesian velocity vs. contravariant volume flux.
26 *
27 * @param[in,out] user The UserCtx containing the PETSc Vecs to be modified.
28 * @param[in] field_name The case-insensitive string name of the field to dimensionalize
29 * (e.g., "Ucat", "P", "Ucont", "Coordinates", "ParticlePosition", "ParticleVelocity").
30 * @return PetscErrorCode
31 */
32PetscErrorCode DimensionalizeField(UserCtx *user, const char *field_name);
33
34/**
35 * @brief Orchestrates the dimensionalization of all relevant fields loaded from a file.
36 *
37 * This function is intended to be called in the post-processor immediately after
38 * all solver output has been read into memory. It calls DimensionalizeField() for each of the core
39 * physical quantities to convert the entire loaded state from non-dimensional to
40 * dimensional units, preparing it for analysis and visualization.
41 *
42 * @param[in,out] user The UserCtx containing all the fields to be dimensionalized.
43 * @return PetscErrorCode
44 */
45PetscErrorCode DimensionalizeAllLoadedFields(UserCtx *user);
46
47// ===========================================================================
48// Particle Post-Processing Kernels
49// ===========================================================================
50
51
52/**
53 * @brief Computes the specific kinetic energy (KE per unit mass) for each particle.
54 *
55 * This kernel calculates SKE = 0.5 * |velocity|^2. It requires that the
56 * velocity field exists and will populate the specific kinetic energy field.
57 * The output field must be registered before this kernel is called.
58 *
59 * @param user The UserCtx containing the DMSwarm.
60 * @param velocity_field The name of the input vector field for particle velocity.
61 * @param ske_field The name of the output scalar field to store specific KE.
62 * @return PetscErrorCode
63 */
64PetscErrorCode ComputeSpecificKE(UserCtx* user, const char* velocity_field, const char* ske_field);
65
66#endif // POSTPROCESSING_KERNELS_H
Public interface for data input/output routines.
Logging utilities and macros for PETSc-based applications.
PetscErrorCode ComputeQCriterion(UserCtx *user)
Computes the Q-Criterion, a scalar value identifying vortex cores.
PetscErrorCode ComputeSpecificKE(UserCtx *user, const char *velocity_field, const char *ske_field)
Computes the specific kinetic energy (KE per unit mass) for each particle.
PetscErrorCode NormalizeRelativeField(UserCtx *user, const char *relative_field_name)
Normalizes a relative field by subtracting a reference value.
PetscErrorCode DimensionalizeField(UserCtx *user, const char *field_name)
Scales a specified field from non-dimensional to dimensional units in-place.
PetscErrorCode DimensionalizeAllLoadedFields(UserCtx *user)
Orchestrates the dimensionalization of all relevant fields loaded from a file.
PetscErrorCode ComputeNodalAverage(UserCtx *user, const char *in_field_name, const char *out_field_name)
Computes node-centered data by averaging 8 surrounding cell-centered values, exactly replicating the ...
Main header file for a complex fluid dynamics solver.
User-defined context containing data specific to a single computational grid level.
Definition variables.h:661