Cantera  2.1.2
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 
12 
13 using namespace std;
14 
15 namespace Cantera
16 {
17 
18 SolidTransport::SolidTransport() :
19  Transport() ,
20  m_nmobile(0),
21  m_Adiff(0),
22  m_Ndiff(0),
23  m_Ediff(0),
24  m_sp(0),
25  m_Alam(-1.0),
26  m_Nlam(0),
27  m_Elam(0)
28 {
29 }
30 
31 SolidTransport::SolidTransport(const SolidTransport& right) :
32  Transport(),
33  m_nmobile(0),
34  m_Adiff(0),
35  m_Ndiff(0),
36  m_Ediff(0),
37  m_sp(0),
38  m_Alam(-1.0),
39  m_Nlam(0),
40  m_Elam(0)
41 {
42  /*
43  * Use the assignment operator to do the brunt
44  * of the work for the copy constructor.
45  */
46  *this = right;
47 }
48 
49 SolidTransport& SolidTransport::operator=(const SolidTransport& b)
50 {
51  if (&b != this) {
52  return *this;
53  }
54  Transport::operator=(b);
55 
56  m_nmobile = b.m_nmobile;
57  m_Adiff = b.m_Adiff;
58  m_Ndiff = b.m_Ndiff;
59  m_Ediff = b.m_Ediff;
60  m_sp = b.m_sp;
61  m_Alam = b.m_Alam;
62  m_Nlam = b.m_Nlam;
63  m_Elam = b.m_Elam;
64 
65  return *this;
66 
67 }
68 
70 {
71  SolidTransport* tr = new SolidTransport(*this);
72  return dynamic_cast<Transport*>(tr);
73 }
74 
76 {
77  m_thermo = tr.thermo;
78  tr.thermo = 0;
79  //m_nsp = m_thermo->nSpecies();
80  //m_tmin = m_thermo->minTemp();
81  //m_tmax = m_thermo->maxTemp();
82 
83  // make a local copy of the molecular weights
84  //m_mw.resize(m_nsp, 0.0);
85  //copy(m_thermo->molecularWeights().begin(),
86  // m_thermo->molecularWeights().end(), m_mw.begin());
87 
89  tr.ionConductivity = 0;
91  tr.electConductivity = 0;
93  tr.thermalConductivity = 0;
95  tr.defectDiffusivity = 0;
97  tr.defectActivity = 0;
98 
99  return true;
100 }
101 
102 void SolidTransport::setParameters(const int n, const int k, const doublereal* const p)
103 {
104  warn_deprecated("SolidTransport::setParameters");
105  switch (n) {
106 
107  case 0:
108  // set the Arrhenius parameters for the diffusion coefficient
109  // of species k.
110  m_sp.push_back(k);
111  m_Adiff.push_back(p[0]);
112  m_Ndiff.push_back(p[1]);
113  m_Ediff.push_back(p[2]);
114  m_nmobile = m_sp.size();
115  break;
116 
117  case 1:
118  // set the thermal conductivity Arrhenius parameters.
119  m_Alam = p[0];
120  m_Nlam = p[2];
121  m_Elam = p[2];
122  break;
123 
124  default:
125  ;
126  }
127 
128  m_work.resize(m_thermo->nSpecies());
129 
130 }
131 
133 {
134  // LTPspecies method
136 }
137 
139 {
140  if (m_nmobile == 0) {
141  // LTPspecies method
143  } else {
144  getMobilities(&m_work[0]);
145  int nsp = m_thermo->nSpecies();
146  doublereal sum = 0.0;
147  for (int k = 0; k < nsp; k++) {
148  sum += m_thermo->charge(k) * m_thermo->moleFraction(k) * m_work[k];
149  }
150  return sum * m_thermo->molarDensity();
151  }
152 }
153 
154 /****************** thermalConductivity ******************************/
155 
157 {
158  if (m_Alam > 0.0) {
159  //legacy test case?
160  doublereal t = m_thermo->temperature();
161  return m_Alam * pow(t, m_Nlam) * exp(-m_Elam/t);
162  } else {
163  // LTPspecies method
165  }
166 }
167 
169 {
170  // LTPspecies method
172 }
173 
175 {
176  // LTPspecies method
178 }
179 
180 void SolidTransport::getMobilities(doublereal* const mobil)
181 {
182  getMixDiffCoeffs(mobil);
183  doublereal t = m_thermo->temperature();
184  doublereal c1 = ElectronCharge / (Boltzmann * t);
185  for (size_t k = 0; k < m_thermo->nSpecies(); k++) {
186  mobil[k] *= c1;
187  }
188 
189 }
190 
191 void SolidTransport::getMixDiffCoeffs(doublereal* const d)
192 {
193  size_t nsp = m_thermo->nSpecies();
194  for (size_t k = 0; k < nsp; k++) {
195  d[k] = 0.0;
196  }
197 }
198 }
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 pure species transport property.
Definition: LTPspecies.cpp:96
thermo_t * thermo
Pointer to the ThermoPhase object.
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:76
virtual doublereal electricalConductivity()
Returns the electron conductivity of the phase.
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:597
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:252
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:524
doublereal temperature() const
Temperature (K).
Definition: Phase.h:528
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.
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
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:78
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:504