GRINS-0.7.0
catalytic_wall_base.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2016 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 #ifndef GRINS_CATALYTIC_WALL_BASE_H
26 #define GRINS_CATALYTIC_WALL_BASE_H
27 
28 // GRINS
29 #include "grins/catalycity_base.h"
31 #include "grins/shared_ptr.h"
32 #include "grins/var_typedefs.h"
33 
34 // libMesh
35 #include "libmesh/libmesh_common.h"
36 #include "libmesh/auto_ptr.h" // libMesh::UniquePtr
37 
38 namespace libMesh
39 {
40  class FEMSystem;
41 }
42 
43 namespace GRINS
44 {
45  // Forward declarations
46  class AssemblyContext;
47  class CachedValues;
48 
49  template<typename Chemistry>
51  {
52  public:
53 
54  CatalyticWallBase( SharedPtr<Chemistry>& chem,
55  SharedPtr<CatalycityBase>& gamma,
56  const std::vector<VariableIndex>& species_vars,
57  VariableIndex T_var,
58  libMesh::Real p0,
59  unsigned int reactant_species_idx);
60 
62  CatalyticWallBase( const Chemistry& chem_mixture,
63  CatalycityBase& gamma,
64  const unsigned int reactant_species_idx );
65 
66  virtual ~CatalyticWallBase(){};
67 
69  virtual void apply_fluxes( AssemblyContext& context,
70  const CachedValues& cache,
71  const bool request_jacobian ) =0;
72 
73  virtual void init( const libMesh::FEMSystem& /*system*/ ){};
74 
75  libMesh::Real rho( libMesh::Real T, libMesh::Real p0, libMesh::Real R_mix) const;
76 
78  libMesh::Real omega_dot( const libMesh::Real rho_s, const libMesh::Real T ) const;
79 
80  libMesh::Real domega_dot_dws( const libMesh::Real rho_s, const libMesh::Real w_s,
81  const libMesh::Real T, const libMesh::Real R ) const;
82 
83  libMesh::Real domega_dot_dT( const libMesh::Real rho_s, const libMesh::Real T ) const;
84 
85  void set_catalycity_params( const std::vector<libMesh::Real>& params );
86 
87  protected:
88 
90  libMesh::Real eval_gamma( libMesh::Real T ) const;
91 
93  libMesh::Real eval_gamma_dT( libMesh::Real T ) const;
94 
95  SharedPtr<Chemistry> _chem_ptr;
96 
98  const Chemistry& _chemistry;
99 
100  SharedPtr<CatalycityBase> _gamma_ptr;
101 
103  libMesh::UniquePtr<CatalycityBase> _gamma_s;
104 
106  const libMesh::Real _C;
107 
109  std::vector<VariableIndex> _species_vars;
110 
113 
115 
119  libMesh::Real _p0;
120  };
121 
122  /* ------------------------- Inline Functions -------------------------*/
123  template<typename Chemistry>
124  inline
125  libMesh::Real CatalyticWallBase<Chemistry>::rho( libMesh::Real T, libMesh::Real p0, libMesh::Real R_mix) const
126  {
127  return p0/(R_mix*T);
128  }
129 
130  template<typename Chemistry>
131  inline
132  libMesh::Real CatalyticWallBase<Chemistry>::eval_gamma( libMesh::Real T ) const
133  {
134  libMesh::Real value;
135 
136  if(_gamma_s)
137  value = (*_gamma_s)(T);
138  else if(_gamma_ptr)
139  value = (*_gamma_ptr)(T);
140  else
141  libmesh_error();
142 
143  return value;
144  }
145 
146  template<typename Chemistry>
147  inline
148  libMesh::Real CatalyticWallBase<Chemistry>::eval_gamma_dT( libMesh::Real T ) const
149  {
150  libMesh::Real value;
151 
152  if(_gamma_s)
153  value = (*_gamma_s).dT(T);
154  else if(_gamma_ptr)
155  value = (*_gamma_ptr).dT(T);
156  else
157  libmesh_error();
158 
159  return value;
160  }
161 
162  template<typename Chemistry>
163  inline
164  libMesh::Real CatalyticWallBase<Chemistry>::omega_dot( const libMesh::Real rho_s, const libMesh::Real T ) const
165  {
166  return rho_s*this->eval_gamma(T)*_C*std::sqrt(T);
167  }
168 
169  template<typename Chemistry>
170  inline
171  libMesh::Real CatalyticWallBase<Chemistry>::domega_dot_dws( const libMesh::Real rho_s, const libMesh::Real w_s,
172  const libMesh::Real T, const libMesh::Real R ) const
173  {
174  return (1.0/w_s - rho_s/R)*(this->omega_dot( rho_s, T ));
175  }
176 
177  template<typename Chemistry>
178  inline
179  libMesh::Real CatalyticWallBase<Chemistry>::domega_dot_dT( const libMesh::Real rho_s, const libMesh::Real T ) const
180  {
181  libMesh::Real sqrtT = std::sqrt(T);
182 
183  return rho_s*_C*( 0.5/sqrtT*this->eval_gamma(T) + sqrtT*this->eval_gamma_dT(T) );
184  }
185 
186 } // end namespace GRINS
187 
188 #endif // GRINS_CATALYTIC_WALL_BASE_H
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
Definition: var_typedefs.h:42
SharedPtr< CatalycityBase > _gamma_ptr
virtual void init(const libMesh::FEMSystem &)
void set_catalycity_params(const std::vector< libMesh::Real > &params)
GRINS namespace.
libMesh::Real _p0
Thermodynamic pressure.
SharedPtr< Chemistry > _chem_ptr
libMesh::Real eval_gamma_dT(libMesh::Real T) const
Temporary helper to deal with intermediate refactoring.
virtual void apply_fluxes(AssemblyContext &context, const CachedValues &cache, const bool request_jacobian)=0
Deprecated.
libMesh::Real eval_gamma(libMesh::Real T) const
Temporary helper to deal with intermediate refactoring.
libMesh::Real domega_dot_dT(const libMesh::Real rho_s, const libMesh::Real T) const
libMesh::Real omega_dot(const libMesh::Real rho_s, const libMesh::Real T) const
libMesh::Real domega_dot_dws(const libMesh::Real rho_s, const libMesh::Real w_s, const libMesh::Real T, const libMesh::Real R) const
CatalyticWallBase(SharedPtr< Chemistry > &chem, SharedPtr< CatalycityBase > &gamma, const std::vector< VariableIndex > &species_vars, VariableIndex T_var, libMesh::Real p0, unsigned int reactant_species_idx)
libMesh::UniquePtr< CatalycityBase > _gamma_s
Deprecated.
const Chemistry & _chemistry
Deprecated.
std::vector< VariableIndex > _species_vars
libMesh::Real rho(libMesh::Real T, libMesh::Real p0, libMesh::Real R_mix) const

Generated on Thu Jun 2 2016 21:52:27 for GRINS-0.7.0 by  doxygen 1.8.10