PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
 
Loading...
Searching...
No Matches
field_catalog.h
Go to the documentation of this file.
1/**
2 * @file field_catalog.h
3 * @brief Authoritative identities and storage metadata for persistent Eulerian fields.
4 *
5 * Field identifiers describe conceptual fields at compile time. They do not own,
6 * allocate, or modify PETSc objects. A FieldView resolves one identifier against
7 * an existing UserCtx after the normal setup lifecycle has created its DMs and
8 * vectors.
9 */
10
11#ifndef FIELD_CATALOG_H
12#define FIELD_CATALOG_H
13
14#include <stddef.h>
15
16#include "variables.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/** @brief Compile-time identity for a catalogued Eulerian field. */
70
71/** @brief Logical storage topology of a field. */
80
81/** @brief UserCtx DM family used to store a field. */
87
88/** @brief Extra repair required after the normal PETSc global-to-local scatter. */
96
97/** @brief Conditions controlling when a field can have runtime storage. */
106
107/** @brief Operations supported by a catalog entry. */
117
118/** @brief Immutable metadata for one field identity. */
133
134/** @brief Non-owning runtime objects resolved for one field and UserCtx. */
135typedef struct {
137 DM dm;
140} FieldView;
141
142/**
143 * @brief Return immutable metadata for a valid field identifier.
144 * @param[in] field_id Compile-time field identity.
145 * @param[out] descriptor Catalog entry owned by the field-catalog module.
146 * @return Zero on success; PETSc error for an invalid ID or null output.
147 */
148PetscErrorCode FieldGetDescriptor(FieldId field_id, const FieldDescriptor **descriptor);
149
150/**
151 * @brief Resolve a user-facing field name once into its typed identity.
152 * @param[in] field_name Canonical name or registered alias.
153 * @param[out] field_id Resolved field identity.
154 * @return Zero on success; PETSc unknown-type error for an unregistered name.
155 */
156PetscErrorCode FieldIdFromName(const char *field_name, FieldId *field_id);
157
158/**
159 * @brief Return the canonical printable name for an ID.
160 * @param[in] field_id Field identity.
161 * @return Canonical name, or "InvalidField" for an invalid ID.
162 */
163const char *FieldCanonicalName(FieldId field_id);
164
165/**
166 * @brief Return a stable printable label for a field layout.
167 * @param[in] layout Layout enum to describe.
168 * @return Catalog-owned label, or `Invalid-Layout` for an invalid enum.
169 */
170const char *FieldLayoutName(FieldLayout layout);
171
172/**
173 * @brief Resolve the existing DM and global/local vectors for one field.
174 *
175 * This function never creates storage. Optional fields whose setup conditions
176 * were not enabled retain valid descriptors but return PETSC_ERR_ARG_WRONGSTATE
177 * because their runtime vectors are absent.
178 *
179 * @param[in] user Existing per-grid context.
180 * @param[in] field_id Field identity to resolve.
181 * @param[out] view Non-owning runtime view.
182 * @return Zero on success or a PETSc argument/state error.
183 */
184PetscErrorCode FieldGetView(UserCtx *user, FieldId field_id, FieldView *view);
185
186#ifdef __cplusplus
187}
188#endif
189
190#endif /* FIELD_CATALOG_H */
FieldLayout layout
PetscErrorCode FieldIdFromName(const char *field_name, FieldId *field_id)
Resolve a user-facing field name once into its typed identity.
const char * alias_1
FieldCapabilities
Operations supported by a catalog entry.
@ FIELD_CAPABILITY_CHECKPOINT
@ FIELD_CAPABILITY_GHOST_UPDATE
@ FIELD_CAPABILITY_PERIODIC_GEOMETRY_SHIFT
@ FIELD_CAPABILITY_PERIODIC_CELL_SYNC
@ FIELD_CAPABILITY_NONE
@ FIELD_CAPABILITY_PERIODIC_FACE_SYNC
@ FIELD_CAPABILITY_PERIODIC_STAGGERED_SYNC
FieldAvailability
Conditions controlling when a field can have runtime storage.
@ FIELD_AVAILABILITY_WALL_MODEL
@ FIELD_AVAILABILITY_FINEST_LEVEL
@ FIELD_AVAILABILITY_PARTICLES
@ FIELD_AVAILABILITY_TURBULENCE
@ FIELD_AVAILABILITY_LES_DYNAMIC
@ FIELD_AVAILABILITY_ALWAYS
FieldSyncClass
Extra repair required after the normal PETSc global-to-local scatter.
@ FIELD_SYNC_STANDARD
@ FIELD_SYNC_K_FACE
@ FIELD_SYNC_J_FACE
@ FIELD_SYNC_COMPONENT_STAGGERED
@ FIELD_SYNC_I_FACE
unsigned int capabilities
const FieldDescriptor * descriptor
const char * FieldCanonicalName(FieldId field_id)
Return the canonical printable name for an ID.
unsigned int availability
PetscErrorCode FieldGetView(UserCtx *user, FieldId field_id, FieldView *view)
Resolve the existing DM and global/local vectors for one field.
FieldDMKind dm_kind
FieldLayout
Logical storage topology of a field.
@ FIELD_LAYOUT_K_FACE
@ FIELD_LAYOUT_I_FACE
@ FIELD_LAYOUT_CELL_CENTERED
@ FIELD_LAYOUT_COMPONENT_STAGGERED
@ FIELD_LAYOUT_NODE_CENTERED
@ FIELD_LAYOUT_J_FACE
const char * canonical_name
const char * alias_2
const char * FieldLayoutName(FieldLayout layout)
Return a stable printable label for a field layout.
FieldSyncClass sync_class
PetscErrorCode FieldGetDescriptor(FieldId field_id, const FieldDescriptor **descriptor)
Return immutable metadata for a valid field identifier.
FieldDMKind
UserCtx DM family used to store a field.
@ FIELD_DM_FDA
@ FIELD_DM_COORDINATES
@ FIELD_DM_DA
FieldId
Compile-time identity for a catalogued Eulerian field.
@ FIELD_ID_PSI
@ FIELD_ID_JETA
@ FIELD_ID_CENTZ
@ FIELD_ID_CSI
@ FIELD_ID_IAJ
@ FIELD_ID_CELL_SCALAR_AT_CORNER
@ FIELD_ID_NVERT
@ FIELD_ID_UCAT
@ FIELD_ID_NVERT_O
@ FIELD_ID_KETA
@ FIELD_ID_JAJ
@ FIELD_ID_COORDINATES
@ FIELD_ID_UCONT_O
@ FIELD_ID_KAJ
@ FIELD_ID_CELL_VECTOR_AT_CORNER
@ FIELD_ID_AJ
@ FIELD_ID_NU_T
@ FIELD_ID_CENTY
@ FIELD_ID_GRID_SPACE
@ FIELD_ID_KZET
@ FIELD_ID_IETA
@ FIELD_ID_DIFFUSIVITY_GRADIENT
@ FIELD_ID_UCONT
@ FIELD_ID_U_TAU
@ FIELD_ID_ICSI
@ FIELD_ID_POST_VECTOR
@ FIELD_ID_ETA
@ FIELD_ID_PHI
@ FIELD_ID_POST_SCALAR
@ FIELD_ID_NU_WALL
@ FIELD_ID_CS
@ FIELD_ID_CENT
@ FIELD_ID_QCRIT
@ FIELD_ID_JCSI
@ FIELD_ID_JZET
@ FIELD_ID_INVALID
@ FIELD_ID_P
@ FIELD_ID_IZET
@ FIELD_ID_UCONT_RM1
@ FIELD_ID_ZET
@ FIELD_ID_KCSI
@ FIELD_ID_CENTX
@ FIELD_ID_PARTICLE_COUNT
@ FIELD_ID_COUNT
@ FIELD_ID_DIFFUSIVITY
Immutable metadata for one field identity.
Non-owning runtime objects resolved for one field and UserCtx.
Main header file for a complex fluid dynamics solver.
User-defined context containing data specific to a single computational grid level.
Definition variables.h:1068