- The paper introduces pyDOF, an open-source Python library that uses constrained optimisation to design symmetric physical-space forward and inverse filters with user-controlled van Cittert reconstruction order.
- Benchmark results show pyDOF achieves competitive mean-squared error while strictly limiting pass-band overshoot to 0.05%, enforcing unity response at zero wavenumber, and attenuating the grid cut-off.
- The library’s adaptive designs recover resolved signal content in Gaussian-filter, turbulent-flame, and image tests, but higher inverse orders require larger stencils and greater computational cost.
pyDOF is an open-source Python library for designing symmetric, physical-space discrete filters, covering both forward filtering and inverse (deconvolution) filter design within a single constrained-optimisation framework. The library builds on a framework previously developed by the authors for large eddy simulation (LES) applications (2606.26830), and its distinguishing feature relative to standard signal-processing tools is support for inverse filter design with explicit user control over the reconstruction order.
Motivation and positioning
The primary application domain is computational fluid dynamics, where discrete filters underpin turbulence and combustion models such as dynamic Smagorinsky, scale-similarity, and mixed models, as well as deconvolution-based approaches that reconstruct unfiltered fields from filtered ones. In LES, filtering operations are applied to 3D fields on meshes with millions of points, so filters must be accurate yet compact. Physical-space convolution is preferred over Fourier-based approaches for ease of implementation, parallelisation, and boundary-condition handling.
The authors argue that conventional coefficient derivation via truncated Taylor-series expansions produces filters that perform poorly at high wavenumbers near the grid cut-off kh=π, are not consistent (constant signals may be damped or amplified), and may have negative transfer functions—rendering them unsuitable for deconvolution modelling since reconstruction becomes unstable when G^d(kh)≤0 for some resolved wavenumber. Classic signal-processing methods address forward filter design well: Kaiser windows offer efficient design with controllable transition width; Parks-McClellan yields equi-ripple optimal filters; least-squares methods minimise global error but without ripple or transition-width control. However, none of these provide independent pass-band/stop-band control, consistency constraints, positivity guarantees, or—in the case of most published work—inverse filter design within a unified framework. pyDOF fills this gap using constrained optimisation with van Cittert regularisation for the inverse problem.
For a 1D mesh with spacing h, the forward filter is a symmetric stencil convolution uˉi=∑l=−MFMFglui+l with real transfer function G^d(krh)=g0+2l=1∑MFglcos(krhl). The inverse filter operates analogously on the filtered field with coefficients bl and half-stencil MI.
The inverse target derives from van Cittert iteration. For b=1, after N iterations the reconstructed transfer function is
Q^dN(krh)=1−(1−G^d(krh))N+1.
Two properties follow directly: any wavenumber with G^d(kh)≤00 can never be recovered, whereas if G^d(kh)≤01 then G^d(kh)≤02 as G^d(kh)≤03. This makes positivity of the forward transfer function a prerequisite for stable deconvolution, which pyDOF enforces via constraints. The user selects G^d(kh)≤04 explicitly, thereby controlling how much of the resolved wavenumber range is reconstructed—a parameter most iterative schemes leave implicit through runtime cost.
Optimisation minimises either mean-squared error (G^d(kh)≤05) or mean absolute error (G^d(kh)≤06) between G^d(kh)≤07 and a target G^d(kh)≤08, optionally augmented by a gradient-smoothing penalty weighted by G^d(kh)≤09. For inverse filters, the objective matches h0 against h1 (or its continuous-domain analogue h2). Built-in targets include Gaussian, Helmholtz, implicit (Padé-type), Butterworth, and arbitrary sharp multi-band ideal filters defined by band edges; users may supply custom targets through class inheritance.
Constraints are specified by keywords: value fixing at zero or one (fixOne, fixZero), lower/upper bounds over wavenumber intervals (luBounds), positivity, bounding within h3, monotonicity of the transfer function gradient, and an adaptive switch instructing the optimiser to grow the stencil size until a target error metric is met. The value-fixing constraints deserve emphasis: they guarantee h4 (consistency for constant signals) and h5 (complete attenuation at grid cut-off), properties that Kaiser-window, Parks-McClellan, and unconstrained least-squares designs cannot enforce simultaneously.
Implementation
The library exposes a small object-oriented API built around five core classes. Wavenumber defines the sampled range h6; Filter subclasses encapsulate continuous target transfer functions; DiscreteFilter holds the coefficients and stencil configuration for forward or inverse filters; ReconstructedTransferFunction computes h7 or h8 from a discrete filter (optionally combined with a physical-space Filter); and Optimiser assembles and solves the constrained problem, updating coefficients in place. Coefficients are exported as plain text parseable from any language. The design is deliberately decoupled from any specific optimiser, so alternative solvers can be substituted while retaining the constraint and target abstractions.
Validation
Low-pass filters. For an ideal low-pass target with cut-off h9 and stop-band attenuation of 60 dB, stencil sizes of 73 and 145 were derived from the standard formula uˉi=∑l=−MFMFglui+l0 for transition widths uˉi=∑l=−MFMFglui+l1 and uˉi=∑l=−MFMFglui+l2. pyDOF was benchmarked against Kaiser-window, Parks-McClellan, and least-squares designs, with a uniform ripple bound uˉi=∑l=−MFMFglui+l3 imposed over both bands plus the two value-fixing constraints. Least-squares achieves the lowest mean-squared error but exhibits severe Gibbs overshoot (~9% in the pass-band). pyDOF's overshoot is exactly bounded at 0.05%—a direct consequence of the imposed constraint—and its MSQE is competitive:
| Method |
MSQE (uˉi=∑l=−MFMFglui+l4=73) |
Max pass-band overshoot |
| Kaiser window |
4.91E-03 |
1.20E-01 |
| Parks-McClellan |
4.77E-03 |
6.32E-02 |
| Least-squares |
2.80E-03 |
9.00E+00 |
| pyDOF |
4.80E-03 |
5.00E-02 |
Trends are similar at uˉi=∑l=−MFMFglui+l5 and for multi-pass-band filters with transition bands centred at uˉi=∑l=−MFMFglui+l6 and uˉi=∑l=−MFMFglui+l7. A physical-space test on a 512-point periodic signal containing pass-band components and stop-band components including the grid cut-off confirms correct attenuation behaviour. Computationally, Kaiser windows remain cheapest, followed by Parks-McClellan, then the optimisation approaches—an expected trade-off given that filter design is a one-time offline cost.
Forward and inverse Gaussian filters. With uˉi=∑l=−MFMFglui+l8 and adaptive stencil selection (forward error tolerance uˉi=∑l=−MFMFglui+l9, inverse G^d(krh)=g0+2l=1∑MFglcos(krhl)0), the adaptive procedure selected G^d(krh)=g0+2l=1∑MFglcos(krhl)1 for the forward filter, while the inverse stencil grows with reconstruction order: G^d(krh)=g0+2l=1∑MFglcos(krhl)2, 14, and 26 for G^d(krh)=g0+2l=1∑MFglcos(krhl)3, 500, and 5000 respectively. Forward MSQE is G^d(krh)=g0+2l=1∑MFglcos(krhl)4; inverse MSQE remains below G^d(krh)=g0+2l=1∑MFglcos(krhl)5 across all orders, with maximum overshoot in G^d(krh)=g0+2l=1∑MFglcos(krhl)6 rising from 0.12% to 0.75% as G^d(krh)=g0+2l=1∑MFglcos(krhl)7 increases. A physical-space test shows recovery of the original signal down to the largest resolved wavenumber component. Note the monotone trend: higher reconstruction order demands larger inverse stencils and slightly larger composite error, so the reconstruction order trades accuracy against convolution cost.
2D turbulent flame and images. Applying dimensional splitting to 1D filters designed for an extreme implicit target (G^d(krh)=g0+2l=1∑MFglcos(krhl)8, near the boundary of the admissible range G^d(krh)=g0+2l=1∑MFglcos(krhl)9) with reconstruction order limited to bl0 for cost reasons, the adaptive optimiser produced bl1 and bl2. Filtering a DNS density field of a turbulent premixed V-flame removes substantial fine-scale structure; reconstruction at this modest order recovers much of it. The same filter pair applied to 2D images recovers the originals almost completely at bl3, illustrating applicability beyond CFD.
Limitations and open questions
Several caveats bear directly on the results. First, the framework is restricted to symmetric, explicit, real-coefficient filters obtained via dimensional splitting; asymmetric or truly multidimensional stencils are outside its scope. Second, the validation against classical methods covers ideal low-pass and multi-pass targets only; no comparison is reported for smooth targets such as Gaussian or Butterworth against alternative inverse-design approaches, so the claimed advantage rests largely on the unique capability set rather than uniformly superior error metrics—indeed, unconstrained least-squares attains lower MSQE in every benchmarked case. Third, the inverse design inherits van Cittert's structural limitation: wavenumbers where the forward transfer function vanishes are unrecoverable regardless of bl4, making the positivity constraint essential rather than optional. Fourth, computational cost of the optimisation exceeds classical methods, and the paper does not report optimiser runtimes quantitatively. Finally, the 2D demonstrations use a fixed, modest reconstruction order chosen for cost; the interaction between stencil growth, reconstruction order, and 3D convolution expense on production-scale LES meshes is demonstrated only by reference to prior work rather than established here.
Conclusion
pyDOF provides a unified, constraint-driven framework for designing symmetric discrete forward and inverse filters, with adaptive stencil selection, explicit reconstruction-order control, and extensible target transfer functions. Benchmark results show error metrics comparable to Kaiser-window and Parks-McClellan designs while enforcing consistency and complete grid cut-off attenuation that those methods cannot impose, and the inverse-filter capability—validated on turbulent-flame and image data—is the library's principal differentiator. The main open questions concern extension beyond symmetric 1D-split filters and quantitative cost characterisation relative to classical design methods.