Pressure-Poisson projection: the multigrid pressure-correction solve, the pressure update, and the velocity correction that makes Ucont divergence-free.
More...
Go to the source code of this file.
Functions | |
| PetscErrorCode | PoissonSolver_Multigrid (UserMG *usermg) |
| Solves the pressure-correction equation for every block with geometric multigrid. | |
| PetscErrorCode | AssemblePoissonOperator (UserCtx *user) |
| Assembles the pressure-correction operator on one multigrid level. | |
| PetscErrorCode | ComputePoissonRHS (UserCtx *user, Vec B) |
| Forms the right-hand side of the pressure-correction equation. | |
| PetscErrorCode | UpdatePressure (UserCtx *user) |
Adds the pressure correction to the pressure, P += Phi, and refreshes both fields' periodic images and ghosts. | |
| PetscErrorCode | ProjectVelocity (UserCtx *user) |
Corrects the contravariant flux with the gradient of Phi. | |
Pressure-Poisson projection: the multigrid pressure-correction solve, the pressure update, and the velocity correction that makes Ucont divergence-free.
The discrete operator, the right-hand side, and the projection gradient are built from one face-gradient definition, so the Laplacian the solver inverts is exactly the divergence of the gradient the projection applies.
Every masked operation reads the solid field from the UserCtx of the level it acts on (lNvert). Solid cells are excluded from the operator, the right-hand side, the projection, and the multigrid transfers; cells next to a solid face use one-sided transverse differences.
Definition in file poisson.h.
|
extern |
Solves the pressure-correction equation for every block with geometric multigrid.
On the first call for a block, assembles the operator on every multigrid level and builds the outer Krylov solver with its PCMG preconditioner, grid transfers, level smoothers, coarse solve, and null space. The solver is kept in the finest level's UserCtx::ksp and reused on every later call; it is destroyed with the context.
Each call refreshes the ghosted contravariant flux, forms the right-hand side, solves for Phi on the finest level, and appends the iteration history to Poisson_Solver_Convergence_History_Block_<bi>.log in the run's log directory.
Solver controls are read from PETSc options under the ps_ prefix (-ps_ksp_*, -ps_mg_levels_N_*, -ps_mg_coarse_*) when the solver is built.
| [in,out] | usermg | Multigrid hierarchy; the finest level's Phi receives the solution. |
Solves the pressure-correction equation for every block with geometric multigrid.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/poisson.h.
Definition at line 952 of file poisson.c.
|
extern |
Assembles the pressure-correction operator on one multigrid level.
Allocates user->A on the first call and reassembles its entries on later calls into the same nonzero structure. Fluid rows carry the 19-point curvilinear Laplacian; dummy rows on the domain boundary and solid rows are identities. Non-periodic faces are homogeneous Neumann; periodic faces wrap to the opposite interior layer.
| [in,out] | user | Level context supplying metrics, lNvert, and boundary types. |
Assembles the pressure-correction operator on one multigrid level.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/poisson.h.
Definition at line 251 of file poisson.c.
|
extern |
Forms the right-hand side of the pressure-correction equation.
Writes the scaled divergence of the ghosted contravariant flux lUcont into B, zero on dummy and solid cells, and stores its domain integral in SimCtx::poissonSourceImbalance.
| [in] | user | Finest-level context. |
| [out] | B | Right-hand-side vector on user->da. |
Forms the right-hand side of the pressure-correction equation.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/poisson.h.
Definition at line 353 of file poisson.c.
|
extern |
Adds the pressure correction to the pressure, P += Phi, and refreshes both fields' periodic images and ghosts.
| [in,out] | user | Block context holding P and Phi. |
Adds the pressure correction to the pressure, P += Phi, and refreshes both fields' periodic images and ghosts.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/poisson.h.
Definition at line 416 of file poisson.c.
|
extern |
Corrects the contravariant flux with the gradient of Phi.
Subtracts dt / COEF_TIME_ACCURACY times the face pressure-gradient flux from every fluid face of Ucont, then refreshes the periodic images, reconstructs the Cartesian velocity, and finalizes the cell fields that depend on it.
| [in,out] | user | Block context; reads the ghosted lPhi. |
Corrects the contravariant flux with the gradient of Phi.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/poisson.h.
Definition at line 438 of file poisson.c.