Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.6dev
      Class Index
      File List
   Version 1.0.6
   Version 1.0.5new_solver
   Version 1.0.5dev
   Version 1.0.5b
   Version 1.0.4dev
   Version 1.0.4
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads
epot_bicgstabsolver.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2013 Taneli Kalvas. All rights reserved.
6  *
7  * You can redistribute this software and/or modify it under the terms
8  * of the GNU General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this library (file "COPYING" included in the package);
19  * if not, write to the Free Software Foundation, Inc., 51 Franklin
20  * Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  * If you have questions about your rights to use or distribute this
23  * software, please contact Berkeley Lab's Technology Transfer
24  * Department at TTD@lbl.gov. Other questions, comments and bug
25  * reports should be sent directly to the author via email at
26  * taneli.kalvas@jyu.fi.
27  *
28  * NOTICE. This software was developed under partial funding from the
29  * U.S. Department of Energy. As such, the U.S. Government has been
30  * granted for itself and others acting on its behalf a paid-up,
31  * nonexclusive, irrevocable, worldwide license in the Software to
32  * reproduce, prepare derivative works, and perform publicly and
33  * display publicly. Beginning five (5) years after the date
34  * permission to assert copyright is obtained from the U.S. Department
35  * of Energy, and subject to any subsequent five (5) year renewals,
36  * the U.S. Government is granted for itself and others acting on its
37  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
38  * the Software to reproduce, prepare derivative works, distribute
39  * copies to the public, perform publicly and display publicly, and to
40  * permit others to do so.
41  */
42 
43 
44 #ifndef EPOT_BICGSTABSOLVER_HPP
45 #define EPOT_BICGSTABSOLVER_HPP 1
46 
47 
48 #include "epot_matrixsolver.hpp"
49 #include "precond.hpp"
50 
51 
55 
56  double _eps;
57  uint32_t _imax;
59  uint32_t _iter;
60  double _res;
61  double _err;
63  double _newton_res;
64  double _newton_res_norm;
65  double _newton_step;
66  double _newton_step_norm;
68  bool _gnewton;
69  double _newton_eps;
70  uint32_t _newton_imax;
72  Precond *_pc;
74  MeshScalarField *_epot;
75  void (*_callback)(void);
76  void (*_callback_nonlinear)(void);
80  virtual void reset_problem( void );
81 
84  virtual void subsolve( MeshScalarField &epot, const MeshScalarField &scharge );
85 
86  void bicgstab( const Matrix &mat, const Vector &rhs, Vector &sol,
87  const Precond &pc );
88 
89 public:
90 
94  double eps = 1.0e-4,
95  uint32_t imax = 10000,
96  double newton_eps = 1.0e-4,
97  uint32_t newton_imax = 10,
98  bool gnewton = true );
99 
102  EpotBiCGSTABSolver( Geometry &geom, std::istream &s );
103 
106  virtual ~EpotBiCGSTABSolver();
107 
110  void set_preconditioner( Precond &pc );
111 
116  void set_gnewton( bool enable );
117 
122  void set_eps( double eps );
123 
128  void set_imax( uint32_t imax );
129 
134  void set_newton_imax( uint32_t newton_imax );
135 
140  void set_newton_eps( double eps );
141 
144  double get_newton_residual( void ) const;
145 
148  double get_newton_residual_norm( void ) const;
149 
152  double get_newton_step( void ) const;
153 
156  double get_newton_step_norm( void ) const;
157 
163  double get_scaled_residual( void ) const;
164 
172  double get_error_estimate( void ) const;
173 
176  uint32_t get_iter( void ) const;
177 
183  void set_analysis_callback( void (*func)(void) );
184 
190  void set_analysis_callback_nonlinear( void (*func)(void) );
191 
194  virtual void debug_print( std::ostream &os ) const;
195 
198  virtual void save( std::ostream &s ) const;
199 };
200 
201 
202 #endif
BiCGSTAB matrix solver for Electric potential problem.
Definition: epot_bicgstabsolver.hpp:54
virtual ~EpotBiCGSTABSolver()
Destructor.
Definition: epot_bicgstabsolver.cpp:87
void set_analysis_callback_nonlinear(void(*func)(void))
Set analysis callback for nonlinear iteration.
Definition: epot_bicgstabsolver.cpp:489
void set_newton_imax(uint32_t newton_imax)
Sets maximum iteration count for Newton-Raphson steps.
Definition: epot_bicgstabsolver.cpp:122
double get_newton_residual(void) const
Get last Newton-Raphson residual.
Definition: epot_bicgstabsolver.cpp:159
double get_newton_residual_norm(void) const
Get last Newton-Raphson residual norm.
Definition: epot_bicgstabsolver.cpp:165
uint32_t get_iter(void) const
Get number of iteration rounds done with last solve().
Definition: epot_bicgstabsolver.cpp:153
double get_newton_step_norm(void) const
Get last Newton-Raphson step size norm.
Definition: epot_bicgstabsolver.cpp:177
void set_eps(double eps)
Sets the accuracy request for BiCGSTAB solver.
Definition: epot_bicgstabsolver.cpp:108
void set_imax(uint32_t imax)
Sets maximum iteration count for BiCGSTAB solver.
Definition: epot_bicgstabsolver.cpp:116
virtual void debug_print(std::ostream &os) const
Print debugging information to os.
Definition: epot_bicgstabsolver.cpp:495
double get_scaled_residual(void) const
Get scaled residual error.
Definition: epot_bicgstabsolver.cpp:136
void set_gnewton(bool enable)
Enable/disable globally convergent Newton-Raphson.
Definition: epot_bicgstabsolver.cpp:102
void set_analysis_callback(void(*func)(void))
Set analysis callback.
Definition: epot_bicgstabsolver.cpp:483
double get_error_estimate(void) const
Get estimate of relative solution error.
Definition: epot_bicgstabsolver.cpp:142
double get_newton_step(void) const
Get last Newton-Raphson step size.
Definition: epot_bicgstabsolver.cpp:171
void set_preconditioner(Precond &pc)
Set preconditioner to use.
Definition: epot_bicgstabsolver.cpp:94
virtual void save(std::ostream &s) const
Saves problem data to stream.
Definition: epot_bicgstabsolver.cpp:81
EpotBiCGSTABSolver(Geometry &geom, double eps=1.0e-4, uint32_t imax=10000, double newton_eps=1.0e-4, uint32_t newton_imax=10, bool gnewton=true)
Constructor.
Definition: epot_bicgstabsolver.cpp:53
void set_newton_eps(double eps)
Sets the accuracy request for Newton-Raphson.
Definition: epot_bicgstabsolver.cpp:128
Parent class for Matrix-based solvers for Electric potential problem.
Definition: epot_matrixsolver.hpp:62
Geometry defining class.
Definition: geometry.hpp:180
Base matrix class.
Definition: matrix.hpp:76
Scalar field class.
Definition: meshscalarfield.hpp:70
Abstract base preconditioner class.
Definition: precond.hpp:59
Dense math vector class.
Definition: mvector.hpp:71
Matrix solver for electric potential problem.
Base class for preconditioners.


Reference manual for Ion Beam Simulator 1.0.6dev
Generated by Doxygen 1.9.1 on Thu Sep 11 2025 09:37:24.