Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::composite::SetupReuse Struct Reference

The state of setup reuse (HypreMLABecLap::setReuseSolverSetup, HypreMLNodeLap::setReuseSolverSetup). More...

#include <AMReX_CompositeSystemUtil.H>

Public Member Functions

void setMaxChange (Real f)
 The change threshold (see rescale).
void setupDone ()
void setSetupMatrix (Real norm2)
template<class P>
bool rescale (Gpu::DeviceVector< Real > &vals, P const &scaled, bool new_setup, MPI_Comm comm, int verbose, std::string const &prefix)
 Scale the values of vals (on the device) for which scaled(i) is true to the setup matrix (the others, a pinned row's identity entry say, do not depend on the coefficients: they stay and do not count), or make this matrix the setup matrix (new_setup: the setup is done for it next). Collective over comm. Returns true when the scaled matrix has changed by more than max_change since the setup; this matrix is then the setup matrix and the caller redoes the setup.

Public Attributes

Real setup_norm2 = 0.0
 squared 2-norm of the setup matrix's values
Real scale = 1.0
 the current matrix (and rhs) is scaled by this
Real max_change = 0.0
Gpu::DeviceVector< Real > setup_vals
 The setup matrix's values (max_change > 0); valid on all ranks or none.
bool have_vals = false
bool capture = false
bool current = false

Detailed Description

The state of setup reuse (HypreMLABecLap::setReuseSolverSetup, HypreMLNodeLap::setReuseSolverSetup).

A kept solver setup (hypre) or AlgMG hierarchy is for the matrix it was done with. A later matrix is scaled to that matrix's 2-norm (of the triplet values that depend on the coefficients, which fix the ratio) and the right-hand side with it, so that a uniform change of the coefficients, by a time step say, leaves the kept setup exact; otherwise its smoother weights and coarse corrections grow with the change until the preconditioner diverges. With a threshold (reuse_setup_max_change), a copy of the setup matrix's values is kept and the change of the scaled matrix since the setup is measured against it.

Member Function Documentation

◆ rescale()

template<class P>
bool amrex::composite::SetupReuse::rescale ( Gpu::DeviceVector< Real > & vals,
P const & scaled,
bool new_setup,
MPI_Comm comm,
int verbose,
std::string const & prefix )
inline

Scale the values of vals (on the device) for which scaled(i) is true to the setup matrix (the others, a pinned row's identity entry say, do not depend on the coefficients: they stay and do not count), or make this matrix the setup matrix (new_setup: the setup is done for it next). Collective over comm. Returns true when the scaled matrix has changed by more than max_change since the setup; this matrix is then the setup matrix and the caller redoes the setup.

◆ setMaxChange()

void amrex::composite::SetupReuse::setMaxChange ( Real f)
inline

The change threshold (see rescale).

◆ setSetupMatrix()

void amrex::composite::SetupReuse::setSetupMatrix ( Real norm2)
inline

The current matrix, assembled without its triplets held (which the callers do only without a threshold), is the setup matrix; norm2 is the global squared 2-norm of its values. No values are kept.

◆ setupDone()

void amrex::composite::SetupReuse::setupDone ( )
inline

A solve did the setup for the current matrix. Done for a matrix scaled to an earlier setup's (after resetSolverSetup(), reuse_setup_max_iter, or the retry of a solve that did not converge), the norm on record still describes it but the kept values do not: the next update becomes the reference of the change check.

Member Data Documentation

◆ capture

bool amrex::composite::SetupReuse::capture = false

The next matrix becomes the reference: the threshold was set after the kept setup, or a solve did the setup for a scaled matrix

◆ current

bool amrex::composite::SetupReuse::current = false

The setup matrix on record is the current matrix, unscaled (the last update made it the setup matrix); otherwise the current matrix is scaled to an earlier one

◆ have_vals

bool amrex::composite::SetupReuse::have_vals = false

◆ max_change

Real amrex::composite::SetupReuse::max_change = 0.0

redo the setup beyond this change (0: never)

◆ scale

Real amrex::composite::SetupReuse::scale = 1.0

the current matrix (and rhs) is scaled by this

◆ setup_norm2

Real amrex::composite::SetupReuse::setup_norm2 = 0.0

squared 2-norm of the setup matrix's values

◆ setup_vals

Gpu::DeviceVector<Real> amrex::composite::SetupReuse::setup_vals

The setup matrix's values (max_change > 0); valid on all ranks or none.


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