OpenImpala
Image-based parallel transport property solver
Loading...
Searching...
No Matches
OpenImpala Namespace Reference

Namespaces

namespace  bc_detail

Classes

class  BoundaryCondition
 Abstract base class for boundary conditions. More...
struct  CathodeParams
 Structure to hold cathode material and electrode parameters. More...
class  CathodeWrite
 A writer for generating cathode parameter files for battery models. More...
class  ConnectedComponents
 Labels connected components of a phase using parallel flood-fill. More...
class  DatReader
 Reads and provides access to raw image data from specific DAT files. More...
class  DirichletExternalBC
 Applies Dirichlet BC at domain boundary faces perpendicular to the flow direction. More...
class  DirichletPhaseBoundaryBC
 Applies Dirichlet BC at active cells adjacent to inactive cells near the domain boundary. More...
class  EffectiveDiffusivityHypre
 Solves the cell problem ∇_ξ ⋅ (D ∇_ξ χ_k) = -∇_ξ ⋅ (D ê_k) for a corrector function χ_k. More...
class  HDF5Reader
 Reads 3D image/scalar field data from a specified dataset within an HDF5 file directly into AMReX MultiFabs, suitable for large datasets. More...
class  HypreStructSolver
 Base class for HYPRE structured-grid solvers. More...
struct  ImageData
 Result of loading and thresholding a 3D image file. More...
struct  MacroGeometry
 Macro-geometric parameters derived from the AMReX Geometry. More...
class  NeumannBC
 Zero-flux Neumann BC — no stencil modification needed. More...
class  ParticleSizeDistribution
 Computes equivalent sphere radii from connected component volumes. More...
class  PercolationCheck
 Checks whether a phase percolates across the domain in a given direction. More...
class  PeriodicBC
 Periodic BC — requires HYPRE periodic grid setup. More...
struct  PhysicsConfig
class  RawReader
 Reads and provides access to data from raw binary files where metadata (dimensions, data type, endianness) is provided externally. More...
class  ResultsJSON
struct  REVConfig
 Configuration for an REV study. More...
class  SpecificSurfaceArea
 Computes the specific surface area between two phases in an iMultiFab. More...
class  ThroughThicknessProfile
 Computes a through-thickness volume fraction profile. More...
class  TiffReader
 Reads 3D image data from single/multi-directory TIFFs or file sequences. Performs parallel, chunked reading directly into AMReX iMultiFab. More...
class  Tortuosity
 Abstract base class for computing the tortuosity of a structure. More...
class  TortuosityDirect
 Computes tortuosity using a simple iterative Finite Volume solver for the Poisson equation. More...
class  TortuosityHypre
class  TortuosityMLMG
 Computes tortuosity using AMReX's native matrix-free MLMG solver. More...
class  TortuositySolverBase
 Shared base class for all tortuosity solvers. More...
class  VolumeFraction
 Computes the volume fraction of a specific phase within an amrex::iMultiFab. More...

Typedefs

using Real = amrex::Real

Enumerations

enum class  BCType { DirichletExternal , DirichletPhaseBoundary , Neumann , Periodic }
 Boundary condition types for transport solvers. More...
enum class  CellType {
  BLOCKED = 0 , FREE = 1 , BOUNDARY_X_LO = 2 , BOUNDARY_X_HI = 3 ,
  BOUNDARY_Y_LO = 4 , BOUNDARY_Y_HI = 5 , BOUNDARY_Z_LO = 6 , BOUNDARY_Z_HI = 7
}
 Cell types identifying the role of a cell within the domain. More...
enum class  Direction { X = 0 , Y = 1 , Z = 2 }
 Defines cardinal directions for calculations. More...
enum class  PhysicsType {
  Diffusion , ElectricalConductivity , ThermalConductivity , DielectricPermittivity ,
  MagneticPermeability
}
enum class  PrecondType { SMG , PFMG }
 Preconditioner type for HYPRE Krylov solvers. More...
enum class  RawDataType {
  UNKNOWN , UINT8 , INT8 , INT16_LE ,
  INT16_BE , UINT16_LE , UINT16_BE , INT32_LE ,
  INT32_BE , UINT32_LE , UINT32_BE , FLOAT32_LE ,
  FLOAT32_BE , FLOAT64_LE , FLOAT64_BE
}
 Specifies the expected primitive data type and endianness of voxels within a raw binary data file. More...
enum class  SolverType {
  Jacobi , GMRES , FlexGMRES , PCG ,
  BiCGSTAB , SMG , PFMG
}
 Specifies the HYPRE structured solver algorithm to use. More...
enum  StencilIdx : int {
  STN_C = 0 , STN_MX = 1 , STN_PX = 2 , STN_MY = 3 ,
  STN_PY = 4 , STN_MZ = 5 , STN_PZ = 6 , NSTENCIL = 7
}
 Stencil indices (0-based, matching HYPRE_StructStencilSetElement order). More...

Functions

void calculateDeffTensor (amrex::Real Deff_tensor[3][3], const amrex::MultiFab &mf_chi_x, const amrex::MultiFab &mf_chi_y, const amrex::MultiFab &mf_chi_z, const amrex::iMultiFab &active_mask, const amrex::Geometry &geom, int verbose=0, const amrex::MultiFab *mf_diff_coeff=nullptr)
 Assembles the effective diffusivity tensor from periodic corrector fields.
void collectBoundarySeeds (const amrex::iMultiFab &phaseFab, int phaseID, int dir, const amrex::Geometry &geom, amrex::Vector< amrex::IntVect > &inletSeeds, amrex::Vector< amrex::IntVect > &outletSeeds)
 Collect boundary seeds on inlet/outlet faces of a phase.
void computeFaceFluxes (const amrex::Box &bx, const amrex::Array4< amrex::Real > &fx, const amrex::Array4< amrex::Real > &fy, const amrex::Array4< amrex::Real > &fz, const amrex::Array4< const amrex::Real > &sol, const amrex::Real *dxinv)
 Compute face fluxes using finite differences on a cell-centred solution.
std::unique_ptr< BoundaryCondition > createBC (BCType type)
 Create a BoundaryCondition object from a BCType enum.
void effDiffFillMatrix (amrex::Real *a_out, amrex::Real *rhs_out, amrex::Real *xinit_out, int npts, const int *active_mask, const int *mask_lo, const int *mask_hi, const amrex::Real *diff_coeff, const int *dc_lo, const int *dc_hi, const int *bxlo, const int *bxhi, const int *domlo, const int *domhi, const amrex::Real *cell_sizes, int dir_k, int verbose, amrex::Real pin_scale=1.0)
 Fill HYPRE matrix for the effective-diffusivity cell problem.
SolverType effDiffSolverType (const std::string &solver_str)
 Backward-compatible alias for parseSolverType().
void forwardEulerUpdate (const amrex::Box &bx, const amrex::Array4< const amrex::Real > &p_arr, const amrex::Array4< amrex::Real > &n_arr, const amrex::Array4< const amrex::Real > &fx, const amrex::Array4< const amrex::Real > &fy, const amrex::Array4< const amrex::Real > &fz, const amrex::Real *dxinv, amrex::Real dt)
 Forward Euler update: phi_new = phi_old + dt * div(flux).
void integrateBoundaryFluxes (const amrex::Box &cell_bx, const amrex::Array4< const amrex::Real > &fx, const amrex::Array4< const amrex::Real > &fy, const amrex::Array4< const amrex::Real > &fz, const amrex::Box &fxbox, const amrex::Box &fybox, const amrex::Box &fzbox, int dir, amrex::Real &flux_in, amrex::Real &flux_out)
 Sum fluxes on the inlet (low) and outlet (high) domain faces.
ImageData loadImage (const std::filesystem::path &filepath, const std::string &hdf5_dataset, amrex::Real threshold_val, int box_size, int verbose=1)
 Loads a 3D image from file and thresholds it into a binary phase field.
void parallelFloodFill (amrex::iMultiFab &reachabilityMask, const amrex::iMultiFab &phaseFab, int phaseID, const amrex::Vector< amrex::IntVect > &seedPoints, const amrex::Geometry &geom, int verbose=0, int label=FLOOD_ACTIVE)
 GPU-compatible parallel flood fill on an iMultiFab.
BCType parseBCType (const std::string &bc_str)
 Convert a case-insensitive string to BCType.
Direction parseDirection (const std::string &dir_str)
 Convert a case-insensitive direction string to Direction enum.
SolverType parseSolverType (const std::string &solver_str)
 Convert a case-insensitive solver name to SolverType.
void removeIsolatedCells (int *q, const int *q_lo, const int *q_hi, int, const int *bxlo, const int *bxhi, const int *domlo, const int *domhi)
 Remove isolated single cells by checking 6-connectivity.
void runREVStudy (const amrex::Geometry &geom_full, const amrex::BoxArray &ba_full, const amrex::DistributionMapping &dm_full, const amrex::iMultiFab &mf_phase_full, const REVConfig &config)
 Runs an REV convergence study on the given full-domain phase field.
void tortuosityFillMatrix (amrex::Real *a, amrex::Real *rhs, amrex::Real *xinit, int nval, const int *active_mask, const int *mask_lo, const int *mask_hi, const amrex::Real *diff_coeff, const int *dc_lo, const int *dc_hi, const int *bxlo, const int *bxhi, const int *domlo, const int *domhi, const amrex::Real *dxinv, amrex::Real vlo, amrex::Real vhi, int dir, int verbose)
 Fill HYPRE matrix coefficients for the tortuosity solve (interior stencil only).
void tortuosityFillMatrix (amrex::Real *a, amrex::Real *rhs, amrex::Real *xinit, int nval, const int *active_mask, const int *mask_lo, const int *mask_hi, const amrex::Real *diff_coeff, const int *dc_lo, const int *dc_hi, const int *bxlo, const int *bxhi, const int *domlo, const int *domhi, const amrex::Real *dxinv, amrex::Real vlo, amrex::Real vhi, int dir, int verbose, const BoundaryCondition *bc_inlet_outlet, const BoundaryCondition *bc_sides)
 Fill HYPRE matrix coefficients with configurable boundary conditions.
SolverType tortuositySolverType (const std::string &solver_str)
 Backward-compatible alias for parseSolverType().

Variables

constexpr int CELL_ACTIVE = 1
constexpr int CELL_INACTIVE = 0
 Mask values.
constexpr int CELL_PINNED = 2
 Pinned active cell marker (chi = 0 Dirichlet pin for per-component nullspace removal).
constexpr int CELL_TYPE_BLOCKED = 0
 Cell-type constants (matching Tortuosity.H conventions).
constexpr int CELL_TYPE_FREE = 1
constexpr int FLOOD_ACTIVE = 1
constexpr int FLOOD_INACTIVE = 0
 Marker values used in reachability masks.
constexpr int NEIGHBOR_OUTSIDE = -1
 Sentinel value for neighbors outside the physical domain.
constexpr amrex::Real SMALL_REAL = 1.0e-15
 Small tolerance for floating-point comparisons.

Typedef Documentation

◆ Real

using OpenImpala::Real = amrex::Real

Enumeration Type Documentation

◆ BCType

enum class OpenImpala::BCType
strong

Boundary condition types for transport solvers.

Enumerator
DirichletExternal 

Dirichlet at domain faces (standard, v1.0.0 default)

DirichletPhaseBoundary 

Dirichlet at active cells adjacent to inactive cells near boundary

Neumann 

Zero-flux Neumann (implicit — no stencil modification needed)

Periodic 

Periodic wrapping (requires HYPRE periodic grid)

◆ CellType

enum class OpenImpala::CellType
strong

Cell types identifying the role of a cell within the domain.

Used by solver kernels to identify cells near boundaries or blocked regions, potentially aiding in applying specific boundary conditions or skipping calculations.

Enumerator
BLOCKED 

Cell is fully blocked (e.g., solid phase, no transport).

FREE 

Cell is fully open (e.g., conductive phase, allows transport).

BOUNDARY_X_LO 

Cell is on the lower boundary in the X-direction.

BOUNDARY_X_HI 

Cell is on the higher boundary in the X-direction.

BOUNDARY_Y_LO 

Cell is on the lower boundary in the Y-direction.

BOUNDARY_Y_HI 

Cell is on the higher boundary in the Y-direction.

BOUNDARY_Z_LO 

Cell is on the lower boundary in the Z-direction.

BOUNDARY_Z_HI 

Cell is on the higher boundary in the Z-direction.

◆ Direction

enum class OpenImpala::Direction
strong

Defines cardinal directions for calculations.

Enumerator
X 
Y 
Z 

◆ PhysicsType

enum class OpenImpala::PhysicsType
strong
Enumerator
Diffusion 
ElectricalConductivity 
ThermalConductivity 
DielectricPermittivity 
MagneticPermeability 

◆ PrecondType

enum class OpenImpala::PrecondType
strong

Preconditioner type for HYPRE Krylov solvers.

SMG is the default because its point-based smoothing handles the decoupled rows that arise from masked cells (inactive cells have A_ii=1, b_i=0, which PFMG's semicoarsening fails to coarsen meaningfully — symptom: PCG+PFMG hits max iterations without converging on porous-media inputs). PFMG is the more scalable choice for fully active grids (no masked-out regions). Both have full GPU support in HYPRE 2.31 when HYPRE_SetMemoryLocation(HYPRE_MEMORY_DEVICE) is active (see HypreStructSolver::createMatrixAndVectors).

Enumerator
SMG 

Semicoarsening multigrid — robust default, handles masked rows

PFMG 

Parallel semicoarsening multigrid — scales better on full grids

◆ RawDataType

enum class OpenImpala::RawDataType
strong

Specifies the expected primitive data type and endianness of voxels within a raw binary data file.

Endianness (Little Endian - LE, Big Endian - BE) must be specified for multi-byte data types (16-bit, 32-bit, 64-bit) to ensure correct interpretation on different machine architectures.

Enumerator
UNKNOWN 

Default, indicating an uninitialized or invalid type.

UINT8 

8-bit unsigned integer (char, byte). Endianness irrelevant.

INT8 

8-bit signed integer (signed char). Endianness irrelevant.

INT16_LE 

16-bit signed integer, Little Endian (least significant byte first, common on x86).

INT16_BE 

16-bit signed integer, Big Endian (most significant byte first).

UINT16_LE 

16-bit unsigned integer, Little Endian.

UINT16_BE 

16-bit unsigned integer, Big Endian.

INT32_LE 

32-bit signed integer, Little Endian.

INT32_BE 

32-bit signed integer, Big Endian.

UINT32_LE 

32-bit unsigned integer, Little Endian.

UINT32_BE 

32-bit unsigned integer, Big Endian.

FLOAT32_LE 

32-bit single-precision float (IEEE 754), Little Endian.

FLOAT32_BE 

32-bit single-precision float (IEEE 754), Big Endian.

FLOAT64_LE 

64-bit double-precision float (IEEE 754), Little Endian.

FLOAT64_BE 

64-bit double-precision float (IEEE 754), Big Endian.

◆ SolverType

enum class OpenImpala::SolverType
strong

Specifies the HYPRE structured solver algorithm to use.

Shared by TortuosityHypre and EffectiveDiffusivityHypre.

Enumerator
Jacobi 

HYPRE_StructJacobi

GMRES 

HYPRE_StructGMRES

FlexGMRES 

HYPRE_StructFlexGMRES

PCG 

HYPRE_StructPCG

BiCGSTAB 

HYPRE_StructBiCGSTAB

SMG 

HYPRE_StructSMG

PFMG 

HYPRE_StructPFMG

◆ StencilIdx

Stencil indices (0-based, matching HYPRE_StructStencilSetElement order).

Enumerator
STN_C 

Center.

STN_MX 

-X (West)

STN_PX 

+X (East)

STN_MY 

-Y (South)

STN_PY 

+Y (North)

STN_MZ 

-Z (Bottom)

STN_PZ 

+Z (Top)

NSTENCIL 

Function Documentation

◆ calculateDeffTensor()

void OpenImpala::calculateDeffTensor ( amrex::Real Deff_tensor[3][3],
const amrex::MultiFab & mf_chi_x,
const amrex::MultiFab & mf_chi_y,
const amrex::MultiFab & mf_chi_z,
const amrex::iMultiFab & active_mask,
const amrex::Geometry & geom,
int verbose = 0,
const amrex::MultiFab * mf_diff_coeff = nullptr )

Assembles the effective diffusivity tensor from periodic corrector fields.

Integrates conservative harmonic face fluxes across all +x, +y, +z faces in the periodic domain, preserving exact discrete Onsager symmetry and Voigt/Reuss bounds.

Parameters
[out]Deff_tensor3x3 output tensor (row-major: Deff_tensor[row][col]).
[in]mf_chi_xCorrector field for x-direction (1 component, >= 1 ghost cell).
[in]mf_chi_yCorrector field for y-direction (1 component, >= 1 ghost cell).
[in]mf_chi_zCorrector field for z-direction (1 component, >= 1 ghost cell).
[in]active_maskInteger mask: 1 = active cell, 0 = inactive (>= 0 ghost cells).
[in]geomPeriodic AMReX Geometry defining cell sizes and periodicity.
[in]verboseVerbosity level (0 = silent).
[in]mf_diff_coeffOptional cell-centred diffusivity MultiFab (defaults to 1.0 on active cells).

◆ collectBoundarySeeds()

void OpenImpala::collectBoundarySeeds ( const amrex::iMultiFab & phaseFab,
int phaseID,
int dir,
const amrex::Geometry & geom,
amrex::Vector< amrex::IntVect > & inletSeeds,
amrex::Vector< amrex::IntVect > & outletSeeds )

Collect boundary seeds on inlet/outlet faces of a phase.

Scans the lo and hi faces of the domain in direction dir for cells matching phaseID, gathers them across MPI ranks via Allgatherv, and returns deduplicated seed vectors.

Parameters
[in]phaseFabPhase data.
[in]phaseIDPhase ID to seed.
[in]dirFlow direction (determines which faces to scan).
[in]geomAMReX Geometry.
[out]inletSeedsSeeds on the low face (populated on return).
[out]outletSeedsSeeds on the high face (populated on return).

◆ computeFaceFluxes()

void OpenImpala::computeFaceFluxes ( const amrex::Box & bx,
const amrex::Array4< amrex::Real > & fx,
const amrex::Array4< amrex::Real > & fy,
const amrex::Array4< amrex::Real > & fz,
const amrex::Array4< const amrex::Real > & sol,
const amrex::Real * dxinv )
inline

Compute face fluxes using finite differences on a cell-centred solution.

Sets flux to zero if either adjacent cell is blocked. Uses AMReX Array4 for clean multi-dimensional indexing.

Parameters
bxValid cell-centred box defining the region.
fxX-face flux (output), Array4<Real>.
fyY-face flux (output), Array4<Real>.
fzZ-face flux (output), Array4<Real>.
solSolution field with component 0 = phi, component 1 = cell type.
dxinvInverse cell sizes [1/dx, 1/dy, 1/dz].

◆ createBC()

std::unique_ptr< BoundaryCondition > OpenImpala::createBC ( BCType type)
inline

Create a BoundaryCondition object from a BCType enum.

Parameters
typeThe BC type to create.
Returns
Unique pointer to the created BoundaryCondition.

◆ effDiffFillMatrix()

void OpenImpala::effDiffFillMatrix ( amrex::Real * a_out,
amrex::Real * rhs_out,
amrex::Real * xinit_out,
int npts,
const int * active_mask,
const int * mask_lo,
const int * mask_hi,
const amrex::Real * diff_coeff,
const int * dc_lo,
const int * dc_hi,
const int * bxlo,
const int * bxhi,
const int * domlo,
const int * domhi,
const amrex::Real * cell_sizes,
int dir_k,
int verbose,
amrex::Real pin_scale = 1.0 )
inline

Fill HYPRE matrix for the effective-diffusivity cell problem.

Parameters
[out]a_outFlattened stencil array, size npts*7.
[out]rhs_outRHS vector, size npts.
[out]xinit_outInitial guess, size npts.
[in]nptsNumber of cells in this box.
[in]active_mask3-D cell-state mask (0=inactive, 1=active, 2=pinned active).
[in]mask_loLower bounds of mask (3 ints).
[in]mask_hiUpper bounds of mask (3 ints).
[in]diff_coeff3-D cell-centred diffusion coefficients.
[in]dc_loLower bounds of diff_coeff (3 ints).
[in]dc_hiUpper bounds of diff_coeff (3 ints).
[in]bxloLower corner of valid box (3 ints).
[in]bxhiUpper corner of valid box (3 ints).
[in]domloDomain lower corner (3 ints).
[in]domhiDomain upper corner (3 ints).
[in]cell_sizesGrid spacing [dx, dy, dz].
[in]dir_kDirection of unit vector e_k (0=X, 1=Y, 2=Z).
[in]verboseDebug print level.
[in]pin_scaleDiagonal scale for decoupled inactive and pinned cells.

◆ effDiffSolverType()

SolverType OpenImpala::effDiffSolverType ( const std::string & solver_str)
inline

Backward-compatible alias for parseSolverType().

Deprecated
Use parseSolverType() instead.

◆ forwardEulerUpdate()

void OpenImpala::forwardEulerUpdate ( const amrex::Box & bx,
const amrex::Array4< const amrex::Real > & p_arr,
const amrex::Array4< amrex::Real > & n_arr,
const amrex::Array4< const amrex::Real > & fx,
const amrex::Array4< const amrex::Real > & fy,
const amrex::Array4< const amrex::Real > & fz,
const amrex::Real * dxinv,
amrex::Real dt )
inline

Forward Euler update: phi_new = phi_old + dt * div(flux).

Only updates component 0 (phi). Cell type (component 1) is untouched.

Parameters
bxValid cell-centred box.
p_arrOld solution (input), Array4<const Real>.
n_arrNew solution (output), Array4<Real>.
fxX-face flux (input).
fyY-face flux (input).
fzZ-face flux (input).
dxinvInverse cell sizes [1/dx, 1/dy, 1/dz].
dtTime step / relaxation parameter.

◆ integrateBoundaryFluxes()

void OpenImpala::integrateBoundaryFluxes ( const amrex::Box & cell_bx,
const amrex::Array4< const amrex::Real > & fx,
const amrex::Array4< const amrex::Real > & fy,
const amrex::Array4< const amrex::Real > & fz,
const amrex::Box & fxbox,
const amrex::Box & fybox,
const amrex::Box & fzbox,
int dir,
amrex::Real & flux_in,
amrex::Real & flux_out )
inline

Sum fluxes on the inlet (low) and outlet (high) domain faces.

Parameters
cell_bxCell-centred valid box for this FAB.
fxX-face flux Array4 (const).
fyY-face flux Array4 (const).
fzZ-face flux Array4 (const).
fxboxAllocated memory box for fx (to check face ownership).
fyboxAllocated memory box for fy.
fzboxAllocated memory box for fz.
dirFlow direction (0=X, 1=Y, 2=Z).
flux_in(output) accumulated flux entering through the low face.
flux_out(output) accumulated flux exiting through the high face.

◆ loadImage()

ImageData OpenImpala::loadImage ( const std::filesystem::path & filepath,
const std::string & hdf5_dataset,
amrex::Real threshold_val,
int box_size,
int verbose = 1 )

Loads a 3D image from file and thresholds it into a binary phase field.

Detects the file format from the extension (.tif/.tiff, .h5/.hdf5, .dat), reads the image using the appropriate reader class, and applies a threshold to produce a binary phase field (0/1).

The resulting geometry uses periodic boundary conditions, consistent with the homogenization cell-problem formulation.

Parameters
filepathFull path to the input image file.
hdf5_datasetHDF5 dataset name (only used for .h5/.hdf5 files).
threshold_valThreshold value: voxels > threshold → phase 1, else → phase 0.
box_sizeMaximum grid box size for AMReX BoxArray decomposition.
verboseVerbosity level (0=silent, 1+=progress output).
Returns
ImageData struct containing geometry, grid, and phase field.
Exceptions
std::runtime_errorif the file cannot be read or has unsupported format.

◆ parallelFloodFill()

void OpenImpala::parallelFloodFill ( amrex::iMultiFab & reachabilityMask,
const amrex::iMultiFab & phaseFab,
int phaseID,
const amrex::Vector< amrex::IntVect > & seedPoints,
const amrex::Geometry & geom,
int verbose = 0,
int label = FLOOD_ACTIVE )

GPU-compatible parallel flood fill on an iMultiFab.

Marks all cells of phaseID that are 6-connected to any seed point as FLOOD_ACTIVE in reachabilityMask. Uses iterative wavefront expansion with FillBoundary for MPI ghost exchange.

The inner expansion loop uses amrex::ParallelFor, which maps to GPU kernels when AMReX is built with CUDA/HIP, and to OpenMP threads on CPU builds. Early termination uses a device-compatible atomic flag.

Parameters
[out]reachabilityMaskiMultiFab to fill (1 comp, >=1 ghost). Set to label for reachable cells.
[in]phaseFabPhase data (1 comp, >=1 ghost).
[in]phaseIDPhase ID to flood through.
[in]seedPointsInitial seed cell coordinates.
[in]geomAMReX Geometry for FillBoundary periodicity.
[in]verboseVerbosity (0=silent, >1 prints iteration count).
[in]labelInteger label to write into reachable cells. Default FLOOD_ACTIVE (1). ConnectedComponents passes a unique label per component.

◆ parseBCType()

BCType OpenImpala::parseBCType ( const std::string & bc_str)
inline

Convert a case-insensitive string to BCType.

Parameters
bc_strBC name (e.g. "DirichletExternal", "neumann", "periodic").
Returns
Corresponding BCType enum value.
Note
Calls amrex::Abort if bc_str is unrecognised.

◆ parseDirection()

Direction OpenImpala::parseDirection ( const std::string & dir_str)
inline

Convert a case-insensitive direction string to Direction enum.

Parameters
dir_strDirection name ("X", "Y", or "Z", case-insensitive).
Returns
Corresponding Direction enum value.
Note
Calls amrex::Abort if dir_str is unrecognised.

◆ parseSolverType()

SolverType OpenImpala::parseSolverType ( const std::string & solver_str)
inline

Convert a case-insensitive solver name to SolverType.

Parameters
solver_strSolver name (e.g. "FlexGMRES", "pcg", "BiCGSTAB").
Returns
Corresponding SolverType enum value.
Note
Calls amrex::Abort if solver_str is unrecognised.

◆ removeIsolatedCells()

void OpenImpala::removeIsolatedCells ( int * q,
const int * q_lo,
const int * q_hi,
int ,
const int * bxlo,
const int * bxhi,
const int * domlo,
const int * domhi )
inline

Remove isolated single cells by checking 6-connectivity.

For each cell in bxlo:bxhi, if none of the 6 face-connected neighbours share the same phase, the cell's phase is flipped (0<->1).

Parameters
[in,out]qPointer to integer phase data (first component).
[in]q_loLower bounds of q array (3 ints, includes ghosts).
[in]q_hiUpper bounds of q array (3 ints, includes ghosts).
[in]ncompNumber of components (only component 0 is used).
[in]bxloLower corner of valid box to iterate (3 ints).
[in]bxhiUpper corner of valid box to iterate (3 ints).
[in]domloPhysical domain lower corner (3 ints).
[in]domhiPhysical domain upper corner (3 ints).

◆ runREVStudy()

void OpenImpala::runREVStudy ( const amrex::Geometry & geom_full,
const amrex::BoxArray & ba_full,
const amrex::DistributionMapping & dm_full,
const amrex::iMultiFab & mf_phase_full,
const REVConfig & config )

Runs an REV convergence study on the given full-domain phase field.

For each target size and sample, extracts a random sub-volume from the full domain, solves the cell problem in 3 directions using EffectiveDiffusivityHypre, assembles the D_eff tensor, and appends the result to a CSV file.

Parameters
geom_fullGeometry of the full domain.
ba_fullBoxArray of the full domain.
dm_fullDistributionMapping of the full domain.
mf_phase_fullPhase field of the full domain.
configREV study configuration.

◆ tortuosityFillMatrix() [1/2]

void OpenImpala::tortuosityFillMatrix ( amrex::Real * a,
amrex::Real * rhs,
amrex::Real * xinit,
int nval,
const int * active_mask,
const int * mask_lo,
const int * mask_hi,
const amrex::Real * diff_coeff,
const int * dc_lo,
const int * dc_hi,
const int * bxlo,
const int * bxhi,
const int * domlo,
const int * domhi,
const amrex::Real * dxinv,
amrex::Real vlo,
amrex::Real vhi,
int dir,
int verbose )
inline

Fill HYPRE matrix coefficients for the tortuosity solve (interior stencil only).

Discretises div(D grad(phi)) = 0 on a 7-point stencil with harmonic-mean face coefficients. Inactive cells are decoupled (A_ii=1, A_ij=0, b=0). Sets a linear initial guess along the flow direction.

Note
This function builds the interior stencil only. Boundary conditions are NOT applied here — call the BC-aware overload or apply BoundaryCondition objects separately after this function returns.
Parameters
[out]aFlattened stencil array, size nval*7 (C,W,E,S,N,B,T).
[out]rhsRight-hand side, size nval.
[out]xinitInitial guess, size nval.
[in]nvalNumber of cells in this box.
[in]active_mask3-D activity mask (1=active, 0=inactive), with ghosts.
[in]mask_loLower bounds of active_mask (3 ints).
[in]mask_hiUpper bounds of active_mask (3 ints).
[in]diff_coeff3-D cell-centred diffusion coefficients, with ghosts.
[in]dc_loLower bounds of diff_coeff (3 ints).
[in]dc_hiUpper bounds of diff_coeff (3 ints).
[in]bxloLower corner of valid box (3 ints).
[in]bxhiUpper corner of valid box (3 ints).
[in]domloDomain lower corner (3 ints).
[in]domhiDomain upper corner (3 ints).
[in]dxinvInverse grid spacing squared: [1/dx^2, 1/dy^2, 1/dz^2].
[in]vloDirichlet BC value on the low face.
[in]vhiDirichlet BC value on the high face.
[in]dirFlow direction (0=X, 1=Y, 2=Z).
[in]verboseDebug print level.

◆ tortuosityFillMatrix() [2/2]

void OpenImpala::tortuosityFillMatrix ( amrex::Real * a,
amrex::Real * rhs,
amrex::Real * xinit,
int nval,
const int * active_mask,
const int * mask_lo,
const int * mask_hi,
const amrex::Real * diff_coeff,
const int * dc_lo,
const int * dc_hi,
const int * bxlo,
const int * bxhi,
const int * domlo,
const int * domhi,
const amrex::Real * dxinv,
amrex::Real vlo,
amrex::Real vhi,
int dir,
int verbose,
const BoundaryCondition * bc_inlet_outlet,
const BoundaryCondition * bc_sides )
inline

Fill HYPRE matrix coefficients with configurable boundary conditions.

Builds the interior stencil via tortuosityFillMatrix(), then applies inlet/outlet and lateral boundary conditions via BoundaryCondition objects.

Parameters
bc_inlet_outletBC strategy for domain faces perpendicular to flow direction.
bc_sidesBC strategy for domain faces parallel to flow direction (lateral).

All other parameters are identical to the interior-only overload.

◆ tortuositySolverType()

SolverType OpenImpala::tortuositySolverType ( const std::string & solver_str)
inline

Backward-compatible alias for parseSolverType().

Deprecated
Use parseSolverType() instead.

Variable Documentation

◆ CELL_ACTIVE

int OpenImpala::CELL_ACTIVE = 1
constexpr

◆ CELL_INACTIVE

int OpenImpala::CELL_INACTIVE = 0
constexpr

Mask values.

◆ CELL_PINNED

int OpenImpala::CELL_PINNED = 2
constexpr

Pinned active cell marker (chi = 0 Dirichlet pin for per-component nullspace removal).

◆ CELL_TYPE_BLOCKED

int OpenImpala::CELL_TYPE_BLOCKED = 0
constexpr

Cell-type constants (matching Tortuosity.H conventions).

◆ CELL_TYPE_FREE

int OpenImpala::CELL_TYPE_FREE = 1
constexpr

◆ FLOOD_ACTIVE

int OpenImpala::FLOOD_ACTIVE = 1
constexpr

◆ FLOOD_INACTIVE

int OpenImpala::FLOOD_INACTIVE = 0
constexpr

Marker values used in reachability masks.

◆ NEIGHBOR_OUTSIDE

int OpenImpala::NEIGHBOR_OUTSIDE = -1
constexpr

Sentinel value for neighbors outside the physical domain.

◆ SMALL_REAL

amrex::Real OpenImpala::SMALL_REAL = 1.0e-15
constexpr

Small tolerance for floating-point comparisons.