Hermes2D  2.0
Hermes::Hermes2D::PicardSolver< Scalar > Class Template Reference

#include <picard_solver.h>

+ Inheritance diagram for Hermes::Hermes2D::PicardSolver< Scalar >:

Public Member Functions

 PicardSolver (DiscreteProblem< Scalar > *dp)
 
 PicardSolver (const WeakForm< Scalar > *wf, const Space< Scalar > *space)
 
 PicardSolver (const WeakForm< Scalar > *wf, Hermes::vector< const Space< Scalar > * > spaces)
 
virtual bool isOkay () const
 State querying helpers.
 
std::string getClassName () const
 Get class name, for the purpose of messaging.
 
void set_verbose_output_linear_solver (bool verbose_output_to_set)
 Sets the attribute verbose_output for the inner Newton's loop to the paramater passed.
 
void solve (Scalar *coeff_vec=NULL)
 
void solve (Solution< Scalar > *initial_guess)
 
void solve (Hermes::vector< Solution< Scalar > * > initial_guess)
 
virtual void set_time (double time)
 set time information for time-dependent problems.
 
virtual void set_time_step (double time_step)
 
virtual void set_spaces (Hermes::vector< const Space< Scalar > * > spaces)
 Overridden Mixins::SettableSpaces methods.
 
virtual void set_space (const Space< Scalar > *space)
 
virtual Hermes::vector< const
Space< Scalar > * > 
get_spaces () const
 Get all spaces as a Hermes::vector.
 
void use_Anderson_acceleration (bool to_set)
 Turn on / off the Anderson acceleration. By default it is off.
 
void set_picard_tol (double tol)
 Set the relative tolerance, thus co-determine when to stop Picard's iterations.
 
void set_picard_max_iter (int max_iter)
 Set the maximum number of Picard's iterations, thus co-determine when to stop Picard's iterations.
 
void set_num_last_vector_used (int num)
 
void set_anderson_beta (double beta)
 
void set_weak_formulation (const WeakForm< Scalar > *wf)
 Set the weak forms.
 
- Public Member Functions inherited from Hermes::Hermes2D::Mixins::SettableSpaces< Scalar >
virtual const Space< Scalar > * get_space (int n) const
 
- Public Member Functions inherited from Hermes::Hermes2D::Mixins::MatrixRhsOutput< Scalar >
 MatrixRhsOutput ()
 
void output_matrix (int firstIterations=-1)
 
void set_print_zero_matrix_entries (bool to_set)
 Sets this instance to output matrix entries even though they are zero or not.
 
void set_matrix_filename (std::string name)
 
void set_matrix_varname (std::string name)
 
void set_matrix_E_matrix_dump_format (EMatrixDumpFormat format)
 
void set_matrix_number_format (char *number_format)
 
void output_rhs (int firstIterations=-1)
 
void set_rhs_filename (std::string name)
 
void set_rhs_varname (std::string name)
 
void set_rhs_E_matrix_dump_format (EMatrixDumpFormat format)
 
void set_rhs_number_format (char *number_format)
 
- Public Member Functions inherited from Hermes::Hermes2D::Mixins::StateQueryable
void check () const
 Method to handle the state.
 

Additional Inherited Members

- Protected Attributes inherited from Hermes::Hermes2D::Mixins::MatrixRhsOutput< Scalar >
bool print_matrix_zero_values
 
bool output_matrixOn
 
int output_matrixIterations
 
std::string matrixFilename
 
std::string matrixVarname
 
EMatrixDumpFormat matrixFormat
 
char * matrix_number_format
 
bool output_rhsOn
 
int output_rhsIterations
 
std::string RhsFilename
 
std::string RhsVarname
 
EMatrixDumpFormat RhsFormat
 
char * rhs_number_format
 

Detailed Description

template<typename Scalar>
class Hermes::Hermes2D::PicardSolver< Scalar >

Class for the Picard's method.
For details about the optionally applied Anderson acceleration, the following website
http://hpfem.org/hermes/hermes-tutorial/doc/_build/html/src/hermes2d/B-nonlinear/01-picard.html will give an overview.
Typical usage:
// Initialize Picard's solver.
// Here wf is Hermes2D::WeakForm<std::complex<double> >, space is Hermes2D::Space<std::complex<double> >
Hermes::Hermes2D::PicardSolver<std::complex<double> > picard_solver(&wf, &space);

// Here we have an initial guess for the Picard's method - let us say that we already have a previous time level solution
Solution<std::complex<double> > prevTimeLevelSolution;

..... // Here we fill prevTimeLevelSolution.

// Solve the linear problem.
try
{
 // Call solve with the initial guess.
 picard_solver.solve(&prevTimeLevelSolution);

 // Get the solution vector from the solver.
 std::complex<double> * sln_vector = picard_solver.get_sln_vector();

 // Translate the solution vector into the previously initialized Solution<std::complex<double> > using the static method vector_to_solution.
 Hermes::Hermes2D::Solution<std::complex<double> >::vector_to_solution(sln_vector, &space, &sln);
}
// All kinds of Exceptions may happen (Linear algebraic solver, some bad parameters, some data not initialized...)
catch(Hermes::Exceptions::Exception& e)
{
 e.print_msg();
 return -1;
}
// For illustrative purposes, otherwise one can just catch std::exception directly, as Hermes::Exceptions::Exception derive from it.
catch(std::exception& e)
{
 std::cout << e.what();
 return -1;
}

Definition at line 74 of file picard_solver.h.

Member Function Documentation

template<typename Scalar >
void Hermes::Hermes2D::PicardSolver< Scalar >::set_anderson_beta ( double  beta)

Set the Anderson beta coefficient. See the details about the Anderson acceleration for explanation of this parameter.

Definition at line 229 of file picard_solver.cpp.

template<typename Scalar >
void Hermes::Hermes2D::PicardSolver< Scalar >::set_num_last_vector_used ( int  num)

Set how many last vectors will be used for Anderson acceleration. See the details about the Anderson acceleration for explanation of this parameter.

Definition at line 223 of file picard_solver.cpp.

template<typename Scalar >
void Hermes::Hermes2D::PicardSolver< Scalar >::solve ( Scalar *  coeff_vec = NULL)

Solve.

Parameters
[in]coeff_vecCeofficient vector to start from.

Definition at line 259 of file picard_solver.cpp.

template<typename Scalar >
void Hermes::Hermes2D::PicardSolver< Scalar >::solve ( Solution< Scalar > *  initial_guess)

Solve.

Parameters
[in]initial_guessSolution to start from (which is projected to obtain the initial coefficient vector.

Definition at line 241 of file picard_solver.cpp.

template<typename Scalar >
void Hermes::Hermes2D::PicardSolver< Scalar >::solve ( Hermes::vector< Solution< Scalar > * >  initial_guess)

Solve.

Parameters
[in]initial_guessSolutions to start from (which is projected to obtain the initial coefficient vector.

Definition at line 249 of file picard_solver.cpp.


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