Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
oomph::HelmholtzMGPreconditioner< DIM > Class Template Reference

#include <helmholtz_geometric_multigrid.h>

+ Inheritance diagram for oomph::HelmholtzMGPreconditioner< DIM >:

Public Types

typedef HelmholtzSmoother *(* PreSmootherFactoryFctPt )()
 typedef for a function that returns a pointer to an object of the class HelmholtzSmoother to be used as the pre-smoother More...
 
typedef HelmholtzSmoother *(* PostSmootherFactoryFctPt )()
 typedef for a function that returns a pointer to an object of the class HelmholtzSmoother to be used as the post-smoother More...
 

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)
 Constructor: Set up default values for number of V-cycles and pre- and post-smoothing steps. More...
 
 ~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 ()
 Disable all output from mg_solve apart from the number of V-cycles used to solve the problem. More...
 
void disable_output ()
 Suppress anything that can be suppressed, i.e. any timings. Things like mesh adaptation can not however be silenced using this. More...
 
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)
 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. More...
 
void post_smooth (const unsigned &level)
 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. More...
 
double residual_norm (const unsigned &level)
 Return norm of residual r=b-Ax and the residual vector itself on the level-th level. More...
 
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 ()
 Function to create the fully expanded system matrix on the coarsest level. More...
 
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)
 Builds a CRDoubleMatrix that is used to interpolate the residual between levels. The transpose can be used as the full weighting restriction. More...
 
void interpolation_matrix_set (const unsigned &level, Vector< double > &value, Vector< int > &col_index, Vector< int > &row_st, unsigned &ncol, unsigned &nrow)
 Builds a CRDoubleMatrix that is used to interpolate the residual between levels. The transpose can be used as the full weighting restriction. More...
 
void set_restriction_matrices_as_interpolation_transposes ()
 Builds a CRDoubleMatrix on each level that is used to restrict the residual between levels. The transpose can be used as the interpolation matrix. More...
 
void 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. More...
 
void interpolate_and_correct (const unsigned &level)
 Interpolate solution at current level onto next finer mesh and correct the solution x at that level. More...
 
void 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. More...
 
void setup_interpolation_matrices ()
 Setup the interpolation matrix on each level. More...
 
void setup_interpolation_matrices_unstructured ()
 Setup the interpolation matrix on each level (used for unstructured meshes) More...
 
void setup_transfer_matrices ()
 Setup the transfer matrices on each level. More...
 
void full_setup ()
 Do a full setup (assumes everything will be setup around the HelmholtzMGProblem pointer given in the constructor) 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...
 
template<>
void level_up_local_coord_of_node (const int &son_type, Vector< double > &s)
 
template<>
void level_up_local_coord_of_node (const int &son_type, Vector< double > &s)
 
- Public Member Functions inherited from oomph::BlockPreconditioner< CRDoubleMatrix >
 BlockPreconditioner ()
 Constructor. More...
 
 BlockPreconditioner (const BlockPreconditioner &)
 Broken copy constructor. More...
 
virtual ~BlockPreconditioner ()
 Destructor. More...
 
void operator= (const BlockPreconditioner &)
 Broken assignment operator. More...
 
CRDoubleMatrixmatrix_pt () const
 Access function to matrix_pt. If this is the master then cast the matrix pointer to MATRIX*, error check and return. Otherwise ask the master for its matrix pointer. More...
 
void turn_on_recursive_debug_flag ()
 Toggles on the recursive debug flag. The change goes up the block preconditioning hierarchy. More...
 
void turn_off_recursive_debug_flag ()
 Toggles off the recursive debug flag. The change goes up the block preconditioning hierarchy. More...
 
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)
 Function to turn this preconditioner into a subsidiary preconditioner that operates within a bigger "master block preconditioner (e.g. a Navier-Stokes 2x2 block preconditioner dealing with the fluid sub-blocks within a 3x3 FSI preconditioner. Once this is done the master block preconditioner deals with the block setup etc. The vector doftype_in_master_preconditioner_coarse must specify the dof number in the master preconditioner that corresponds to a dof number in this preconditioner. 1. The length of the vector is used to determine the number of blocks in this preconditioner therefore it must be correctly sized. 2. block_setup(...) should be called in the master preconditioner before this method is called. 3. block_setup(...) should be called in the corresponding subsidiary preconditioner after this method is called. More...
 
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)
 Function to turn this preconditioner into a subsidiary preconditioner that operates within a bigger "master block preconditioner (e.g. a Navier-Stokes 2x2 block preconditioner dealing with the fluid sub-blocks within a 3x3 FSI preconditioner. Once this is done the master block preconditioner deals with the block setup etc. The vector doftype_in_master_preconditioner_coarse must specify the dof number in the master preconditioner that corresponds to a dof number in this preconditioner. 1. The length of the vector is used to determine the number of blocks in this preconditioner therefore it must be correctly sized. 2. block_setup(...) should be called in the master preconditioner before this method is called. 3. block_setup(...) should be called in the corresponding subsidiary preconditioner after this method is called. More...
 
virtual void block_setup ()
 Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of freedom with their "blocks" and their indices (row/column numbers) in those blocks. The distributions of the preconditioner and the internal blocks are automatically specified (and assumed to be uniform) at this stage. This method should be used if the identity dof-to-block mapping is okay, i.e. dof number 0 corresponds to block number 0 dof number 1 corresponds to block number 1 dof number 2 corresponds to block number 2 etc... More...
 
void block_setup (const Vector< unsigned > &dof_to_block_map)
 Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of freedom with their "blocks" and their indices (row/column numbers) in those blocks. The distributions of the preconditioner and the blocks are automatically specified (and assumed to be uniform) at this stage. This method should be used if anything other than the identity dof-to-block mapping is required. The argument vector dof_to_block_map should be of length ndof. The indices represents the dof types whilst the value represents the block types. In general we want: More...
 
void get_block (const unsigned &i, const unsigned &j, CRDoubleMatrix &output_matrix, const bool &ignore_replacement_block=false) const
 Put block (i,j) into output_matrix. This block accounts for any coarsening of dof types and any replaced dof-level blocks above this preconditioner. More...
 
CRDoubleMatrix get_block (const unsigned &i, const unsigned &j, const bool &ignore_replacement_block=false) const
 Return block (i,j). If the optional argument ignore_replacement_block is true, then any blocks in Replacement_dof_block_pt will be ignored throughout the preconditioning hierarchy. More...
 
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)
 Get a block from a different matrix using the blocking scheme that has already been set up. More...
 
void get_blocks (DenseMatrix< bool > &required_blocks, DenseMatrix< CRDoubleMatrix * > &block_matrix_pt) const
 Get all the block matrices required by the block preconditioner. Takes a pointer to a matrix of bools that indicate if a specified sub-block is required for the preconditioning operation. Computes the required block matrices, and stores pointers to them in the matrix block_matrix_pt. If an entry in block_matrix_pt is equal to NULL on return, that sub-block has not been requested and is therefore not available. More...
 
void get_dof_level_block (const unsigned &i, const unsigned &j, CRDoubleMatrix &output_block, const bool &ignore_replacement_block=false) const
 Gets dof-level block (i,j). If Replacement_dof_block_pt(i,j) is not null, then the replacement block is returned via a deep copy. More...
 
CRDoubleMatrix get_concatenated_block (const VectorMatrix< BlockSelector > &selected_block)
 Returns a concatenation of the block matrices specified by the argument selected_block. The VectorMatrix selected_block must be correctly sized as it is used to determine the number of sub block matrices to concatenate. More...
 
void get_concatenated_block_vector (const Vector< unsigned > &block_vec_number, const DoubleVector &v, DoubleVector &b)
 Takes the naturally ordered vector and extracts the blocks indicated by the block number (the values) in the Vector block_vec_number all at once, then concatenates them without communication. Here, the values in block_vec_number is the block number in the current preconditioner. This is a non-const function because distributions may be created and stored in Auxiliary_block_distribution_pt for future use. More...
 
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 entries to the appropriate entries in the naturally ordered vector, v. Here the values in block_vec_number indicates which blocks the vector b is a concatenation of. The block number are those in the current preconditioner. If the preconditioner is a subsidiary block preconditioner the other entries in v that are not associated with it are left alone. More...
 
void get_block_vectors (const Vector< unsigned > &block_vec_number, const DoubleVector &v, Vector< DoubleVector > &s) const
 Takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is the sum of the lengths of the individual block vectors defined in block_vec_number. More...
 
void get_block_vectors (const DoubleVector &v, Vector< DoubleVector > &s) const
 Takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is Nrow. This is simply a wrapper around the other get_block_vectors(...) function where the block_vec_number Vector is the identity, i.e. block_vec_number is [0, 1, ..., nblock_types - 1]. More...
 
void return_block_vectors (const Vector< unsigned > &block_vec_number, const Vector< DoubleVector > &s, DoubleVector &v) const
 Takes the vector of block vectors, s, and copies its entries into the naturally ordered vector, v. If this is a subsidiary block preconditioner only those entries in v that are associated with its blocks are affected. The block_vec_number indicates which block the vectors in s came from. The block number corresponds to the block numbers in this preconditioner. More...
 
void return_block_vectors (const Vector< DoubleVector > &s, DoubleVector &v) const
 Takes the vector of block vectors, s, and copies its entries into the naturally ordered vector, v. If this is a subsidiary block preconditioner only those entries in v that are associated with its blocks are affected. The block_vec_number indicates which block the vectors in s came from. The block number corresponds to the block numbers in this preconditioner. This is simply a wrapper around the other return_block_vectors(...) function where the block_vec_number Vector is the identity, i.e. block_vec_number is [0, 1, ..., nblock_types - 1]. More...
 
void get_block_vector (const unsigned &n, const DoubleVector &v, DoubleVector &b) const
 Takes the naturally ordered vector, v and returns the n-th block vector, b. Here n is the block number in the current preconditioner. More...
 
void return_block_vector (const unsigned &n, const DoubleVector &b, DoubleVector &v) const
 Takes the n-th block ordered vector, b, and copies its entries to the appropriate entries in the naturally ordered vector, v. Here n is the block number in the current block preconditioner. If the preconditioner is a subsidiary block preconditioner the other entries in v that are not associated with it are left alone. More...
 
void get_block_ordered_preconditioner_vector (const DoubleVector &v, DoubleVector &w)
 Given the naturally ordered vector, v, return the vector rearranged in block order in w. This function calls get_concatenated_block_vector(...) with the identity block mapping. More...
 
void return_block_ordered_preconditioner_vector (const DoubleVector &w, DoubleVector &v) const
 Takes the block ordered vector, w, and reorders it in natural order. Reordered vector is returned in v. Note: If the preconditioner is a subsidiary preconditioner then only the components of the vector associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas that of the vector w is of length this->nrow(). More...
 
unsigned nblock_types () const
 Return the number of block types. More...
 
unsigned ndof_types () const
 Return the total number of DOF types. More...
 
const Meshmesh_pt (const unsigned &i) const
 Access to i-th mesh (of the various meshes that contain block preconditionable elements of the same number of dof type). More...
 
unsigned nmesh () const
 Return the number of meshes in Mesh_pt. More...
 
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
 Given a global dof number, returns the index in the block it belongs to. This is the overall index, not local block (in parallel). More...
 
const LinearAlgebraDistributionblock_distribution_pt (const unsigned &b) const
 Access function to the block distributions (const version). More...
 
LinearAlgebraDistributionblock_distribution_pt (const unsigned b)
 Access function to the block distributions (non-const version). More...
 
LinearAlgebraDistributiondof_block_distribution_pt (const unsigned &b)
 Access function to the dof-level block distributions. More...
 
const LinearAlgebraDistributionmaster_distribution_pt () const
 Access function to the distribution of the master preconditioner. If this preconditioner does not have a master preconditioner then the distribution of this preconditioner is returned. More...
 
unsigned ndof_types_in_mesh (const unsigned &i) const
 Return the number of DOF types in mesh i. WARNING: This should only be used by the upper-most master block preconditioner. An error is thrown is this function is called from a subsidiary preconditioner. They (and since every block preconditioner can in principle be used as s subsidiary preconditioner: all block preconditioners) should store local copies of "their meshes" (if they're needed for anything) More...
 
bool is_subsidiary_block_preconditioner () const
 Return true if this preconditioner is a subsidiary preconditioner. More...
 
bool is_master_block_preconditioner () const
 Return true if this preconditioner is the master block preconditioner. More...
 
void set_block_output_to_files (const std::string &basefilename)
 Set the base part of the filename to output blocks to. If it is set then all blocks will be output at the end of block_setup. If it is left empty nothing will be output. More...
 
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 ()
 A helper method to reduce the memory requirements of block preconditioners. Once the methods get_block(...), get_blocks(...) and build_preconditioner_matrix(...) have been called in this and all subsidiary block preconditioners this method can be called to clean up. More...
 
BlockPreconditioner
< CRDoubleMatrix > * 
master_block_preconditioner_pt () const
 Access function to the master block preconditioner pt. More...
 
void clear_block_preconditioner_base ()
 Clears all BlockPreconditioner data. Called by the destructor and the block_setup(...) methods. More...
 
void document ()
 debugging method to document the setup. Should only be called after block_setup(...). More...
 
Vector< Vector< unsigned > > doftype_coarsen_map_fine () const
 Access function for the Doftype_coarsen_map_fine variable. More...
 
Vector< unsigned > get_fine_grain_dof_types_in (const unsigned &i) const
 Returns the most fine grain dof types in a (possibly coarsened) dof type. More...
 
unsigned nfine_grain_dof_types_in (const unsigned &i) const
 Access function for the number of most fine grain dof types in a (possibly coarsened) dof type. More...
 
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)
 Setup a matrix vector product. matvec_prod_pt is a pointer to the MatrixVectorProduct, block_pt is a pointer to the block matrix, block_col_indices is a vector indicating which block indices does the RHS vector we want to multiply the matrix by. More...
 
void setup_matrix_vector_product (MatrixVectorProduct *matvec_prod_pt, CRDoubleMatrix *block_pt, const unsigned &block_col_index)
 Setup matrix vector product. This is simply a wrapper around the other setup_matrix_vector_product function. More...
 
void internal_get_block_ordered_preconditioner_vector (const DoubleVector &v, DoubleVector &w) const
 Given the naturally ordered vector, v, return the vector rearranged in block order in w. This is a legacy function from the old block preconditioning framework. Kept alive in case it may be needed again. More...
 
void internal_return_block_ordered_preconditioner_vector (const DoubleVector &w, DoubleVector &v) const
 Takes the block ordered vector, w, and reorders it in the natural order. Reordered vector is returned in v. Note: If the preconditioner is a subsidiary preconditioner then only the components of the vector associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas that of the vector w is of length this->nrow(). More...
 
unsigned internal_nblock_types () const
 Return the number internal blocks. This should be the same as the number of internal dof types. Internally, the block preconditioning framework always work with the most fine grain blocks. I.e. it always deal with the most fine grain dof-level blocks. This allows for coarsening of dof types. When we extract a block, we look at the Block_to_dof_map_fine vector to find out which most fine grain dof types belongs to this block. More...
 
unsigned internal_ndof_types () const
 Return the number of internal dof types. This is the number of most fine grain dof types. The preconditioner writer should not have to concern him/her-self with the internal dof/block types. Thus this fuction is moved to private. We have kept this function alive since it it still used deep within the inner workings of the block preconditioning framework. More...
 
void internal_return_block_vector (const unsigned &n, const DoubleVector &b, DoubleVector &v) const
 Takes the n-th block ordered vector, b, and copies its entries to the appropriate entries in the naturally ordered vector, v. Here n is the block number in the current block preconditioner. If the preconditioner is a subsidiary block preconditioner the other entries in v that are not associated with it are left alone. More...
 
void internal_get_block_vector (const unsigned &n, const DoubleVector &v, DoubleVector &b) const
 A helper function, takes the naturally ordered vector, v, and extracts the n-th block vector, b. Here n is the block number in the current preconditioner. NOTE: The ordering of the vector b is the same as the ordering of the block matrix from internal_get_block(...). More...
 
void internal_get_block_vectors (const Vector< unsigned > &block_vec_number, const DoubleVector &v, Vector< DoubleVector > &s) const
 Takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. The block_vec_number indicates which blocks we want. These blocks and vectors are those corresponding to the internal blocks. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is the sum of the Nrow of the sub vectors. More...
 
void internal_get_block_vectors (const DoubleVector &v, Vector< DoubleVector > &s) const
 A helper function, takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. The block_vec_number indicates which blocks we want. These blocks and vectors are those corresponding to the internal blocks. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is the sum of the Nrow of the sub vectors. This is simply a wrapper around the other internal_get_block_vectors(...) function with the identity block_vec_number vector. More...
 
void internal_return_block_vectors (const Vector< unsigned > &block_vec_number, const Vector< DoubleVector > &s, DoubleVector &v) const
 A helper function, takes the vector of block vectors, s, and copies its entries into the naturally ordered vector, v. If this is a subsidiary block preconditioner only those entries in v that are associated with its blocks are affected. More...
 
void internal_return_block_vectors (const Vector< DoubleVector > &s, DoubleVector &v) const
 A helper function, takes the vector of block vectors, s, and copies its entries into the naturally ordered vector, v. If this is a subsidiary block preconditioner only those entries in v that are associated with its blocks are affected. This is simple a wrapper around the other internal_return_block_vectors(...) function with the identity block_vec_number vector. More...
 
void internal_get_block (const unsigned &i, const unsigned &j, CRDoubleMatrix &output_block) const
 Gets block (i,j) from the matrix pointed to by Matrix_pt and returns it in output_block. This is associated with the internal blocks. Please use the other get_block(...) function. More...
 
int internal_block_number (const unsigned &i_dof) const
 Return the block number corresponding to a global index i_dof. This returns the block number corresponding to the internal blocks. What this means is that this returns the most fine grain dof-block number which this global index i_dof corresponds to. Since the writer of the preconditioner does not need to care about the internal block types, this function should not be used and thus moved to private. This function should not be removed since it is still used deep within the inner workings of the block preconditioning framework. More...
 
int internal_index_in_block (const unsigned &i_dof) const
 Return the index in the block corresponding to a global block number i_dof. The index returned corresponds to the internal blocks, which is the most fine grain dof blocks. More...
 
const LinearAlgebraDistributioninternal_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)
 insert a Vector<unsigned> and LinearAlgebraDistribution* pair into Auxiliary_block_distribution_pt. The Auxiliary_block_distribution_pt should only contain pointers to distributions concatenated at this block level. We try to ensure this by checking if the block_vec_number vector is within the range nblock_types(). Of course, this does not guarantee correctness, but this is the least we can do. More...
 
void block_matrix_test (const unsigned &i, const unsigned &j, const CRDoubleMatrix *block_matrix_pt) const
 Private helper function to check that every element in the block matrix (i,j) matches the corresponding element in the original matrix. More...
 
int get_index_of_value (const Vector< myType > &vec, const myType val, const bool sorted=false) const
 Get the index of first occurrence of value in a vector. If the element does not exist, -1 is returned. The optional parameter indicates of the Vector is sorted or not. Complexity: if the Vector is sorted, then on average, logarithmic in the distance between first and last: Performs approximately log2(N)+2 element comparisons. Otherwise, up to linear in the distance between first and last: Compares elements until a match is found. More...
 
- Public Member Functions inherited from oomph::Preconditioner
 Preconditioner ()
 Constructor. More...
 
 Preconditioner (const Preconditioner &)
 Broken copy constructor. More...
 
void operator= (const Preconditioner &)
 Broken assignment operator. More...
 
virtual ~Preconditioner ()
 Destructor (empty) More...
 
void setup (DoubleMatrixBase *matrix_pt)
 Setup the preconditioner: store the matrix pointer and the communicator pointer then call preconditioner specific setup() function. More...
 
void setup (const Problem *problem_pt, DoubleMatrixBase *matrix_pt)
 Compatability layer for old preconditioners where problem pointers were needed. The problem pointer is only used to get a communicator pointer. More...
 
virtual void set_matrix_pt (DoubleMatrixBase *matrix_pt)
 Set the matrix pointer. More...
 
virtual const OomphCommunicatorcomm_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...
 
- Public Member Functions inherited from oomph::DistributableLinearAlgebraObject
 DistributableLinearAlgebraObject ()
 Default constructor - create a distribution. More...
 
 DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)
 Broken copy constructor. More...
 
void operator= (const DistributableLinearAlgebraObject &)
 Broken assignment operator. More...
 
virtual ~DistributableLinearAlgebraObject ()
 Destructor. More...
 
LinearAlgebraDistributiondistribution_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)
 setup the distribution of this distributable linear algebra object More...
 
void build_distribution (const LinearAlgebraDistribution &dist)
 setup the distribution of this distributable linear algebra object More...
 

Private Member Functions

void mg_solve (Vector< DoubleVector > &result)
 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. More...
 
void block_preconditioner_self_test ()
 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 | |--—|---—|. More...
 
void setup ()
 Function to set up the hierachy of levels. Creates a vector of pointers to each MG level. More...
 
void setup_mg_hierarchy ()
 Function to set up the hierachy of levels. Creates a vector of pointers to each MG level. More...
 
void setup_mg_structures ()
 Function to set up the hierachy of levels. Creates a vector of pointers to each MG level. More...
 
void maximum_edge_width (const unsigned &level, double &h)
 Estimate the value of the parameter h on the level-th problem in the hierarchy. More...
 
void setup_smoothers ()
 Function to set up all of the smoothers once the system matrices have been set up. More...
 
template<>
void maximum_edge_width (const unsigned &level, double &h)
 
template<>
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...
 
HelmholtzMGProblemMg_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
 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. More...
 
CRDoubleMatrixCoarsest_matrix_mg_pt
 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. More...
 
DoubleVector Coarsest_x_mg
 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 | |--—|. More...
 
DoubleVector Coarsest_rhs_mg
 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 | |--—|. More...
 
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 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. More...
 
Vector< Vector< DoubleVector > > Rhs_mg_vectors_storage
 Vector of vectors to store the RHS vectors. This uses the same format as the X_mg_vectors_storage vector. More...
 
Vector< Vector< DoubleVector > > Residual_mg_vectors_storage
 Vector to vectors to store the residual vectors. This uses the same format as the X_mg_vectors_storage vector. More...
 
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
 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. More...
 
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
 Boolean variable to indicate whether or not the problem was successfully solved. More...
 
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...
 

Additional Inherited Members

- Protected Member Functions inherited from oomph::BlockPreconditioner< CRDoubleMatrix >
void set_nmesh (const unsigned &n)
 Specify the number of meshes required by this block preconditioner. Note: elements in different meshes correspond to different types of DOF. More...
 
void set_mesh (const unsigned &i, const Mesh *const mesh_pt, const bool &allow_multiple_element_type_in_mesh=false)
 Set the i-th mesh for this block preconditioner. Note: The method set_nmesh(...) must be called before this method to specify the number of meshes. By default, it is assumed that each mesh only contains elements of the same type. This condition may be relaxed by setting the boolean allow_multiple_element_type_in_mesh to true, however, each mesh must only contain elements with the same number of dof types. More...
 
void set_replacement_dof_block (const unsigned &block_i, const unsigned &block_j, CRDoubleMatrix *replacement_dof_block_pt)
 Set replacement dof-level blocks. Only dof-level blocks can be set. This is important due to how the dof type coarsening feature operates. More...
 
bool any_mesh_distributed () const
 Check if any of the meshes are distributed. This is equivalent to problem.distributed() and is used as a replacement. More...
 
int internal_dof_number (const unsigned &i_dof) const
 Return the number of the block associated with global unknown i_dof. If this preconditioner is a subsidiary block preconditioner then the block number in the subsidiary block preconditioner is returned. If a particular global DOF is not associated with this preconditioner then -1 is returned. More...
 
unsigned internal_index_in_dof (const unsigned &i_dof) const
 Return the row/column number of global unknown i_dof within it's block. More...
 
unsigned internal_block_dimension (const unsigned &b) const
 Return the number of degrees of freedom in block b. Note that if this preconditioner acts as a subsidiary preconditioner then b refers to the block number in the subsidiary preconditioner not the master block preconditioner. More...
 
unsigned internal_dof_block_dimension (const unsigned &i) const
 Return the size of the dof "block" i, i.e. how many degrees of freedom are associated with it. Note that if this preconditioner acts as a subsidiary preconditioner, then i refers to the block number in the subsidiary preconditioner not the master block preconditioner. More...
 
unsigned master_nrow () const
 Return the number of dofs (number of rows or columns) in the overall problem. The prefix "master_" is sort of redundant when used as a stand-alone block preconditioner but is required to avoid ambiguities. The latter is stored (and maintained) separately for each specific block preconditioner regardless of its role. More...
 
unsigned internal_master_dof_number (const unsigned &b) const
 Takes the block number within this preconditioner and returns the corresponding block number in the master preconditioner. If this preconditioner does not have a master block preconditioner then the block number passed is returned. More...
 
const LinearAlgebraDistributioninternal_preconditioner_matrix_distribution_pt () const
 access function to the internal preconditioner matrix distribution pt. preconditioner_matrix_distribution_pt always returns the concatenation of the internal block distributions. Since the writer of the preconditioner does not need to concern themselves with the internal dof/block, please use preconditioner_matrix_distribution_pt(). More...
 
const LinearAlgebraDistributionpreconditioner_matrix_distribution_pt () const
 Access function to the preconditioner matrix distribution pointer. This is the concatenation of the block distributions with the identity ordering. I.e. if this preconditioner has three block types, with the three associated block distributions dist_b0, dist_b1 and dist_b2, then this distribution is: LinearAlgebraDistributionHelpers::concatenate(dist_b0, dist_b1, dist_b2). More...
 
- Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject
void clear_distribution ()
 clear the distribution of this distributable linear algebra object More...
 
- Protected Attributes inherited from oomph::BlockPreconditioner< CRDoubleMatrix >
MapMatrix< unsigned,
CRDoubleMatrix * > 
Replacement_dof_block_pt
 The replacement dof-level blocks. More...
 
Vector
< LinearAlgebraDistribution * > 
Block_distribution_pt
 The distribution for the blocks. More...
 
Vector< Vector< unsigned > > Block_to_dof_map_coarse
 Mapping for block types to dof types. These are the dof types the writer of the preconditioner expects. For the upper-most master block preconditioner, this would be the sum of the dof types in the meshes. For subsidiary block preconditioners, this is determined by the parent preconditioner when passing in the doftype_coarsen_map_coarse vector in turn_into_subsidiary_block_preconditioner(...). More...
 
Vector< Vector< unsigned > > Block_to_dof_map_fine
 Mapping for the block types to the most fine grain dof types. More...
 
Vector< Vector< unsigned > > Doftype_coarsen_map_coarse
 Mapping for dof types within THIS precondition. This is usually passed down from the parent preconditioner. This list is used to tell which does types should be considered as a single dof type within this preconditioner. I.e. we "coarsen" the dof types. The values are local to this preconditioner, for example, even if the Doftype_in_master_preconditioner_coarse = [2,3,4], the vector Doftype_coarsen_map_coarse = [[0],[1,2]], saying your local dof types 0 should be considered as dof type 0 and dof types 1 and 2 are considered as dof type 1. More...
 
Vector< Vector< unsigned > > Doftype_coarsen_map_fine
 Mapping the dof types within this preconditioner. The values in here refers to the most grain dof types. This list is automatically generated either in block_setup(...) (for the top-most preconditioner) or the turn_into_subsidiary_block_preconditioner(...) function. Please refer to the comment above Doftype_coarsen_map_coarse for more details. More...
 
Vector
< LinearAlgebraDistribution * > 
Internal_block_distribution_pt
 Storage for the default distribution for each internal block. More...
 
Vector
< LinearAlgebraDistribution * > 
Dof_block_distribution_pt
 Storage for the default distribution for each dof block at this level. More...
 
Vector< unsigned > Allow_multiple_element_type_in_mesh
 Vector of unsigned to indicate which meshes contain multiple element types. More...
 
Vector< const Mesh * > Mesh_pt
 Vector of pointers to the meshes containing the elements used in the block preconditioner. Const pointers to prevent modification of the mesh by the preconditioner (this could be relaxed if needed). If this is a subsidiary preconditioner, then the information is looked up in the master preconditioner. More...
 
Vector< unsigned > Ndof_types_in_mesh
 Storage for number of types of degree of freedom of the elements in each mesh. More...
 
unsigned Internal_nblock_types
 Number of different block types in this preconditioner. Note that this information is maintained if used as a subsidiary or stand-alone block preconditioner, in the latter case it stores the number of blocks within the subsidiary preconditioner. More...
 
unsigned Internal_ndof_types
 Number of different DOF types in this preconditioner. Note that this information is maintained if used as a subsidiary or stand-alone block preconditioner, in the latter case it stores the number of dofs within the subsidiary preconditioner. More...
 

Detailed Description

template<unsigned DIM>
class oomph::HelmholtzMGPreconditioner< DIM >

Definition at line 62 of file helmholtz_geometric_multigrid.h.

Member Typedef Documentation

template<unsigned DIM>
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

Definition at line 73 of file helmholtz_geometric_multigrid.h.

template<unsigned DIM>
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

Definition at line 69 of file helmholtz_geometric_multigrid.h.

Constructor & Destructor Documentation

template<unsigned DIM>
oomph::HelmholtzMGPreconditioner< DIM >::HelmholtzMGPreconditioner ( HelmholtzMGProblem mg_problem_pt)
inline

Constructor: Set up default values for number of V-cycles and pre- and post-smoothing steps.

Definition at line 93 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Mg_hierarchy_pt, and oomph::HelmholtzMGPreconditioner< DIM >::Mg_problem_pt.

template<unsigned DIM>
oomph::HelmholtzMGPreconditioner< DIM >::~HelmholtzMGPreconditioner ( )
inline

Delete any dynamically allocated data.

Definition at line 116 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory().

Member Function Documentation

template<unsigned DIM>
double& oomph::HelmholtzMGPreconditioner< DIM >::alpha_shift ( )
inline

Function to change the value of the shift.

Definition at line 193 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Alpha_shift.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::block_preconditioner_self_test ( )
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.

Definition at line 874 of file helmholtz_geometric_multigrid.h.

References i, oomph::DenseMatrix< T >::nrow(), and oomph::oomph_info.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory ( )
inlinevirtual
template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::direct_solve ( )
inline
template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::disable_doc_time ( )
inline

Disable time documentation.

Definition at line 200 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::disable_output ( )
inline
template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::disable_smoother_and_superlu_doc_time ( )
inline
template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::disable_v_cycle_output ( )
inline

Disable all output from mg_solve apart from the number of V-cycles used to solve the problem.

Definition at line 208 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time, and oomph::HelmholtzMGPreconditioner< DIM >::Suppress_v_cycle_output.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::enable_doc_time ( )
inline

Enable time documentation.

Definition at line 239 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::enable_output ( )
inline
template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::enable_v_cycle_output ( )
inline

Enable the output of the V-cycle timings and other output.

Definition at line 246 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Doc_time, and oomph::HelmholtzMGPreconditioner< DIM >::Suppress_v_cycle_output.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::full_setup ( )

Do a full setup (assumes everything will be setup around the HelmholtzMGProblem pointer given in the constructor)

Runs a full setup of the MG solver.

Definition at line 1128 of file helmholtz_geometric_multigrid.h.

References i, oomph::oomph_info, oomph::Global_string_for_annotation::string(), and oomph::TimingHelpers::timer().

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::setup().

template<unsigned DIM>
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.

Definition at line 3610 of file helmholtz_geometric_multigrid.h.

References oomph::TrilinosEpetraHelpers::multiply().

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::interpolation_matrix_set ( const unsigned &  level,
double *  value,
int *  col_index,
int *  row_st,
unsigned &  ncol,
unsigned &  nnz 
)
inline

Builds a CRDoubleMatrix that is used to interpolate the residual between levels. The transpose can be used as the full weighting restriction.

Definition at line 394 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Interpolation_matrices_storage_pt.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::interpolation_matrix_set ( const unsigned &  level,
Vector< double > &  value,
Vector< int > &  col_index,
Vector< int > &  row_st,
unsigned &  ncol,
unsigned &  nrow 
)
inline
template<unsigned DIM>
unsigned oomph::HelmholtzMGPreconditioner< DIM >::iterations ( ) const
inline

Number of iterations.

Definition at line 539 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::V_cycle_counter.

template<unsigned DIM>
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.

template<>
void oomph::HelmholtzMGPreconditioner< 3 >::level_up_local_coord_of_node ( const int &  son_type,
Vector< double > &  s 
)
template<>
void oomph::HelmholtzMGPreconditioner< 2 >::level_up_local_coord_of_node ( const int &  son_type,
Vector< double > &  s 
)
template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::maximum_edge_width ( const unsigned &  level,
double &  h 
)
private

Estimate the value of the parameter h on the level-th problem in the hierarchy.

template<>
void oomph::HelmholtzMGPreconditioner< 2 >::maximum_edge_width ( const unsigned &  level,
double &  h 
)
private

This is the explicit template specialisation of the case DIM=2.

Definition at line 2230 of file helmholtz_geometric_multigrid.h.

References oomph::Mesh::element_pt(), i, oomph::Mesh::nelement(), oomph::FiniteElement::node_pt(), and oomph::Node::x().

template<>
void oomph::HelmholtzMGPreconditioner< 3 >::maximum_edge_width ( const unsigned &  level,
double &  h 
)
private

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.

Definition at line 2361 of file helmholtz_geometric_multigrid.h.

References oomph::Mesh::element_pt(), i, oomph::OcTreeNames::LDB, oomph::OcTreeNames::LDF, oomph::OcTreeNames::LUB, oomph::OcTreeNames::LUF, oomph::Mesh::nelement(), oomph::FiniteElement::node_pt(), oomph::OcTreeNames::RDB, oomph::OcTreeNames::RDF, oomph::OcTreeNames::RUB, oomph::OcTreeNames::RUF, and oomph::Node::x().

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::mg_solve ( Vector< DoubleVector > &  result)
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.

Definition at line 3650 of file helmholtz_geometric_multigrid.h.

References i, oomph::oomph_info, and oomph::TimingHelpers::timer().

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::preconditioner_solve().

template<unsigned DIM>
unsigned& oomph::HelmholtzMGPreconditioner< DIM >::npost_smooth ( )
inline

Return the number of post-smoothing iterations (lvalue)

Definition at line 287 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Npost_smooth.

template<unsigned DIM>
unsigned& oomph::HelmholtzMGPreconditioner< DIM >::npre_smooth ( )
inline

Return the number of pre-smoothing iterations (lvalue)

Definition at line 295 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Npre_smooth.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::post_smooth ( const unsigned &  level)
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.

Definition at line 338 of file helmholtz_geometric_multigrid.h.

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.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::pre_smooth ( const unsigned &  level)
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.

Definition at line 307 of file helmholtz_geometric_multigrid.h.

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.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::preconditioner_solve ( const DoubleVector r,
DoubleVector z 
)
inlinevirtual
template<unsigned DIM>
double oomph::HelmholtzMGPreconditioner< DIM >::residual_norm ( const unsigned &  level)
inline

Return norm of residual r=b-Ax and the residual vector itself on the level-th level.

Definition at line 351 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Residual_mg_vectors_storage.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::post_smooth(), and oomph::HelmholtzMGPreconditioner< DIM >::pre_smooth().

template<unsigned DIM>
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.

Definition at line 736 of file helmholtz_geometric_multigrid.h.

References i, oomph::Vector< _Tp >::initialise(), and oomph::TrilinosEpetraHelpers::multiply().

template<unsigned DIM>
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)

Definition at line 3577 of file helmholtz_geometric_multigrid.h.

References oomph::TrilinosEpetraHelpers::multiply().

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::set_post_smoother_factory_function ( PostSmootherFactoryFctPt  post_smoother_fn)
inline

Access function to set the post-smoother creation function.

Definition at line 84 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Post_smoother_factory_function_pt.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::set_pre_smoother_factory_function ( PreSmootherFactoryFctPt  pre_smoother_fn)
inline

Access function to set the pre-smoother creation function.

Definition at line 76 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Pre_smoother_factory_function_pt.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::set_restriction_matrices_as_interpolation_transposes ( )
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.

Definition at line 460 of file helmholtz_geometric_multigrid.h.

References i, oomph::HelmholtzMGPreconditioner< DIM >::Interpolation_matrices_storage_pt, oomph::HelmholtzMGPreconditioner< DIM >::Nlevel, and oomph::HelmholtzMGPreconditioner< DIM >::Restriction_matrices_storage_pt.

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::setup ( )
inlineprivatevirtual
template<unsigned DIM>
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.

Definition at line 1985 of file helmholtz_geometric_multigrid.h.

References oomph::CRDoubleMatrix::column_index(), i, oomph::CRDoubleMatrix::ncol(), oomph::CRDoubleMatrix::nnz(), oomph::CRDoubleMatrix::nrow(), oomph::oomph_info, oomph::CRDoubleMatrix::row_start(), oomph::TimingHelpers::timer(), and oomph::CRDoubleMatrix::value().

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::setup_interpolation_matrices ( )
template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::setup_interpolation_matrices_unstructured ( )
template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::setup_mg_hierarchy ( )
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.

Definition at line 1274 of file helmholtz_geometric_multigrid.h.

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, and oomph::TimingHelpers::timer().

template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::setup_mg_structures ( )
private
template<unsigned DIM>
void oomph::HelmholtzMGPreconditioner< DIM >::setup_smoothers ( )
private
template<unsigned DIM>
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.

Definition at line 1430 of file helmholtz_geometric_multigrid.h.

References oomph::oomph_info, and oomph::TimingHelpers::timer().

template<unsigned DIM>
double& oomph::HelmholtzMGPreconditioner< DIM >::tolerance ( )
inline

Access function for the variable Tolerance (lvalue)

Definition at line 186 of file helmholtz_geometric_multigrid.h.

References oomph::HelmholtzMGPreconditioner< DIM >::Tolerance.

Member Data Documentation

template<unsigned DIM>
double oomph::HelmholtzMGPreconditioner< DIM >::Alpha_shift
private

Temporary version of the shift – to run bash scripts.

Definition at line 721 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::alpha_shift().

template<unsigned DIM>
CRDoubleMatrix* oomph::HelmholtzMGPreconditioner< DIM >::Coarsest_matrix_mg_pt
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.

Definition at line 626 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory(), oomph::HelmholtzMGPreconditioner< DIM >::direct_solve(), and oomph::HelmholtzMGPreconditioner< DIM >::disable_smoother_and_superlu_doc_time().

template<unsigned DIM>
DoubleVector oomph::HelmholtzMGPreconditioner< DIM >::Coarsest_rhs_mg
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 | |--—|.

Definition at line 646 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::direct_solve().

template<unsigned DIM>
DoubleVector oomph::HelmholtzMGPreconditioner< DIM >::Coarsest_x_mg
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 | |--—|.

Definition at line 636 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::direct_solve().

template<unsigned DIM>
bool oomph::HelmholtzMGPreconditioner< DIM >::Doc_time
private
template<unsigned DIM>
bool oomph::HelmholtzMGPreconditioner< DIM >::Has_been_setup
private

Boolean variable to indicate whether or not the solver has been setup.

Definition at line 711 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory().

template<unsigned DIM>
bool oomph::HelmholtzMGPreconditioner< DIM >::Has_been_solved
private

Boolean variable to indicate whether or not the problem was successfully solved.

Definition at line 715 of file helmholtz_geometric_multigrid.h.

template<unsigned DIM>
Vector<CRDoubleMatrix*> oomph::HelmholtzMGPreconditioner< DIM >::Interpolation_matrices_storage_pt
private
template<unsigned DIM>
Vector<double> oomph::HelmholtzMGPreconditioner< DIM >::Max_edge_width
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.

Definition at line 678 of file helmholtz_geometric_multigrid.h.

template<unsigned DIM>
Vector<HelmholtzMGProblem*> oomph::HelmholtzMGPreconditioner< DIM >::Mg_hierarchy_pt
private
template<unsigned DIM>
Vector<Vector<CRDoubleMatrix*> > oomph::HelmholtzMGPreconditioner< DIM >::Mg_matrices_storage_pt
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.

Definition at line 616 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::clean_up_memory().

template<unsigned DIM>
HelmholtzMGProblem* oomph::HelmholtzMGPreconditioner< DIM >::Mg_problem_pt
private

Pointer to the MG problem (deep copy)

Definition at line 605 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::HelmholtzMGPreconditioner().

template<unsigned DIM>
unsigned oomph::HelmholtzMGPreconditioner< DIM >::Nlevel
private
template<unsigned DIM>
unsigned oomph::HelmholtzMGPreconditioner< DIM >::Npost_smooth
private

Number of post-smoothing steps.

Definition at line 693 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::npost_smooth().

template<unsigned DIM>
unsigned oomph::HelmholtzMGPreconditioner< DIM >::Npre_smooth
private

Number of pre-smoothing steps.

Definition at line 690 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::npre_smooth().

template<unsigned DIM>
unsigned oomph::HelmholtzMGPreconditioner< DIM >::Nvcycle
private

Maximum number of V-cycles.

Definition at line 696 of file helmholtz_geometric_multigrid.h.

template<unsigned DIM>
PostSmootherFactoryFctPt oomph::HelmholtzMGPreconditioner< DIM >::Post_smoother_factory_function_pt
private

Function to create post-smoothers.

Definition at line 555 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::set_post_smoother_factory_function().

template<unsigned DIM>
Vector<HelmholtzSmoother*> oomph::HelmholtzMGPreconditioner< DIM >::Post_smoothers_storage_pt
private
template<unsigned DIM>
PreSmootherFactoryFctPt oomph::HelmholtzMGPreconditioner< DIM >::Pre_smoother_factory_function_pt
private

Function to create pre-smoothers.

Definition at line 552 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::set_pre_smoother_factory_function().

template<unsigned DIM>
Vector<HelmholtzSmoother*> oomph::HelmholtzMGPreconditioner< DIM >::Pre_smoothers_storage_pt
private
template<unsigned DIM>
Vector<Vector<DoubleVector> > oomph::HelmholtzMGPreconditioner< DIM >::Residual_mg_vectors_storage
private

Vector to vectors to store the residual vectors. This uses the same format as the X_mg_vectors_storage vector.

Definition at line 667 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::residual_norm().

template<unsigned DIM>
Vector<CRDoubleMatrix*> oomph::HelmholtzMGPreconditioner< DIM >::Restriction_matrices_storage_pt
private
template<unsigned DIM>
Vector<Vector<DoubleVector> > oomph::HelmholtzMGPreconditioner< DIM >::Rhs_mg_vectors_storage
private
template<unsigned DIM>
std::ostream* oomph::HelmholtzMGPreconditioner< DIM >::Stream_pt
private
template<unsigned DIM>
bool oomph::HelmholtzMGPreconditioner< DIM >::Suppress_all_output
private
template<unsigned DIM>
bool oomph::HelmholtzMGPreconditioner< DIM >::Suppress_v_cycle_output
private
template<unsigned DIM>
double oomph::HelmholtzMGPreconditioner< DIM >::Tolerance
private

The tolerance of the multigrid preconditioner.

Definition at line 684 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::tolerance().

template<unsigned DIM>
unsigned oomph::HelmholtzMGPreconditioner< DIM >::V_cycle_counter
private

Pointer to counter for V-cycles.

Definition at line 699 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::iterations().

template<unsigned DIM>
double oomph::HelmholtzMGPreconditioner< DIM >::Wavenumber
private

The value of the wavenumber, k.

Definition at line 681 of file helmholtz_geometric_multigrid.h.

template<unsigned DIM>
Vector<Vector<DoubleVector> > oomph::HelmholtzMGPreconditioner< DIM >::X_mg_vectors_storage
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.

Definition at line 659 of file helmholtz_geometric_multigrid.h.

Referenced by oomph::HelmholtzMGPreconditioner< DIM >::direct_solve(), oomph::HelmholtzMGPreconditioner< DIM >::post_smooth(), oomph::HelmholtzMGPreconditioner< DIM >::pre_smooth(), and oomph::HelmholtzMGPreconditioner< DIM >::preconditioner_solve().


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