IBAMR  IBAMR version 0.20.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
IBAMR::LevelSetUtilities::LevelSetMassLossFixer Class Reference

Correct a regularized phase volume by a uniform level-set shift. More...

#include <ibamr/LevelSetUtilities.h>

Inheritance diagram for IBAMR::LevelSetUtilities::LevelSetMassLossFixer:
Inheritance graph
[legend]

Public Member Functions

 LevelSetMassLossFixer (std::string object_name, SAMRAI::tbox::Pointer< AdvDiffHierarchyIntegrator > adv_diff_integrator, std::vector< SAMRAI::tbox::Pointer< SAMRAI::pdat::CellVariable< NDIM, double >>> ls_vars, SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > input_db=nullptr, bool register_for_restart=true)
 Constructor of the class. More...
 
 ~LevelSetMassLossFixer ()
 
void putToDatabase (SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > db) override
 
const LevelSetContainer & getLevelSetContainer () const
 
LevelSetContainer & getLevelSetContainer ()
 
void setInitialVolume (double v0)
 
double getInitialVolume () const
 
void setTargetVolume (double v)
 
double getTargetVolume () const
 
void setLagrangeMultiplier (double q)
 
double getLagrangeMultiplier () const
 
void setTime (double time)
 
double getTime () const
 
int getCorrectionInterval () const
 
double getErrorRelTolerance () const
 
double getMaxIterations () const
 
bool enableLogging () const
 
void correctVolume (double new_time, bool three_phase)
 Correct NEW-context interiors at a due correction event. More...
 

Private Member Functions

void getFromRestart ()
 Restore the initial volume, target, and interface half-width. More...
 
void getFromInput (SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > input_db)
 Read correction controls and the input interface half-width. More...
 

Private Attributes

std::string d_object_name
 
LevelSetContainer d_ls_container
 
bool d_registered_for_restart
 
bool d_enable_logging = false
 
double d_vol_init = std::numeric_limits<double>::quiet_NaN()
 
double d_vol_target = std::numeric_limits<double>::quiet_NaN()
 
double d_q = std::numeric_limits<double>::quiet_NaN()
 
double d_time = 0.0
 
int d_interval = 1
 
int d_max_its = 64
 
double d_rel_tol = 1e-12
 
std::optional< double > d_abs_tol
 

Detailed Description

The two-phase correction targets gas volume \(\int H(-(\phi+q))\,dV\); the three-phase correction targets liquid volume \(\int H(\phi+q)H(\psi)\,dV\). Set the initial volume after hierarchy initialization; setTargetVolume() may update the target before a later correction. The half-width is half_width times the geometric mean cell spacing on each patch.

The volume tolerance is abs_tol + rel_tol*abs(target). The default rel_tol is 1e-12; omitted abs_tol means 64 machine epsilons times the current fluid capacity. Require finite 0 <= rel_tol < 1 and nonnegative finite abs_tol. max_its (default 64) is a positive trial-evaluation budget, excluding the initial check, at most two bracket endpoints, and final field verification. A safeguarded Newton/bisection solve either accepts a finite field within tolerance or reports TBOX_ERROR before changing the corrected interiors.

Restart restores the initial volume, target, and half-width. Logging state is transient; interval, iteration budget, and tolerances use current input or defaults. correction_interval must be positive. With interval two, the callbacks correct pre-advance steps 0 and 2 (the first and third advances).

Constructor & Destructor Documentation

◆ LevelSetMassLossFixer()

IBAMR::LevelSetUtilities::LevelSetMassLossFixer::LevelSetMassLossFixer ( std::string  object_name,
SAMRAI::tbox::Pointer< AdvDiffHierarchyIntegrator >  adv_diff_integrator,
std::vector< SAMRAI::tbox::Pointer< SAMRAI::pdat::CellVariable< NDIM, double >>>  ls_vars,
SAMRAI::tbox::Pointer< SAMRAI::tbox::Database >  input_db = nullptr,
bool  register_for_restart = true 
)
Parameters
input_dbprovides parameters enable_logging, correction_interval, max_its, rel_tol, abs_tol, and half_width.

◆ ~LevelSetMassLossFixer()

IBAMR::LevelSetUtilities::LevelSetMassLossFixer::~LevelSetMassLossFixer ( )

Member Function Documentation

◆ putToDatabase()

void IBAMR::LevelSetUtilities::LevelSetMassLossFixer::putToDatabase ( SAMRAI::tbox::Pointer< SAMRAI::tbox::Database >  db)
overridevirtual

This method serializes the object by writing data to the specified database.

NOTE: The asymetry (not having a "getFromDatabase") is from the historical method for doing SAMRAI restart. The constructor for a Serializable class should get the database to restore state from by making a getRootDatabase call to the RestartManager.

Implements SAMRAI::tbox::Serializable.

◆ getLevelSetContainer() [1/2]

const LevelSetContainer& IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getLevelSetContainer ( ) const
inline

◆ getLevelSetContainer() [2/2]

LevelSetContainer& IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getLevelSetContainer ( )
inline

◆ setInitialVolume()

void IBAMR::LevelSetUtilities::LevelSetMassLossFixer::setInitialVolume ( double  v0)

◆ getInitialVolume()

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getInitialVolume ( ) const
inline

◆ setTargetVolume()

void IBAMR::LevelSetUtilities::LevelSetMassLossFixer::setTargetVolume ( double  v)
inline

◆ getTargetVolume()

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getTargetVolume ( ) const
inline

◆ setLagrangeMultiplier()

void IBAMR::LevelSetUtilities::LevelSetMassLossFixer::setLagrangeMultiplier ( double  q)
inline

◆ getLagrangeMultiplier()

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getLagrangeMultiplier ( ) const
inline

◆ setTime()

void IBAMR::LevelSetUtilities::LevelSetMassLossFixer::setTime ( double  time)
inline

◆ getTime()

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getTime ( ) const
inline

◆ getCorrectionInterval()

int IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getCorrectionInterval ( ) const
inline

◆ getErrorRelTolerance()

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getErrorRelTolerance ( ) const
inline

◆ getMaxIterations()

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getMaxIterations ( ) const
inline

◆ enableLogging()

bool IBAMR::LevelSetUtilities::LevelSetMassLossFixer::enableLogging ( ) const
inline

◆ correctVolume()

void IBAMR::LevelSetUtilities::LevelSetMassLossFixer::correctVolume ( double  new_time,
bool  three_phase 
)

All ranks participate with identical controls. NEW data must be allocated. three_phase selects liquid volume with the second level set demarcating solid; otherwise correct gas volume using the first level set alone. A skipped event leaves the field and last-correction logging unchanged.

◆ getFromRestart()

void IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getFromRestart ( )
private

◆ getFromInput()

void IBAMR::LevelSetUtilities::LevelSetMassLossFixer::getFromInput ( SAMRAI::tbox::Pointer< SAMRAI::tbox::Database >  input_db)
private

Member Data Documentation

◆ d_object_name

std::string IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_object_name
private

◆ d_ls_container

LevelSetContainer IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_ls_container
private

◆ d_registered_for_restart

bool IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_registered_for_restart
private

◆ d_enable_logging

bool IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_enable_logging = false
private

◆ d_vol_init

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_vol_init = std::numeric_limits<double>::quiet_NaN()
private

◆ d_vol_target

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_vol_target = std::numeric_limits<double>::quiet_NaN()
private

◆ d_q

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_q = std::numeric_limits<double>::quiet_NaN()
private

◆ d_time

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_time = 0.0
private

◆ d_interval

int IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_interval = 1
private

◆ d_max_its

int IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_max_its = 64
private

◆ d_rel_tol

double IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_rel_tol = 1e-12
private

◆ d_abs_tol

std::optional<double> IBAMR::LevelSetUtilities::LevelSetMassLossFixer::d_abs_tol
private

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