Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SolidTransport.cpp
Go to the documentation of this file.
1 /**
2  * @file SolidTransport.cpp
3  * Definition file for the class SolidTransport, which handles transport
4  * of ions within solid phases
5  * (see \ref tranprops and \link Cantera::SolidTransport SolidTransport \endlink).
6  */
7 // copyright 2008 California Institute of Technology
8 
11 
12 using namespace std;
13 
14 namespace Cantera
15 {
16 
17 SolidTransport::SolidTransport() :
18  m_nmobile(0),
19  m_Alam(-1.0),
20  m_Nlam(0),
21  m_Elam(0)
22 {
23 }
24 
25 SolidTransport::SolidTransport(const SolidTransport& right) :
26  m_nmobile(0),
27  m_Alam(-1.0),
28  m_Nlam(0),
29  m_Elam(0)
30 {
31  /*
32  * Use the assignment operator to do the brunt
33  * of the work for the copy constructor.
34  */
35  *this = right;
36 }
37 
38 SolidTransport& SolidTransport::operator=(const SolidTransport& b)
39 {
40  if (&b != this) {
41  return *this;
42  }
43  Transport::operator=(b);
44 
45  m_nmobile = b.m_nmobile;
46  m_Adiff = b.m_Adiff;
47  m_Ndiff = b.m_Ndiff;
48  m_Ediff = b.m_Ediff;
49  m_sp = b.m_sp;
50  m_Alam = b.m_Alam;
51  m_Nlam = b.m_Nlam;
52  m_Elam = b.m_Elam;
53 
54  return *this;
55 
56 }
57 
59 {
60  SolidTransport* tr = new SolidTransport(*this);
61  return dynamic_cast<Transport*>(tr);
62 }
63 
65 {
66  m_thermo = tr.thermo;
67  tr.thermo = 0;
69  tr.ionConductivity = 0;
71  tr.electConductivity = 0;
73  tr.thermalConductivity = 0;
75  tr.defectDiffusivity = 0;
77  tr.defectActivity = 0;
78 
79  return true;
80 }
81 
82 void SolidTransport::setParameters(const int n, const int k, const doublereal* const p)
83 {
84  warn_deprecated("SolidTransport::setParameters");
85  switch (n) {
86 
87  case 0:
88  // set the Arrhenius parameters for the diffusion coefficient
89  // of species k.
90  m_sp.push_back(k);
91  m_Adiff.push_back(p[0]);
92  m_Ndiff.push_back(p[1]);
93  m_Ediff.push_back(p[2]);
94  m_nmobile = m_sp.size();
95  break;
96 
97  case 1:
98  // set the thermal conductivity Arrhenius parameters.
99  m_Alam = p[0];
100  m_Nlam = p[2];
101  m_Elam = p[2];
102  break;
103 
104  default:
105  ;
106  }
107 
108  m_work.resize(m_thermo->nSpecies());
109 
110 }
111 
113 {
114  // LTPspecies method
116 }
117 
119 {
120  if (m_nmobile == 0) {
121  // LTPspecies method
123  } else {
124  getMobilities(&m_work[0]);
125  doublereal sum = 0.0;
126  for (size_t k = 0; k < m_thermo->nSpecies(); k++) {
127  sum += m_thermo->charge(k) * m_thermo->moleFraction(k) * m_work[k];
128  }
129  return sum * m_thermo->molarDensity();
130  }
131 }
132 
133 /****************** thermalConductivity ******************************/
134 
136 {
137  if (m_Alam > 0.0) {
138  //legacy test case?
139  doublereal t = m_thermo->temperature();
140  return m_Alam * pow(t, m_Nlam) * exp(-m_Elam/t);
141  } else {
142  // LTPspecies method
144  }
145 }
146 
148 {
149  // LTPspecies method
151 }
152 
154 {
155  // LTPspecies method
157 }
158 
159 void SolidTransport::getMobilities(doublereal* const mobil)
160 {
161  getMixDiffCoeffs(mobil);
162  doublereal t = m_thermo->temperature();
163  doublereal c1 = ElectronCharge / (Boltzmann * t);
164  for (size_t k = 0; k < m_thermo->nSpecies(); k++) {
165  mobil[k] *= c1;
166  }
167 
168 }
169 
170 void SolidTransport::getMixDiffCoeffs(doublereal* const d)
171 {
172  size_t nsp = m_thermo->nSpecies();
173  for (size_t k = 0; k < nsp; k++) {
174  d[k] = 0.0;
175  }
176 }
177 }
LTPspecies * defectDiffusivity
Model type for the defectDiffusivity – or more like a defect diffusivity in the context of the solid ...
virtual void getMixDiffCoeffs(doublereal *const d)
Returns a vector of mixture averaged diffusion coefficients.
virtual doublereal getSpeciesTransProp()
Returns the vector of standard state species transport property.
Definition: LTPspecies.cpp:92
thermo_t * thermo
Pointer to the ThermoPhase object: shallow pointer.
virtual doublereal thermalConductivity()
Returns the thermal conductivity of the phase.
LTPspecies * defectActivity
Model type for the defectActivity.
vector_fp m_Adiff
Coefficient for the diffusivity of species within a solid.
virtual void setParameters(const int n, const int k, const doublereal *const p)
virtual Transport * duplMyselfAsTransport() const
Duplication routine for objects which inherit from Transport.
thermo_t * m_thermo
pointer to the object representing the phase
Header file defining class SolidTransportData.
Base class for transport property managers.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:78
virtual doublereal electricalConductivity()
Returns the electron conductivity of the phase.
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:663
virtual void getMobilities(doublereal *const mobil)
Get the Electrical mobilities (m^2/V/s).
vector_fp m_Ndiff
Temperature power coefficient for the diffusivity of species in a solid.
LTPspecies * electConductivity
Model type for the electrical conductivity.
Header file for defining the class SolidTransport, which handles transport of ions within solid phase...
Class SolidTransport implements transport properties for solids.
virtual doublereal ionConductivity()
Returns the ionic conductivity of the phase.
virtual doublereal defectDiffusivity()
LTPspecies * m_electConductivity
Model type for the electrical conductivity.
LTPspecies * m_ionConductivity
Model type for the ionic conductivity.
LTPspecies * m_defectDiffusivity
Model type for the defectDiffusivity – or more like a defect diffusivity in the context of the solid ...
doublereal m_Alam
Coefficient for the thermal conductivity of a solid.
LTPspecies * m_thermalConductivity
Model type for the thermal conductivity.
virtual doublereal defectActivity()
The activity of defects in the solid.
doublereal m_Elam
Arrhenius factor for the thermal conductivity of a solid.
vector_int m_sp
Index of mobile species to global species.
virtual bool initSolid(SolidTransportData &tr)
Initialize the transport object.
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:265
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:561
doublereal temperature() const
Temperature (K).
Definition: Phase.h:602
LTPspecies * ionConductivity
Model type for the ionic conductivity.
vector_fp m_work
extra fp array of length nSpecies()
LTPspecies * thermalConductivity
Model type for the thermal conductivity.
doublereal m_Nlam
Temperature power coefficient for the thermal conductivity of a solid.
LTPspecies * m_defectActivity
Model type for the defectActivity.
size_t m_nmobile
number of mobile species
Class SolidTransportData holds transport parameters for a specific solid-phase species.
vector_fp m_Ediff
Arrhenius factor for the species diffusivities of a solid.
const doublereal Boltzmann
Boltzmann's constant [J/K].
Definition: ct_defs.h:76
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Definition: Phase.h:578