PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
 
Loading...
Searching...
No Matches
particle_field_catalog.h
Go to the documentation of this file.
1/**
2 * @file particle_field_catalog.h
3 * @brief Typed identities and metadata for persistent solver-particle fields.
4 *
5 * Particle fields intentionally use a catalog separate from Eulerian fields.
6 * They are registered on a DMSwarm, may use integer storage, and do not own a
7 * global/local Vec pair in UserCtx. Text is translated only where PETSc or a
8 * user/file interface requires a registered DMSwarm name.
9 */
10
11#ifndef PARTICLE_FIELD_CATALOG_H
12#define PARTICLE_FIELD_CATALOG_H
13
14#include <petscdmswarm.h>
15
16#include "field_catalog.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/** @brief Compile-time identity for a persistent solver-particle field. */
37
38/** @brief Owner of a field's DMSwarm registration. */
43
44/** @brief Operations supported by a particle-field catalog entry. */
45typedef enum {
51 /** The particle carries the value, so a configured initial value survives: nothing
52 re-derives it from the Eulerian fields or from particle location. */
55
56/** @brief Immutable metadata for one persistent particle field. */
70
71/**
72 * @brief Return immutable metadata for a valid particle field ID.
73 * @param[in] field_id Typed particle-field identity.
74 * @param[out] descriptor Catalog-owned immutable descriptor.
75 * @return Zero on success; a PETSc argument error for invalid input.
76 */
77PetscErrorCode ParticleFieldGetDescriptor(ParticleFieldId field_id,
78 const ParticleFieldDescriptor **descriptor);
79
80/**
81 * @brief Resolve a canonical name or registered alias at a text-ingress boundary.
82 * @param[in] field_name Canonical particle name or registered alias.
83 * @param[out] field_id Resolved typed identity.
84 * @return Zero on success; `PETSC_ERR_ARG_UNKNOWN_TYPE` for unknown text.
85 */
86PetscErrorCode ParticleFieldIdFromName(const char *field_name, ParticleFieldId *field_id);
87
88/**
89 * @brief Look a name up without treating an unknown name as an error.
90 * @param[in] field_name Canonical particle name or registered alias.
91 * @param[out] field_id Resolved identity, or `PARTICLE_FIELD_ID_INVALID` when not found.
92 * @param[out] found Whether the name is registered.
93 * @return Zero on success; PETSc error only for null arguments.
94 */
95PetscErrorCode ParticleFieldTryIdFromName(const char *field_name, ParticleFieldId *field_id,
96 PetscBool *found);
97
98/**
99 * @brief Find the particle field that scatters to an Eulerian field.
100 * @param[in] target Eulerian field identity.
101 * @param[out] field_id The particle field whose scatter target is @p target.
102 * @return Zero on success; `PETSC_ERR_ARG_WRONG` when no particle field scatters there.
103 */
104PetscErrorCode ParticleFieldIdFromScatterTarget(FieldId target, ParticleFieldId *field_id);
105
106/**
107 * @brief Return the canonical PETSc DMSwarm name for an ID.
108 * @param[in] field_id Typed particle-field identity.
109 * @return Catalog-owned canonical name or `InvalidParticleField`.
110 */
111const char *ParticleFieldName(ParticleFieldId field_id);
112
113#ifdef __cplusplus
114}
115#endif
116
117#endif /* PARTICLE_FIELD_CATALOG_H */
Authoritative identities and storage metadata for persistent Eulerian fields.
FieldId
Compile-time identity for a catalogued Eulerian field.
Physical dimension as exponents of the reference length, velocity, and density.
const char * ParticleFieldName(ParticleFieldId field_id)
Return the canonical PETSc DMSwarm name for an ID.
ParticleFieldId
Compile-time identity for a persistent solver-particle field.
@ PARTICLE_FIELD_ID_LOCATION_STATUS
@ PARTICLE_FIELD_ID_WEIGHT
@ PARTICLE_FIELD_ID_POSITION
@ PARTICLE_FIELD_ID_PID
@ PARTICLE_FIELD_ID_CELL_ID
@ PARTICLE_FIELD_ID_PSI
@ PARTICLE_FIELD_ID_RANK
@ PARTICLE_FIELD_ID_DIFFUSIVITY_GRADIENT
@ PARTICLE_FIELD_ID_COUNT
@ PARTICLE_FIELD_ID_DIFFUSIVITY
@ PARTICLE_FIELD_ID_INVALID
@ PARTICLE_FIELD_ID_VELOCITY
ParticleFieldRegistration registration
PetscErrorCode ParticleFieldIdFromName(const char *field_name, ParticleFieldId *field_id)
Resolve a canonical name or registered alias at a text-ingress boundary.
ParticleFieldCapabilities
Operations supported by a particle-field catalog entry.
@ PARTICLE_FIELD_CAPABILITY_MODEL_UPDATE
@ PARTICLE_FIELD_CAPABILITY_USER_INITIALIZE
The particle carries the value, so a configured initial value survives: nothing re-derives it from th...
@ PARTICLE_FIELD_CAPABILITY_DEFAULT_INITIALIZE
@ PARTICLE_FIELD_CAPABILITY_CHECKPOINT
@ PARTICLE_FIELD_CAPABILITY_EULERIAN_SCATTER
@ PARTICLE_FIELD_CAPABILITY_NONE
ParticleFieldRegistration
Owner of a field's DMSwarm registration.
@ PARTICLE_FIELD_REGISTRATION_PETSC
@ PARTICLE_FIELD_REGISTRATION_PICURV
PetscErrorCode ParticleFieldIdFromScatterTarget(FieldId target, ParticleFieldId *field_id)
Find the particle field that scatters to an Eulerian field.
PetscErrorCode ParticleFieldGetDescriptor(ParticleFieldId field_id, const ParticleFieldDescriptor **descriptor)
Return immutable metadata for a valid particle field ID.
PetscErrorCode ParticleFieldTryIdFromName(const char *field_name, ParticleFieldId *field_id, PetscBool *found)
Look a name up without treating an unknown name as an error.
Immutable metadata for one persistent particle field.