PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
 
Loading...
Searching...
No Matches
BC_Handlers.h
Go to the documentation of this file.
1#ifndef BC_HANDLERS_H
2#define BC_HANDLERS_H
3
4#include "variables.h"
5#include "logging.h"
6
7//================================================================================
8// VALIDATORS
9//================================================================================
10
11/**
12 * @brief (Private) Validates all consistency rules for a driven flow (channel/pipe) setup.
13 *
14 * This function enforces a strict set of rules to ensure a driven flow simulation is
15 * configured correctly. It is called by the main `BoundarySystem_Validate` dispatcher.
16 *
17 * The validation rules are checked in a specific order:
18 * 1. Detect if any `DRIVEN_` handler is active. If not, the function returns immediately.
19 * 2. Ensure that no `INLET`, `OUTLET`, or `FARFIELD` boundary conditions exist anywhere in the
20 * domain, as they are physically incompatible with a pressure-driven flow model.
21 * 3. Verify that both faces in the driven direction are of `mathematical_type PERIODIC`.
22 * 4. Verify that both faces in the driven direction use the exact same `DRIVEN_` handler type.
23 *
24 * @param user The UserCtx for a single block.
25 * @return PetscErrorCode 0 on success, non-zero PETSc error code on failure.
26 */
27PetscErrorCode Validate_DrivenFlowConfiguration(UserCtx *user);
28
29
30//================================================================================
31//
32// HANDLER "CONSTRUCTOR" FUNCTION DECLARATIONS
33//
34// Each function is responsible for populating a BoundaryCondition struct
35// with the correct function pointers for its specific behavior. They are
36// implemented in BC_Handlers.c and called by the factory in Boundaries.c.
37//
38//================================================================================
39
40/**
41 * @brief Configures a BoundaryCondition object to behave as a no-slip, stationary wall.
42 *
43 * @param[in,out] bc Boundary object whose callbacks and handler metadata are installed.
44 * @return PetscErrorCode 0 on success.
45 */
46PetscErrorCode Create_WallNoSlip(BoundaryCondition *bc);
47
48/**
49 * @brief Configures a BoundaryCondition object to behave as a free-slip wall.
50 *
51 * The wall is impenetrable and exerts no shear: the normal velocity vanishes and the
52 * tangential velocity has zero normal gradient, which is also the condition at a plane
53 * of symmetry. The boundary value follows the adjacent velocity, so the handler also
54 * provides `UpdateUbcs`.
55 *
56 * @param[in,out] bc Boundary object whose callbacks and handler metadata are installed.
57 * @return PetscErrorCode 0 on success.
58 */
59PetscErrorCode Create_WallFreeSlip(BoundaryCondition *bc);
60
61/**
62 * @brief Configures a BoundaryCondition object as an inlet whose velocity is a configured
63 * source: expressions over position, time and grid-line fractions, in the Cartesian,
64 * curvilinear or face-normal frame, a PICSLICE file, or a file with expressions added
65 * to it, optionally rescaled to a bulk velocity or flow rate, with optional synthetic
66 * fluctuations.
67 *
68 * The face's `source_id` parameter names the options `-face_source_<id>_*` that hold the
69 * source (see PicurvVelocitySourceCreate()) and its optional `_bulk_velocity` or `_flow_rate`
70 * target. A `source_file` parameter names a staged PICSLICE file of solver-unit values, one per
71 * interior face slot: a normal speed, or a Cartesian velocity with three components, in one
72 * frame or in several frames interpolated in time. Expressions in the file's frame, when
73 * given, are added to it, and the target then rescales the expressions alone. The
74 * `-face_source_<id>_fluct*` options add digital-filter fluctuations after the rescaling.
75 *
76 * @param bc A pointer to the generic BoundaryCondition object to be configured.
77 * @return PetscErrorCode 0 on success.
78 */
80
81/**
82 * @brief Configures a BoundaryCondition object for conservative outlet treatment.
83 *
84 * The constructed handler applies outlet updates that preserve the solver's
85 * global mass/flux consistency assumptions.
86 *
87 * @param bc A pointer to the generic BoundaryCondition object to be configured.
88 * @return PetscErrorCode 0 on success.
89 */
91
92/**
93 * @brief Configures a BoundaryCondition object for geometric periodic coupling.
94 *
95 * This constructor wires periodic boundary callbacks that exchange values across
96 * opposite faces according to the configured periodic directions.
97 *
98 * @param bc A pointer to the generic BoundaryCondition object to be configured.
99 * @return PetscErrorCode 0 on success.
100 */
102
103/**
104 * @brief Configures a BoundaryCondition object for periodic driven-flow forcing.
105 *
106 * This constructor wires the periodic callbacks that enforce a prescribed driving
107 * strategy (for example constant target flux) on a periodic direction pair.
108 *
109 * @param bc A pointer to the generic BoundaryCondition object to be configured.
110 * @return PetscErrorCode 0 on success.
111 */
113
114/**
115 * @brief Configures a BoundaryCondition object for initial-flux periodic driving.
116 *
117 * Wires the same periodic callbacks as Create_PeriodicDrivenConstant(), but the
118 * target flux is measured from the field the run starts with rather than read
119 * from the bcs file, so this handler takes no `target_flux` parameter. The
120 * latched target is checkpointed so a restart holds the original value.
121 *
122 * @param bc A pointer to the generic BoundaryCondition object to be configured.
123 * @return PetscErrorCode 0 on success.
124 */
126
127/**
128 * @brief Creates a wall moving along itself at a velocity source, the prescribed inlet's without its flux.
129 * @param bc Boundary condition to fill.
130 * @return PetscErrorCode 0 on success.
131 */
132PetscErrorCode Create_WallMoving(BoundaryCondition *bc);
133
134/**
135 * @brief Appends each prescribed-velocity inlet's flow rate and mean normal speed this step to
136 * `inlet_flow.csv`. Collective.
137 * @param user Block.
138 * @return PetscErrorCode 0 on success.
139 */
140PetscErrorCode LogPrescribedFlowDiagnostics(UserCtx *user);
141
142#endif // BC_HANDLERS_H
PetscErrorCode Create_WallFreeSlip(BoundaryCondition *bc)
Configures a BoundaryCondition object to behave as a free-slip wall.
PetscErrorCode Create_WallMoving(BoundaryCondition *bc)
Creates a wall moving along itself at a velocity source, the prescribed inlet's without its flux.
PetscErrorCode Create_PeriodicGeometric(BoundaryCondition *bc)
Configures a BoundaryCondition object for geometric periodic coupling.
PetscErrorCode Validate_DrivenFlowConfiguration(UserCtx *user)
(Private) Validates all consistency rules for a driven flow (channel/pipe) setup.
Definition BC_Handlers.c:15
PetscErrorCode Create_PeriodicDrivenInitial(BoundaryCondition *bc)
Configures a BoundaryCondition object for initial-flux periodic driving.
PetscErrorCode Create_PeriodicDrivenConstant(BoundaryCondition *bc)
Configures a BoundaryCondition object for periodic driven-flow forcing.
PetscErrorCode Create_InletPrescribedVelocity(BoundaryCondition *bc)
Configures a BoundaryCondition object as an inlet whose velocity is a configured source: expressions ...
PetscErrorCode LogPrescribedFlowDiagnostics(UserCtx *user)
Appends each prescribed-velocity inlet's flow rate and mean normal speed this step to inlet_flow....
PetscErrorCode Create_WallNoSlip(BoundaryCondition *bc)
Configures a BoundaryCondition object to behave as a no-slip, stationary wall.
PetscErrorCode Create_OutletConservation(BoundaryCondition *bc)
Configures a BoundaryCondition object for conservative outlet treatment.
Logging utilities and macros for PETSc-based applications.
The "virtual table" struct for a boundary condition handler object.
Definition variables.h:389
Main header file for a complex fluid dynamics solver.
User-defined context containing data specific to a single computational grid level.
Definition variables.h:1157