OpenImpala
Image-based parallel transport property solver
Loading...
Searching...
No Matches
OpenImpala::EffectiveDiffusivityHypre Class Reference

Solves the cell problem ∇_ξ ⋅ (D ∇_ξ χ_k) = -∇_ξ ⋅ (D ê_k) for a corrector function χ_k. More...

#include <EffectiveDiffusivityHypre.H>

Inheritance diagram for OpenImpala::EffectiveDiffusivityHypre:
[legend]
Collaboration diagram for OpenImpala::EffectiveDiffusivityHypre:
[legend]

Public Types

using SolverType = OpenImpala::SolverType
 Alias for the shared HYPRE solver type enum (defined in Tortuosity.H).

Public Member Functions

int buildCellTypeMask (amrex::iMultiFab &mf_cell_type) const
 EffectiveDiffusivityHypre (const amrex::Geometry &geom, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm, const amrex::iMultiFab &mf_phase_input, const int phase_id, const OpenImpala::Direction dir_of_chi_k, const SolverType solver_type, const std::string &resultspath, int verbose_level=1, bool write_plotfile_flag=false, const std::map< int, amrex::Real > &phase_coeffs={})
 Construct new solver for the effective diffusivity cell problem.
 EffectiveDiffusivityHypre (const EffectiveDiffusivityHypre &)=delete
void generateActiveMask ()
const amrex::iMultiFab & getActiveMask () const
void getChiSolution (amrex::MultiFab &chi_field)
 Retrieves the solved corrector function χ_k.
const amrex::MultiFab & getDiffCoeff () const
void initializeDiffCoeff ()
EffectiveDiffusivityHypre & operator= (const EffectiveDiffusivityHypre &)=delete
void setupMatrixEquation ()
bool solve ()
 Solves the cell problem for the configured χ_k.
 ~EffectiveDiffusivityHypre () override=default
 Destructor. Base class handles HYPRE resource cleanup.
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::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

Detailed Description

Solves the cell problem ∇_ξ ⋅ (D ∇_ξ χ_k) = -∇_ξ ⋅ (D ê_k) for a corrector function χ_k.

This class uses HYPRE's structured-grid solvers to find the corrector function χ_k for a given direction k (X, Y, or Z). The material phase where D=D_material is identified from the input phase data. The class sets up and solves the PDE with periodic boundary conditions for χ_k and specific Neumann conditions on internal pore-solid interfaces.

The full effective diffusivity tensor D_eff calculation, which requires all three χ_k fields, is intended to be performed outside this class.

Member Typedef Documentation

◆ SolverType

Alias for the shared HYPRE solver type enum (defined in Tortuosity.H).

Constructor & Destructor Documentation

◆ EffectiveDiffusivityHypre() [1/2]

OpenImpala::EffectiveDiffusivityHypre::EffectiveDiffusivityHypre ( const amrex::Geometry & geom,
const amrex::BoxArray & ba,
const amrex::DistributionMapping & dm,
const amrex::iMultiFab & mf_phase_input,
const int phase_id,
const OpenImpala::Direction dir_of_chi_k,
const SolverType solver_type,
const std::string & resultspath,
int verbose_level = 1,
bool write_plotfile_flag = false,
const std::map< int, amrex::Real > & phase_coeffs = {} )

Construct new solver for the effective diffusivity cell problem.

Parameters
geomAMReX Geometry object defining the domain (REV).
baAMReX BoxArray defining the distribution of grid patches.
dmAMReX DistributionMapping defining processor assignments.
mf_phase_inputInput iMultiFab containing phase IDs (expects 1 component, >=1 ghost cell).
phase_idThe ID of the phase considered to be the conductive material (where D=D_material, e.g., pores).
dir_of_chi_kThe direction 'k' (X, Y, or Z) for which the corrector function χ_k is being solved. This determines the ê_k vector in the RHS of the cell problem.
solver_typeSolver type to use (from SolverType enum).
resultspathPath to directory for writing output files (e.g., plotfiles for χ_k).
verbose_levelVerbosity level (0=silent, 1=basic, 2+=detailed HYPRE output). Default 1.
write_plotfile_flagIf true, write a plotfile of the solved χ_k field. Default false.

◆ ~EffectiveDiffusivityHypre()

OpenImpala::EffectiveDiffusivityHypre::~EffectiveDiffusivityHypre ( )
overridedefault

Destructor. Base class handles HYPRE resource cleanup.

◆ EffectiveDiffusivityHypre() [2/2]

OpenImpala::EffectiveDiffusivityHypre::EffectiveDiffusivityHypre ( const EffectiveDiffusivityHypre & )
delete

Member Function Documentation

◆ buildCellTypeMask()

int OpenImpala::EffectiveDiffusivityHypre::buildCellTypeMask ( amrex::iMultiFab & mf_cell_type) const

◆ generateActiveMask()

void OpenImpala::EffectiveDiffusivityHypre::generateActiveMask ( )

◆ getActiveMask()

const amrex::iMultiFab & OpenImpala::EffectiveDiffusivityHypre::getActiveMask ( ) const
inline

◆ getChiSolution()

void OpenImpala::EffectiveDiffusivityHypre::getChiSolution ( amrex::MultiFab & chi_field)

Retrieves the solved corrector function χ_k.

This method should be called after solve() has returned true. It copies the solution from the internal HYPRE vector to the provided AMReX MultiFab. The chi_field should be pre-allocated with the same BoxArray, DistributionMapping, 1 component, and desired number of ghost cells (typically 1 for subsequent gradient calculations).

Parameters
chi_fieldOutput MultiFab to store the solved χ_k.

◆ getDiffCoeff()

const amrex::MultiFab & OpenImpala::EffectiveDiffusivityHypre::getDiffCoeff ( ) const
inline

◆ hiV()

amrex::Array< HYPRE_Int, 3 > OpenImpala::EffectiveDiffusivityHypre::hiV ( const amrex::Box & b)
inlinestatic

◆ initializeDiffCoeff()

void OpenImpala::EffectiveDiffusivityHypre::initializeDiffCoeff ( )

◆ loV()

amrex::Array< HYPRE_Int, 3 > OpenImpala::EffectiveDiffusivityHypre::loV ( const amrex::Box & b)
inlinestatic

◆ operator=()

EffectiveDiffusivityHypre & OpenImpala::EffectiveDiffusivityHypre::operator= ( const EffectiveDiffusivityHypre & )
delete

◆ setupMatrixEquation()

void OpenImpala::EffectiveDiffusivityHypre::setupMatrixEquation ( )

◆ solve()

bool OpenImpala::EffectiveDiffusivityHypre::solve ( )

Solves the cell problem for the configured χ_k.

Sets up and calls the HYPRE solver. The solved χ_k field can be retrieved using getChiSolution().

Returns
True if the solver converged to the specified tolerance, false otherwise.

The documentation for this class was generated from the following files: