PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
Loading...
Searching...
No Matches
Filter.h File Reference
#include "variables.h"
#include "logging.h"
Include dependency graph for Filter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

double ApplyLESTestFilter (const SimCtx *simCtx, double values[3][3][3], double weights[3][3][3])
 Applies a numerical "test filter" to a 3x3x3 stencil of data points.
 

Function Documentation

◆ ApplyLESTestFilter()

double ApplyLESTestFilter ( const SimCtx simCtx,
double  values[3][3][3],
double  weights[3][3][3] 
)

Applies a numerical "test filter" to a 3x3x3 stencil of data points.

EXPLANATION of "Test Filter": In the dynamic Smagorinsky LES model, the model coefficient (Cs) is not constant. It is calculated "dynamically" by sampling the turbulent energy cascade at two different scales. The first scale is the grid filter itself (implicit in the discretization). The second, larger scale is this explicit "test filter". By comparing the behavior of the resolved flow at these two scales, the model can determine the appropriate amount of dissipation needed, and thus calculate the Smagorinsky coefficient.

This function is the primary interface for this process. It selects the appropriate filtering algorithm based on simulation settings.

Parameters
simCtxThe global simulation context, containing flags like testfilter_ik.
valuesThe 3x3x3 array of scalar values at the stencil points.
weightsThe 3x3x3 array of weights (typically 1/cell volume) for averaging.
Returns
The resulting scalar value after applying the test filter.

Applies a numerical "test filter" to a 3x3x3 stencil of data points.

Definition at line 145 of file Filter.c.

146{
147 // This function acts as a dispatcher. It reads the simulation configuration
148 // and calls the appropriate internal filtering routine.
149 if (simCtx->testfilter_ik) {
150 // If the "-testfilter_ik" flag is set, it indicates that the simulation
151 // is homogeneous in the i and k directions, so we use the specialized,
152 // more accurate Simpson's rule filter. The `weights` are ignored in this case.
154 } else {
155 // This is the default case for general, non-uniform, curvilinear grids.
156 // The volume-weighted box filter is used to ensure correct averaging.
157 return ApplyVolumeWeightedBoxFilter(values, weights);
158 }
159}
static double ApplyVolumeWeightedBoxFilter(double values[3][3][3], double weights[3][3][3])
(Internal) Applies a volume-weighted 3D box filter to a 3x3x3 stencil.
Definition Filter.c:62
static double ApplySimpsonRuleHomogeneousFilter(double values[3][3][3])
(Internal) Applies a 2D homogeneous test filter in the i-k plane using Simpson's rule.
Definition Filter.c:34
PetscInt testfilter_ik
Definition variables.h:612
Here is the call graph for this function:
Here is the caller graph for this function: