GRINS-0.8.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-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 #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  virtual void register_parameter( const std::string & param_name,
89 
90  protected:
91 
93  libMesh::Real eval_gamma( libMesh::Real T ) const;
94 
96  libMesh::Real eval_gamma_dT( libMesh::Real T ) const;
97 
98  SharedPtr<Chemistry> _chem_ptr;
99 
101  const Chemistry& _chemistry;
102 
103  SharedPtr<CatalycityBase> _gamma_ptr;
104 
106  libMesh::UniquePtr<CatalycityBase> _gamma_s;
107 
109  const libMesh::Real _C;
110 
112  std::vector<VariableIndex> _species_vars;
113 
116 
118 
122  libMesh::Real _p0;
123  };
124 
125  /* ------------------------- Inline Functions -------------------------*/
126  template<typename Chemistry>
127  inline
128  libMesh::Real CatalyticWallBase<Chemistry>::rho( libMesh::Real T, libMesh::Real p0, libMesh::Real R_mix) const
129  {
130  return p0/(R_mix*T);
131  }
132 
133  template<typename Chemistry>
134  inline
135  libMesh::Real CatalyticWallBase<Chemistry>::eval_gamma( libMesh::Real T ) const
136  {
137  libMesh::Real value;
138 
139  if(_gamma_s)
140  value = (*_gamma_s)(T);
141  else if(_gamma_ptr)
142  value = (*_gamma_ptr)(T);
143  else
144  libmesh_error();
145 
146  return value;
147  }
148 
149  template<typename Chemistry>
150  inline
151  libMesh::Real CatalyticWallBase<Chemistry>::eval_gamma_dT( libMesh::Real T ) const
152  {
153  libMesh::Real value;
154 
155  if(_gamma_s)
156  value = (*_gamma_s).dT(T);
157  else if(_gamma_ptr)
158  value = (*_gamma_ptr).dT(T);
159  else
160  libmesh_error();
161 
162  return value;
163  }
164 
165  template<typename Chemistry>
166  inline
167  libMesh::Real CatalyticWallBase<Chemistry>::omega_dot( const libMesh::Real rho_s, const libMesh::Real T ) const
168  {
169  return rho_s*this->eval_gamma(T)*_C*std::sqrt(T);
170  }
171 
172  template<typename Chemistry>
173  inline
174  libMesh::Real CatalyticWallBase<Chemistry>::domega_dot_dws( const libMesh::Real rho_s, const libMesh::Real w_s,
175  const libMesh::Real T, const libMesh::Real R ) const
176  {
177  return (1.0/w_s - rho_s/R)*(this->omega_dot( rho_s, T ));
178  }
179 
180  template<typename Chemistry>
181  inline
182  libMesh::Real CatalyticWallBase<Chemistry>::domega_dot_dT( const libMesh::Real rho_s, const libMesh::Real T ) const
183  {
184  libMesh::Real sqrtT = std::sqrt(T);
185 
186  return rho_s*_C*( 0.5/sqrtT*this->eval_gamma(T) + sqrtT*this->eval_gamma_dT(T) );
187  }
188 
189 } // end namespace GRINS
190 
191 #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
virtual void register_parameter(const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
Each subclass will register its copy of an independent.
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 Tue Dec 19 2017 12:47:27 for GRINS-0.8.0 by  doxygen 1.8.9.1