antioch-0.4.0
transport_mixture.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 // Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA 02110-1301 USA
24 //
25 //-----------------------------------------------------------------------el-
26 
27 // This class
29 
30 // Antioch
32 #include "antioch/ascii_parser.h"
33 #include "antioch/xml_parser.h"
34 #include "antioch/chemkin_parser.h"
35 
36 namespace Antioch
37 {
38  template<typename CoeffType>
40  const std::string & filename, bool verbose, ParsingType type )
41  : _chemical_mixture( chem_mix),
42  _transport_species(_chemical_mixture.n_species(), NULL )
43  {
44 
45  ParserBase<CoeffType> * parser(NULL);
46  switch(type)
47  {
48  case ASCII:
49  parser = new ASCIIParser<CoeffType>(filename,verbose);
50  break;
51  case CHEMKIN:
52  parser = new ChemKinParser<CoeffType>(filename,verbose);
53  break;
54  case XML:
55  parser = new XMLParser<CoeffType>(filename,verbose);
56  break;
57  default:
58  antioch_parsing_error("unknown type");
59  }
60 
61  // Now read in transport properties for the requested species and stash
62  read_transport_species_data(parser,*this);
63 
64  // check we have everyone requested
65  for( unsigned int s = 0; s < _transport_species.size(); ++s )
66  {
67  if(!_transport_species[s]) // it is not mandatory, Blottner or Sutherland are self-sufficient
68  {
69  std::cerr << "Warning: missing transport data for species "
70  << _chemical_mixture.species_inverse_name_map().at(_chemical_mixture.species_list()[s])
71  << "\n"
72  << "Be sure to use a transport model that does not require the default data"
73  << std::endl;
74  }
75  }
76 
77  delete parser;
78  }
79 
80  template<typename CoeffType>
82  ParserBase<CoeffType> * parser)
83  : _chemical_mixture( mixture),
84  _transport_species(_chemical_mixture.n_species(), NULL )
85  {
86  // Now read in transport properties for the requested species and stash
87  read_transport_species_data(parser,*this);
88 
89  // check we have everyone requested
90  for( unsigned int s = 0; s < _transport_species.size(); ++s )
91  {
92  if(!_transport_species[s]) // it is not mandatory, Blottner or Sutherland are self-sufficient
93  {
94  std::cerr << "Warning: missing transport data for species " << _chemical_mixture.species_inverse_name_map().at(
95  _chemical_mixture.species_list()[s]) << "\n"
96  << "Be sure to use a transport model that does not require the default data"
97  << std::endl;
98  }
99  }
100 
101  return;
102 
103  }
104 
105  template<typename CoeffType>
107  {
108  // Clean up all the TransportSpecies we stored
109  for( typename std::vector<TransportSpecies<CoeffType>* >::iterator it = _transport_species.begin();
110  it < _transport_species.end(); ++it )
111  {
112  delete (*it);
113  }
114  }
115 
116  template<typename CoeffType>
117  void TransportMixture<CoeffType>::add_species( const unsigned int index,
118  CoeffType LJ_depth,
119  CoeffType LJ_diameter,
120  CoeffType dipole_moment,
121  CoeffType polarizability,
122  CoeffType rotational_relaxation,
123  CoeffType mass)
124  {
125  Species name_enum = _chemical_mixture.species_list()[index];
126 
127  _transport_species[index] = new TransportSpecies<CoeffType>(name_enum,
128  LJ_depth,
129  LJ_diameter,
130  dipole_moment,
131  polarizability,
132  rotational_relaxation,mass);
133  }
134 
135 } // end namespace Antioch
136 
137 // Instantiate
std::vector< TransportSpecies< CoeffType > * > _transport_species
void read_transport_species_data(ParserBase< NumericType > *parser, TransportMixture< NumericType > &transport)
Class to encapsulate data relevant for transport for each chemical species.
void add_species(const unsigned int index, CoeffType LJ_depth, CoeffType LJ_diameter, CoeffType dipole_moment, CoeffType polarizability, CoeffType rotational_relaxation, CoeffType mass)
Class storing chemical mixture properties.
Definition: ascii_parser.h:55
const ChemicalMixture< CoeffType > & _chemical_mixture
Nothing is stored, this parser is based on the tinyxml2 implementation.
#define antioch_parsing_error(description)
Class storing chemical mixture properties.
The parameters are reduced parameters.
ANTIOCH_NUMERIC_TYPE_CLASS_INSTANTIATE(Antioch::TransportMixture)
A parser is an instance related to a file.
ChemKin format file reader.

Generated on Thu Jul 7 2016 11:09:46 for antioch-0.4.0 by  doxygen 1.8.8