antioch-0.4.0
blottner_parsing.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 
28 
29 // Antioch
33 
34 // C++
35 #include <fstream>
36 #include <iostream>
37 
38 namespace Antioch
39 {
40  template<class NumericType>
42  const std::string &filename )
43  {
44  std::ifstream in(filename.c_str());
45  if(!in.is_open())
46  {
47  std::cerr << "ERROR: unable to load file " << filename << std::endl;
48  antioch_error();
49  }
50 
51  // skip the header
52  skip_comment_lines(in, '#');
53 
54  std::string name;
55  NumericType a, b, c;
56 
57  while (in.good())
58  {
59  in >> name; // Species Name
60  in >> a; //
61  in >> b; //
62  in >> c; //
63 
64  // If we are still good, we have a valid set of transport
65  // data for this species. Otherwise, we read past end-of-file
66  // in the section above
67  if (in.good())
68  {
69  const ChemicalMixture<NumericType>& chem_mixture = mu.chemical_mixture();
70 
71  // Check if this is a species we want.
72  if( chem_mixture.species_name_map().find(name) !=
73  chem_mixture.species_name_map().end() )
74  {
75  // Pack up coefficients
76  std::vector<NumericType> coeffs(3);
77  coeffs[0] = a;
78  coeffs[1] = b;
79  coeffs[2] = c;
80  mu.add(name, coeffs);
81  }
82  }
83 
84  }
85  in.close();
86  return;
87  }
88 
89  template<class NumericType>
91  {
93  }
94 
95  // Instantiate
97 
98 } // end namespace Antioch
ANTIOCH_BLOTTNER_PARSING_INSTANTIATE()
const ChemicalMixture< CoeffType > & chemical_mixture() const
method to send this back
Container class for species viscosities.
#define antioch_error()
void read_blottner_data_ascii_default(MixtureViscosity< BlottnerViscosity< NumericType >, NumericType > &mu)
const std::map< std::string, Species > & species_name_map() const
static const std::string & blottner_data()
Class storing chemical mixture properties.
The parameters are reduced parameters.
void read_blottner_data_ascii(MixtureViscosity< BlottnerViscosity< NumericType >, NumericType > &mu, const std::string &filename)
void skip_comment_lines(std::istream &in, const char comment_start)
Skip comment lines in the header of an ASCII text file prefixed with the comment character 'comment_s...
Definition: input_utils.h:46

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