|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Main program for DMSwarm interpolation using the fdf-curvIB method. More...
#include "interpolation.h"Go to the source code of this file.
Macros | |
| #define | NUM_WEIGHTS 8 |
| #define | ERROR_MSG_BUFFER_SIZE 256 |
| #define | __FUNCT__ "InterpolateFieldFromCornerToCenter_Vector" |
| #define | __FUNCT__ "InterpolateFieldFromCornerToCenter_Scalar" |
| #define | __FUNCT__ "TestCornerToCenterInterpolation" |
| #define | __FUNCT__ "InterpolateFieldFromCenterToCorner_Vector" |
| #define | __FUNCT__ "InterpolateFieldFromCenterToCorner_Scalar" |
| #define | __FUNCT "PiecWiseLinearInterpolation_Scalar" |
| #define | __FUNCT "PiecWiseLinearInterpolation_Vector" |
| #define | __FUNCT "ComputeTrilinearWeights" |
| #define | __FUNCT "TrilinearInterpolation_Scalar" |
| #define | __FUNCT "TrilinearInterpolation_Vector" |
| #define | __FUNCT "InterpolateEulerFieldToSwarmForParticle" |
| #define | __FUNCT__ "InterpolateEulerFieldFromCenterToSwarm" |
| #define | __FUNCT__ "InterpolateEulerFieldFromCornerToSwarm" |
| #define | __FUNCT__ "InterpolateEulerFieldToSwarm" |
| #define | __FUNCT__ "InterpolateAllFieldsToSwarm" |
| #define | __FUNCT__ "GetScatterTargetInfo" |
| #define | __FUNCT__ "GetPersistentLocalVector" |
| #define | __FUNCT__ "AccumulateParticleField" |
| #define | __FUNCT__ "NormalizeGridVectorByCount" |
| #define | __FUNCT__ "ScatterParticleFieldToEulerField_Internal" |
| #define | __FUNCT__ "ScatterParticleFieldToEulerField" |
| #define | __FUNCT__ "ScatterAllParticleFieldsToEulerFields" |
| #define | __FUNCT__ "InterpolateCornerToFaceCenter_Scalar" |
| #define | __FUNCT__ "InterpolateCornerToFaceCenter_Vector" |
Functions | |
| PetscErrorCode | InterpolateFieldFromCornerToCenter_Vector (Cmpnts ***field_arr, Cmpnts ***centfield_arr, UserCtx *user) |
Internal helper implementation: InterpolateFieldFromCornerToCenter_Vector(). | |
| PetscErrorCode | InterpolateFieldFromCornerToCenter_Scalar (PetscReal ***field_arr, PetscReal ***centfield_arr, UserCtx *user) |
Internal helper implementation: InterpolateFieldFromCornerToCenter_Scalar(). | |
| PetscErrorCode | TestCornerToCenterInterpolation (UserCtx *user) |
Internal helper implementation: TestCornerToCenterInterpolation(). | |
| PetscErrorCode | InterpolateFieldFromCenterToCorner_Vector (Cmpnts ***centfield_arr, Cmpnts ***corner_arr, UserCtx *user) |
Internal helper implementation: InterpolateFieldFromCenterToCorner_Vector(). | |
| PetscErrorCode | InterpolateFieldFromCenterToCorner_Scalar (PetscReal ***centfield_arr, PetscReal ***corner_arr, UserCtx *user) |
Internal helper implementation: InterpolateFieldFromCenterToCorner_Scalar(). | |
| PetscErrorCode | PieceWiseLinearInterpolation_Scalar (const char *fieldName, PetscReal ***fieldScal, PetscInt iCell, PetscInt jCell, PetscInt kCell, PetscReal *val) |
Internal helper implementation: PieceWiseLinearInterpolation_Scalar(). | |
| PetscErrorCode | PieceWiseLinearInterpolation_Vector (const char *fieldName, Cmpnts ***fieldVec, PetscInt iCell, PetscInt jCell, PetscInt kCell, Cmpnts *vec) |
Internal helper implementation: PieceWiseLinearInterpolation_Vector(). | |
| static void | ComputeTrilinearWeights (PetscReal a1, PetscReal a2, PetscReal a3, PetscReal *w) |
Internal helper implementation: ComputeTrilinearWeights(). | |
| static void | ComputeTrilinearWeightsUnclamped (PetscReal a1, PetscReal a2, PetscReal a3, PetscReal *w) |
| Unclamped trilinear weights for boundary extrapolation. | |
| PetscErrorCode | TrilinearInterpolation_Scalar (const char *fieldName, PetscReal ***fieldScal, PetscInt i, PetscInt j, PetscInt k, PetscReal a1, PetscReal a2, PetscReal a3, PetscReal *val) |
Internal helper implementation: TrilinearInterpolation_Scalar(). | |
| PetscErrorCode | TrilinearInterpolation_Vector (const char *fieldName, Cmpnts ***fieldVec, PetscInt i, PetscInt j, PetscInt k, PetscReal a1, PetscReal a2, PetscReal a3, Cmpnts *vec) |
Internal helper implementation: TrilinearInterpolation_Vector(). | |
| static PetscErrorCode | InterpolateEulerFieldToSwarmForParticle (const char *fieldName, void *fieldPtr, Particle *particle, void *swarmOut, PetscInt p, PetscInt blockSize) |
Internal helper implementation: InterpolateEulerFieldToSwarmForParticle(). | |
| static PetscErrorCode | InterpolateEulerFieldFromCenterToSwarm (UserCtx *user, Vec fieldLocal_cellCentered, const char *fieldName, const char *swarmOutFieldName) |
| Direct cell-center trilinear interpolation (second-order on curvilinear grids). | |
| static PetscErrorCode | InterpolateEulerFieldFromCornerToSwarm (UserCtx *user, Vec fieldLocal_cellCentered, const char *fieldName, const char *swarmOutFieldName) |
| Corner-averaged interpolation path (legacy). | |
| PetscErrorCode | InterpolateEulerFieldToSwarm (UserCtx *user, Vec fieldLocal_cellCentered, const char *fieldName, const char *swarmOutFieldName) |
| Dispatches grid-to-particle interpolation to the method selected in the control file. | |
| PetscErrorCode | InterpolateAllFieldsToSwarm (UserCtx *user) |
Internal helper implementation: InterpolateAllFieldsToSwarm(). | |
| PetscErrorCode | GetScatterTargetInfo (UserCtx *user, const char *particleFieldName, DM *targetDM, PetscInt *expected_dof) |
| Determines the target Eulerian DM and expected DOF for scattering a given particle field. | |
| PetscErrorCode | GetPersistentLocalVector (UserCtx *user, const char *fieldName, Vec *localVec) |
Internal helper implementation: GetPersistentLocalVector(). | |
| PetscErrorCode | AccumulateParticleField (DM swarm, const char *particleFieldName, DM gridSumDM, Vec gridSumVec) |
| Accumulates a particle field (scalar or vector) into a target grid sum vector. | |
| PetscErrorCode | NormalizeGridVectorByCount (DM countDM, Vec countVec, DM dataDM, Vec sumVec, Vec avgVec) |
| Normalizes a grid vector of sums by a grid vector of counts to produce an average. | |
| static PetscErrorCode | ScatterParticleFieldToEulerField_Internal (UserCtx *user, const char *particleFieldName, DM targetDM, PetscInt expected_dof, Vec eulerFieldAverageVec) |
Internal helper implementation: ScatterParticleFieldToEulerField_Internal(). | |
| PetscErrorCode | ScatterParticleFieldToEulerField (UserCtx *user, const char *particleFieldName, Vec eulerFieldAverageVec) |
| Scatters a particle field (scalar or vector) to the corresponding Eulerian field average. | |
| PetscErrorCode | ScatterAllParticleFieldsToEulerFields (UserCtx *user) |
| Scatters a predefined set of particle fields to their corresponding Eulerian fields. | |
| PetscErrorCode | InterpolateCornerToFaceCenter_Scalar (PetscReal ***corner_arr, PetscReal ***faceX_arr, PetscReal ***faceY_arr, PetscReal ***faceZ_arr, UserCtx *user) |
Internal helper implementation: InterpolateCornerToFaceCenter_Scalar(). | |
| PetscErrorCode | InterpolateCornerToFaceCenter_Vector (Cmpnts ***corner_arr, Cmpnts ***faceX_arr, Cmpnts ***faceY_arr, Cmpnts ***faceZ_arr, UserCtx *user) |
Internal helper implementation: InterpolateCornerToFaceCenter_Vector(). | |
Main program for DMSwarm interpolation using the fdf-curvIB method.
Provides routines for interpolation between corner-based and center-based fields in the cell-centered DM (fda), plus partial usage examples for DMSwarm-based field sampling.
Definition in file interpolation.c.
| #define NUM_WEIGHTS 8 |
Definition at line 13 of file interpolation.c.
| #define ERROR_MSG_BUFFER_SIZE 256 |
Definition at line 16 of file interpolation.c.
| #define __FUNCT "PiecWiseLinearInterpolation_Scalar" |
Definition at line 457 of file interpolation.c.
| #define __FUNCT "PiecWiseLinearInterpolation_Vector" |
Definition at line 457 of file interpolation.c.
| #define __FUNCT "ComputeTrilinearWeights" |
Definition at line 457 of file interpolation.c.
| #define __FUNCT "TrilinearInterpolation_Scalar" |
Definition at line 457 of file interpolation.c.
| #define __FUNCT "TrilinearInterpolation_Vector" |
Definition at line 457 of file interpolation.c.
| #define __FUNCT "InterpolateEulerFieldToSwarmForParticle" |
Definition at line 457 of file interpolation.c.
| PetscErrorCode InterpolateFieldFromCornerToCenter_Vector | ( | Cmpnts *** | field_arr, |
| Cmpnts *** | centfield_arr, | ||
| UserCtx * | user | ||
| ) |
Internal helper implementation: InterpolateFieldFromCornerToCenter_Vector().
Safely interpolate a vector field from corner nodes (from the coordinate DM) to cell centers (from the cell-centered DM) using the provided UserCtx.
Local to this translation unit.
Definition at line 25 of file interpolation.c.
| PetscErrorCode InterpolateFieldFromCornerToCenter_Scalar | ( | PetscReal *** | field_arr, |
| PetscReal *** | centfield_arr, | ||
| UserCtx * | user | ||
| ) |
Internal helper implementation: InterpolateFieldFromCornerToCenter_Scalar().
Safely interpolate a scalar field from corner nodes (from the coordinate DM) to cell centers (from the cell-centered DM) using the provided UserCtx.
Local to this translation unit.
Definition at line 86 of file interpolation.c.
| PetscErrorCode TestCornerToCenterInterpolation | ( | UserCtx * | user | ) |
Internal helper implementation: TestCornerToCenterInterpolation().
Tests the InterpolateFieldFromCornerToCenter function by reproducing the Cent vector.
Local to this translation unit.
Definition at line 137 of file interpolation.c.
| PetscErrorCode InterpolateFieldFromCenterToCorner_Vector | ( | Cmpnts *** | centfield_arr, |
| Cmpnts *** | corner_arr, | ||
| UserCtx * | user | ||
| ) |
Internal helper implementation: InterpolateFieldFromCenterToCorner_Vector().
Interpolates a vector field from cell centers to corner nodes.
Local to this translation unit.
Definition at line 196 of file interpolation.c.
| PetscErrorCode InterpolateFieldFromCenterToCorner_Scalar | ( | PetscReal *** | centfield_arr, |
| PetscReal *** | corner_arr, | ||
| UserCtx * | user | ||
| ) |
Internal helper implementation: InterpolateFieldFromCenterToCorner_Scalar().
Interpolates a scalar field from cell centers to corner nodes.
Local to this translation unit.
Definition at line 331 of file interpolation.c.
| PetscErrorCode PieceWiseLinearInterpolation_Scalar | ( | const char * | fieldName, |
| PetscReal *** | fieldScal, | ||
| PetscInt | iCell, | ||
| PetscInt | jCell, | ||
| PetscInt | kCell, | ||
| PetscReal * | val | ||
| ) |
Internal helper implementation: PieceWiseLinearInterpolation_Scalar().
Returns the scalar value from the input cell index without blending.
Local to this translation unit.
Definition at line 462 of file interpolation.c.
| PetscErrorCode PieceWiseLinearInterpolation_Vector | ( | const char * | fieldName, |
| Cmpnts *** | fieldVec, | ||
| PetscInt | iCell, | ||
| PetscInt | jCell, | ||
| PetscInt | kCell, | ||
| Cmpnts * | vec | ||
| ) |
Internal helper implementation: PieceWiseLinearInterpolation_Vector().
Returns the vector value from the input cell index without blending.
Local to this translation unit.
Definition at line 487 of file interpolation.c.
|
inlinestatic |
Internal helper implementation: ComputeTrilinearWeights().
Local to this translation unit.
Definition at line 516 of file interpolation.c.
|
inlinestatic |
Unclamped trilinear weights for boundary extrapolation.
Identical to ComputeTrilinearWeights() but without clamping a1, a2, a3 to [0,1]. Allows weights outside [0,1] for linear extrapolation at non-periodic boundaries. Weights still sum to 1.0.
Definition at line 549 of file interpolation.c.
| PetscErrorCode TrilinearInterpolation_Scalar | ( | const char * | fieldName, |
| PetscReal *** | fieldScal, | ||
| PetscInt | i, | ||
| PetscInt | j, | ||
| PetscInt | k, | ||
| PetscReal | a1, | ||
| PetscReal | a2, | ||
| PetscReal | a3, | ||
| PetscReal * | val | ||
| ) |
Internal helper implementation: TrilinearInterpolation_Scalar().
Computes the trilinear interpolated scalar at a given point.
Local to this translation unit.
Definition at line 577 of file interpolation.c.
| PetscErrorCode TrilinearInterpolation_Vector | ( | const char * | fieldName, |
| Cmpnts *** | fieldVec, | ||
| PetscInt | i, | ||
| PetscInt | j, | ||
| PetscInt | k, | ||
| PetscReal | a1, | ||
| PetscReal | a2, | ||
| PetscReal | a3, | ||
| Cmpnts * | vec | ||
| ) |
Internal helper implementation: TrilinearInterpolation_Vector().
Computes the trilinear interpolated vector (e.g., velocity) at a given point.
Local to this translation unit.
Definition at line 641 of file interpolation.c.
|
inlinestatic |
Internal helper implementation: InterpolateEulerFieldToSwarmForParticle().
Local to this translation unit.
Definition at line 735 of file interpolation.c.
|
static |
Direct cell-center trilinear interpolation (second-order on curvilinear grids).
For each particle, determines the 8 nearest cell centers via octant detection, constructs a dual cell, computes face-distance-based trilinear weights, and interpolates directly from cell-centered data. At non-periodic boundaries where the dual cell cannot be fully formed, octant clamping with unclamped trilinear extrapolation preserves second-order accuracy. Periodic boundaries use ghost cell data directly. No intermediate corner staging or extra ghost exchange is needed.
Definition at line 853 of file interpolation.c.
|
static |
Corner-averaged interpolation path (legacy).
Stages cell-centered data to corners via unweighted averaging, then trilinear interpolation from corners to particles. Local to this translation unit.
Definition at line 1059 of file interpolation.c.
| PetscErrorCode InterpolateEulerFieldToSwarm | ( | UserCtx * | user, |
| Vec | fieldLocal_cellCentered, | ||
| const char * | fieldName, | ||
| const char * | swarmOutFieldName | ||
| ) |
Dispatches grid-to-particle interpolation to the method selected in the control file.
Interpolates a cell-centered field (scalar or vector) onto DMSwarm particles, using a robust, PETSc-idiomatic two-stage process.
Routes to InterpolateEulerFieldFromCenterToSwarm (direct trilinear, second-order) or InterpolateEulerFieldFromCornerToSwarm (corner-averaged, legacy) based on user->simCtx->interpolationMethod.
Definition at line 1371 of file interpolation.c.
| PetscErrorCode InterpolateAllFieldsToSwarm | ( | UserCtx * | user | ) |
Internal helper implementation: InterpolateAllFieldsToSwarm().
Interpolates all relevant fields from the DMDA to the DMSwarm.
Local to this translation unit.
Definition at line 1397 of file interpolation.c.
| PetscErrorCode InterpolateCornerToFaceCenter_Scalar | ( | PetscReal *** | corner_arr, |
| PetscReal *** | faceX_arr, | ||
| PetscReal *** | faceY_arr, | ||
| PetscReal *** | faceZ_arr, | ||
| UserCtx * | user | ||
| ) |
Internal helper implementation: InterpolateCornerToFaceCenter_Scalar().
Interpolates a scalar field from corner nodes to all face centers.
Local to this translation unit.
Definition at line 2069 of file interpolation.c.
| PetscErrorCode InterpolateCornerToFaceCenter_Vector | ( | Cmpnts *** | corner_arr, |
| Cmpnts *** | faceX_arr, | ||
| Cmpnts *** | faceY_arr, | ||
| Cmpnts *** | faceZ_arr, | ||
| UserCtx * | user | ||
| ) |
Internal helper implementation: InterpolateCornerToFaceCenter_Vector().
Interpolates a vector field from corner nodes to all face centers.
Local to this translation unit.
Definition at line 2159 of file interpolation.c.