flow
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
flow_bindings.cpp File Reference

nanobind module flow — the Kokkos cut-cell IBM Navier-Stokes solver (peclet.flow.Solver). More...

#include <nanobind/nanobind.h>
#include <nanobind/ndarray.h>
#include <nanobind/stl/pair.h>
#include <nanobind/stl/string.h>
#include <nanobind/stl/vector.h>
#include <array>
#include <cstdint>
#include <Kokkos_Core.hpp>
#include <string>
#include <vector>
#include "flow_ibm.hpp"
#include "peclet/core/python/ndarray_interop.hpp"

Go to the source code of this file.

Functions

template<class S >
static nb::ndarray< nb::numpy, double > field_out (S &s, std::vector< double > &&v)
 
static std::vector< double > grid_in (nb::ndarray< double, nb::f_contig > a)
 
template<class S >
static auto field3d_out (S &s, peclet::flow::CCField f)
 
template<class Grid >
static void bind_solver (nb::module_ &m, const char *name)
 
 NB_MODULE (_flow, m)
 

Detailed Description

nanobind module flow — the Kokkos cut-cell IBM Navier-Stokes solver (peclet.flow.Solver).

Exposes peclet::flow::IbmSolver to Python: set rho/mu/dt, a body force, an SDF solid (cut-cell IBM no-slip

  • optional cut-cell pressure projection), step, read back the velocity/pressure, and query the cut-cell flux divergence. Exercised by verify_poiseuille_sdflow (IBM channel) and verify_periodic_spheres_sdflow (cut-cell Stokes through a sphere packing). Kokkos is initialized at import and finalized via Python atexit (the solver holds Kokkos Views, so callers must release the Solver before exit – del + gc.collect()). rank()/bcast_from_root() are single-rank stubs (the multi-rank path lives in tests/kokkos_mpi).

Arrays cross the boundary through the shared zero-copy bridge (peclet::core::python, in core): fields come back as Fortran-order (nx,ny,nz) float64 NumPy arrays referencing the field buffer, and inputs are read as flat x-fastest buffers. See tpx/python/ndarray_interop.hpp.

Definition in file flow_bindings.cpp.

Function Documentation

◆ field_out()

template<class S >
static nb::ndarray< nb::numpy, double > field_out ( S &  s,
std::vector< double > &&  v 
)
static

Definition at line 58 of file flow_bindings.cpp.

Referenced by bind_solver().

◆ grid_in()

static std::vector< double > grid_in ( nb::ndarray< double, nb::f_contig >  a)
static

Definition at line 69 of file flow_bindings.cpp.

Referenced by bind_solver().

◆ field3d_out()

template<class S >
static auto field3d_out ( S &  s,
peclet::flow::CCField  f 
)
static

Definition at line 80 of file flow_bindings.cpp.

Referenced by bind_solver().

◆ bind_solver()

template<class Grid >
static void bind_solver ( nb::module_ &  m,
const char *  name 
)
static

◆ NB_MODULE()

NB_MODULE ( _flow  ,
 
)

Definition at line 554 of file flow_bindings.cpp.