Skip to content

Non-uniform grid Laplacian operator in matrix_ops #45

@jc-macdonald

Description

@jc-macdonald

Non-uniform grid Laplacian operator

Add a 1D Laplacian operator for non-uniform grids to matrix_ops.py. Currently make_1d_laplacian only supports uniform grids. The structured-observables chemostat model requires a Neumann-BC tridiagonal Laplacian on curvature-weighted non-uniform grids.

Implementation

  • make_1d_laplacian(n, dx=None, grid=None, bc='neumann') — extend existing function to accept a non-uniform grid array
  • For non-uniform grid: second-order FD stencil with variable spacing h_i = grid[i+1] - grid[i]
  • Neumann BC: ghost-node approach, one-sided differences at boundaries
  • Return sparse CSC matrix compatible with existing CachedImplicitSolve
  • Optional: 4th-order Laplacian for biharmonic diffusion (used in Chemostat_Simulator)

Source code reference

  • Thoery_1_Code.ipynb: neumann_tridiag_laplacian_1d(theta_grid) — FD on non-uniform 1D grid
  • Chemostat_Simulator.ipynb: 4th-order Laplacian in simulate_model2_explicit

Tests

  • Uniform grid: matches existing make_1d_laplacian output
  • Non-uniform grid: second-order convergence on smooth test function
  • Neumann BC: constant function in null space
  • Symmetric matrix for symmetric grids

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions