#include <complex_smoother.h>
Public Member Functions | |
ComplexDampedJacobi (const double &omega=0.5) | |
Constructor (empty) More... | |
~ComplexDampedJacobi () | |
Empty destructor. More... | |
void | clean_up_memory () |
Cleanup data that's stored for resolve (if any has been stored) More... | |
ComplexDampedJacobi (const ComplexDampedJacobi &) | |
Broken copy constructor. More... | |
void | operator= (const ComplexDampedJacobi &) |
Broken assignment operator. More... | |
void | calculate_omega (const double &k, const double &h) |
Function to calculate the value of Omega by passing in the value of k and h [see Elman et al. "A multigrid method enhanced by
Krylov subspace iteration for discrete Helmholtz equations", p.1303]. More... | |
double & | omega () |
Get access to the value of Omega (lvalue) More... | |
void | complex_smoother_setup (Vector< CRDoubleMatrix *> helmholtz_matrix_pt) |
Setup: Pass pointer to the matrix and store in cast form. More... | |
void | complex_smoother_solve (const Vector< DoubleVector > &rhs, Vector< DoubleVector > &solution) |
The smoother_solve function performs fixed number of iterations on the system A*result=rhs. The number of (smoothing) iterations is the same as the max. number of iterations in the underlying IterativeLinearSolver class. More... | |
void | solve (Problem *const &problem_pt, DoubleVector &result) |
Use damped Jacobi iteration as an IterativeLinearSolver: This obtains the Jacobian matrix J and the residual vector r (needed for the Newton method) from the problem's get_jacobian function and returns the result of Jx=r. More... | |
unsigned | iterations () const |
Number of iterations taken. More... | |
![]() | |
HelmholtzSmoother () | |
Empty constructor. More... | |
virtual | ~HelmholtzSmoother () |
Virtual empty destructor. More... | |
void | complex_matrix_multiplication (Vector< CRDoubleMatrix *> matrices_pt, const Vector< DoubleVector > &x, Vector< DoubleVector > &soln) |
Helper function to calculate a complex matrix-vector product. Assumes the matrix has been provided as a Vector of length two; the first entry containing the real part of the system matrix and the second entry containing the imaginary part. More... | |
template<typename MATRIX > | |
void | check_validity_of_solve_helper_inputs (CRDoubleMatrix *const &real_matrix_pt, CRDoubleMatrix *const &imag_matrix_pt, const Vector< DoubleVector > &rhs, Vector< DoubleVector > &solution, const double &n_dof) |
Self-test to check that all the dimensions of the inputs to solve helper are consistent and everything that needs to be built, is. More... | |
![]() | |
IterativeLinearSolver () | |
Constructor: Set (default) trivial preconditioner and set defaults for tolerance and max. number of iterations. More... | |
IterativeLinearSolver (const IterativeLinearSolver &) | |
Broken copy constructor. More... | |
void | operator= (const IterativeLinearSolver &) |
Broken assignment operator. More... | |
virtual | ~IterativeLinearSolver () |
Destructor (empty) More... | |
Preconditioner *& | preconditioner_pt () |
Access function to preconditioner. More... | |
Preconditioner *const & | preconditioner_pt () const |
Access function to preconditioner (const version) More... | |
double & | tolerance () |
Access to convergence tolerance. More... | |
unsigned & | max_iter () |
Access to max. number of iterations. More... | |
void | enable_doc_convergence_history () |
Enable documentation of the convergence history. More... | |
void | disable_doc_convergence_history () |
Disable documentation of the convergence history. More... | |
void | open_convergence_history_file_stream (const std::string &file_name, const std::string &zone_title="") |
Write convergence history into file with specified filename (automatically switches on doc). Optional second argument is a string that can be used (as a zone title) to identify what case we're running (e.g. what combination of linear solver and preconditioner or parameter values are used). More... | |
void | close_convergence_history_file_stream () |
Close convergence history output stream. More... | |
double | jacobian_setup_time () const |
returns the time taken to assemble the jacobian matrix and residual vector More... | |
double | linear_solver_solution_time () const |
return the time taken to solve the linear system More... | |
virtual double | preconditioner_setup_time () const |
returns the the time taken to setup the preconditioner More... | |
void | enable_setup_preconditioner_before_solve () |
Setup the preconditioner before the solve. More... | |
void | disable_setup_preconditioner_before_solve () |
Don't set up the preconditioner before the solve. More... | |
void | enable_error_after_max_iter () |
Throw an error if we don't converge within max_iter. More... | |
void | disable_error_after_max_iter () |
Don't throw an error if we don't converge within max_iter (default). More... | |
void | enable_iterative_solver_as_preconditioner () |
void | disable_iterative_solver_as_preconditioner () |
![]() | |
LinearSolver () | |
Empty constructor, initialise the member data. More... | |
LinearSolver (const LinearSolver &dummy) | |
Broken copy constructor. More... | |
void | operator= (const LinearSolver &) |
Broken assignment operator. More... | |
virtual | ~LinearSolver () |
Empty virtual destructor. More... | |
void | enable_doc_time () |
Enable documentation of solve times. More... | |
void | disable_doc_time () |
Disable documentation of solve times. More... | |
bool | is_doc_time_enabled () const |
Is documentation of solve times enabled? More... | |
bool | is_resolve_enabled () const |
Boolean flag indicating if resolves are enabled. More... | |
virtual void | enable_resolve () |
Enable resolve (i.e. store matrix and/or LU decomposition, say) Virtual so it can be overloaded to perform additional tasks. More... | |
virtual void | disable_resolve () |
Disable resolve (i.e. store matrix and/or LU decomposition, say) This function simply resets an internal flag. It's virtual so it can be overloaded to perform additional tasks such as cleaning up memory that is only required for the resolve. More... | |
virtual void | solve (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. More... | |
virtual void | solve (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. More... | |
virtual void | resolve (const DoubleVector &rhs, DoubleVector &result) |
Resolve the system defined by the last assembled jacobian and the rhs vector. Solution is returned in the vector result. (broken virtual) More... | |
virtual void | enable_computation_of_gradient () |
function to enable the computation of the gradient required for the globally convergent Newton method More... | |
void | disable_computation_of_gradient () |
function to disable the computation of the gradient required for the globally convergent Newton method More... | |
void | reset_gradient () |
function to reset the size of the gradient before each Newton solve More... | |
void | get_gradient (DoubleVector &gradient) |
function to access the gradient, provided it has been computed More... | |
![]() | |
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... | |
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) |
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 | complex_solve_helper (const Vector< DoubleVector > &rhs, Vector< DoubleVector > &solution) |
This is where the actual work is done. More... | |
Private Attributes | |
bool | Matrix_can_be_deleted |
Boolean flag to indicate if the matrices pointed to by Matrix_real_pt and Matrix_imag_pt can be deleted. More... | |
CRDoubleMatrix * | Matrix_real_pt |
Pointer to the real part of the system matrix. More... | |
CRDoubleMatrix * | Matrix_imag_pt |
Pointer to the real part of the system matrix. More... | |
Vector< double > | Matrix_diagonal_real |
Vector containing the diagonal entries of A_r (real(A)) More... | |
Vector< double > | Matrix_diagonal_imag |
Vector containing the diagonal entries of A_c (imag(A)) More... | |
Vector< double > | Matrix_diagonal_inv_sq |
Vector whose j'th entry is given by 1/(A_r(j,j)^2 + A_c(j,j)^2) More... | |
unsigned | Iterations |
Number of iterations taken. More... | |
double | Omega |
Damping factor. More... | |
Additional Inherited Members | |
![]() | |
void | clear_distribution () |
clear the distribution of this distributable linear algebra object More... | |
![]() | |
bool | Use_as_smoother |
When a derived class object is being used as a smoother in the MG algorithm the residual norm does not need to be calculated. This boolean is used as a flag to indicate this in solve_helper(...) More... | |
![]() | |
bool | Doc_convergence_history |
Flag indicating if the convergence history is to be documented. More... | |
std::ofstream | Output_file_stream |
Output file stream for convergence history. More... | |
double | Tolerance |
Convergence tolerance. More... | |
unsigned | Max_iter |
Maximum number of iterations. More... | |
Preconditioner * | Preconditioner_pt |
Pointer to the preconditioner. More... | |
double | Jacobian_setup_time |
Jacobian setup time. More... | |
double | Solution_time |
linear solver solution time More... | |
double | Preconditioner_setup_time |
Preconditioner setup time. More... | |
bool | Setup_preconditioner_before_solve |
indicates whether the preconditioner should be setup before solve. Default = true; More... | |
bool | Throw_error_after_max_iter |
Should we throw an error instead of just returning when we hit the max iterations? More... | |
bool | Use_iterative_solver_as_preconditioner |
Use the iterative solver as preconditioner. More... | |
bool | First_time_solve_when_used_as_preconditioner |
![]() | |
bool | Enable_resolve |
Boolean that indicates whether the matrix (or its factors, in the case of direct solver) should be stored so that the resolve function can be used. More... | |
bool | Doc_time |
Boolean flag that indicates whether the time taken. More... | |
bool | Compute_gradient |
flag that indicates whether the gradient required for the globally convergent Newton method should be computed or not More... | |
bool | Gradient_has_been_computed |
flag that indicates whether the gradient was computed or not More... | |
DoubleVector | Gradient_for_glob_conv_newton_solve |
DoubleVector storing the gradient for the globally convergent Newton method. More... | |
![]() | |
static IdentityPreconditioner | Default_preconditioner |
Default preconditioner: The base class for preconditioners is a fully functional (if trivial!) preconditioner. More... | |
Damped Jacobi "solver" templated by matrix type. The "solver" exists in many different incarnations: It's an IterativeLinearSolver, and a Smoother, all of which use the same basic iteration.
Definition at line 259 of file complex_smoother.h.
|
inline |
Constructor (empty)
Definition at line 265 of file complex_smoother.h.
|
inline |
Empty destructor.
Definition at line 273 of file complex_smoother.h.
References oomph::LinearSolver::clean_up_memory().
|
inline |
Broken copy constructor.
Definition at line 306 of file complex_smoother.h.
References oomph::BrokenCopy::broken_copy().
|
inline |
Function to calculate the value of Omega by passing in the value of k and h [see Elman et al. "A multigrid method enhanced by Krylov subspace iteration for discrete Helmholtz equations", p.1303].
Definition at line 320 of file complex_smoother.h.
References oomph::MathematicalConstants::Pi, and oomph::IterativeLinearSolver::tolerance().
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::setup_smoothers().
|
inlinevirtual |
Cleanup data that's stored for resolve (if any has been stored)
Reimplemented from oomph::LinearSolver.
Definition at line 280 of file complex_smoother.h.
|
inlinevirtual |
Setup: Pass pointer to the matrix and store in cast form.
Implements oomph::HelmholtzSmoother.
Definition at line 385 of file complex_smoother.h.
References i.
|
inlinevirtual |
The smoother_solve function performs fixed number of iterations on the system A*result=rhs. The number of (smoothing) iterations is the same as the max. number of iterations in the underlying IterativeLinearSolver class.
Implements oomph::HelmholtzSmoother.
Definition at line 458 of file complex_smoother.h.
References oomph::HelmholtzSmoother::Use_as_smoother.
|
private |
This is where the actual work is done.
Definition at line 521 of file complex_smoother.h.
References oomph::DoubleVector::build(), oomph::CRDoubleMatrix::build(), oomph::LinearAlgebraDistribution::built(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::IterativeLinearSolver::Doc_convergence_history, oomph::LinearSolver::Doc_time, i, oomph::IterativeLinearSolver::Max_iter, oomph::DoubleVector::norm(), oomph::oomph_info, oomph::IterativeLinearSolver::Output_file_stream, oomph::IterativeLinearSolver::Solution_time, oomph::Global_string_for_annotation::string(), oomph::IterativeLinearSolver::Throw_error_after_max_iter, oomph::TimingHelpers::timer(), oomph::IterativeLinearSolver::Tolerance, and oomph::HelmholtzSmoother::Use_as_smoother.
|
inlinevirtual |
Number of iterations taken.
Implements oomph::IterativeLinearSolver.
Definition at line 478 of file complex_smoother.h.
|
inline |
Get access to the value of Omega (lvalue)
Definition at line 378 of file complex_smoother.h.
|
inline |
Broken assignment operator.
Definition at line 312 of file complex_smoother.h.
References oomph::BrokenCopy::broken_assign().
|
inlinevirtual |
Use damped Jacobi iteration as an IterativeLinearSolver: This obtains the Jacobian matrix J and the residual vector r (needed for the Newton method) from the problem's get_jacobian function and returns the result of Jx=r.
Implements oomph::LinearSolver.
Definition at line 472 of file complex_smoother.h.
References oomph::BrokenCopy::broken_assign().
|
private |
Number of iterations taken.
Definition at line 509 of file complex_smoother.h.
|
private |
Boolean flag to indicate if the matrices pointed to by Matrix_real_pt and Matrix_imag_pt can be deleted.
Definition at line 491 of file complex_smoother.h.
|
private |
Vector containing the diagonal entries of A_c (imag(A))
Definition at line 503 of file complex_smoother.h.
|
private |
Vector whose j'th entry is given by 1/(A_r(j,j)^2 + A_c(j,j)^2)
Definition at line 506 of file complex_smoother.h.
|
private |
Vector containing the diagonal entries of A_r (real(A))
Definition at line 500 of file complex_smoother.h.
|
private |
Pointer to the real part of the system matrix.
Definition at line 497 of file complex_smoother.h.
|
private |
Pointer to the real part of the system matrix.
Definition at line 494 of file complex_smoother.h.
|
private |
Damping factor.
Definition at line 512 of file complex_smoother.h.