Xyce  6.1
N_DEV_BernouliSupport.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-----------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_BernouliSupport.h,v $
27 //
28 // Purpose : This class contains the range limit constants and
29 // supporting functions for the
30 // Bernoulli, Aux1 and Aux2 functions as well as their
31 // derivatives.
32 //
33 // This is derived (somewhat) from the SG Framework
34 // program, brkpnts.c, by Kevin M. Kramer.
35 //
36 // For more information consult "Analysis
37 // and Simulation of Electronic Devices" by Siegfried
38 // Selberherr pages 158 and 159.
39 //
40 // Special Notes : From the brkpnts.c program:
41 //
42 // This program determines how to evaluate the following functions to machine
43 // precision. The breakpoints of these functions are dependent upon the host
44 // computer's floating point architecture and floating point library.
45 //
46 //
47 // x
48 // B(x) = -------
49 // e^x - 1
50 //
51 //
52 // d (1-x)*e^x - 1
53 // --B(x) = -------------
54 // dx (e^x - 1)^2
55 //
56 //
57 // x
58 // Aux1(x) = -------
59 // sinh(x)
60 //
61 // d sinh(x) - x*cosh(x)
62 // --Aux1(x) = -------------------
63 // dx (sinh(x))^2
64 //
65 // 1
66 // Aux2(x) = -------
67 // 1 + e^x
68 //
69 // d - e^x
70 // --Aux2(x) = -----------
71 // dx (1 + e^x)^2
72 //
73 //
74 // To achieve machine precision, the above functions should be evaluated as
75 // follows:
76 //
77 //
78 // /
79 // | -x x <= +0.0e+00
80 // | x / (e^x - 1) +0.0e+00 < x < +0.0e+00
81 // B(x) =< 1 - x/2*(1 - x/6*(1 - x*x/60)) +0.0e+00 <= x <= +2.7e-314
82 // | x*e^-x / (1 - e^-x) +2.7e-314 < x < +0.0e+00
83 // | x*e^-x +0.0e+00 <= x < +0.0e+00
84 // | 0 +0.0e+00 <= x
85 // \
86 //
87 // /
88 // | -1 x <= +3.7e-314
89 // | {(1-x)*e^x - 1} +3.7e-314 < x <= -2.0e+00
90 // d | {(1-x)*e^x - 1} / (e^x - 1)^2 -2.0e+00 < x < -3.1e-231
91 // --B(x)=< -1/2 + x/6*(1 - x*x/30) -3.1e-231 <= x <= -4.3e-232
92 // dx | {(1-x)*e^-x - e^-2x}/(1 - e^-x)^2 -4.3e-232 < x < +0.0e+00
93 // | {(1-x)*e^-x - e^-2x} +0.0e+00 <= x < -2.0e+00
94 // | 0 -2.0e+00 <= x
95 // \
96 //
97 // /
98 // | x / sinh(x) x <= -8.0e-03
99 // Aux1(x)=< 1 - x*x/6*(1 - 7*x*x/60) -8.0e-03 < x < +8.0e-03
100 // | x / sinh(x) +8.0e-03 <= x
101 // \
102 //
103 // /
104 // d | {sinh(x) - x*cosh(x)}/{sinh(x)}^2 x <= -4.8e-03
105 // --Aux1(x)=< -x/3*(1 - 7*x*x/30) -4.8e-03 < x < +4.8e-03
106 // dx | {sinh(x) - x*cosh(x)}/{sinh(x)}^2 +4.8e-03 <= x
107 // \
108 //
109 // /
110 // | 1 x <= -3.7e+01
111 // Aux2(x) =< 1 / (1 + e^x) -3.7e+01 < x < +3.7e+01
112 // | e^-x +3.7e+01 < x < +7.5e+02
113 // | 0 +7.5e+02 <= x
114 // \
115 //
116 // /
117 // | 0 x <= -7.5e+02
118 // d | - e^x -7.5e+02 < x < -3.7e+01
119 // --Aux2(x)=< - e^x / {1 + e^x}^2 -3.7e+01 <= x <= +3.7e+01
120 // dx | - e^-x +3.7e+01 < x < +7.5e+02
121 // | 0 +7.5e+02 <= x
122 // \
123 //
124 // Additional comment, ERK. The auxilliary functions (aux1 and aux2) are
125 // the only functions that are actually required. The Bernouli functions
126 // appear early in Selberherr's derivation of the electron and hole current
127 // densities, but are not used in the final expressions.
128 //
129 // Calculating the numerical limits for the Bernouli functions has proved
130 // to be problematic on some platforms, so in this class only the aux1
131 // and aux2 limits will be calculated.
132 //
133 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
134 //
135 // Creation Date : 08/01/04
136 //
137 // Revision Information:
138 // ---------------------
139 //
140 // Revision Number: $Revision: 1.10 $
141 //
142 // Revision Date : $Date: 2015/04/08 19:18:25 $
143 //
144 // Current Owner : $Author: tvrusso $
145 //-----------------------------------------------------------------------------
146 
147 #ifndef Xyce_N_DEV_BernouliSupport_h
148 #define Xyce_N_DEV_BernouliSupport_h
149 
150 // ---------- Standard Includes ----------
151 #include <string>
152 
153 // ---------- Xyce Includes ----------
154 #include <N_DEV_Const.h>
155 #include <N_UTL_Param.h>
156 
157 namespace Xyce {
158 namespace Device {
159 
160 typedef double (* FUNC)(double);
161 
162 //-----------------------------------------------------------------------------
163 // Class : BernouliSupport
164 // Purpose : Class which contains materials-related data and
165 // functions.
166 // Special Notes :
167 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
168 // Creation Date : 3/16/00
169 //-----------------------------------------------------------------------------
171 {
172 public:
173  BernouliSupport ();
174 
175  BernouliSupport (const BernouliSupport & right);
176 
177  virtual ~BernouliSupport ();
178 
179 protected:
180 
181 private:
182  int sign(double x);
183  double Bisection(FUNC func1, FUNC func2, double Xpos, double Xneg);
184  double Secant(FUNC func1, FUNC func2, double x1);
185  double Asymptotic(FUNC func1, FUNC func2, double x, double dx);
186 
187 public:
188  // Bernouli breakpoints
189  double bp0_BERN;
190  double bp1_BERN;
191  double bp2_BERN;
192  double bp3_BERN;
193  double bp4_BERN;
194  double bp0_DBERN;
195  double bp1_DBERN;
196  double bp2_DBERN;
197  double bp3_DBERN;
198  double bp4_DBERN;
199  double bp5_DBERN;
200 
201  // aux1 function breakpoints
202  double bp0_AUX1;
203  double bp1_AUX1;
204  double bp0_DAUX1;
205  double bp1_DAUX1;
206 
207  // aux2 function breakpoints
208  double bp0_AUX2;
209  double bp1_AUX2;
210  double bp2_AUX2;
211  double bp0_DAUX2;
212  double bp1_DAUX2;
213  double bp2_DAUX2;
214  double bp3_DAUX2;
215 
216  // Miscellaneous breakpoints
217  double bp0_MISC;
218 
219 protected:
220 
221 private:
222 
223 };
224 
225 } // namespace Device
226 } // namespace Xyce
227 
228 #endif // Xyce_N_DEV_BernouliSupport_h
double Asymptotic(FUNC func1, FUNC func2, double x, double dx)
Pure virtual class to augment a linear system.
double(* FUNC)(double)
double Secant(FUNC func1, FUNC func2, double x1)
double Bisection(FUNC func1, FUNC func2, double Xpos, double Xneg)