GRINS-0.8.0
antioch_kinetics.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 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
31 #include "grins/antioch_kinetics.h"
32 
33 // GRINS
34 #include "grins/antioch_mixture.h"
35 
36 // Antioch
37 #include "antioch/temp_cache.h"
38 #include "antioch/vector_utils.h"
39 
40 namespace GRINS
41 {
42  template<typename KineticsThermoCurveFit>
44  : _antioch_mixture( mixture ),
45  _antioch_kinetics( mixture.reaction_set(), 0 ),
46  _antioch_nasa_thermo( mixture.nasa_mixture() )
47  {}
48 
49  template<typename KineticsThermoCurveFit>
51  omega_dot( const libMesh::Real& T,
52  const libMesh::Real rho,
53  const std::vector<libMesh::Real>& mass_fractions,
54  std::vector<libMesh::Real>& omega_dot )
55  {
56  Antioch::TempCache<libMesh::Real> temp_cache(T);
57  this->omega_dot(temp_cache,rho,mass_fractions,omega_dot);
58  }
59 
60  template<typename KineticsThermoCurveFit>
62  omega_dot( const Antioch::TempCache<libMesh::Real>& temp_cache,
63  const libMesh::Real rho,
64  const std::vector<libMesh::Real>& mass_fractions,
65  std::vector<libMesh::Real>& omega_dot )
66  {
67  const unsigned int n_species = _antioch_mixture.n_species();
68 
69  libmesh_assert_equal_to( mass_fractions.size(), n_species );
70  libmesh_assert_equal_to( omega_dot.size(), n_species );
71 
72  std::vector<libMesh::Real> h_RT_minus_s_R(n_species, 0.0);
73  std::vector<libMesh::Real> molar_densities(n_species, 0.0);
74 
75  _antioch_nasa_thermo.h_RT_minus_s_R( temp_cache, h_RT_minus_s_R );
76 
77  _antioch_mixture.molar_densities( rho, mass_fractions, molar_densities );
78 
79  // If we don't clip negative densities, then we always have
80  // density to evaluate
81  bool have_density = !_antioch_mixture.clip_negative_rho();
82 
83  // If we don't necessarily have density to evaluate, then we need
84  // to check (and potentially clip) each species
85  if (!have_density)
86  for (unsigned int i=0; i != n_species; ++i)
87  {
88  if (molar_densities[i] <= 0)
89  molar_densities[i] = 0;
90  else
91  have_density = true;
92  }
93 
94  if (have_density)
95  _antioch_kinetics.compute_mass_sources( temp_cache.T,
96  molar_densities,
97  h_RT_minus_s_R,
98  omega_dot );
99  else
100  std::fill(omega_dot.begin(), omega_dot.end(), 0.0);
101  }
102 
103 }// end namespace GRINS
104 
105 #endif // GRINS_HAVE_ANTIOCH
GRINS namespace.
void omega_dot(const libMesh::Real &T, const libMesh::Real rho, const std::vector< libMesh::Real > &mass_fractions, std::vector< libMesh::Real > &omega_dot)
Wrapper class for storing state for Antioch thermo and kinetics.

Generated on Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1