OpenImpala
Image-based parallel transport property solver
Loading...
Searching...
No Matches
OpenImpala::TortuositySolverBase Class Referenceabstract

Shared base class for all tortuosity solvers. More...

#include <TortuositySolverBase.H>

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

Public Member Functions

void buildDiffusionCoeffField ()
amrex::iMultiFab buildTraversableMask ()
void computePlaneFluxes (const amrex::MultiFab &mf_soln)
void generateActivityMask (const amrex::iMultiFab &phaseFab, int phaseID, OpenImpala::Direction dir)
amrex::Real getActiveVolumeFraction () const
amrex::Real getEffectiveDiffusivity () const
amrex::Real getFinalRelativeResidualNorm () const
amrex::Real getFluxIn () const
amrex::Real getFluxOut () const
const amrex::Geometry & getGeometry () const
const std::map< int, amrex::Real > & getPhaseCoeffMap () const
const std::vector< amrex::Real > & getPlaneFluxes () const
amrex::Real getPlaneFluxMaxDeviation () const
const amrex::MultiFab & getSolutionField () const
bool getSolverConverged () const
int getSolverIterations () const
void globalFluxes ()
bool isMultiPhase () const
TortuositySolverBase & operator= (const TortuositySolverBase &)=delete
void parallelFloodFill (amrex::iMultiFab &reachabilityMask, const amrex::iMultiFab &phaseFab, int phaseID, const amrex::Vector< amrex::IntVect > &seedPoints)
void preconditionPhaseFab ()
virtual bool solve ()=0
 Run the linear solver, populating m_mf_solution.
 TortuositySolverBase (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 std::string &resultspath, const amrex::Real vlo, const amrex::Real vhi, int verbose, bool write_plotfile, const std::map< int, amrex::Real > &phase_coeffs={})
 Construct common solver infrastructure.
 TortuositySolverBase (const TortuositySolverBase &)=delete
amrex::Real value (const bool refresh=false) override
 Template method: solve, compute flux, return tortuosity.
void writeSolutionPlotfile (const std::string &label)
 ~TortuositySolverBase () 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.

Protected Attributes

amrex::Real m_active_vf = 0.0
 Volume fraction of percolating phase.
amrex::BoxArray m_ba
bool m_converged = false
amrex::Real m_deff = std::numeric_limits<amrex::Real>::quiet_NaN()
const OpenImpala::Direction m_dir
amrex::DistributionMapping m_dm
amrex::Real m_final_res_norm = 0.0
bool m_first_call = true
amrex::Real m_flux_in = 0.0
amrex::Real m_flux_out = 0.0
amrex::Real m_flux_tol = 1.0e-4
bool m_fluxes_precomputed = false
amrex::Geometry m_geom
bool m_is_multi_phase = false
amrex::Real m_max_diff_coeff = 1.0
amrex::iMultiFab m_mf_active_mask
 1 = percolating, 0 = isolated
amrex::MultiFab m_mf_diff_coeff
 Cell-centred D(x) from phase map.
amrex::iMultiFab m_mf_phase
 Phase IDs (with ghosts).
amrex::MultiFab m_mf_solution
 Solution phi (1 comp, 1 ghost) — populated by solve().
int m_num_iterations = 0
const int m_phase
std::map< int, amrex::Real > m_phase_coeff_map
 Phase ID -> transport coefficient.
amrex::Real m_plane_flux_max_dev = 0.0
std::vector< amrex::Real > m_plane_fluxes
std::string m_resultspath
amrex::Real m_value = std::numeric_limits<amrex::Real>::quiet_NaN()
int m_verbose
const amrex::Real m_vf
 Original total VF (reference).
amrex::Real m_vhi
amrex::Real m_vlo
bool m_write_plotfile

Additional Inherited Members

Protected Member Functions inherited from OpenImpala::Tortuosity
 Tortuosity ()=default

Detailed Description

Shared base class for all tortuosity solvers.

Handles problem setup (phase data, diffusion coefficients, activity mask) and post-solve analysis (flux integration, tortuosity calculation). Subclasses implement the pure-virtual solve() method.

Constructor & Destructor Documentation

◆ TortuositySolverBase() [1/2]

OpenImpala::TortuositySolverBase::TortuositySolverBase ( 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 std::string & resultspath,
const amrex::Real vlo,
const amrex::Real vhi,
int verbose,
bool write_plotfile,
const std::map< int, amrex::Real > & phase_coeffs = {} )

Construct common solver infrastructure.

Performs all solver-independent setup: copies phase data, parses multi-phase configuration, removes isolated cells, builds the diffusion coefficient field, and generates the activity mask via boundary-seeded parallel flood fill.

Parameters
geomAMReX Geometry defining the domain.
baAMReX BoxArray defining grid patch layout.
dmAMReX DistributionMapping for processor assignment.
mf_phase_inputInput iMultiFab of phase IDs (1 component, >=1 ghost).
vfTotal volume fraction of the target phase.
phasePhase ID to solve for.
dirFlow direction (X, Y, or Z).
resultspathOutput directory for results files.
vloDirichlet potential at inlet face.
vhiDirichlet potential at outlet face.
verboseVerbosity level (0=silent).
write_plotfileWrite AMReX plotfile of solution.

◆ ~TortuositySolverBase()

OpenImpala::TortuositySolverBase::~TortuositySolverBase ( )
overridedefault

◆ TortuositySolverBase() [2/2]

OpenImpala::TortuositySolverBase::TortuositySolverBase ( const TortuositySolverBase & )
delete

Member Function Documentation

◆ buildDiffusionCoeffField()

void OpenImpala::TortuositySolverBase::buildDiffusionCoeffField ( )

◆ buildTraversableMask()

amrex::iMultiFab OpenImpala::TortuositySolverBase::buildTraversableMask ( )

◆ computePlaneFluxes()

void OpenImpala::TortuositySolverBase::computePlaneFluxes ( const amrex::MultiFab & mf_soln)

◆ generateActivityMask()

void OpenImpala::TortuositySolverBase::generateActivityMask ( const amrex::iMultiFab & phaseFab,
int phaseID,
OpenImpala::Direction dir )

◆ getActiveVolumeFraction()

amrex::Real OpenImpala::TortuositySolverBase::getActiveVolumeFraction ( ) const
inline

◆ getEffectiveDiffusivity()

amrex::Real OpenImpala::TortuositySolverBase::getEffectiveDiffusivity ( ) const
inline

◆ getFinalRelativeResidualNorm()

amrex::Real OpenImpala::TortuositySolverBase::getFinalRelativeResidualNorm ( ) const
inline

◆ getFluxIn()

amrex::Real OpenImpala::TortuositySolverBase::getFluxIn ( ) const
inline

◆ getFluxOut()

amrex::Real OpenImpala::TortuositySolverBase::getFluxOut ( ) const
inline

◆ getGeometry()

const amrex::Geometry & OpenImpala::TortuositySolverBase::getGeometry ( ) const
inline

◆ getPhaseCoeffMap()

const std::map< int, amrex::Real > & OpenImpala::TortuositySolverBase::getPhaseCoeffMap ( ) const
inline

◆ getPlaneFluxes()

const std::vector< amrex::Real > & OpenImpala::TortuositySolverBase::getPlaneFluxes ( ) const
inline

◆ getPlaneFluxMaxDeviation()

amrex::Real OpenImpala::TortuositySolverBase::getPlaneFluxMaxDeviation ( ) const
inline

◆ getSolutionField()

const amrex::MultiFab & OpenImpala::TortuositySolverBase::getSolutionField ( ) const
inline

◆ getSolverConverged()

bool OpenImpala::TortuositySolverBase::getSolverConverged ( ) const
inline

◆ getSolverIterations()

int OpenImpala::TortuositySolverBase::getSolverIterations ( ) const
inline

◆ globalFluxes()

void OpenImpala::TortuositySolverBase::globalFluxes ( )

◆ isMultiPhase()

bool OpenImpala::TortuositySolverBase::isMultiPhase ( ) const
inline

◆ operator=()

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

◆ parallelFloodFill()

void OpenImpala::TortuositySolverBase::parallelFloodFill ( amrex::iMultiFab & reachabilityMask,
const amrex::iMultiFab & phaseFab,
int phaseID,
const amrex::Vector< amrex::IntVect > & seedPoints )

◆ preconditionPhaseFab()

void OpenImpala::TortuositySolverBase::preconditionPhaseFab ( )

◆ solve()

virtual bool OpenImpala::TortuositySolverBase::solve ( )
pure virtual

Run the linear solver, populating m_mf_solution.

Subclasses must:

  1. Solve the system and write the solution into m_mf_solution
  2. Call m_mf_solution.FillBoundary() after populating
  3. Set m_converged, m_num_iterations, m_final_res_norm
Returns
true if solver converged.

Implemented in OpenImpala::TortuosityMLMG.

◆ value()

amrex::Real OpenImpala::TortuositySolverBase::value ( const bool refresh = false)
overridevirtual

Template method: solve, compute flux, return tortuosity.

On first call (or refresh), calls solve(), then globalFluxes(), checks flux conservation, and computes tau = active_vf / D_eff. Returns NaN on failure (non-convergence, flux non-conservation).

Implements OpenImpala::Tortuosity.

◆ writeSolutionPlotfile()

void OpenImpala::TortuositySolverBase::writeSolutionPlotfile ( const std::string & label)

Member Data Documentation

◆ m_active_vf

amrex::Real OpenImpala::TortuositySolverBase::m_active_vf = 0.0
protected

Volume fraction of percolating phase.

◆ m_ba

amrex::BoxArray OpenImpala::TortuositySolverBase::m_ba
protected

◆ m_converged

bool OpenImpala::TortuositySolverBase::m_converged = false
protected

◆ m_deff

amrex::Real OpenImpala::TortuositySolverBase::m_deff = std::numeric_limits<amrex::Real>::quiet_NaN()
protected

◆ m_dir

const OpenImpala::Direction OpenImpala::TortuositySolverBase::m_dir
protected

◆ m_dm

amrex::DistributionMapping OpenImpala::TortuositySolverBase::m_dm
protected

◆ m_final_res_norm

amrex::Real OpenImpala::TortuositySolverBase::m_final_res_norm = 0.0
protected

◆ m_first_call

bool OpenImpala::TortuositySolverBase::m_first_call = true
protected

◆ m_flux_in

amrex::Real OpenImpala::TortuositySolverBase::m_flux_in = 0.0
protected

◆ m_flux_out

amrex::Real OpenImpala::TortuositySolverBase::m_flux_out = 0.0
protected

◆ m_flux_tol

amrex::Real OpenImpala::TortuositySolverBase::m_flux_tol = 1.0e-4
protected

◆ m_fluxes_precomputed

bool OpenImpala::TortuositySolverBase::m_fluxes_precomputed = false
protected

◆ m_geom

amrex::Geometry OpenImpala::TortuositySolverBase::m_geom
protected

◆ m_is_multi_phase

bool OpenImpala::TortuositySolverBase::m_is_multi_phase = false
protected

◆ m_max_diff_coeff

amrex::Real OpenImpala::TortuositySolverBase::m_max_diff_coeff = 1.0
protected

◆ m_mf_active_mask

amrex::iMultiFab OpenImpala::TortuositySolverBase::m_mf_active_mask
protected

1 = percolating, 0 = isolated

◆ m_mf_diff_coeff

amrex::MultiFab OpenImpala::TortuositySolverBase::m_mf_diff_coeff
protected

Cell-centred D(x) from phase map.

◆ m_mf_phase

amrex::iMultiFab OpenImpala::TortuositySolverBase::m_mf_phase
protected

Phase IDs (with ghosts).

◆ m_mf_solution

amrex::MultiFab OpenImpala::TortuositySolverBase::m_mf_solution
protected

Solution phi (1 comp, 1 ghost) — populated by solve().

◆ m_num_iterations

int OpenImpala::TortuositySolverBase::m_num_iterations = 0
protected

◆ m_phase

const int OpenImpala::TortuositySolverBase::m_phase
protected

◆ m_phase_coeff_map

std::map<int, amrex::Real> OpenImpala::TortuositySolverBase::m_phase_coeff_map
protected

Phase ID -> transport coefficient.

◆ m_plane_flux_max_dev

amrex::Real OpenImpala::TortuositySolverBase::m_plane_flux_max_dev = 0.0
protected

◆ m_plane_fluxes

std::vector<amrex::Real> OpenImpala::TortuositySolverBase::m_plane_fluxes
protected

◆ m_resultspath

std::string OpenImpala::TortuositySolverBase::m_resultspath
protected

◆ m_value

amrex::Real OpenImpala::TortuositySolverBase::m_value = std::numeric_limits<amrex::Real>::quiet_NaN()
protected

◆ m_verbose

int OpenImpala::TortuositySolverBase::m_verbose
protected

◆ m_vf

const amrex::Real OpenImpala::TortuositySolverBase::m_vf
protected

Original total VF (reference).

◆ m_vhi

amrex::Real OpenImpala::TortuositySolverBase::m_vhi
protected

◆ m_vlo

amrex::Real OpenImpala::TortuositySolverBase::m_vlo
protected

◆ m_write_plotfile

bool OpenImpala::TortuositySolverBase::m_write_plotfile
protected

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