![]() |
|
#include <helmholtz_geometric_multigrid.h>
Public Types | |
typedef HelmholtzSmoother *(* | PreSmootherFactoryFctPt) () |
typedef HelmholtzSmoother *(* | PostSmootherFactoryFctPt) () |
Public Member Functions | |
void | set_pre_smoother_factory_function (PreSmootherFactoryFctPt pre_smoother_fn) |
Access function to set the pre-smoother creation function. More... | |
void | set_post_smoother_factory_function (PostSmootherFactoryFctPt post_smoother_fn) |
Access function to set the post-smoother creation function. More... | |
HelmholtzMGPreconditioner (HelmholtzMGProblem *mg_problem_pt) | |
~HelmholtzMGPreconditioner () | |
Delete any dynamically allocated data. More... | |
void | clean_up_memory () |
Clean up anything that needs to be cleaned up. More... | |
double & | tolerance () |
Access function for the variable Tolerance (lvalue) More... | |
double & | alpha_shift () |
Function to change the value of the shift. More... | |
void | disable_doc_time () |
Disable time documentation. More... | |
void | disable_v_cycle_output () |
void | disable_output () |
void | enable_doc_time () |
Enable time documentation. More... | |
void | enable_v_cycle_output () |
Enable the output of the V-cycle timings and other output. More... | |
void | enable_output () |
Enable the output from anything that could have been suppressed. More... | |
void | disable_smoother_and_superlu_doc_time () |
Suppress the output of both smoothers and SuperLU. More... | |
unsigned & | npost_smooth () |
Return the number of post-smoothing iterations (lvalue) More... | |
unsigned & | npre_smooth () |
Return the number of pre-smoothing iterations (lvalue) More... | |
void | pre_smooth (const unsigned &level) |
void | post_smooth (const unsigned &level) |
double | residual_norm (const unsigned &level) |
double | residual_norm (const unsigned &level, Vector< DoubleVector > &residual) |
Calculate the norm of the residual vector, r=b-Ax. More... | |
void | setup_coarsest_level_structures () |
void | direct_solve () |
Call the direct solver (SuperLU) to solve the problem exactly. More... | |
void | interpolation_matrix_set (const unsigned &level, double *value, int *col_index, int *row_st, unsigned &ncol, unsigned &nnz) |
void | interpolation_matrix_set (const unsigned &level, Vector< double > &value, Vector< int > &col_index, Vector< int > &row_st, unsigned &ncol, unsigned &nrow) |
void | set_restriction_matrices_as_interpolation_transposes () |
void | restrict_residual (const unsigned &level) |
void | interpolate_and_correct (const unsigned &level) |
void | level_up_local_coord_of_node (const int &son_type, Vector< double > &s) |
void | setup_interpolation_matrices () |
Setup the interpolation matrix on each level. More... | |
void | setup_interpolation_matrices_unstructured () |
Setup the interpolation matrices. More... | |
void | setup_transfer_matrices () |
Setup the transfer matrices on each level. More... | |
void | full_setup () |
Runs a full setup of the MG solver. More... | |
void | preconditioner_solve (const DoubleVector &r, DoubleVector &z) |
Function applies MG to the vector r for a full solve. More... | |
unsigned | iterations () const |
Number of iterations. More... | |
void | level_up_local_coord_of_node (const int &son_type, Vector< double > &s) |
void | level_up_local_coord_of_node (const int &son_type, Vector< double > &s) |
void | setup (DoubleMatrixBase *matrix_pt) |
void | setup (const Problem *problem_pt, DoubleMatrixBase *matrix_pt) |
virtual void | setup ()=0 |
![]() | |
BlockPreconditioner () | |
Constructor. More... | |
BlockPreconditioner (const BlockPreconditioner &)=delete | |
Broken copy constructor. More... | |
virtual | ~BlockPreconditioner () |
Destructor. More... | |
void | operator= (const BlockPreconditioner &)=delete |
Broken assignment operator. More... | |
CRDoubleMatrix * | matrix_pt () const |
void | turn_on_recursive_debug_flag () |
void | turn_off_recursive_debug_flag () |
void | turn_on_debug_flag () |
Toggles on the debug flag. More... | |
void | turn_off_debug_flag () |
Toggles off the debug flag. More... | |
void | turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse) |
void | turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse, const Vector< Vector< unsigned >> &doftype_coarsen_map_coarse) |
virtual void | block_setup () |
void | block_setup (const Vector< unsigned > &dof_to_block_map) |
void | get_block (const unsigned &i, const unsigned &j, CRDoubleMatrix &output_matrix, const bool &ignore_replacement_block=false) const |
CRDoubleMatrix | get_block (const unsigned &i, const unsigned &j, const bool &ignore_replacement_block=false) const |
void | set_master_matrix_pt (CRDoubleMatrix *in_matrix_pt) |
Set the matrix_pt in the upper-most master preconditioner. More... | |
void | get_block_other_matrix (const unsigned &i, const unsigned &j, CRDoubleMatrix *in_matrix_pt, CRDoubleMatrix &output_matrix) |
void | get_blocks (DenseMatrix< bool > &required_blocks, DenseMatrix< CRDoubleMatrix * > &block_matrix_pt) const |
void | get_dof_level_block (const unsigned &i, const unsigned &j, CRDoubleMatrix &output_block, const bool &ignore_replacement_block=false) const |
void | get_dof_level_block (const unsigned &block_i, const unsigned &block_j, CRDoubleMatrix &output_block, const bool &ignore_replacement_block) const |
CRDoubleMatrix | get_concatenated_block (const VectorMatrix< BlockSelector > &selected_block) |
void | get_concatenated_block_vector (const Vector< unsigned > &block_vec_number, const DoubleVector &v, DoubleVector &b) |
void | return_concatenated_block_vector (const Vector< unsigned > &block_vec_number, const DoubleVector &b, DoubleVector &v) const |
Takes concatenated block ordered vector, b, and copies its. More... | |
void | get_block_vectors (const Vector< unsigned > &block_vec_number, const DoubleVector &v, Vector< DoubleVector > &s) const |
void | get_block_vectors (const DoubleVector &v, Vector< DoubleVector > &s) const |
void | return_block_vectors (const Vector< unsigned > &block_vec_number, const Vector< DoubleVector > &s, DoubleVector &v) const |
void | return_block_vectors (const Vector< DoubleVector > &s, DoubleVector &v) const |
void | get_block_vector (const unsigned &n, const DoubleVector &v, DoubleVector &b) const |
void | return_block_vector (const unsigned &n, const DoubleVector &b, DoubleVector &v) const |
void | get_block_ordered_preconditioner_vector (const DoubleVector &v, DoubleVector &w) |
void | return_block_ordered_preconditioner_vector (const DoubleVector &w, DoubleVector &v) const |
unsigned | nblock_types () const |
Return the number of block types. More... | |
unsigned | ndof_types () const |
Return the total number of DOF types. More... | |
const Mesh * | mesh_pt (const unsigned &i) const |
unsigned | nmesh () const |
int | block_number (const unsigned &i_dof) const |
Return the block number corresponding to a global index i_dof. More... | |
int | index_in_block (const unsigned &i_dof) const |
const LinearAlgebraDistribution * | block_distribution_pt (const unsigned &b) const |
Access function to the block distributions (const version). More... | |
LinearAlgebraDistribution * | block_distribution_pt (const unsigned b) |
Access function to the block distributions (non-const version). More... | |
LinearAlgebraDistribution * | dof_block_distribution_pt (const unsigned &b) |
Access function to the dof-level block distributions. More... | |
const LinearAlgebraDistribution * | master_distribution_pt () const |
unsigned | ndof_types_in_mesh (const unsigned &i) const |
bool | is_subsidiary_block_preconditioner () const |
bool | is_master_block_preconditioner () const |
void | set_block_output_to_files (const std::string &basefilename) |
void | disable_block_output_to_files () |
Turn off output of blocks (by clearing the basefilename string). More... | |
bool | block_output_on () const |
Test if output of blocks is on or not. More... | |
void | output_blocks_to_files (const std::string &basefilename, const unsigned &precision=8) const |
void | post_block_matrix_assembly_partial_clear () |
BlockPreconditioner< CRDoubleMatrix > * | master_block_preconditioner_pt () const |
Access function to the master block preconditioner pt. More... | |
void | clear_block_preconditioner_base () |
void | document () |
Vector< Vector< unsigned > > | doftype_coarsen_map_fine () const |
Vector< unsigned > | get_fine_grain_dof_types_in (const unsigned &i) const |
unsigned | nfine_grain_dof_types_in (const unsigned &i) const |
MapMatrix< unsigned, CRDoubleMatrix * > | replacement_dof_block_pt () const |
Access function to the replaced dof-level blocks. More... | |
void | setup_matrix_vector_product (MatrixVectorProduct *matvec_prod_pt, CRDoubleMatrix *block_pt, const Vector< unsigned > &block_col_indices) |
void | setup_matrix_vector_product (MatrixVectorProduct *matvec_prod_pt, CRDoubleMatrix *block_pt, const unsigned &block_col_index) |
void | internal_get_block_ordered_preconditioner_vector (const DoubleVector &v, DoubleVector &w) const |
void | internal_return_block_ordered_preconditioner_vector (const DoubleVector &w, DoubleVector &v) const |
unsigned | internal_nblock_types () const |
unsigned | internal_ndof_types () const |
void | internal_return_block_vector (const unsigned &n, const DoubleVector &b, DoubleVector &v) const |
void | internal_get_block_vector (const unsigned &n, const DoubleVector &v, DoubleVector &b) const |
void | internal_get_block_vectors (const Vector< unsigned > &block_vec_number, const DoubleVector &v, Vector< DoubleVector > &s) const |
void | internal_get_block_vectors (const DoubleVector &v, Vector< DoubleVector > &s) const |
void | internal_return_block_vectors (const Vector< unsigned > &block_vec_number, const Vector< DoubleVector > &s, DoubleVector &v) const |
void | internal_return_block_vectors (const Vector< DoubleVector > &s, DoubleVector &v) const |
void | internal_get_block (const unsigned &i, const unsigned &j, CRDoubleMatrix &output_block) const |
void | internal_get_block (const unsigned &block_i, const unsigned &block_j, CRDoubleMatrix &output_block) const |
int | internal_block_number (const unsigned &i_dof) const |
int | internal_index_in_block (const unsigned &i_dof) const |
const LinearAlgebraDistribution * | internal_block_distribution_pt (const unsigned &b) const |
Access function to the internal block distributions. More... | |
void | insert_auxiliary_block_distribution (const Vector< unsigned > &block_vec_number, LinearAlgebraDistribution *dist_pt) |
void | block_matrix_test (const unsigned &i, const unsigned &j, const CRDoubleMatrix *block_matrix_pt) const |
int | get_index_of_value (const Vector< myType > &vec, const myType val, const bool sorted=false) const |
![]() | |
Preconditioner () | |
Constructor. More... | |
Preconditioner (const Preconditioner &)=delete | |
Broken copy constructor. More... | |
void | operator= (const Preconditioner &)=delete |
Broken assignment operator. More... | |
virtual | ~Preconditioner () |
Destructor (empty) More... | |
virtual void | preconditioner_solve_transpose (const DoubleVector &r, DoubleVector &z) |
void | setup (DoubleMatrixBase *matrix_pt) |
void | setup (const Problem *problem_pt, DoubleMatrixBase *matrix_pt) |
void | enable_silent_preconditioner_setup () |
Set up the block preconditioner quietly! More... | |
void | disable_silent_preconditioner_setup () |
Be verbose in the block preconditioner setup. More... | |
virtual void | set_matrix_pt (DoubleMatrixBase *matrix_pt) |
Set the matrix pointer. More... | |
virtual const OomphCommunicator * | comm_pt () const |
Get function for comm pointer. More... | |
virtual void | set_comm_pt (const OomphCommunicator *const comm_pt) |
Set the communicator pointer. More... | |
double | setup_time () const |
Returns the time to setup the preconditioner. More... | |
virtual void | turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse) |
virtual void | turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse, const Vector< Vector< unsigned >> &doftype_coarsen_map_coarse) |
![]() | |
DistributableLinearAlgebraObject () | |
Default constructor - create a distribution. More... | |
DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DistributableLinearAlgebraObject &)=delete |
Broken assignment operator. More... | |
virtual | ~DistributableLinearAlgebraObject () |
Destructor. More... | |
LinearAlgebraDistribution * | distribution_pt () const |
access to the LinearAlgebraDistribution More... | |
unsigned | nrow () const |
access function to the number of global rows. More... | |
unsigned | nrow_local () const |
access function for the num of local rows on this processor. More... | |
unsigned | nrow_local (const unsigned &p) const |
access function for the num of local rows on this processor. More... | |
unsigned | first_row () const |
access function for the first row on this processor More... | |
unsigned | first_row (const unsigned &p) const |
access function for the first row on this processor More... | |
bool | distributed () const |
distribution is serial or distributed More... | |
bool | distribution_built () const |
void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
void | build_distribution (const LinearAlgebraDistribution &dist) |
Private Member Functions | |
void | mg_solve (Vector< DoubleVector > &result) |
void | block_preconditioner_self_test () |
void | setup () |
void | setup_mg_hierarchy () |
void | setup_mg_structures () |
Set up the MG structures on each level. More... | |
void | maximum_edge_width (const unsigned &level, double &h) |
void | setup_smoothers () |
Set up the smoothers on all levels. More... | |
void | maximum_edge_width (const unsigned &level, double &h) |
void | maximum_edge_width (const unsigned &level, double &h) |
Private Attributes | |
PreSmootherFactoryFctPt | Pre_smoother_factory_function_pt |
Function to create pre-smoothers. More... | |
PostSmootherFactoryFctPt | Post_smoother_factory_function_pt |
Function to create post-smoothers. More... | |
HelmholtzMGProblem * | Mg_problem_pt |
Pointer to the MG problem (deep copy) More... | |
Vector< HelmholtzMGProblem * > | Mg_hierarchy_pt |
Vector containing pointers to problems in hierarchy. More... | |
Vector< Vector< CRDoubleMatrix * > > | Mg_matrices_storage_pt |
CRDoubleMatrix * | Coarsest_matrix_mg_pt |
DoubleVector | Coarsest_x_mg |
DoubleVector | Coarsest_rhs_mg |
Vector< CRDoubleMatrix * > | Interpolation_matrices_storage_pt |
Vector to store the interpolation matrices. More... | |
Vector< CRDoubleMatrix * > | Restriction_matrices_storage_pt |
Vector to store the restriction matrices. More... | |
Vector< Vector< DoubleVector > > | X_mg_vectors_storage |
Vector< Vector< DoubleVector > > | Rhs_mg_vectors_storage |
Vector< Vector< DoubleVector > > | Residual_mg_vectors_storage |
Vector< HelmholtzSmoother * > | Pre_smoothers_storage_pt |
Vector to store the pre-smoothers. More... | |
Vector< HelmholtzSmoother * > | Post_smoothers_storage_pt |
Vector to store the post-smoothers. More... | |
Vector< double > | Max_edge_width |
double | Wavenumber |
The value of the wavenumber, k. More... | |
double | Tolerance |
The tolerance of the multigrid preconditioner. More... | |
unsigned | Nlevel |
The number of levels in the multigrid heirachy. More... | |
unsigned | Npre_smooth |
Number of pre-smoothing steps. More... | |
unsigned | Npost_smooth |
Number of post-smoothing steps. More... | |
unsigned | Nvcycle |
Maximum number of V-cycles. More... | |
unsigned | V_cycle_counter |
Pointer to counter for V-cycles. More... | |
bool | Doc_time |
Indicates whether or not time documentation should be used. More... | |
bool | Suppress_v_cycle_output |
Indicates whether or not the V-cycle output should be suppressed. More... | |
bool | Suppress_all_output |
If this is set to true then all output from the solver is suppressed. More... | |
bool | Has_been_setup |
Boolean variable to indicate whether or not the solver has been setup. More... | |
bool | Has_been_solved |
std::ostream * | Stream_pt |
Pointer to the output stream – defaults to std::cout. More... | |
double | Alpha_shift |
Temporary version of the shift – to run bash scripts. More... | |
/////////////////////////////////////////////////////// /////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
typedef HelmholtzSmoother*(* oomph::HelmholtzMGPreconditioner< DIM >::PostSmootherFactoryFctPt) () |
typedef for a function that returns a pointer to an object of the class HelmholtzSmoother to be used as the post-smoother
typedef HelmholtzSmoother*(* oomph::HelmholtzMGPreconditioner< DIM >::PreSmootherFactoryFctPt) () |
typedef for a function that returns a pointer to an object of the class HelmholtzSmoother to be used as the pre-smoother
|
inline |
Constructor: Set up default values for number of V-cycles and pre- and post-smoothing steps.
References oomph::HelmholtzMGPreconditioner< DIM >::Mg_hierarchy_pt, and oomph::HelmholtzMGPreconditioner< DIM >::Mg_problem_pt.
|
inline |
Delete any dynamically allocated data.
References oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory().
|
inline |
Function to change the value of the shift.
References oomph::HelmholtzMGPreconditioner< DIM >::Alpha_shift.
Referenced by PMLStructuredCubicHelmholtz< ELEMENT >::set_gmres_multigrid_solver(), and PMLHelmholtzMGProblem< ELEMENT >::set_gmres_multigrid_solver().
|
private |
Function to ensure the block form of the Jacobian matches the form described, i.e. we should have: |--—|---—| | A_r | -A_c | A = |--—|---—|. | A_c | A_r | |--—|---—|
Check the block preconditioner framework returns the correct system matrix
References boost::multiprecision::fabs(), i, j, oomph::DenseMatrix< T >::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, tmp, and Eigen::value.
|
inlinevirtual |
Clean up anything that needs to be cleaned up.
Reimplemented from oomph::Preconditioner.
References oomph::HelmholtzMGPreconditioner< DIM >::Coarsest_matrix_mg_pt, oomph::HelmholtzMGPreconditioner< DIM >::Has_been_setup, i, oomph::HelmholtzMGPreconditioner< DIM >::Interpolation_matrices_storage_pt, j, oomph::HelmholtzMGPreconditioner< DIM >::Mg_matrices_storage_pt, oomph::HelmholtzMGPreconditioner< DIM >::Nlevel, oomph::HelmholtzMGPreconditioner< DIM >::Post_smoothers_storage_pt, oomph::HelmholtzMGPreconditioner< DIM >::Pre_smoothers_storage_pt, and oomph::HelmholtzMGPreconditioner< DIM >::Restriction_matrices_storage_pt.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::~HelmholtzMGPreconditioner().
|
inline |
Call the direct solver (SuperLU) to solve the problem exactly.
References oomph::HelmholtzMGPreconditioner< DIM >::Coarsest_matrix_mg_pt, oomph::HelmholtzMGPreconditioner< DIM >::Coarsest_rhs_mg, oomph::HelmholtzMGPreconditioner< DIM >::Coarsest_x_mg, oomph::DoubleVectorHelpers::concatenate(), oomph::HelmholtzMGPreconditioner< DIM >::Nlevel, oomph::HelmholtzMGPreconditioner< DIM >::Rhs_mg_vectors_storage, oomph::DoubleMatrixBase::solve(), oomph::DoubleVectorHelpers::split(), and oomph::HelmholtzMGPreconditioner< DIM >::X_mg_vectors_storage.
|
inline |
Disable time documentation.
References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time.
Referenced by PMLStructuredCubicHelmholtz< ELEMENT >::set_gmres_multigrid_solver(), and PMLHelmholtzMGProblem< ELEMENT >::set_gmres_multigrid_solver().
|
inline |
Suppress anything that can be suppressed, i.e. any timings. Things like mesh adaptation can not however be silenced using this
References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time, oomph::oomph_info, oomph::oomph_nullstream, oomph::OomphInfo::stream_pt(), oomph::HelmholtzMGPreconditioner< DIM >::Stream_pt, oomph::HelmholtzMGPreconditioner< DIM >::Suppress_all_output, and oomph::HelmholtzMGPreconditioner< DIM >::Suppress_v_cycle_output.
Referenced by PMLStructuredCubicHelmholtz< ELEMENT >::set_gmres_multigrid_solver(), and PMLHelmholtzMGProblem< ELEMENT >::set_gmres_multigrid_solver().
|
inline |
Suppress the output of both smoothers and SuperLU.
References oomph::HelmholtzMGPreconditioner< DIM >::Coarsest_matrix_mg_pt, oomph::LinearSolver::disable_doc_time(), i, oomph::DoubleMatrixBase::linear_solver_pt(), oomph::HelmholtzMGPreconditioner< DIM >::Nlevel, oomph::HelmholtzMGPreconditioner< DIM >::Post_smoothers_storage_pt, and oomph::HelmholtzMGPreconditioner< DIM >::Pre_smoothers_storage_pt.
|
inline |
Disable all output from mg_solve apart from the number of V-cycles used to solve the problem
References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time, and oomph::HelmholtzMGPreconditioner< DIM >::Suppress_v_cycle_output.
Referenced by PMLStructuredCubicHelmholtz< ELEMENT >::set_gmres_multigrid_solver(), and PMLHelmholtzMGProblem< ELEMENT >::set_gmres_multigrid_solver().
|
inline |
Enable time documentation.
References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time.
|
inline |
Enable the output from anything that could have been suppressed.
References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time, oomph::HelmholtzMGPreconditioner< DIM >::Suppress_all_output, and oomph::HelmholtzMGPreconditioner< DIM >::Suppress_v_cycle_output.
|
inline |
Enable the output of the V-cycle timings and other output.
References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time, and oomph::HelmholtzMGPreconditioner< DIM >::Suppress_v_cycle_output.
void oomph::HelmholtzMGPreconditioner< DIM >::full_setup |
Runs a full setup of the MG solver.
Do a full setup (assumes everything will be setup around the HelmholtzMGProblem pointer given in the constructor)
References oomph::TerminateHelper::clean_up_memory(), oomph::MPI_Helpers::communicator_pt(), oomph::FiniteElement::dim(), DIM, i, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::Global_string_for_annotation::string(), and oomph::TimingHelpers::timer().
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::setup().
void oomph::HelmholtzMGPreconditioner< DIM >::interpolate_and_correct | ( | const unsigned & | level | ) |
Interpolate solution at current level onto next finer mesh and correct the solution x at that level
References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inline |
Builds a CRDoubleMatrix that is used to interpolate the residual between levels. The transpose can be used as the full weighting restriction.
References oomph::HelmholtzMGPreconditioner< DIM >::Interpolation_matrices_storage_pt, and Eigen::value.
|
inline |
Builds a CRDoubleMatrix that is used to interpolate the residual between levels. The transpose can be used as the full weighting restriction.
References oomph::LinearAlgebraDistribution::communicator_pt(), oomph::HelmholtzMGPreconditioner< DIM >::Interpolation_matrices_storage_pt, oomph::HelmholtzMGPreconditioner< DIM >::Mg_hierarchy_pt, oomph::OomphCommunicator::nproc(), oomph::DistributableLinearAlgebraObject::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::Global_string_for_annotation::string(), and Eigen::value.
|
inline |
Number of iterations.
References oomph::HelmholtzMGPreconditioner< DIM >::V_cycle_counter.
void oomph::HelmholtzMGPreconditioner< DIM >::level_up_local_coord_of_node | ( | const int & | son_type, |
Vector< double > & | s | ||
) |
Given the son_type of an element and a local node number j in that element with nnode_1d nodes per coordinate direction, return the local coordinate s in its father element. Needed in the setup of the interpolation matrices
void oomph::HelmholtzMGPreconditioner< 3 >::level_up_local_coord_of_node | ( | const int & | son_type, |
Vector< double > & | s | ||
) |
Given the son type of the element and the local coordinate s of a given node in the son element, return the local coordinate s in its father element. 3D case.
References oomph::OcTreeNames::LDB, oomph::OcTreeNames::LDF, oomph::OcTreeNames::LUB, oomph::OcTreeNames::LUF, oomph::Tree::OMEGA, oomph::OcTreeNames::RDB, oomph::OcTreeNames::RDF, oomph::OcTreeNames::RUB, oomph::OcTreeNames::RUF, and s.
void oomph::HelmholtzMGPreconditioner< 2 >::level_up_local_coord_of_node | ( | const int & | son_type, |
Vector< double > & | s | ||
) |
Given the son type of the element and the local coordinate s of a given node in the son element, return the local coordinate s in its father element. 2D case.
References oomph::QuadTreeNames::NE, oomph::QuadTreeNames::NW, oomph::Tree::OMEGA, s, oomph::QuadTreeNames::SE, and oomph::QuadTreeNames::SW.
|
private |
Estimate the value of the parameter h on the level-th problem in the hierarchy.
|
private |
Find the value of the parameters h on the level-th problem in the hierarchy. The value of h is determined by looping over each element in the mesh and calculating the length of each side and take the maximum value.Note, this is a heuristic calculation; if the mesh is nonuniform or adaptive refinement is used then the value of h, is not the same everywhere so we find the maximum edge width instead. If, however, uniform refinement is used on a uniform mesh (using quad elements) then this will return the correct value of h.
This is the explicit template specialisation of the case DIM=2.
References oomph::Mesh::element_pt(), i, j, n, oomph::Mesh::nelement(), oomph::FiniteElement::node_pt(), Eigen::bfloat16_impl::pow(), sqrt(), and oomph::Node::x().
|
private |
Find the value of the parameters h on the level-th problem in the hierarchy. The value of h is determined by looping over each element in the mesh and calculating the length of each side and take the maximum value. Note, this is a heuristic calculation; if the mesh is non-uniform or adaptive refinement is used then the value of h, is not the same everywhere so we find the maximum edge width instead. If, however, uniform refinement is used on a uniform mesh (using quad elements) then this will return the correct value of h.
This is the explicit template specialisation of the case DIM=3. The calculation of h is different here. In 2D we were able to loop over each pair of nodes in an anti-clockwise manner since the only node pairs were {(C0,C1),(C1,C2),(C2,C3),(C3,C0)} where CN denotes the N-th corner in the element. In 3D this method cannot be used since we have 12 edges to consider.
References oomph::Mesh::element_pt(), i, j, oomph::OcTreeNames::LDB, oomph::OcTreeNames::LDF, oomph::OcTreeNames::LUB, oomph::OcTreeNames::LUF, n, oomph::Mesh::nelement(), oomph::FiniteElement::node_pt(), Eigen::bfloat16_impl::pow(), oomph::OcTreeNames::RDB, oomph::OcTreeNames::RDF, oomph::OcTreeNames::RUB, oomph::OcTreeNames::RUF, sqrt(), oomph::OcTree::vertex_to_node_number(), and oomph::Node::x().
|
private |
Do the actual solve – this is called through the pure virtual solve function in the LinearSolver base class. The function is stored as protected to allow the HelmholtzMGPreconditioner derived class to use the solver
Linear solver. This is where the general V-cycle algorithm is implemented
References i, oomph::oomph_info, and oomph::TimingHelpers::timer().
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::preconditioner_solve().
|
inline |
Return the number of post-smoothing iterations (lvalue)
References oomph::HelmholtzMGPreconditioner< DIM >::Npost_smooth.
|
inline |
Return the number of pre-smoothing iterations (lvalue)
References oomph::HelmholtzMGPreconditioner< DIM >::Npre_smooth.
|
inline |
Post-smoother: Perform max_iter smoothing steps on the linear system Ax=b with current RHS vector, b, starting with current solution vector, x. Uses the default smoother (set in the HelmholtzMGProblem constructor) which can be overloaded for specific problem.
References oomph::HelmholtzMGPreconditioner< DIM >::Post_smoothers_storage_pt, oomph::HelmholtzMGPreconditioner< DIM >::residual_norm(), oomph::HelmholtzMGPreconditioner< DIM >::Rhs_mg_vectors_storage, and oomph::HelmholtzMGPreconditioner< DIM >::X_mg_vectors_storage.
|
inline |
Pre-smoother: Perform 'max_iter' smoothing steps on the linear system Ax=b with current RHS vector, b, starting with current solution vector, x. Return the residual vector r=b-Ax. Uses the default smoother (set in the HelmholtzMGProblem constructor) which can be overloaded for a specific problem.
References oomph::HelmholtzMGPreconditioner< DIM >::Pre_smoothers_storage_pt, oomph::HelmholtzMGPreconditioner< DIM >::residual_norm(), oomph::HelmholtzMGPreconditioner< DIM >::Rhs_mg_vectors_storage, and oomph::HelmholtzMGPreconditioner< DIM >::X_mg_vectors_storage.
|
inlinevirtual |
Function applies MG to the vector r for a full solve.
Implements oomph::Preconditioner.
References oomph::BlockPreconditioner< CRDoubleMatrix >::get_block_vectors(), oomph::HelmholtzMGPreconditioner< DIM >::mg_solve(), oomph::oomph_info, oomph::BlockPreconditioner< CRDoubleMatrix >::return_block_vectors(), oomph::HelmholtzMGPreconditioner< DIM >::Rhs_mg_vectors_storage, oomph::OomphInfo::stream_pt(), oomph::HelmholtzMGPreconditioner< DIM >::Stream_pt, oomph::HelmholtzMGPreconditioner< DIM >::Suppress_all_output, oomph::HelmholtzMGPreconditioner< DIM >::Suppress_v_cycle_output, and oomph::HelmholtzMGPreconditioner< DIM >::X_mg_vectors_storage.
|
inline |
Return norm of residual r=b-Ax and the residual vector itself on the level-th level
References j, and oomph::HelmholtzMGPreconditioner< DIM >::Residual_mg_vectors_storage.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::post_smooth(), and oomph::HelmholtzMGPreconditioner< DIM >::pre_smooth().
double oomph::HelmholtzMGPreconditioner< DIM >::residual_norm | ( | const unsigned & | level, |
Vector< DoubleVector > & | residual | ||
) |
Calculate the norm of the residual vector, r=b-Ax.
Calculating the residual r=b-Ax in the complex case requires more care than the real case. To calculate the residual vector we split A, x and b into their complex components: r = b - A*x, = (b_r + i*b_c) - (A_r + i*A_c)*(x_r + i*x_c), = [b_r - A_r*x_r + A_c*x_c] + i*[b_c - A_r*x_c - A_c*x_r], ==> real(r) = b_r - A_r*x_r + A_c*x_c, & imag(r) = b_c - A_r*x_c - A_c*x_r.
References i, oomph::Vector< _Tp >::initialise(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and sqrt().
void oomph::HelmholtzMGPreconditioner< DIM >::restrict_residual | ( | const unsigned & | level | ) |
Restrict residual (computed on level-th MG level) to the next coarser mesh and stick it into the coarse mesh RHS vector.
Restrict residual (computed on current MG level) to next coarser mesh and stick it into the coarse mesh RHS vector using the restriction matrix (if restrict_flag=1) or the transpose of the interpolation matrix (if restrict_flag=2)
References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inline |
Access function to set the post-smoother creation function.
References oomph::HelmholtzMGPreconditioner< DIM >::Post_smoother_factory_function_pt.
Referenced by PMLStructuredCubicHelmholtz< ELEMENT >::set_gmres_multigrid_solver(), and PMLHelmholtzMGProblem< ELEMENT >::set_gmres_multigrid_solver().
|
inline |
Access function to set the pre-smoother creation function.
References oomph::HelmholtzMGPreconditioner< DIM >::Pre_smoother_factory_function_pt.
Referenced by PMLStructuredCubicHelmholtz< ELEMENT >::set_gmres_multigrid_solver(), and PMLHelmholtzMGProblem< ELEMENT >::set_gmres_multigrid_solver().
|
inline |
Builds a CRDoubleMatrix on each level that is used to restrict the residual between levels. The transpose can be used as the interpolation matrix
References i, oomph::HelmholtzMGPreconditioner< DIM >::Interpolation_matrices_storage_pt, oomph::HelmholtzMGPreconditioner< DIM >::Nlevel, and oomph::HelmholtzMGPreconditioner< DIM >::Restriction_matrices_storage_pt.
|
inlineprivatevirtual |
Function to set up the hierachy of levels. Creates a vector of pointers to each MG level
Implements oomph::Preconditioner.
References oomph::HelmholtzMGPreconditioner< DIM >::full_setup(), oomph::oomph_info, oomph::OomphInfo::stream_pt(), oomph::HelmholtzMGPreconditioner< DIM >::Stream_pt, and oomph::HelmholtzMGPreconditioner< DIM >::Suppress_all_output.
|
virtual |
Use the version in the Preconditioner base class for the alternative setup function that takes a matrix pointer as an argument.
Implements oomph::Preconditioner.
|
inlinevirtual |
Use the version in the Preconditioner base class for the alternative setup function that takes a matrix pointer as an argument.
Implements oomph::Preconditioner.
|
inlinevirtual |
Use the version in the Preconditioner base class for the alternative setup function that takes a matrix pointer as an argument.
Implements oomph::Preconditioner.
void oomph::HelmholtzMGPreconditioner< DIM >::setup_coarsest_level_structures |
Function to create the fully expanded system matrix on the coarsest level
Function to set up structures on the coarsest level of the MG hierarchy. This includes setting up the CRDoubleMatrix version of the coarsest level system matrix. This would otherwise be stored as a vector of pointers to the constituent CRDoubleMatrix objects which has the form: |--—| | A_r | Matrix_mg_pt = |--—| | A_i | |--—| and we want to construct: |--—|---—| | A_r | -A_c | Coarse_matrix_mg_pt = |--—|---—| | A_c | A_r | |--—|---—| Once this is done we have to set up the distributions of the vectors associated with Coarse_matrix_mg_pt
References oomph::CRDoubleMatrix::column_index(), i, j, oomph::CRDoubleMatrix::ncol(), oomph::CRDoubleMatrix::nnz(), oomph::CRDoubleMatrix::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::CRDoubleMatrix::row_start(), oomph::TimingHelpers::timer(), Eigen::value, and oomph::CRDoubleMatrix::value().
void oomph::HelmholtzMGPreconditioner< DIM >::setup_interpolation_matrices |
Setup the interpolation matrix on each level.
Set up the interpolation matrices.
References DIM, oomph::Data::eqn_number(), oomph::Mesh::finite_element_pt(), i, j, k, oomph::MeshAsGeomObject::locate_zeta(), oomph::HangInfo::master_node_pt(), oomph::HangInfo::master_weight(), oomph::Mesh::nelement(), oomph::HangInfo::nmaster(), oomph::Tree::OMEGA, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, s, and Eigen::value.
void oomph::HelmholtzMGPreconditioner< DIM >::setup_interpolation_matrices_unstructured |
Setup the interpolation matrices.
Setup the interpolation matrix on each level (used for unstructured meshes)
References DIM, oomph::Data::eqn_number(), oomph::Node::hanging_pt(), oomph::Node::is_hanging(), oomph::MeshAsGeomObject::locate_zeta(), oomph::HangInfo::master_node_pt(), oomph::HangInfo::master_weight(), oomph::HangInfo::nmaster(), oomph::FiniteElement::nnode(), oomph::Mesh::nnode(), oomph::FiniteElement::node_pt(), oomph::Mesh::node_pt(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::Node::position(), s, oomph::FiniteElement::shape(), and Eigen::value.
|
private |
Function to set up the hierachy of levels. Creates a vector of pointers to each MG level
Set up the MG hierarchy. Creates a vector of pointers to each MG level and resizes internal storage for multigrid data
References oomph::Problem::actions_after_adapt(), oomph::Problem::actions_before_adapt(), oomph::Problem::assign_eqn_numbers(), oomph::HelmholtzMGProblem::make_new_problem(), oomph::HelmholtzMGProblem::mg_bulk_mesh_pt(), oomph::oomph_info, oomph::TreeBasedRefineableMeshBase::refine_base_mesh_as_in_reference_mesh_minus_one(), and oomph::TimingHelpers::timer().
|
private |
Set up the MG structures on each level.
Function to set up the hierachy of levels. Creates a vector of pointers to each MG level
References oomph::PMLHelmholtzEquations< DIM >::alpha_pt(), GlobalParameters::Alpha_shift, oomph::CRDoubleMatrix::build(), oomph::LinearAlgebraDistribution::communicator_pt(), i, j, oomph::PMLHelmholtzEquations< DIM >::k_squared(), oomph::OomphCommunicator::nproc(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, sqrt(), oomph::Global_string_for_annotation::string(), oomph::TimingHelpers::timer(), tmp, and GlobalParameters::Wavenumber.
|
private |
Set up the smoothers on all levels.
Function to set up all of the smoothers once the system matrices have been set up
References oomph::ComplexDampedJacobi< MATRIX >::calculate_omega(), oomph::LinearAlgebraDistribution::communicator_pt(), i, oomph::OomphCommunicator::nproc(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::Global_string_for_annotation::string(), oomph::TimingHelpers::timer(), oomph::IterativeLinearSolver::tolerance(), and GlobalParameters::Wavenumber.
void oomph::HelmholtzMGPreconditioner< DIM >::setup_transfer_matrices |
Setup the transfer matrices on each level.
Set up the transfer matrices. Both the pure injection and full weighting method have been implemented here but it is highly recommended that full weighting is used in general. In both methods the transpose of the transfer matrix is used to transfer a vector back
References oomph::oomph_info, and oomph::TimingHelpers::timer().
|
inline |
Access function for the variable Tolerance (lvalue)
References oomph::HelmholtzMGPreconditioner< DIM >::Tolerance.
|
private |
Temporary version of the shift – to run bash scripts.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::alpha_shift().
|
private |
Stores the system matrix on the coarest level in the fully expanded format: |--—|---—| | A_r | -A_c | A = |--—|---—|. | A_c | A_r | |--—|---—| Note: this is NOT the same as A = A_r + iA_c
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory(), oomph::HelmholtzMGPreconditioner< DIM >::direct_solve(), and oomph::HelmholtzMGPreconditioner< DIM >::disable_smoother_and_superlu_doc_time().
|
private |
Assuming we're solving the system Ax=b, this vector will contain the expanded solution vector on the coarsest level of the heirarchy. This will have the form: |--—| | b_r | b = |--—|. | b_c | |--—|
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::direct_solve().
|
private |
Assuming we're solving the system Ax=b, this vector will contain the expanded solution vector on the coarsest level of the heirarchy. This will have the form: |--—| | x_r | x = |--—|. | x_c | |--—|
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::direct_solve().
|
private |
Indicates whether or not time documentation should be used.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::disable_doc_time(), oomph::HelmholtzMGPreconditioner< DIM >::disable_output(), oomph::HelmholtzMGPreconditioner< DIM >::disable_v_cycle_output(), oomph::HelmholtzMGPreconditioner< DIM >::enable_doc_time(), oomph::HelmholtzMGPreconditioner< DIM >::enable_output(), and oomph::HelmholtzMGPreconditioner< DIM >::enable_v_cycle_output().
|
private |
Boolean variable to indicate whether or not the solver has been setup.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory().
|
private |
Boolean variable to indicate whether or not the problem was successfully solved
|
private |
Vector to store the interpolation matrices.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory(), oomph::HelmholtzMGPreconditioner< DIM >::interpolation_matrix_set(), and oomph::HelmholtzMGPreconditioner< DIM >::set_restriction_matrices_as_interpolation_transposes().
|
private |
Vector to storage the maximum edge width of each mesh. We only need the maximum edge width on levels where we use a smoother to determine the value of kh
|
private |
Vector containing pointers to problems in hierarchy.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::HelmholtzMGPreconditioner(), and oomph::HelmholtzMGPreconditioner< DIM >::interpolation_matrix_set().
|
private |
Vector of vectors to store the system matrices. The i-th entry in this vector contains a vector of length two. The first entry of which contains the real part of the system matrix which we refer to as A_r and the second entry contains the imaginary part of the system matrix which we refer to as A_c. That is to say, the true system matrix is given by A = A_r + iA_c
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory().
|
private |
Pointer to the MG problem (deep copy)
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::HelmholtzMGPreconditioner().
|
private |
The number of levels in the multigrid heirachy.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory(), oomph::HelmholtzMGPreconditioner< DIM >::direct_solve(), oomph::HelmholtzMGPreconditioner< DIM >::disable_smoother_and_superlu_doc_time(), and oomph::HelmholtzMGPreconditioner< DIM >::set_restriction_matrices_as_interpolation_transposes().
|
private |
Number of post-smoothing steps.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::npost_smooth().
|
private |
Number of pre-smoothing steps.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::npre_smooth().
|
private |
Maximum number of V-cycles.
|
private |
Function to create post-smoothers.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::set_post_smoother_factory_function().
|
private |
Vector to store the post-smoothers.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory(), oomph::HelmholtzMGPreconditioner< DIM >::disable_smoother_and_superlu_doc_time(), and oomph::HelmholtzMGPreconditioner< DIM >::post_smooth().
|
private |
Function to create pre-smoothers.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::set_pre_smoother_factory_function().
|
private |
Vector to store the pre-smoothers.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory(), oomph::HelmholtzMGPreconditioner< DIM >::disable_smoother_and_superlu_doc_time(), and oomph::HelmholtzMGPreconditioner< DIM >::pre_smooth().
|
private |
Vector to vectors to store the residual vectors. This uses the same format as the X_mg_vectors_storage vector
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::residual_norm().
|
private |
Vector to store the restriction matrices.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory(), and oomph::HelmholtzMGPreconditioner< DIM >::set_restriction_matrices_as_interpolation_transposes().
|
private |
Vector of vectors to store the RHS vectors. This uses the same format as the X_mg_vectors_storage vector
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::direct_solve(), oomph::HelmholtzMGPreconditioner< DIM >::post_smooth(), oomph::HelmholtzMGPreconditioner< DIM >::pre_smooth(), and oomph::HelmholtzMGPreconditioner< DIM >::preconditioner_solve().
|
private |
Pointer to the output stream – defaults to std::cout.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::disable_output(), oomph::HelmholtzMGPreconditioner< DIM >::preconditioner_solve(), and oomph::HelmholtzMGPreconditioner< DIM >::setup().
|
private |
If this is set to true then all output from the solver is suppressed.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::disable_output(), oomph::HelmholtzMGPreconditioner< DIM >::enable_output(), oomph::HelmholtzMGPreconditioner< DIM >::preconditioner_solve(), and oomph::HelmholtzMGPreconditioner< DIM >::setup().
|
private |
Indicates whether or not the V-cycle output should be suppressed.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::disable_output(), oomph::HelmholtzMGPreconditioner< DIM >::disable_v_cycle_output(), oomph::HelmholtzMGPreconditioner< DIM >::enable_output(), oomph::HelmholtzMGPreconditioner< DIM >::enable_v_cycle_output(), and oomph::HelmholtzMGPreconditioner< DIM >::preconditioner_solve().
|
private |
The tolerance of the multigrid preconditioner.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::tolerance().
|
private |
Pointer to counter for V-cycles.
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::iterations().
|
private |
The value of the wavenumber, k.
|
private |
Vector of vectors to store the solution vectors (X_mg) in two parts; the real and imaginary. To access the real part of the solution vector on the i-th level we need to access X_mg_vectors_storage[i][0] while accessing X_mg_vectors_storage[i][1] will give us the corresponding imaginary part
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::direct_solve(), oomph::HelmholtzMGPreconditioner< DIM >::post_smooth(), oomph::HelmholtzMGPreconditioner< DIM >::pre_smooth(), and oomph::HelmholtzMGPreconditioner< DIM >::preconditioner_solve().