Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_RateConstantCalculators.C
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-2014 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_RateConstantCalculators.C,v $
27 //
28 // Purpose : strategy pattern for reactions with different temperature
29 // dependent rate constant styles
30 //
31 // Special Notes :
32 //
33 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
34 //
35 // Creation Date : 07/27/2006
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.7 $
41 //
42 // Revision Date : $Date: 2014/02/24 23:49:15 $
43 //
44 // Current Owner : $Author: tvrusso $
45 //-----------------------------------------------------------------------------
46 
47 #include <Xyce_config.h>
48 
49 
50 
51 #include <N_UTL_Misc.h>
52 
53 #ifdef HAVE_CMATH
54 #include <cmath>
55 #else
56 #include <math.h>
57 #endif
58 
59 #include <string>
60 #include <vector>
61 
62 #include <N_DEV_Const.h>
63 #include <N_ERH_ErrorMgr.h>
64 
65 #include <N_DEV_Specie.h>
67 
68 namespace Xyce {
69 namespace Device {
70 
71 //-----------------------------------------------------------------------------
72 // Function : SimpleRateCalculator::SimpleRateCalculator
73 // Purpose : constructor for "simple" reaction rate calculator
74 // This is one that has no temperature dependence, and scales
75 // as concentration*time
76 // Special Notes :
77 // Scope : public
78 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
79 // Creation Date : 7/31/06
80 //-----------------------------------------------------------------------------
81  SimpleRateCalculator::SimpleRateCalculator(double k, double C0, double t0,
82  double x0)
83  : K(k)
84  {
85  setScaleFactors(C0,t0,x0);
86  }
87 
88 //-----------------------------------------------------------------------------
89 // Function : SimpleRateCalculator::SimpleRateCalculator
90 // Purpose : Copy constructor for "simple" reaction rate calculator
91 // Special Notes :
92 // Scope : public
93 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
94 // Creation Date : 7/31/06
95 //-----------------------------------------------------------------------------
97  :K(right.K),
98  rk0(right.rk0)
99  {
100  }
101 
102 //-----------------------------------------------------------------------------
103 // Function : SimpleRateCalculator::Clone
104 // Purpose : Copy self operation for "simple" reaction rate calculator
105 // Special Notes :
106 // Scope : public
107 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
108 // Creation Date : 7/31/06
109 //-----------------------------------------------------------------------------
111  {
112  return new SimpleRateCalculator(*this);
113  }
114 
115 //-----------------------------------------------------------------------------
116 // Function : SimpleRateCalculator::computeRateConstant
117 // Purpose : returns rate constant for simple rate style
118 // Special Notes :
119 // Scope : public
120 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
121 // Creation Date : 7/31/06
122 //-----------------------------------------------------------------------------
124  {
125  return(K);
126  }
127 
128 //-----------------------------------------------------------------------------
129 // Function : SimpleRateCalculator::rateConstantScaleFactor
130 // Purpose : returns rate scaling factor for simple rate style
131 // Special Notes :
132 // Scope : public
133 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
134 // Creation Date : 7/31/06
135 //-----------------------------------------------------------------------------
137  {
138  return (rk0);
139  }
140 
141 
142 //-----------------------------------------------------------------------------
143 // Function : CaptureRateCalculator::CaptureRateCalculator
144 // Purpose : constructor for capture reaction rate calculator
145 // This is one that models electron or hole capture reactions.
146 // Special Notes :
147 // Scope : public
148 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
149 // Creation Date : 7/31/06
150 //-----------------------------------------------------------------------------
152  double C0, double t0,
153  double x0)
154  {
155  K=sigma*v;
156  setScaleFactors(C0,t0,x0);
157  }
158 
159 //-----------------------------------------------------------------------------
160 // Function : CaptureRateCalculator::CaptureRateCalculator
161 // Purpose : Copy constructor for "capture" reaction rate calculator
162 // Special Notes :
163 // Scope : public
164 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
165 // Creation Date : 7/31/06
166 //-----------------------------------------------------------------------------
168  :K(right.K),
169  rk0(right.rk0)
170  {
171  }
172 //-----------------------------------------------------------------------------
173 // Function : CaptureRateCalculator::Clone
174 // Purpose : Copy self operation for "capture" reaction rate calculator
175 // Special Notes :
176 // Scope : public
177 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
178 // Creation Date : 7/31/06
179 //-----------------------------------------------------------------------------
181  {
182  return new CaptureRateCalculator(*this);
183  }
184 
185 //-----------------------------------------------------------------------------
186 // Function : CaptureRateCalculator::computeRateConstant
187 // Purpose : returns rate constant for capture rate style
188 // Special Notes :
189 // Scope : public
190 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
191 // Creation Date : 7/31/06
192 //-----------------------------------------------------------------------------
194  {
195  return(K);
196  }
197 
198 //-----------------------------------------------------------------------------
199 // Function : CaptureRateCalculator::rateConstantScaleFactor
200 // Purpose : returns rate scaling factor for capture rate style
201 // Special Notes :
202 // Scope : public
203 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
204 // Creation Date : 7/31/06
205 //-----------------------------------------------------------------------------
207  {
208  return (rk0);
209  }
210 
211 //-----------------------------------------------------------------------------
212 // Function : EmissionRateCalculator::EmissionRateCalculator
213 // Purpose : constructor for emission reaction rate calculator
214 // This is one that models electron or hole emission reactions.
215 // Special Notes :
216 // Scope : public
217 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
218 // Creation Date : 7/31/06
219 //-----------------------------------------------------------------------------
221  double N, double Energy,
222  double C0, double t0,
223  double x0)
224  : E(Energy)
225  {
226  K_f=sigma*v*N;
227  setScaleFactors(C0,t0,x0);
228  }
229 
230 //-----------------------------------------------------------------------------
231 // Function : EmissionRateCalculator::EmissionRateCalculator
232 // Purpose : Copy constructor for "emission" reaction rate calculator
233 // Special Notes :
234 // Scope : public
235 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
236 // Creation Date : 7/31/06
237 //-----------------------------------------------------------------------------
239  :T0(right.T0),
240  E(right.E),
241  K_f(right.K_f)
242  {
243  }
244 
245 //-----------------------------------------------------------------------------
246 // Function : EmissionRateCalculator::Clone
247 // Purpose : Copy self operation for "emission" reaction rate calculator
248 // Special Notes :
249 // Scope : public
250 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
251 // Creation Date : 7/31/06
252 //-----------------------------------------------------------------------------
254  {
255  return new EmissionRateCalculator(*this);
256  }
257 //-----------------------------------------------------------------------------
258 // Function : EmissionRateCalculator::computeRateConstant
259 // Purpose : returns rate constant for emission rate style
260 // Special Notes :
261 // Scope : public
262 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
263 // Creation Date : 7/31/06
264 //-----------------------------------------------------------------------------
266  {
267  double KbT=CONSTboltz*T/CONSTQ;
268  return(K_f*exp(-E/KbT));
269  }
270 
271 //-----------------------------------------------------------------------------
272 // Function : EmissionRateCalculator::rateConstantScaleFactor
273 // Purpose : returns rate scaling factor for emission rate style
274 // Special Notes :
275 // Scope : public
276 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
277 // Creation Date : 7/31/06
278 //-----------------------------------------------------------------------------
280  {
281  return (T0);
282  }
283 
284 
285 //-----------------------------------------------------------------------------
286 // Function : ComplexRateCalculator::ComplexRateCalculator
287 // Purpose : constructor for "complex" reaction rate calculator
288 // This is one that models two discrete species forming a
289 // complex, e.g.:
290 // V0 + VM -> VVM
291 //
292 // Special Notes : For this to work, there must either be two species in the
293 // reactants list, or one species with 2.0 as the stochiometric
294 // coefficient.
295 // Scope : public
296 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
297 // Creation Date : 7/31/06
298 //-----------------------------------------------------------------------------
300  std::vector<Specie> &VariableSpecies, std::vector<Specie> &ConstantSpecies,
301  std::vector< std::pair<int,double> > &Reactants,
302  double C0, double t0, double x0)
303  {
304  int ij;
305 
306  // Check assumptions:
307  if ( ! ((Reactants.size() == 1 && Reactants[0].second == 2.0) ||
308  (Reactants.size() == 2 && Reactants[0].second == 1.0 &&
309  Reactants[1].second == 1.0)))
310  {
311  std::string msg;
312  msg = "ComplexRateCalculator: Invalid attempt to use complex rate method.";
313  msg = " This method is only valid for binary complexing reactions:\n";
314  if (Reactants.size() == 1)
315  {
316  msg += " Only one reactant specified, but its stoichimetric coefficient is not 2.\n";
317  }
318  else if (Reactants.size() == 2)
319  {
320  msg += " Two reactants specified, but both stoichimetric coefficient are not 1.\n";
321  }
322  else
323  {
324  msg += " More than two reactants specified.\n";
325  }
326  // exit with error --- we probably need to do something more careful
327  // in parallel
328  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL,msg);
329  }
330 
331  if (Reactants[0].first >= 0)
332  Specie1 = &(VariableSpecies[Reactants[0].first]);
333  else
334  Specie1 = &(ConstantSpecies[-(Reactants[0].first+1)]);
335 
336  // Handle case where there's only one species with a coefficient of 2.0
337  if (Reactants.size() == 1)
338  {
339  Specie2 = Specie1; // that way we can just treat as A+A instead of 2A
340  }
341  else
342  {
343  if (Reactants[1].first >= 0)
344  Specie2 = &(VariableSpecies[Reactants[1].first]);
345  else
346  Specie2 = &(ConstantSpecies[-(Reactants[1].first+1)]);
347  }
348  ij =Specie1->getChargeState();
349  ij *=Specie2->getChargeState();
350 
351 
352 
353  // Only divide reaction_distance_factor by T in one special case
354  Tdep=false;
355  if (ij>0)
357  else if (ij == 0)
359  else
360  {
361  reaction_distance_factor = 4*M_PI*1.4e-4*(-ij);
362  Tdep=true;
363  }
364 
365  setScaleFactors(C0,t0,x0);
366  }
367 
368 
369 //-----------------------------------------------------------------------------
370 // Function : ComplexRateCalculator::ComplexRateCalculator
371 // Purpose : Copy constructor for "complex" reaction rate calculator
372 // Special Notes :
373 // Scope : public
374 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
375 // Creation Date : 7/31/06
376 //-----------------------------------------------------------------------------
378  :rk0(right.rk0),
379  reaction_distance_factor(right.reaction_distance_factor),
380  Tdep(right.Tdep),
381  Specie1(right.Specie1),
382  Specie2(right.Specie2)
383  {
384  }
385 
386 //-----------------------------------------------------------------------------
387 // Function : ComplexRateCalculator::Clone
388 // Purpose : Copy self operation for "complex" reaction rate calculator
389 // Special Notes :
390 // Scope : public
391 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
392 // Creation Date : 7/31/06
393 //-----------------------------------------------------------------------------
395  {
396  return new ComplexRateCalculator(*this);
397  }
398 
399 //-----------------------------------------------------------------------------
400 // Function : ComplexRateCalculator::computeRateConstant
401 // Purpose : returns rate constant for complex rate style
402 // Special Notes :
403 // Scope : public
404 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
405 // Creation Date : 7/31/06
406 //-----------------------------------------------------------------------------
408  {
409  if (Tdep)
412  else
415 
416  }
417 
418 //-----------------------------------------------------------------------------
419 // Function : ComplexRateCalculator::rateConstantScaleFactor
420 // Purpose : returns rate scaling factor for complex rate style
421 // Special Notes :
422 // Scope : public
423 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
424 // Creation Date : 7/31/06
425 //-----------------------------------------------------------------------------
427  {
428  return (rk0);
429  }
430 
431 
432 
433 
434 
435 //-----------------------------------------------------------------------------
436 // Function : DecomplexRateCalculator::DecomplexRateCalculator
437 // Purpose : constructor for "complex" reaction rate calculator
438 // This is one that models two discrete species decomposing from
439 // a complex, e.g.:
440 // VMM->V0 + VM
441 //
442 // Special Notes : For this to work, there must either be two species in the
443 // products list, or one species with 2.0 as the stochiometric
444 // coefficient.
445 // Scope : public
446 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
447 // Creation Date : 5/04/09
448 //-----------------------------------------------------------------------------
450  std::vector<Specie> &VariableSpecies, std::vector<Specie> &ConstantSpecies,
451  std::vector< std::pair<int,double> > &Reactants,
452  std::vector< std::pair<int,double> > &Products,
453  double bindingEnergy, double degenAB, double degenA, double degenB,
454  double siliconConcentration,
455  double C0, double t0, double x0)
456  :concSi(siliconConcentration),
457  c0(C0),
458  gammaAB(degenAB),
459  gammaA(degenA),
460  gammaB(degenB),
461  deltaE(bindingEnergy)
462  {
463  int ij;
464 
465  // Check assumptions:
466  if ( ! ((Products.size() == 1 && Products[0].second == 2.0) ||
467  (Products.size() == 2 && Products[0].second == 1.0 &&
468  Products[1].second == 1.0)))
469  {
470  std::string msg;
471  msg = "DeomplexRateCalculator: Invalid attempt to use decomplex rate method.";
472  msg = " This method is only valid for decomplexing reactions with two products:\n";
473  if (Products.size() == 1)
474  {
475  msg += " Only one product specified, but its stoichimetric coefficient is not 2.\n";
476  }
477  else if (Products.size() == 2)
478  {
479  msg += " Two products specified, but both stoichimetric coefficient are not 1.\n";
480  }
481  else
482  {
483  msg += " More than two products specified.\n";
484  }
485  // exit with error --- we probably need to do something more careful
486  // in parallel
487  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL,msg);
488  }
489 
490  if (Products[0].first >= 0)
491  Specie1 = &(VariableSpecies[Products[0].first]);
492  else
493  Specie1 = &(ConstantSpecies[-(Products[0].first+1)]);
494 
495  // Handle case where there's only one species with a coefficient of 2.0
496  if (Products.size() == 1)
497  {
498  Specie2 = Specie1; // that way we can just treat as A+A instead of 2A
499  }
500  else
501  {
502  if (Products[1].first >= 0)
503  Specie2 = &(VariableSpecies[Products[1].first]);
504  else
505  Specie2 = &(ConstantSpecies[-(Products[1].first+1)]);
506  }
507  ij =Specie1->getChargeState();
508  ij *=Specie2->getChargeState();
509 
510 
511 
512  // Only divide reaction_distance_factor by T in one special case
513  Tdep=false;
514  if (ij>0)
516  else if (ij == 0)
518  else
519  {
520  reaction_distance_factor = 4*M_PI*1.4e-4*(-ij);
521  Tdep=true;
522  }
523 
524  setScaleFactors(C0,t0,x0);
525  }
526 
527 
528 //-----------------------------------------------------------------------------
529 // Function : DecomplexRateCalculator::DecomplexRateCalculator
530 // Purpose : Copy constructor for "decomplex" reaction rate calculator
531 // Special Notes :
532 // Scope : public
533 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
534 // Creation Date : 5/04/09
535 //-----------------------------------------------------------------------------
537  :Specie1(right.Specie1),
538  Specie2(right.Specie2),
539  reaction_distance_factor(right.reaction_distance_factor),
540  Tdep(right.Tdep),
541  deltaE(right.deltaE),
542  gammaA(right.gammaA),
543  gammaB(right.gammaB),
544  gammaAB(right.gammaAB),
545  concSi(right.concSi),
546  rk0(right.rk0),
547  c0(right.c0)
548  {
549  }
550 
551 //-----------------------------------------------------------------------------
552 // Function : DecomplexRateCalculator::Clone
553 // Purpose : Copy self operation for "decomplex" reaction rate calculator
554 // Special Notes :
555 // Scope : public
556 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
557 // Creation Date : 7/31/06
558 //-----------------------------------------------------------------------------
560  {
561  return new DecomplexRateCalculator(*this);
562  }
563 
564 
565 //-----------------------------------------------------------------------------
566 // Function : DecomplexRateCalculator::computeRateConstant
567 // Purpose : returns rate constant for decomplex rate style
568 // Special Notes :
569 // Scope : public
570 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
571 // Creation Date : 7/31/06
572 //-----------------------------------------------------------------------------
574  {
575  double R;
576  double KbT=CONSTboltz*T/CONSTQ;
577  double k;
578  double D1=Specie1->getDiffusionCoefficient(T);
579  double D2=Specie2->getDiffusionCoefficient(T);
580  if (Tdep)
582  else
584 
585  k=(R*(D1 +D2)*(concSi)*((gammaA*gammaB)/gammaAB)*exp(-deltaE/KbT));
586 
587  return k;
588  }
589 
590 //-----------------------------------------------------------------------------
591 // Function : DecomplexRateCalculator::rateConstantScaleFactor
592 // Purpose : returns rate scaling factor for decomplex rate style
593 // Special Notes :
594 // Scope : public
595 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
596 // Creation Date : 7/31/06
597 //-----------------------------------------------------------------------------
599  {
600  return (rk0);
601  }
602 
603 } // namespace Device
604 } // namespace Xyce