|
OpenImpala
Image-based parallel transport property solver
|
#include <TortuosityHypre.H>
Public Types | |
| using | SolverType = OpenImpala::SolverType |
| Alias for the shared HYPRE solver type enum (defined in Tortuosity.H). | |
Public Member Functions | |
| amrex::iMultiFab | buildTraversableMask () |
| bool | checkMatrixProperties () |
| Performs mathematical checks on the assembled HYPRE matrix and RHS vector. | |
| void | computePlaneFluxes (const amrex::MultiFab &mf_soln) |
| void | generateActivityMask (const amrex::iMultiFab &phaseFab, int phaseID, OpenImpala::Direction dir) |
| amrex::Real | getActiveVolumeFraction () const |
| void | getCellTypes (amrex::MultiFab &phi, int ncomp=1) |
| amrex::Real | getEffectiveDiffusivity () const |
| amrex::Real | getFluxIn () const |
| amrex::Real | getFluxOut () const |
| const amrex::Geometry & | getGeometry () const |
| BCType | getInletOutletBCType () const |
| Returns the inlet/outlet BC type. | |
| const std::map< int, amrex::Real > & | getPhaseCoeffMap () const |
| Returns the phase-to-coefficient mapping. | |
| const std::vector< amrex::Real > & | getPlaneFluxes () const |
| Returns the per-plane flux profile computed after solving. | |
| amrex::Real | getPlaneFluxMaxDeviation () const |
| Maximum relative deviation across interior plane fluxes. | |
| BCType | getSidesBCType () const |
| Returns the lateral (sides) BC type. | |
| void | getSolution (amrex::MultiFab &soln, int ncomp=0) |
| const amrex::MultiFab & | getSolutionField () const |
| void | global_fluxes () |
| void | initializeDiffCoeff () |
| bool | isMultiPhase () const |
| Returns true if multi-phase transport coefficients are configured. | |
| TortuosityHypre & | operator= (const TortuosityHypre &)=delete |
| void | preconditionPhaseFab () |
| void | setupMatrixEquation () |
| bool | solve () |
| TortuosityHypre (const amrex::Geometry &geom, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm, const amrex::iMultiFab &mf_phase_input, const amrex::Real vf, const int phase, const OpenImpala::Direction dir, const SolverType solvertype, const std::string &resultspath, const amrex::Real vlo=0.0, const amrex::Real vhi=1.0, int verbose=0, bool write_plotfile=false, const PrecondType precond_type=PrecondType::SMG, const std::map< int, amrex::Real > &phase_coeffs={}) | |
| TortuosityHypre (const TortuosityHypre &)=delete | |
| amrex::Real | value (const bool refresh=false) override |
| virtual | ~TortuosityHypre () override=default |
| Public Member Functions inherited from OpenImpala::Tortuosity | |
| virtual | ~Tortuosity ()=default |
| Virtual destructor (essential for base classes with virtual functions). Ensures proper cleanup when derived classes are deleted via a base class pointer. | |
| Public Member Functions inherited from OpenImpala::HypreStructSolver | |
| amrex::Real | getFinalRelativeResidualNorm () const |
| bool | getSolverConverged () const |
| int | getSolverIterations () const |
| HypreStructSolver (const HypreStructSolver &)=delete | |
| HypreStructSolver & | operator= (const HypreStructSolver &)=delete |
| virtual | ~HypreStructSolver () |
| Virtual destructor. Cleans up HYPRE resources safely (guards against post-MPI_Finalize). | |
Static Public Member Functions | |
| static amrex::Array< HYPRE_Int, 3 > | hiV (const amrex::Box &b) |
| static amrex::Array< HYPRE_Int, 3 > | loV (const amrex::Box &b) |
| Static Public Member Functions inherited from OpenImpala::HypreStructSolver | |
| static amrex::Array< HYPRE_Int, 3 > | hiV (const amrex::Box &b) |
| Convert AMReX Box upper corner to HYPRE_Int array. | |
| static amrex::Array< HYPRE_Int, 3 > | loV (const amrex::Box &b) |
| Convert AMReX Box lower corner to HYPRE_Int array. | |
Additional Inherited Members | |
| Protected Member Functions inherited from OpenImpala::Tortuosity | |
| Tortuosity ()=default | |
| Protected Member Functions inherited from OpenImpala::HypreStructSolver | |
| void | assembleSystem () |
| Assemble HYPRE matrix and vectors after box values have been set. | |
| void | createMatrixAndVectors () |
| Create and initialize HYPRE matrix and vectors (A, b, x). Must be called after setupGrid() and setupStencil(). | |
| HypreStructSolver (const amrex::Geometry &geom, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm, SolverType solvertype, amrex::Real eps, int maxiter, int verbose) | |
| Construct base solver with configuration. Does NOT call any HYPRE functions. | |
| bool | runSolver (PrecondType precond_type=PrecondType::SMG) |
| Run the HYPRE solver specified by m_solvertype. | |
| void | setupGrid (bool periodic=false) |
| Create HYPRE structured grid from AMReX BoxArray. | |
| void | setupStencil () |
| Create 7-point stencil (center + 6 face neighbours). | |
| Protected Attributes inherited from OpenImpala::HypreStructSolver | |
| HYPRE_StructMatrix | m_A = nullptr |
| HYPRE_StructVector | m_b = nullptr |
| amrex::BoxArray | m_ba |
| bool | m_converged = false |
| amrex::DistributionMapping | m_dm |
| amrex::Real | m_eps |
| amrex::Real | m_final_res_norm = std::numeric_limits<amrex::Real>::quiet_NaN() |
| amrex::Geometry | m_geom |
| HYPRE_StructGrid | m_grid = nullptr |
| int | m_maxiter |
| HYPRE_Int | m_num_iterations = -1 |
| const SolverType | m_solvertype |
| HYPRE_StructStencil | m_stencil = nullptr |
| int | m_verbose |
| HYPRE_StructVector | m_x = nullptr |
| Static Protected Attributes inherited from OpenImpala::HypreStructSolver | |
| static constexpr int | STENCIL_SIZE = 7 |
Computes the tortuosity of a porous structure using HYPRE.
Solves a diffusion equation (-Div(Grad(phi)) = 0 with Dirichlet BCs) on a masked subset of the domain derived from phase data, using HYPRE's structured-grid solvers (PFMG, SMG, Krylov methods) to find the potential field. Tortuosity is calculated from the resulting flux and active volume fraction, including checks for solver convergence and flux conservation.
Inherits HYPRE grid/stencil/solver infrastructure from HypreStructSolver.
Alias for the shared HYPRE solver type enum (defined in Tortuosity.H).
| OpenImpala::TortuosityHypre::TortuosityHypre | ( | const amrex::Geometry & | geom, |
| const amrex::BoxArray & | ba, | ||
| const amrex::DistributionMapping & | dm, | ||
| const amrex::iMultiFab & | mf_phase_input, | ||
| const amrex::Real | vf, | ||
| const int | phase, | ||
| const OpenImpala::Direction | dir, | ||
| const SolverType | solvertype, | ||
| const std::string & | resultspath, | ||
| const amrex::Real | vlo = 0.0, | ||
| const amrex::Real | vhi = 1.0, | ||
| int | verbose = 0, | ||
| bool | write_plotfile = false, | ||
| const PrecondType | precond_type = PrecondType::SMG, | ||
| const std::map< int, amrex::Real > & | phase_coeffs = {} ) |
Construct new Tortuosity solver using HYPRE.
| geom | AMReX Geometry object defining the domain. |
| ba | AMReX BoxArray defining the distribution of grid patches. |
| dm | AMReX DistributionMapping defining processor assignments. |
| mf_phase_input | Input iMultiFab containing phase IDs (expects 1 component, >=1 ghost cell). |
| vf | Volume fraction of the phase of interest (total VF, passed for potential reference). |
| phase | Phase ID to calculate tortuosity for. |
| dir | Direction across which to apply potential difference (X, Y, or Z). |
| solvertype | Solver type to use (from SolverType enum). |
| resultspath | Path to directory for writing output files (e.g., plotfiles). |
| vlo | Potential value applied at the low boundary in the specified direction. Default 0.0. |
| vhi | Potential value applied at the high boundary in the specified direction. Default 1.0. |
| verbose | Verbosity level (0=silent, 1=basic, 2=detailed HYPRE output). Default 0. |
| write_plotfile | If true, write a plotfile of the solution potential field. Default false. |
| precond_type | Preconditioner used by Krylov solvers (PCG/GMRES/FlexGMRES/BiCGSTAB). Ignored when solvertype is a standalone multigrid (SMG/PFMG) or Jacobi. Default SMG — robust on masked porous-media inputs where PFMG's semicoarsening fails to converge on the decoupled inactive rows. |
|
overridevirtualdefault |
Destructor. Base class handles HYPRE resource cleanup.
|
delete |
| amrex::iMultiFab OpenImpala::TortuosityHypre::buildTraversableMask | ( | ) |
| bool OpenImpala::TortuosityHypre::checkMatrixProperties | ( | ) |
Performs mathematical checks on the assembled HYPRE matrix and RHS vector.
| void OpenImpala::TortuosityHypre::computePlaneFluxes | ( | const amrex::MultiFab & | mf_soln | ) |
| void OpenImpala::TortuosityHypre::generateActivityMask | ( | const amrex::iMultiFab & | phaseFab, |
| int | phaseID, | ||
| OpenImpala::Direction | dir ) |
|
inline |
| void OpenImpala::TortuosityHypre::getCellTypes | ( | amrex::MultiFab & | phi, |
| int | ncomp = 1 ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the inlet/outlet BC type.
|
inline |
Returns the phase-to-coefficient mapping.
|
inline |
Returns the per-plane flux profile computed after solving.
|
inline |
Maximum relative deviation across interior plane fluxes.
|
inline |
Returns the lateral (sides) BC type.
| void OpenImpala::TortuosityHypre::getSolution | ( | amrex::MultiFab & | soln, |
| int | ncomp = 0 ) |
|
inline |
| void OpenImpala::TortuosityHypre::global_fluxes | ( | ) |
|
inlinestatic |
| void OpenImpala::TortuosityHypre::initializeDiffCoeff | ( | ) |
|
inline |
Returns true if multi-phase transport coefficients are configured.
|
inlinestatic |
|
delete |
| void OpenImpala::TortuosityHypre::preconditionPhaseFab | ( | ) |
| void OpenImpala::TortuosityHypre::setupMatrixEquation | ( | ) |
| bool OpenImpala::TortuosityHypre::solve | ( | ) |
|
overridevirtual |
Calculate or retrieve the tortuosity value.
Solves the underlying diffusion equation using HYPRE if not already solved or if refresh is requested. Checks solver convergence and flux conservation. Calculates flux and computes tortuosity using the average flux magnitude and the active volume fraction if checks pass. Returns NaN if the solver fails to converge, if flux is not conserved, or if calculation leads to invalid states (e.g., zero active VF or Deff).
| refresh | If true, forces recalculation by running the solver again. Default false. |
Implements OpenImpala::Tortuosity.