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_gssolver.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2011-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 #ifndef EPOT_GSSOLVER_HPP
44 #define EPOT_GSSOLVER_HPP 1
45 
46 
47 #include "epot_solver.hpp"
48 
49 
52 class EpotGSSolver : public EpotSolver {
53 
54  MeshScalarField *_epot;
55  MeshScalarField *_rhs;
56 
57  uint32_t _iter;
58  uint32_t _imax;
59  double _eps;
60  double _step;
61  double _err;
62  double _w;
63  double _local_Ulim_fac;
64  double _local_Ulim;
65  uint32_t _local_imax;
66  double _local_eps;
68  double solve_shield_potential( double epf, double cof, double rhs, double p ) const;
69  double solve_pexp_potential( double epf, double cof, double rhs, double p ) const;
70  double solve_nsimp_potential( double epf, double cof, double rhs, double p ) const;
71  void prepare_local_gnewton_settings( void );
72 
73  double gs_loop_3d( void ) const;
74  double gs_process_near_solid_3d( const uint8_t *nearsolid_ptr,
75  uint32_t a, uint32_t dj, uint32_t dk, uint8_t bindex ) const;
76  double gs_process_pure_vacuum_3d( uint32_t a, uint32_t dj, uint32_t dk ) const;
77  double gs_process_neumann_3d( uint32_t a, uint32_t dj, uint32_t dk, uint8_t bindex ) const;
78 
79 
80  double gs_loop_cyl( void ) const;
81  double gs_process_near_solid_cyl( const uint8_t *nearsolid_ptr,
82  uint32_t i, uint32_t j, uint8_t bindex ) const;
83  double gs_process_pure_vacuum_cyl( uint32_t i, uint32_t j ) const;
84  double gs_process_neumann_cyl( uint32_t i, uint32_t j, uint8_t bindex ) const;
85 
86 
87  double gs_loop_2d( void ) const;
88  double gs_process_near_solid_2d( const uint8_t *nearsolid_ptr,
89  uint32_t a, uint32_t dj,
90  uint8_t bindex ) const;
91  double gs_process_pure_vacuum_2d( uint32_t a, uint32_t dj ) const;
92  double gs_process_neumann_2d( uint32_t a, uint32_t dj, uint8_t bindex ) const;
93 
94 
95  double gs_loop_1d( void ) const;
96  double gs_process_near_solid_1d( const uint8_t *nearsolid_ptr,
97  uint32_t i, uint8_t bindex ) const;
98  double gs_process_pure_vacuum_1d( uint32_t i ) const;
99  double gs_process_neumann_1d( uint32_t i, uint8_t bindex ) const;
100 
101 
102  double near_solid_neumann_rhs_contribution( uint32_t i, uint32_t j, uint32_t k,
103  uint8_t bindex, const Vec3D &x ) const;
104  void preprocess( const MeshScalarField &scharge );
105  void postprocess( void );
106 
112  double error_scale( void );
113 
116  virtual void reset_problem( void );
117 
120  virtual void subsolve( MeshScalarField &epot, const MeshScalarField &scharge );
121 
122 public:
123 
126  EpotGSSolver( Geometry &geom );
127 
130  EpotGSSolver( Geometry &geom, std::istream &s );
131 
134  virtual ~EpotGSSolver() {}
135 
140  void set_eps( double eps );
141 
146  void set_imax( uint32_t imax );
147 
152  void set_w( double w );
153 
163  void set_plasma_solver_parameters( double Ulim_fac, uint32_t imax, double eps );
164 
169  double get_potential_change_norm( void ) const;
170 
176  double get_error_estimate( void ) const;
177 
180  uint32_t get_iter( void ) const;
181 
184  virtual void debug_print( std::ostream &os ) const;
185 
188  virtual void save( std::ostream &s ) const;
189 };
190 
191 #endif
Gauss-Seidel solver for Electric potential problem.
Definition: epot_gssolver.hpp:52
EpotGSSolver(Geometry &geom)
Constructor.
Definition: epot_gssolver.cpp:55
void set_w(double w)
Sets relaxation parameter.
Definition: epot_gssolver.cpp:107
virtual void debug_print(std::ostream &os) const
Print debugging information to os.
Definition: epot_gssolver.cpp:1219
void set_eps(double eps)
Sets the accuracy request.
Definition: epot_gssolver.cpp:77
double get_potential_change_norm(void) const
Get potential change norm.
Definition: epot_gssolver.cpp:83
virtual void save(std::ostream &s) const
Saves problem data to stream.
Definition: epot_gssolver.cpp:1213
double get_error_estimate(void) const
Get estimate of relative solution error.
Definition: epot_gssolver.cpp:89
uint32_t get_iter(void) const
Get number of iteration rounds done with last solve().
Definition: epot_gssolver.cpp:95
void set_imax(uint32_t imax)
Sets maximum iteration count.
Definition: epot_gssolver.cpp:101
void set_plasma_solver_parameters(double Ulim_fac, uint32_t imax, double eps)
Set node wise plasma solver parameters.
Definition: epot_gssolver.cpp:113
virtual ~EpotGSSolver()
Destructor.
Definition: epot_gssolver.hpp:134
Class for constructing the linear/nonlinear problem for the solver.
Definition: epot_solver.hpp:210
Geometry defining class.
Definition: geometry.hpp:180
Scalar field class.
Definition: meshscalarfield.hpp:70
Three dimensional vector.
Definition: vec3d.hpp:58
Poisson equation problem for solving electric potential.


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