Cantera  2.4.0
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 
8 // This file is part of Cantera. See License.txt in the top-level directory or
9 // at http://www.cantera.org/license.txt for license and copyright information.
10 
13 
14 using namespace std;
15 
16 namespace Cantera
17 {
18 
19 SolidTransport::SolidTransport() :
20  m_nmobile(0),
21  m_Alam(-1.0),
22  m_Nlam(0),
23  m_Elam(0)
24 {
25  warn_deprecated("Class SolidTransport", "To be removed after Cantera 2.4");
26 }
27 
29 {
30  m_thermo = tr.thermo;
31  tr.thermo = 0;
33  tr.ionConductivity = 0;
35  tr.electConductivity = 0;
37  tr.thermalConductivity = 0;
39  tr.defectDiffusivity = 0;
41  tr.defectActivity = 0;
42  return true;
43 }
44 
45 void SolidTransport::setParameters(const int n, const int k, const doublereal* const p)
46 {
47  switch (n) {
48  case 0:
49  // set the Arrhenius parameters for the diffusion coefficient
50  // of species k.
51  m_sp.push_back(k);
52  m_Adiff.push_back(p[0]);
53  m_Ndiff.push_back(p[1]);
54  m_Ediff.push_back(p[2]);
55  m_nmobile = m_sp.size();
56  break;
57  case 1:
58  // set the thermal conductivity Arrhenius parameters.
59  m_Alam = p[0];
60  m_Nlam = p[2];
61  m_Elam = p[2];
62  break;
63  default:
64  ;
65  }
66  m_work.resize(m_thermo->nSpecies());
67 }
68 
70 {
71  // LTPspecies method
73 }
74 
76 {
77  if (m_nmobile == 0) {
78  // LTPspecies method
80  } else {
81  getMobilities(&m_work[0]);
82  doublereal sum = 0.0;
83  for (size_t k = 0; k < m_thermo->nSpecies(); k++) {
84  sum += m_thermo->charge(k) * m_thermo->moleFraction(k) * m_work[k];
85  }
86  return sum * m_thermo->molarDensity();
87  }
88 }
89 
90 /****************** thermalConductivity ******************************/
91 
93 {
94  if (m_Alam > 0.0) {
95  //legacy test case?
96  doublereal t = m_thermo->temperature();
97  return m_Alam * pow(t, m_Nlam) * exp(-m_Elam/t);
98  } else {
99  // LTPspecies method
101  }
102 }
103 
105 {
106  // LTPspecies method
108 }
109 
111 {
112  // LTPspecies method
114 }
115 
116 void SolidTransport::getMobilities(doublereal* const mobil)
117 {
118  getMixDiffCoeffs(mobil);
119  doublereal t = m_thermo->temperature();
120  doublereal c1 = ElectronCharge / (Boltzmann * t);
121  for (size_t k = 0; k < m_thermo->nSpecies(); k++) {
122  mobil[k] *= c1;
123  }
124 }
125 
126 void SolidTransport::getMixDiffCoeffs(doublereal* const d)
127 {
128  for (size_t k = 0; k < m_thermo->nSpecies(); k++) {
129  d[k] = 0.0;
130  }
131 }
132 }
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:67
thermo_t * thermo
Pointer to the ThermoPhase object: shallow pointer.
doublereal temperature() const
Temperature (K).
Definition: Phase.h:601
virtual doublereal thermalConductivity()
Returns the thermal conductivity of the phase.
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:471
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)
Set model parameters for derived classes.
thermo_t * m_thermo
pointer to the object representing the phase
Header file defining class SolidTransportData.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:266
virtual doublereal electricalConductivity()
Returns the electron conductivity of the phase.
STL namespace.
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...
virtual doublereal ionConductivity()
Returns the ionic conductivity of the phase.
virtual doublereal defectDiffusivity()
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:590
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.
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.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
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.
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:577
const doublereal Boltzmann
Boltzmann&#39;s constant [J/K].
Definition: ct_defs.h:76