Cantera  2.1.2
FtnTransport.h
Go to the documentation of this file.
1 /**
2  * @file FtnTransport.h
3  *
4  * Customizable Fortran transport manager. This manager calls
5  * external Fortran functions to evaluate the transport
6  * properties. This is designed to be used to build custom transport
7  * managers in Fortran.
8  */
9 
10 // Copyright 2003 California Institute of Technology
11 
12 
13 #ifndef CT_FTNTRANSPORT_H
14 #define CT_FTNTRANSPORT_H
15 
17 
18 
19 /**
20  * Change these definitions to change the names of the Fortran
21  * procedures. If you want to define more than one custom Fortran
22  * transport manager, copy this file, rename the class, and change
23  * these definitions.
24  *
25  * The Fortran procedure names must follow the conventions of the Fortran
26  * compiler. On most unix systems, this means the names must be lowercase,
27  * and must include a trailing underscore.
28  *
29  */
30 #define __VISC__ visc_
31 #define __BULKVISC__ bvisc_
32 #define __TCON__ tcon_
33 #define __TDIFF__ tdiff_
34 #define __MULTIDIFF__ multidiff_
35 #define __MIXDIFF__ mixdiff_
36 #define __SIGMA__ sigma_
37 #define __GETMOBILITIES__ getmobilities_
38 
39 
40 extern "C" {
41 
42  doublereal __VISC__(doublereal* t, doublereal* p, doublereal* x);
43  doublereal __BULKVISC__(doublereal* t, doublereal* p, doublereal* x);
44  doublereal __TCON__(doublereal* t, doublereal* p, doublereal* x);
45 
46  void __TDIFF__(doublereal* t, doublereal* p, doublereal* x, doublereal* dt);
47  void __MULTIDIFF__(doublereal* t, doublereal* p, doublereal* x,
48  integer* ld, doublereal* d);
49  void __MIXDIFF__(doublereal* t, doublereal* p, doublereal* x, doublereal* d);
50  void __BINDIFF__(doublereal* t, doublereal* p, doublereal* x, integer* ld, doublereal* d);
51  doublereal __SIGMA__(doublereal* t, doublereal* p, doublereal* x);
52 
53  doublereal __GETMOBILITIES__(doublereal* t, doublereal* p,
54  doublereal* x, doublereal* mobil);
55 
56 }
57 
58 namespace Cantera
59 {
60 
61 /**
62  * A class that calls external Fortran functions to evaluate
63  * transport properties.
64  * @deprecated Broken and unused
65  */
66 class FtnTransport : public Transport
67 {
68 
69 public:
70 
71  FtnTransport(int model, thermo_t* thermo) : Transport(thermo) {
72  warn_deprecated("FtnTransport", "This class will be removed in Cantera 2.2.");
73  m_model = model;
74  m_x.resize(m_thermo->nSpecies(), 0.0);
75  updateTPX();
76  }
77 
78  virtual int model() {
79  return cFtnTransport + m_model;
80  }
81 
82  virtual doublereal viscosity() {
83  updateTPX();
84  return __VISC__(&m_temp, &m_pres, m_x.begin());
85  }
86 
87  virtual doublereal bulkViscosity() {
88  updateTPX();
89  return __BULKVISC__(&m_temp, &m_pres, m_x.begin());
90  }
91 
92  virtual doublereal thermalConductivity() {
93  updateTPX();
94  return __TCON__(&m_temp, &m_pres, m_x.begin());
95  }
96 
97  virtual doublereal electricalConductivity() {
98  updateTPX();
99  return __SIGMA__(&m_temp, &m_pres, m_x.begin());
100  }
101 
102  virtual void getMobilities(doublereal* mobil) {
103  updateTPX();
104  __GETMOBILITIES__(&m_temp, &m_pres, m_x.begin(), mobil);
105  }
106 
107 
108  virtual void getThermalDiffCoeffs(doublereal* dt) {
109  updateTPX();
110  __TDIFF__(&m_temp, &m_pres, m_x.begin(), dt);
111  }
112 
113  virtual void getBinaryDiffCoeffs(int ld, doublereal* d) {
114  updateTPX();
115  integer ldd = ld;
116  __BINDIFF__(&m_temp, &m_pres, m_x.begin(), &ldd, d);
117  }
118 
119  virtual void getMultiDiffCoeffs(int ld, doublereal* d) {
120  updateTPX();
121  integer ldd = ld;
122  __MULTIDIFF__(&m_temp, &m_pres, m_x.begin(), &ldd, d);
123  }
124 
125  virtual void getMixDiffCoeffs(doublereal* d) {
126  updateTPX();
127  __MIXDIFF__(&m_temp, &m_pres, m_x.begin(), d);
128  }
129 
130 
131 private:
132 
133  void updateTPX() {
134  m_temp = m_thermo->temperature();
135  m_pres = m_thermo->pressure();
136  m_thermo->getMoleFractions(m_x.begin());
137  }
138  doublereal m_temp;
139  doublereal m_pres;
140  vector_fp m_x;
141  int m_model;
142 
143 };
144 
145 }
146 #endif
147 
148 
149 
150 
151 
152 
#define __VISC__
Change these definitions to change the names of the Fortran procedures.
Definition: FtnTransport.h:30
Transport(thermo_t *thermo=0, size_t ndim=1)
Constructor.
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
thermo_t * m_thermo
pointer to the object representing the phase
virtual void getThermalDiffCoeffs(doublereal *dt)
Return a vector of Thermal diffusion coefficients [kg/m/sec].
Definition: FtnTransport.h:108
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 viscosity()
Definition: FtnTransport.h:82
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
Definition: Phase.cpp:519
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
virtual doublereal bulkViscosity()
The bulk viscosity in Pa-s.
Definition: FtnTransport.h:87
A class that calls external Fortran functions to evaluate transport properties.
Definition: FtnTransport.h:66
virtual void getMobilities(doublereal *mobil)
Get the Electrical mobilities (m^2/V/s).
Definition: FtnTransport.h:102
thermo_t & thermo()
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:252
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: ThermoPhase.h:314
doublereal temperature() const
Temperature (K).
Definition: Phase.h:528
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:165
virtual void getMixDiffCoeffs(doublereal *d)
Returns a vector of mixture averaged diffusion coefficients.
Definition: FtnTransport.h:125
virtual doublereal electricalConductivity()
Definition: FtnTransport.h:97
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity in W/m/K.
Definition: FtnTransport.h:92