GRINS-0.6.0
antioch_chemistry.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2015 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 
26 #include "grins_config.h"
27 
28 #ifdef GRINS_HAVE_ANTIOCH
29 
30 // This class
32 
33 // libMesh
34 #include "libmesh/getpot.h"
35 
36 namespace GRINS
37 {
38  AntiochChemistry::AntiochChemistry( const GetPot& input )
39  : _antioch_gas(NULL)
40  {
41  if( !input.have_variable("Physics/Chemistry/species") )
42  {
43  std::cerr << "Error: Must specify species list to use Antioch." << std::endl;
44  libmesh_error();
45  }
46 
47  unsigned int n_species = input.vector_variable_size("Physics/Chemistry/species");
48  std::vector<std::string> species_list(n_species);
49 
50  for( unsigned int s = 0; s < n_species; s++ )
51  {
52  species_list[s] = input( "Physics/Chemistry/species", "DIE!", s );
53  }
54 
55  _antioch_gas.reset( new Antioch::ChemicalMixture<libMesh::Real>( species_list ) );
56 
57  return;
58  }
59 
61  {
62  return;
63  }
64 
65  std::string AntiochChemistry::species_name( unsigned int species_index ) const
66  {
67  libmesh_assert_less(species_index, _antioch_gas->n_species());
68 
69 #if ANTIOCH_MAJOR_VERSION < 1 && ANTIOCH_MINOR_VERSION < 3
70  std::string name = "dummy";
71 
72  for( std::map<std::string,unsigned int>::const_iterator it = _antioch_gas->active_species_name_map().begin();
73  it != _antioch_gas->active_species_name_map().end(); it++ )
74  {
75  if( it->second == species_index )
76  {
77  name = it->first;
78  }
79  }
80 
81  if( name == std::string("dummy") )
82  {
83  std::cerr << "Error: Could not find a species name for the given index!"
84  << std::endl;
85  libmesh_error();
86  }
87 
88  return name;
89 #else
90  return _antioch_gas->species_inverse_name_map().find(species_index)->second;
91 #endif
92  }
93 
94 }// end namespace GRINS
95 
96 #endif // GRINS_HAVE_ANTIOCH
unsigned int n_species() const
GRINS namespace.
std::string species_name(unsigned int species_index) const
boost::scoped_ptr< Antioch::ChemicalMixture< libMesh::Real > > _antioch_gas

Generated on Mon Jun 22 2015 21:32:20 for GRINS-0.6.0 by  doxygen 1.8.9.1