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. */
65
66/** @brief Logical storage topology of a field. */
75
76/** @brief UserCtx DM family used to store a field. */
83
84/** @brief Extra repair required after the normal PETSc global-to-local scatter. */
92
93/** @brief Conditions controlling when a field can have runtime storage. */
102
103/** @brief Operations supported by a catalog entry. */
112
113/** @brief Immutable metadata for one field identity. */
128
129/** @brief Non-owning runtime objects resolved for one field and UserCtx. */
130typedef struct {
132 DM dm;
135} FieldView;
136
137/**
138 * @brief Return immutable metadata for a valid field identifier.
139 * @param[in] field_id Compile-time field identity.
140 * @param[out] descriptor Catalog entry owned by the field-catalog module.
141 * @return Zero on success; PETSc error for an invalid ID or null output.
142 */
143PetscErrorCode FieldGetDescriptor(FieldId field_id, const FieldDescriptor **descriptor);
144
145/**
146 * @brief Resolve a user-facing field name once into its typed identity.
147 * @param[in] field_name Canonical name or registered alias.
148 * @param[out] field_id Resolved field identity.
149 * @return Zero on success; PETSc unknown-type error for an unregistered name.
150 */
151PetscErrorCode FieldIdFromName(const char *field_name, FieldId *field_id);
152
153/**
154 * @brief Return the canonical printable name for an ID.
155 * @param[in] field_id Field identity.
156 * @return Canonical name, or "InvalidField" for an invalid ID.
157 */
158const char *FieldCanonicalName(FieldId field_id);
159
160/**
161 * @brief Return a stable printable label for a field layout.
162 * @param[in] layout Layout enum to describe.
163 * @return Catalog-owned label, or `Invalid-Layout` for an invalid enum.
164 */
165const char *FieldLayoutName(FieldLayout layout);
166
167/**
168 * @brief Resolve the existing DM and global/local vectors for one field.
169 *
170 * This function never creates storage. Optional fields whose setup conditions
171 * were not enabled retain valid descriptors but return PETSC_ERR_ARG_WRONGSTATE
172 * because their runtime vectors are absent.
173 *
174 * @param[in] user Existing per-grid context.
175 * @param[in] field_id Field identity to resolve.
176 * @param[out] view Non-owning runtime view.
177 * @return Zero on success or a PETSc argument/state error.
178 */
179PetscErrorCode FieldGetView(UserCtx *user, FieldId field_id, FieldView *view);
180
181#ifdef __cplusplus
182}
183#endif
184
185#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_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_RANS
@ FIELD_AVAILABILITY_FINEST_LEVEL
@ FIELD_AVAILABILITY_LES
@ FIELD_AVAILABILITY_PARTICLES
@ FIELD_AVAILABILITY_TURBULENCE
@ 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_FDA2
@ 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_NVERT
@ FIELD_ID_UCAT
@ FIELD_ID_NVERT_O
@ FIELD_ID_KETA
@ FIELD_ID_JAJ
@ FIELD_ID_COORDINATES
@ FIELD_ID_UCONT_O
@ FIELD_ID_K_OMEGA
@ FIELD_ID_KAJ
@ 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_ICSI
@ FIELD_ID_ETA
@ FIELD_ID_PHI
@ FIELD_ID_CS
@ FIELD_ID_CENT
@ FIELD_ID_JCSI
@ FIELD_ID_JZET
@ FIELD_ID_K_OMEGA_O
@ 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:876