Xyce  6.1
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-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_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.15.2.1 $
41 //
42 // Revision Date : $Date: 2015/04/02 18:20:09 $
43 //
44 // Current Owner : $Author: tvrusso $
45 //-----------------------------------------------------------------------------
46 
47 #include <Xyce_config.h>
48 
49 #include <iostream>
50 #include <string>
51 #include <vector>
52 
53 #include <N_DEV_Const.h>
54 #include <N_ERH_ErrorMgr.h>
55 
56 #include <N_DEV_Specie.h>
58 #include <N_DEV_MaterialLayer.h>
59 
60 #include<iostream>
61 #include <N_UTL_Math.h>
62 
63 namespace Xyce {
64 namespace Device {
65 
66 //-----------------------------------------------------------------------------
67 // Function : SimpleRateCalculator::SimpleRateCalculator
68 // Purpose : constructor for "simple" reaction rate calculator
69 // This is one that has no temperature dependence, and scales
70 // as concentration*time
71 // Special Notes :
72 // Scope : public
73 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
74 // Creation Date : 7/31/06
75 //-----------------------------------------------------------------------------
76  SimpleRateCalculator::SimpleRateCalculator(double k, double C0, double t0,
77  double x0)
78  : K(k)
79  {
80  setScaleFactors(C0,t0,x0);
81  myReactionName = "SimpleRateCalculator";
82  }
83 
84 //-----------------------------------------------------------------------------
85 // Function : SimpleRateCalculator::SimpleRateCalculator
86 // Purpose : Copy constructor for "simple" reaction rate calculator
87 // Special Notes :
88 // Scope : public
89 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
90 // Creation Date : 7/31/06
91 //-----------------------------------------------------------------------------
93  :K(right.K),
94  rk0(right.rk0),
95  myReactionName(right.myReactionName)
96  {
97  }
98 
99 //-----------------------------------------------------------------------------
100 // Function : SimpleRateCalculator::Clone
101 // Purpose : Copy self operation for "simple" reaction rate calculator
102 // Special Notes :
103 // Scope : public
104 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
105 // Creation Date : 7/31/06
106 //-----------------------------------------------------------------------------
108  {
109  return new SimpleRateCalculator(*this);
110  }
111 
112 //-----------------------------------------------------------------------------
113 // Function : SimpleRateCalculator::computeRateConstant
114 // Purpose : returns rate constant for simple rate style
115 // Special Notes :
116 // Scope : public
117 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
118 // Creation Date : 7/31/06
119 //-----------------------------------------------------------------------------
121  {
122  return(K);
123  }
124 
125 
126 //-----------------------------------------------------------------------------
127 // Function : SimpleRateCalculator::computeRateConstant
128 // Purpose : returns rate constant for simple rate style
129 // Special Notes :
130 // Scope : public
131 // Creator : Lawrence C Musson, SNL
132 // Creation Date : 04/17/14
133 //-----------------------------------------------------------------------------
135  std::vector<double> &concs,
136  std::vector<double> &constant_vec)
137  {
138  return(K);
139  }
140 
141 //-----------------------------------------------------------------------------
142 // Function : SimpleRateCalculator::rateConstantScaleFactor
143 // Purpose : returns rate scaling factor for simple rate style
144 // Special Notes :
145 // Scope : public
146 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
147 // Creation Date : 7/31/06
148 //-----------------------------------------------------------------------------
150  {
151  return (rk0);
152  }
153 
154 
155 //-----------------------------------------------------------------------------
156 // Function : CaptureRateCalculator::CaptureRateCalculator
157 // Purpose : constructor for capture reaction rate calculator
158 // This is one that models electron or hole capture reactions.
159 // Special Notes :
160 // Scope : public
161 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
162 // Creation Date : 7/31/06
163 //-----------------------------------------------------------------------------
165  double C0, double t0,
166  double x0)
167  {
168  //K=sigma*v; //velocity is incorporated later
169  K=sigma;
170  setScaleFactors(C0,t0,x0);
171  myReactionName = "CaptureRateCalculator";
172  }
173 
174 //-----------------------------------------------------------------------------
175 // Function : CaptureRateCalculator::CaptureRateCalculator
176 // Purpose : Copy constructor for "capture" reaction rate calculator
177 // Special Notes :
178 // Scope : public
179 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
180 // Creation Date : 7/31/06
181 //-----------------------------------------------------------------------------
183  :K(right.K),
184  rk0(right.rk0),
185  myReactionName(right.myReactionName)
186  {
187  }
188 //-----------------------------------------------------------------------------
189 // Function : CaptureRateCalculator::Clone
190 // Purpose : Copy self operation for "capture" reaction rate calculator
191 // Special Notes :
192 // Scope : public
193 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
194 // Creation Date : 7/31/06
195 //-----------------------------------------------------------------------------
197  {
198  return new CaptureRateCalculator(*this);
199  }
200 
201 //-----------------------------------------------------------------------------
202 // Function : CaptureRateCalculator::computeRateConstant
203 // Purpose : returns rate constant for capture rate style
204 // Special Notes :
205 // Scope : public
206 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
207 // Creation Date : 7/31/06
208 //-----------------------------------------------------------------------------
210  {
211  return(K);
212  }
213 
214 
215 //-----------------------------------------------------------------------------
216 // Function : CaptureRateCalculator::computeRateConstant
217 // Purpose : returns rate constant for capture rate style
218 // Special Notes :
219 // Scope : public
220 // Creator : Lawrence C Musson, SNL
221 // Creation Date : 04/17/2014
222 //-----------------------------------------------------------------------------
224  std::vector<double> &concs,
225  std::vector<double> &constant_vec)
226  {
227  return(K);
228  }
229 
230 //-----------------------------------------------------------------------------
231 // Function : CaptureRateCalculator::rateConstantScaleFactor
232 // Purpose : returns rate scaling factor for capture rate style
233 // Special Notes :
234 // Scope : public
235 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
236 // Creation Date : 7/31/06
237 //-----------------------------------------------------------------------------
239  {
240  return (rk0);
241  }
242 
243 //-----------------------------------------------------------------------------
244 // Function : EmissionRateCalculator::EmissionRateCalculator
245 // Purpose : constructor for emission reaction rate calculator
246 // This is one that models electron or hole emission reactions.
247 // Special Notes :
248 // Scope : public
249 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
250 // Creation Date : 7/31/06
251 //-----------------------------------------------------------------------------
253  double N, double Energy,
254  double C0, double t0,
255  double x0)
256  : E(Energy)
257  {
258  //K_f=sigma*v*N;
259  K_f=sigma; //velocity and DOS are incorporated later
260 
261  setScaleFactors(C0,t0,x0);
262  myReactionName = "Emission Rate Calculator";
263  }
264 
265 //-----------------------------------------------------------------------------
266 // Function : EmissionRateCalculator::EmissionRateCalculator
267 // Purpose : Copy constructor for "emission" reaction rate calculator
268 // Special Notes :
269 // Scope : public
270 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
271 // Creation Date : 7/31/06
272 //-----------------------------------------------------------------------------
274  :T0(right.T0),
275  E(right.E),
276  K_f(right.K_f),
277  myReactionName(right.myReactionName)
278  {
279  }
280 
281 //-----------------------------------------------------------------------------
282 // Function : EmissionRateCalculator::Clone
283 // Purpose : Copy self operation for "emission" reaction rate calculator
284 // Special Notes :
285 // Scope : public
286 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
287 // Creation Date : 7/31/06
288 //-----------------------------------------------------------------------------
290  {
291  return new EmissionRateCalculator(*this);
292  }
293 //-----------------------------------------------------------------------------
294 // Function : EmissionRateCalculator::computeRateConstant
295 // Purpose : returns rate constant for emission rate style
296 // Special Notes :
297 // Scope : public
298 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
299 // Creation Date : 7/31/06
300 //-----------------------------------------------------------------------------
302  {
303  double KbT=CONSTboltz*T/CONSTQ;
304  return(K_f*exp(-E/KbT));
305  }
306 
307 //-----------------------------------------------------------------------------
308 // Function : EmissionRateCalculator::computeRateConstant
309 // Purpose : returns rate constant for emission rate style
310 // Special Notes :
311 // Scope : public
312 // Creator : Lawrence C Musson, SNL
313 // Creation Date : 04/17/2014
314 //-----------------------------------------------------------------------------
316  std::vector<double> &concs,
317  std::vector<double> &constant_vec)
318  {
319  double KbT=CONSTboltz*T/CONSTQ;
320  return(K_f*exp(-E/KbT));
321  }
322 
323 //-----------------------------------------------------------------------------
324 // Function : EmissionRateCalculator::rateConstantScaleFactor
325 // Purpose : returns rate scaling factor for emission rate style
326 // Special Notes :
327 // Scope : public
328 // Creator : Lawrence C Musson, SNL
329 // Creation Date : 04/17/2014
330 //-----------------------------------------------------------------------------
332  {
333  return (T0);
334  }
335 
336 //-----------------------------------------------------------------------------
337 // Function : FDEmissionRateCalculator::FDEmissionRateCalculator
338 // Purpose : constructor for emission reaction rate calculator
339 // This is one that models electron or hole emission reactions.
340 // Fermi-Dirac stats are included in this.
341 // Special Notes :
342 // Scope : public
343 // Creator : Lawrence C Musson, SNL
344 // Creation Date : 04/17/2014
345 //-----------------------------------------------------------------------------
347  double Energy,
348  double v,
349  double C0, double t0,
350  double x0)
351  : E(Energy)
352  {
353  K_f=sigma; //velocity and other things are accounted later
354  setScaleFactors(C0,t0,x0);
355  myReactionName = "Emission Rate Calculator";
356  }
357 
358 //-----------------------------------------------------------------------------
359 // Function : FDEmissionRateCalculator::FDEmissionRateCalculator
360 // Purpose : Copy constructor for "emission" reaction rate calculator
361 // Special Notes :
362 // Scope : public
363 // Creator : Lawrence C Musson, SNL
364 // Creation Date : 04/17/2014
365 //-----------------------------------------------------------------------------
367  :T0(right.T0),
368  E(right.E),
369  K_f(right.K_f),
370  myReactionName(right.myReactionName)
371  {
372  }
373 
374 //-----------------------------------------------------------------------------
375 // Function : FDEmissionRateCalculator::Clone
376 // Purpose : Copy self operation for "emission" reaction rate calculator
377 // Special Notes :
378 // Scope : public
379 // Creator : Lawrence C Musson, SNL
380 // Creation Date : 04/17/2014
381 //-----------------------------------------------------------------------------
383  {
384  return new FDEmissionRateCalculator(*this);
385  }
386 //-----------------------------------------------------------------------------
387 // Function : FDEmissionRateCalculator::computeRateConstant
388 // Purpose : returns rate constant for emission rate style
389 // Special Notes :
390 // Scope : public
391 // Creator : Lawrence C Musson, SNL
392 // Creation Date : 04/17/2014
393 //-----------------------------------------------------------------------------
395  {
396  return(K_f);
397  }
398 
399 //-----------------------------------------------------------------------------
400 // Function : FDEmissionRateCalculator::computeRateConstant
401 // Purpose : returns rate constant for emission rate style
402 // Special Notes :
403 // Scope : public
404 // Creator : Lawrence C Musson, SNL
405 // Creation Date : 04/17/2014
406 //-----------------------------------------------------------------------------
408  std::vector<double> &concs,
409  std::vector<double> &constant_vec)
410  {
411  return(K_f);
412  }
413 
414 //-----------------------------------------------------------------------------
415 // Function : FDEmissionRateCalculator::rateConstantScaleFactor
416 // Purpose : returns rate scaling factor for emission rate style
417 // Special Notes :
418 // Scope : public
419 // Creator : Lawrence C Musson, SNL
420 // Creation Date : 04/17/2014
421 //-----------------------------------------------------------------------------
423  {
424  return (T0);
425  }
426 
427 
428 //-----------------------------------------------------------------------------
429 // Function : ComplexRateCalculator::ComplexRateCalculator
430 // Purpose : constructor for "complex" reaction rate calculator
431 // This is one that models two discrete species forming a
432 // complex, e.g.:
433 // V0 + VM -> VVM
434 //
435 // Special Notes : For this to work, there must either be two species in the
436 // reactants list, or one species with 2.0 as the stochiometric
437 // coefficient.
438 // Scope : public
439 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
440 // Creation Date : 7/31/06
441 //-----------------------------------------------------------------------------
443  std::vector<Specie> &VariableSpecies, std::vector<Specie> &ConstantSpecies,
444  std::vector< std::pair<int,double> > &Reactants,
445  double iC0, double t0, double x0)
446  : classC0(iC0),
447  coulombAttraction(false)
448  {
449  int ij;
450 
451  myReactionName = "Complex Rate Calculator";
452 
453  // Check assumptions:
454  if ( ! ((Reactants.size() == 1 && Reactants[0].second == 2.0) ||
455  (Reactants.size() == 2 && Reactants[0].second == 1.0 &&
456  Reactants[1].second == 1.0)))
457  {
458  Report::UserError msg;
459  msg << "Invalid attempt to use complex rate method. This method is only valid for binary complexing reactions:\n";
460  if (Reactants.size() == 1)
461  {
462  msg << " Only one reactant specified, but its stoichimetric coefficient is not 2.";
463  }
464  else if (Reactants.size() == 2)
465  {
466  msg << " Two reactants specified, but both stoichimetric coefficient are not 1.";
467  }
468  else
469  {
470  msg << " More than two reactants specified.";
471  }
472  }
473 
474  if (Reactants[0].first >= 0)
475  Specie1 = &(VariableSpecies[Reactants[0].first]);
476  else
477  Specie1 = &(ConstantSpecies[-(Reactants[0].first+1)]);
478 
479  // Handle case where there's only one species with a coefficient of 2.0
480  if (Reactants.size() == 1)
481  {
482  Specie2 = Specie1; // that way we can just treat as A+A instead of 2A
483  }
484  else
485  {
486  if (Reactants[1].first >= 0)
487  Specie2 = &(VariableSpecies[Reactants[1].first]);
488  else
489  Specie2 = &(ConstantSpecies[-(Reactants[1].first+1)]);
490  }
491  ij =Specie1->getChargeState();
492  ij *=Specie2->getChargeState();
493 
494 
495  // Only divide reaction_distance_factor by T in one special case
496 
497  //NOTE: The reaction_distance_factor that is being calculated here no longer
498  //has a distance in it. This is because this coefficient is being calculated
499  //before there is a known bulk material. And the reaction distance is material
500  //dependent and also a function of concentration in gallium arsenide. -- LCM
501  Tdep=false;
502  if (ij>0)
504  else if (ij == 0)
505  {
506  coulombAttraction = false;
508  chargeNumberProduct = 0.0;
509  }
510  else
511  {
512  coulombAttraction = true;
514  chargeNumberProduct = -(double)ij;
515  Tdep=true;
516  }
517 
518  setScaleFactors(classC0,t0,x0);
519  }
520 
521 
522 //-----------------------------------------------------------------------------
523 // Function : ComplexRateCalculator::ComplexRateCalculator
524 // Purpose : Copy constructor for "complex" reaction rate calculator
525 // Special Notes :
526 // Scope : public
527 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
528 // Creation Date : 7/31/06
529 //-----------------------------------------------------------------------------
531  :rk0(right.rk0),
532  reaction_distance_factor(right.reaction_distance_factor),
533  Tdep(right.Tdep),
534  Specie1(right.Specie1),
535  Specie2(right.Specie2),
536  classC0(right.classC0),
537  coulombAttraction(right.coulombAttraction),
538  myReactionName(right.myReactionName)
539  {
540  }
541 
542 //-----------------------------------------------------------------------------
543 // Function : ComplexRateCalculator::Clone
544 // Purpose : Copy self operation for "complex" reaction rate calculator
545 // Special Notes :
546 // Scope : public
547 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
548 // Creation Date : 7/31/06
549 //-----------------------------------------------------------------------------
551  {
552  return new ComplexRateCalculator(*this);
553  }
554 
555 //-----------------------------------------------------------------------------
556 // Function : ComplexRateCalculator::computeRateConstant
557 // Purpose : returns rate constant for complex rate style
558 // Special Notes :
559 // Scope : public
560 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
561 // Creation Date : 7/31/06
562 //-----------------------------------------------------------------------------
564  {
565 
566  if (Tdep)
567  return(reaction_distance_factor/T);
568  else
569  return(reaction_distance_factor);
570 
571 
572  /* This is always done in reaction->getRate so that Bourgoin Corbett effects can
573  be properly incorporated. --LCM
574  if (Tdep)
575  return(reaction_distance_factor/T*(Specie1->getDiffusionCoefficient(T)
576  +Specie2->getDiffusionCoefficient(T)));
577  else
578  return(reaction_distance_factor*(Specie1->getDiffusionCoefficient(T)
579  +Specie2->getDiffusionCoefficient(T)));
580  */
581 
582  }
583 
584 
585 //-----------------------------------------------------------------------------
586 // Function : ComplexRateCalculator::computeRateConstant
587 // Purpose : returns rate constant for complex rate style
588 // Special Notes :
589 // Scope : public
590 // Creator : Lawrence C Musson, SNL
591 // Creation Date : 04/17/2014
592 //-----------------------------------------------------------------------------
594  std::vector<double> &concs,
595  std::vector<double> &constant_vec)
596  {
597  if (Tdep)
598  return(reaction_distance_factor/T);
599  else
600  return(reaction_distance_factor);
601 
602  /* This is always done in reaction->getRate so that Bourgoin Corbett effects can
603  be properly incorporated. --LCM
604  if (Tdep)
605  return(reaction_distance_factor/T*(Specie1->getDiffusionCoefficient(T,concs,constant_vec)
606  +Specie2->getDiffusionCoefficient(T)));
607  else
608  return(reaction_distance_factor*(Specie1->getDiffusionCoefficient(T,concs,constant_vec)
609  +Specie2->getDiffusionCoefficient(T,concs,constant_vec)));
610  */
611 
612  }
613 
614 //-----------------------------------------------------------------------------
615 // Function : ComplexRateCalculator::rateConstantScaleFactor
616 // Purpose : returns rate scaling factor for complex rate style
617 // Special Notes :
618 // Scope : public
619 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
620 // Creation Date : 7/31/06
621 //-----------------------------------------------------------------------------
623  {
624  return (rk0);
625  }
626 
627 
628 
629 //-----------------------------------------------------------------------------
630 // Function : ComplexMultiplierRateCalculator::ComplexMultiplierRateCalculator
631 // Purpose : constructor for "complex" reaction rate calculator
632 // This is one that models two discrete species forming a
633 // complex, e.g.:
634 // V0 + VM -> VVM
635 // This method multiplies the rate by a user specified constant
636 // Special Notes : For this to work, there must either be two species in the
637 // reactants list, or one species with 2.0 as the stochiometric
638 // coefficient.
639 // Scope : public
640 // Creator : Lawrence C Musson
641 // Creation Date : 06/26/2014
642 //-----------------------------------------------------------------------------
644  std::vector<Specie> &VariableSpecies, std::vector<Specie> &ConstantSpecies,
645  std::vector< std::pair<int,double> > &Reactants,
646  double C0, double t0, double x0, double mult)
647  {
648  int ij;
649 
650  multiplier = mult;
651 
652  myReactionName = "Complex Multiplier Rate Calculator";
653  // Check assumptions:
654  if ( ! ((Reactants.size() == 1 && Reactants[0].second == 2.0) ||
655  (Reactants.size() == 2 && Reactants[0].second == 1.0 &&
656  Reactants[1].second == 1.0)))
657  {
658  Report::UserError msg;
659  msg <<"Invalid attempt to use complex rate method. This method is only valid for binary complexing reactions:\n";
660  if (Reactants.size() == 1)
661  {
662  msg << " Only one reactant specified, but its stoichimetric coefficient is not 2.";
663  }
664  else if (Reactants.size() == 2)
665  {
666  msg << " Two reactants specified, but both stoichimetric coefficient are not 1.";
667  }
668  else
669  {
670  msg << " More than two reactants specified.";
671  }
672  }
673 
674  if (Reactants[0].first >= 0)
675  Specie1 = &(VariableSpecies[Reactants[0].first]);
676  else
677  Specie1 = &(ConstantSpecies[-(Reactants[0].first+1)]);
678 
679  // Handle case where there's only one species with a coefficient of 2.0
680  if (Reactants.size() == 1)
681  {
682  Specie2 = Specie1; // that way we can just treat as A+A instead of 2A
683  }
684  else
685  {
686  if (Reactants[1].first >= 0)
687  Specie2 = &(VariableSpecies[Reactants[1].first]);
688  else
689  Specie2 = &(ConstantSpecies[-(Reactants[1].first+1)]);
690  }
691  ij =Specie1->getChargeState();
692  ij *=Specie2->getChargeState();
693 
694 
695 
696  // Only divide reaction_distance_factor by T in one special case
697 
698  //NOTE: The reaction_distance_factor that is being calculated here no longer
699  //has a distance in it. This is because this coefficient is being calculated
700  //before there is a known bulk material. And the reaction distance is material
701  //dependent and also a function of concentration in gallium arsenide. -- LCM
702  Tdep=false;
703  if (ij>0)
705  else if (ij == 0)
706  {
707  coulombAttraction = false;
708  //reaction_distance_factor = 4*M_PI*5.0e-8;
710  chargeNumberProduct = 0.0;
711  }
712  else
713  {
714  coulombAttraction = true;
715  //reaction_distance_factor = 4*M_PI*1.4e-4*(-ij);
717  chargeNumberProduct = -(double)ij;
718  Tdep=true;
719  }
720 
721  setScaleFactors(C0,t0,x0);
722  }
723 
724 
725 //-----------------------------------------------------------------------------
726 // Function : ComplexMultiplierRateCalculator::ComplexMultiplierRateCalculator
727 // Purpose : Copy constructor for "complex" reaction rate calculator
728 // Special Notes :
729 // Scope : public
730 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
731 // Creation Date : 7/31/06
732 //-----------------------------------------------------------------------------
734  :rk0(right.rk0),
735  reaction_distance_factor(right.reaction_distance_factor),
736  Tdep(right.Tdep),
737  Specie1(right.Specie1),
738  Specie2(right.Specie2),
739  myReactionName(right.myReactionName)
740  {
741  }
742 
743 //-----------------------------------------------------------------------------
744 // Function : ComplexMultiplierRateCalculator::Clone
745 // Purpose : Copy self operation for "complex" reaction rate calculator
746 // Special Notes :
747 // Scope : public
748 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
749 // Creation Date : 7/31/06
750 //-----------------------------------------------------------------------------
752  {
753  return new ComplexMultiplierRateCalculator(*this);
754  }
755 
756 //-----------------------------------------------------------------------------
757 // Function : ComplexMultiplierRateCalculator::computeRateConstant
758 // Purpose : returns rate constant for complex rate style
759 // Special Notes :
760 // Scope : public
761 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
762 // Creation Date : 7/31/06
763 //-----------------------------------------------------------------------------
765  {
766  if (Tdep)
769  else
772 
773  }
774 
775 
776 //-----------------------------------------------------------------------------
777 // Function : ComplexMultiplierRateCalculator::computeRateConstant
778 // Purpose : returns rate constant for complex rate style
779 // Special Notes :
780 // Scope : public
781 // Creator : Lawrence C Musson, SNL
782 // Creation Date : 04/17/2014
783 //-----------------------------------------------------------------------------
785  std::vector<double> &concs,
786  std::vector<double> &constant_vec)
787  {
788  if (Tdep)
789  return(multiplier*reaction_distance_factor/T*(Specie1->getDiffusionCoefficient(T,concs,constant_vec)
791  else
793  +Specie2->getDiffusionCoefficient(T,concs,constant_vec)));
794 
795  }
796 
797 //-----------------------------------------------------------------------------
798 // Function : ComplexMultiplierRateCalculator::rateConstantScaleFactor
799 // Purpose : returns rate scaling factor for complex rate style
800 // Special Notes :
801 // Scope : public
802 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
803 // Creation Date : 7/31/06
804 //-----------------------------------------------------------------------------
806  {
807  return (rk0);
808  }
809 
810 
811 
812 
813 
814 //-----------------------------------------------------------------------------
815 // Function : DecomplexRateCalculator::DecomplexRateCalculator
816 // Purpose : constructor for "complex" reaction rate calculator
817 // This is one that models two discrete species decomposing from
818 // a complex, e.g.:
819 // VMM->V0 + VM
820 //
821 // Special Notes : For this to work, there must either be two species in the
822 // products list, or one species with 2.0 as the stochiometric
823 // coefficient.
824 // Scope : public
825 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
826 // Creation Date : 5/04/09
827 //-----------------------------------------------------------------------------
829  std::vector<Specie> &VariableSpecies, std::vector<Specie> &ConstantSpecies,
830  std::vector< std::pair<int,double> > &Reactants,
831  std::vector< std::pair<int,double> > &Products,
832  double bindingEnergy, double degenAB, double degenA, double degenB,
833  double siliconConcentration,
834  double C0, double t0, double x0)
835  :concSi(siliconConcentration),
836  c0(C0),
837  gammaAB(degenAB),
838  gammaA(degenA),
839  gammaB(degenB),
840  deltaE(bindingEnergy)
841  {
842  int ij;
843 
844  myReactionName = "Decomplex Rate Calculator";
845 
846  // Check assumptions:
847  if ( ! ((Products.size() == 1 && Products[0].second == 2.0) ||
848  (Products.size() == 2 && Products[0].second == 1.0 &&
849  Products[1].second == 1.0)))
850  {
851  Report::UserError msg;
852  msg << "Invalid attempt to use decomplex rate method. This method is only valid for decomplexing reactions with two products:\n";
853  if (Products.size() == 1)
854  {
855  msg << " Only one product specified, but its stoichimetric coefficient is not 2.";
856  }
857  else if (Products.size() == 2)
858  {
859  msg << " Two products specified, but both stoichimetric coefficient are not 1.";
860  }
861  else
862  {
863  msg << " More than two products specified.";
864  }
865  }
866 
867  if (Products[0].first >= 0)
868  Specie1 = &(VariableSpecies[Products[0].first]);
869  else
870  Specie1 = &(ConstantSpecies[-(Products[0].first+1)]);
871 
872  // Handle case where there's only one species with a coefficient of 2.0
873  if (Products.size() == 1)
874  {
875  Specie2 = Specie1; // that way we can just treat as A+A instead of 2A
876  }
877  else
878  {
879  if (Products[1].first >= 0)
880  Specie2 = &(VariableSpecies[Products[1].first]);
881  else
882  Specie2 = &(ConstantSpecies[-(Products[1].first+1)]);
883  }
884  ij =Specie1->getChargeState();
885  ij *=Specie2->getChargeState();
886 
887 
888  // Only divide reaction_distance_factor by T in one special case
889 
890  //NOTE: The reaction_distance_factor that is being calculated here no longer
891  //has a distance in it. This is because this coefficient is being calculated
892  //before there is a known bulk material. And the reaction distance is material
893  //dependent and also a function of concentration in gallium arsenide. -- LCM
894  Tdep=false;
895  if (ij>0)
897  else if (ij == 0)
898  {
899  coulombAttraction = false;
901  chargeNumberProduct = 0.0;
902  }
903  else
904  {
905  coulombAttraction = true;
907  chargeNumberProduct = -(double)ij;
908  Tdep=true;
909  }
910 
911  setScaleFactors(C0,t0,x0);
912  }
913 
914 
915 //-----------------------------------------------------------------------------
916 // Function : DecomplexRateCalculator::DecomplexRateCalculator
917 // Purpose : Copy constructor for "decomplex" reaction rate calculator
918 // Special Notes :
919 // Scope : public
920 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
921 // Creation Date : 5/04/09
922 //-----------------------------------------------------------------------------
924  :Specie1(right.Specie1),
925  Specie2(right.Specie2),
926  reaction_distance_factor(right.reaction_distance_factor),
927  Tdep(right.Tdep),
928  deltaE(right.deltaE),
929  gammaA(right.gammaA),
930  gammaB(right.gammaB),
931  gammaAB(right.gammaAB),
932  concSi(right.concSi),
933  rk0(right.rk0),
934  c0(right.c0),
935  myReactionName(right.myReactionName)
936  {
937  }
938 
939 //-----------------------------------------------------------------------------
940 // Function : DecomplexRateCalculator::Clone
941 // Purpose : Copy self operation for "decomplex" reaction rate calculator
942 // Special Notes :
943 // Scope : public
944 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
945 // Creation Date : 7/31/06
946 //-----------------------------------------------------------------------------
948  {
949  return new DecomplexRateCalculator(*this);
950  }
951 
952 
953 //-----------------------------------------------------------------------------
954 // Function : DecomplexRateCalculator::computeRateConstant
955 // Purpose : returns rate constant for decomplex rate style
956 // Special Notes :
957 // Scope : public
958 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
959 // Creation Date : 7/31/06
960 //-----------------------------------------------------------------------------
962  {
963  double R;
964  double KbT=CONSTboltz*T/CONSTQ;
965  double k;
966  double D1=Specie1->getDiffusionCoefficient(T);
967  double D2=Specie2->getDiffusionCoefficient(T);
968  if (Tdep)
970  else
972 
973  //k=(R*(D1 +D2)*(concSi)*((gammaA*gammaB)/gammaAB)*exp(-deltaE/KbT));
974 
975  k=(R*(concSi)*((gammaA*gammaB)/gammaAB)*exp(-deltaE/KbT));
976 
977  return k;
978  }
979 
980 
981 //-----------------------------------------------------------------------------
982 // Function : DecomplexRateCalculator::computeRateConstant
983 // Purpose : returns rate constant for decomplex rate style
984 // Special Notes :
985 // Scope : public
986 // Creator : Lawrence C Musson, SNL
987 // Creation Date : 04/17/2014
988 //-----------------------------------------------------------------------------
990  std::vector<double> &concs,
991  std::vector<double> &constant_vec)
992  {
993  double R;
994  double KbT=CONSTboltz*T/CONSTQ;
995  double k;
996  double D1=Specie1->getDiffusionCoefficient(T,concs,constant_vec);
997  double D2=Specie2->getDiffusionCoefficient(T,concs,constant_vec);
998  if (Tdep)
1000  else
1002 
1003  //k=(R*(D1 +D2)*(concSi)*((gammaA*gammaB)/gammaAB)*exp(-deltaE/KbT));
1004 
1005  k=(R*(concSi)*((gammaA*gammaB)/gammaAB)*exp(-deltaE/KbT));
1006 
1007  return k;
1008  }
1009 
1010 //-----------------------------------------------------------------------------
1011 // Function : DecomplexRateCalculator::rateConstantScaleFactor
1012 // Purpose : returns rate scaling factor for decomplex rate style
1013 // Special Notes :
1014 // Scope : public
1015 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
1016 // Creation Date : 7/31/06
1017 //-----------------------------------------------------------------------------
1019  {
1020  return (rk0);
1021  }
1022 
1023 
1024 
1025 
1026 //-----------------------------------------------------------------------------
1027 // Function : BourgoinCorbettRateCalculator::BourgoinCorbettRateCalculator
1028 // Purpose : constructor for "bourgoin corbett" reaction rate calculator
1029 // This is one that models two discrete species decomposing from
1030 // a complex, e.g.:
1031 // SII0 + B0 + H -> BI0
1032 //
1033 // Special Notes :
1034 // Scope : public
1035 // Creator : Lawrence C Musson, SNL
1036 // Creation Date : 03/24/2014
1037 //-----------------------------------------------------------------------------
1039  std::vector<Specie> &VariableSpecies, std::vector<Specie> &ConstantSpecies,
1040  std::vector< std::pair<int,double> > &Reactants,
1041  std::vector< std::pair<int,double> > &Products,
1042  double sigma,
1043  double C0, double t0, double x0)
1044  :c0(C0)
1045  {
1046  int ij;
1047 
1048  // Check assumptions:
1049  if ( ! (Reactants.size() == 3 && Reactants[0].second == 1.0 &&
1050  Reactants[1].second == 1.0 && Reactants[2].second == 1.0) )
1051  {
1052  Report::UserError() << "Invalid attempt to use rate method. This method is only valid for ternary reactions";
1053  }
1054 
1055  if (Reactants[0].first >= 0)
1056  Specie1 = &(VariableSpecies[Reactants[0].first]);
1057  else
1058  Specie1 = &(ConstantSpecies[-(Reactants[0].first+1)]);
1059 
1060  // Handle case where there's only one species with a coefficient of 2.0
1061  if (Reactants.size() == 1)
1062  {
1063  Specie2 = Specie1; // that way we can just treat as A+A instead of 2A
1064  }
1065  else
1066  {
1067  if (Reactants[1].first >= 0)
1068  Specie2 = &(VariableSpecies[Reactants[1].first]);
1069  else
1070  Specie2 = &(ConstantSpecies[-(Reactants[1].first+1)]);
1071  }
1072  ij =Specie1->getChargeState();
1073  ij *=Specie2->getChargeState();
1074 
1075  double carrierThermalVelocity;
1076 
1077  if(Reactants[2].first == -1)
1078  carrierThermalVelocity = 20335471.413078606;
1079  else
1080  carrierThermalVelocity = 16805108.930336751;
1081 
1082 
1083  // Only divide reaction_distance_factor by T in one special case
1084  Tdep=false;
1085  if (ij>0)
1087  else if (ij == 0)
1088  {
1089  reaction_distance_factor = 4*M_PI*5.0e-8*sigma* carrierThermalVelocity * 5.0e-8 * 5.0e-8/6.0;
1090  //reaction_distance_factor = 4*M_PI*5.43e-8;
1091  //reaction_distance_factor = 4*3.1416*5.43e-8;
1092  }
1093  else
1094  {
1095  reaction_distance_factor = 4*M_PI*1.4e-4*(-ij)*sigma*carrierThermalVelocity*5.0e-8*5.0e-8/6.0;
1096  //reaction_distance_factor = 4*M_PI*1.40419676681412915e-4*(-ij)*sigma*carrierThermalVelocity*5.0e-8*5.0e-8/6.0;
1097  Tdep=true;
1098  }
1099 
1100  setScaleFactors(C0,t0,x0);
1101  }
1102 
1103 
1104 //-----------------------------------------------------------------------------
1105 // Function : BourgoinCorbettHoleRateCalculator::BourgoinCorbettHoleRateCalculator
1106 // Purpose : Copy constructor
1107 // Special Notes :
1108 // Scope : public
1109 // Creator : Lawrence C Musson, SNL
1110 // Creation Date : 03/24/2014
1111 //-----------------------------------------------------------------------------
1113  :Specie1(right.Specie1),
1114  Specie2(right.Specie2),
1115  reaction_distance_factor(right.reaction_distance_factor),
1116  Tdep(right.Tdep),
1117  sigma(right.sigma),
1118  rk0(right.rk0),
1119  c0(right.c0)
1120  {
1121  }
1122 
1123 //-----------------------------------------------------------------------------
1124 // Function : BourgoinCorbettHoleRateCalculator::Clone
1125 // Purpose : Copy self operation for "decomplex" reaction rate calculator
1126 // Special Notes :
1127 // Scope : public
1128 // Creator : Lawrence C Musson, SNL
1129 // Creation Date : 03/24/2014
1130 //-----------------------------------------------------------------------------
1132  {
1133  return new BourgoinCorbettHoleRateCalculator(*this);
1134  }
1135 
1136 
1137 //-----------------------------------------------------------------------------
1138 // Function : BourgoinCorbettHoleRateCalculator::computeRateConstant
1139 // Purpose : returns rate constant for decomplex rate style
1140 // Special Notes :
1141 // Scope : public
1142 // Creator : Lawrence C Musson, SNL
1143 // Creation Date : 03/24/2014
1144 //-----------------------------------------------------------------------------
1146  {
1147  double R;
1148  double KbT=CONSTboltz*T/CONSTQ;
1149  double k;
1150  double D1=Specie1->getDiffusionCoefficient(T);
1151  double D2=Specie2->getDiffusionCoefficient(T);
1152  if (Tdep)
1154  else
1156 
1157  k=R;
1158 
1159  return k;
1160  }
1161 
1162 
1163 //-----------------------------------------------------------------------------
1164 // Function : BourgoinCorbettHoleRateCalculator::computeRateConstant
1165 // Purpose : returns rate constant for decomplex rate style
1166 // Special Notes :
1167 // Scope : public
1168 // Creator : Lawrence C Musson, SNL
1169 // Creation Date : 03/24/2014
1170 //-----------------------------------------------------------------------------
1172  std::vector<double> &concs,
1173  std::vector<double> &constant_vec)
1174  {
1175  double R;
1176  double KbT=CONSTboltz*T/CONSTQ;
1177  double k;
1178  double D1=Specie1->getDiffusionCoefficient(T);
1179  double D2=Specie2->getDiffusionCoefficient(T);
1180  if (Tdep)
1182  else
1184 
1185  k=R;
1186 
1187  return k;
1188  }
1189 
1190 //-----------------------------------------------------------------------------
1191 // Function : BourgoinCorbettHoleRateCalculator::rateConstantScaleFactor
1192 // Purpose : returns rate scaling factor for decomplex rate style
1193 // Special Notes :
1194 // Scope : public
1195 // Creator : Lawrence C Musson, SNL
1196 // Creation Date : 03/24/2014
1197 //-----------------------------------------------------------------------------
1199  {
1200  return (rk0);
1201  }
1202 
1203 
1204 
1205 
1206 } // namespace Device
1207 } // namespace Xyce
FDEmissionRateCalculator(double sigma, double Energy, double v, double C0, double t0, double x0)
Rate constant calculator for Electron or Hole emission reaction.
virtual void setScaleFactors(double C0, double t0, double x0)
set concentration, time, and space scale factors (space scale factor is currently unused by any calcu...
ScalarT getDiffusionCoefficient(ScalarT Temperature)
Definition: N_DEV_Specie.h:129
EmissionRateCalculator(double sigma, double v, double N, double Energy, double C0, double t0, double x0)
virtual double rateConstantScaleFactor()
return current scale factor for rate constant
#define CONSTQ
Definition: N_DEV_Const.h:51
virtual double computeRateConstant(double T)
return rate constant at given temperature
virtual void setScaleFactors(double iC0, double t0, double x0)
set concentration, time, and space scale factors (space scale factor is currently unused by any calcu...
Pure virtual class to augment a linear system.
Rate constant calculator for Electron or Hole emission reaction.
virtual EmissionRateCalculator * Clone()
create a copy of this calculator
virtual void setScaleFactors(double C0, double t0, double x0)
set concentration, time, and space scale factors (space scale factor is currently unused by any calcu...
ComplexRateCalculator(std::vector< Specie > &VariableSpecies, std::vector< Specie > &ConstantSpecies, std::vector< std::pair< int, double > > &Reactants, double C0, double t0, double x0)
virtual double rateConstantScaleFactor()
return current scale factor for rate constant
virtual void setScaleFactors(double C0, double t0, double x0)
set concentration, time, and space scale factors (space scale factor is currently unused by any calcu...
virtual void setScaleFactors(double C0, double t0, double x0)
set concentration, time, and space scale factors (space scale factor is currently unused by any calcu...
virtual BourgoinCorbettHoleRateCalculator * Clone()
create a copy of this calculator
virtual void setScaleFactors(double C0, double t0, double x0)
set concentration, time, and space scale factors (space scale factor is currently unused by any calcu...
virtual ComplexRateCalculator * Clone()
create a copy of this calculator
virtual SimpleRateCalculator * Clone()
create a copy of this calculator
ComplexMultiplierRateCalculator(std::vector< Specie > &VariableSpecies, std::vector< Specie > &ConstantSpecies, std::vector< std::pair< int, double > > &Reactants, double C0, double t0, double x0, double multiplier)
virtual double computeRateConstant(double T)
return rate constant at given temperature
SimpleRateCalculator(double k, double C0, double t0, double x0)
virtual double computeRateConstant(double T)
return rate constant at given temperature
virtual ComplexMultiplierRateCalculator * Clone()
create a copy of this calculator
Rate constant calculator for a irreversible two-species complexing reaction.
virtual double rateConstantScaleFactor()
return current scale factor for rate constant
virtual double computeRateConstant(double T)
return rate constant at given temperature
virtual double computeRateConstant(double T)
return rate constant at given temperature
virtual double rateConstantScaleFactor()
return current scale factor for rate constant
virtual double rateConstantScaleFactor()
return current scale factor for rate constant
CaptureRateCalculator(double sigma, double v, double C0, double t0, double x0)
DecomplexRateCalculator(std::vector< Specie > &VariableSpecies, std::vector< Specie > &ConstantSpecies, std::vector< std::pair< int, double > > &Reactants, std::vector< std::pair< int, double > > &Products, double bindingEnergy, double degenAB, double degenA, double degenB, double siliconConcentration, double C0, double t0, double x0)
virtual void setScaleFactors(double C0, double t0, double x0)
set concentration, time, and space scale factors (space scale factor is currently unused by any calcu...
virtual FDEmissionRateCalculator * Clone()
create a copy of this calculator
#define M_PI
virtual double computeRateConstant(double T)
return rate constant at given temperature
virtual double computeRateConstant(double T)
return rate constant at given temperature
Class for trivial, constant rate constant (independent of temperature)
virtual double rateConstantScaleFactor()
return current scale factor for rate constant
BourgoinCorbettHoleRateCalculator(std::vector< Specie > &VariableSpecies, std::vector< Specie > &ConstantSpecies, std::vector< std::pair< int, double > > &Reactants, std::vector< std::pair< int, double > > &Products, double sigma, double C0, double t0, double x0)
virtual double computeRateConstant(double T)
return rate constant at given temperature
Rate constant calculator for Electron or Hole capture reaction.
virtual DecomplexRateCalculator * Clone()
create a copy of this calculator
virtual double rateConstantScaleFactor()
return current scale factor for rate constant
virtual double rateConstantScaleFactor()
return current scale factor for rate constant
virtual void setScaleFactors(double C0, double t0, double x0)
set concentration, time, and space scale factors (space scale factor is currently unused by any calcu...
#define CONSTboltz
Definition: N_DEV_Const.h:53
virtual CaptureRateCalculator * Clone()
create a copy of this calculator