antioch-0.4.0
sutherland_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
32 #include "antioch/input_utils.h"
34 
35 // C++
36 #include <fstream>
37 #include <iostream>
38 
39 namespace Antioch
40 {
41  template<class NumericType>
43  const std::string &filename)
44  {
45  std::ifstream in(filename.c_str());
46  if(!in.is_open())
47  {
48  std::cerr << "ERROR: unable to load file " << filename << std::endl;
49  antioch_error();
50  }
51 
52  // skip the header
53  skip_comment_lines(in, '#');
54 
55  std::string name;
56  NumericType a, b;
57 
58  while (in.good())
59  {
60  in >> name; // Species Name
61  in >> a; //
62  in >> b; //
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(2);
77  coeffs[0] = a;
78  coeffs[1] = b;
79  mu.add(name, coeffs);
80  }
81  }
82  }
83  in.close();
84  }
85 
86  template<class NumericType>
88  {
90  }
91 
92  // Instantiate
94 
95 } // end namespace Antioch
ANTIOCH_SUTHERLAND_PARSING_INSTANTIATE()
const ChemicalMixture< CoeffType > & chemical_mixture() const
method to send this back
Container class for species viscosities.
void read_sutherland_data_ascii_default(MixtureViscosity< SutherlandViscosity< NumericType >, NumericType > &mu)
#define antioch_error()
void read_sutherland_data_ascii(MixtureViscosity< SutherlandViscosity< NumericType >, NumericType > &mu, const std::string &filename)
const std::map< std::string, Species > & species_name_map() const
static const std::string & sutherland_data()
Class storing chemical mixture properties.
The parameters are reduced parameters.
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