Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.5new_solver
      Class Index
      File List
   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_pexp_potential( double epf, double cof, double rhs, double p ) const;
69  double solve_nsimp_potential( double epf, double cof, double rhs, double p ) const;
70  void prepare_local_gnewton_settings( void );
71 
72  double gs_loop_3d( void ) const;
73  double gs_process_near_solid_3d( const uint8_t *nearsolid_ptr,
74  uint32_t a, uint32_t dj, uint32_t dk, uint8_t bindex ) const;
75  double gs_process_pure_vacuum_3d( uint32_t a, uint32_t dj, uint32_t dk ) const;
76  double gs_process_neumann_3d( uint32_t a, uint32_t dj, uint32_t dk, uint8_t bindex ) const;
77 
78 
79  double gs_loop_cyl( void ) const;
80  double gs_process_near_solid_cyl( const uint8_t *nearsolid_ptr,
81  uint32_t i, uint32_t j, uint8_t bindex ) const;
82  double gs_process_pure_vacuum_cyl( uint32_t i, uint32_t j ) const;
83  double gs_process_neumann_cyl( uint32_t i, uint32_t j, uint8_t bindex ) const;
84 
85 
86  double gs_loop_2d( void ) const;
87  double gs_process_near_solid_2d( const uint8_t *nearsolid_ptr,
88  uint32_t a, uint32_t dj,
89  uint8_t bindex ) const;
90  double gs_process_pure_vacuum_2d( uint32_t a, uint32_t dj ) const;
91  double gs_process_neumann_2d( uint32_t a, uint32_t dj, uint8_t bindex ) const;
92 
93 
94  double gs_loop_1d( void ) const;
95  double gs_process_near_solid_1d( const uint8_t *nearsolid_ptr,
96  uint32_t i, uint8_t bindex ) const;
97  double gs_process_pure_vacuum_1d( uint32_t i ) const;
98  double gs_process_neumann_1d( uint32_t i, uint8_t bindex ) const;
99 
100 
101  double near_solid_neumann_rhs_contribution( uint32_t i, uint32_t j, uint32_t k,
102  uint8_t bindex, const Vec3D &x ) const;
103  void preprocess( const MeshScalarField &scharge );
104  void postprocess( void );
105 
111  double error_scale( void );
112 
115  virtual void reset_problem( void );
116 
119  virtual void subsolve( MeshScalarField &epot, const MeshScalarField &scharge );
120 
121 public:
122 
125  EpotGSSolver( Geometry &geom );
126 
129  EpotGSSolver( Geometry &geom, std::istream &s );
130 
133  virtual ~EpotGSSolver() {}
134 
139  void set_eps( double eps );
140 
145  void set_imax( uint32_t imax );
146 
151  void set_w( double w );
152 
162  void set_plasma_solver_parameters( double Ulim_fac, uint32_t imax, double eps );
163 
168  double get_potential_change_norm( void ) const;
169 
175  double get_error_estimate( void ) const;
176 
179  uint32_t get_iter( void ) const;
180 
183  virtual void debug_print( std::ostream &os ) const;
184 
187  virtual void save( std::ostream &s ) const;
188 };
189 
190 #endif
double get_error_estimate(void) const
Get estimate of relative solution error.
Definition: epot_gssolver.cpp:89
virtual void debug_print(std::ostream &os) const
Print debugging information to os.
Definition: epot_gssolver.cpp:1150
Scalar field class.
Definition: meshscalarfield.hpp:70
Geometry defining class.
Definition: geometry.hpp:179
Class for constructing the linear/nonlinear problem for the solver.
Definition: epot_solver.hpp:207
double get_potential_change_norm(void) const
Get potential change norm.
Definition: epot_gssolver.cpp:83
void set_w(double w)
Sets relaxation parameter.
Definition: epot_gssolver.cpp:107
virtual ~EpotGSSolver()
Destructor.
Definition: epot_gssolver.hpp:133
EpotGSSolver(Geometry &geom)
Constructor.
Definition: epot_gssolver.cpp:55
void set_imax(uint32_t imax)
Sets maximum iteration count.
Definition: epot_gssolver.cpp:101
Poisson equation problem for solving electric potential.
void set_plasma_solver_parameters(double Ulim_fac, uint32_t imax, double eps)
Set node wise plasma solver parameters.
Definition: epot_gssolver.cpp:113
uint32_t get_iter(void) const
Get number of iteration rounds done with last solve().
Definition: epot_gssolver.cpp:95
void set_eps(double eps)
Sets the accuracy request.
Definition: epot_gssolver.cpp:77
virtual void save(std::ostream &s) const
Saves problem data to stream.
Definition: epot_gssolver.cpp:1144
Three dimensional vector.
Definition: vec3d.hpp:58
Gauss-Seidel solver for Electric potential problem.
Definition: epot_gssolver.hpp:52


Reference manual for Ion Beam Simulator 1.0.5new_solver
Generated by Doxygen 1.8.5 on Tue May 19 2015 09:15:42.