GRINS-0.6.0
gas_solid_catalytic_wall.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 // This class
27 
28 // libMesh
29 #include "libmesh/quadrature.h"
30 
31 namespace GRINS
32 {
33  template<typename Chemistry>
35  CatalycityBase& gamma,
36  const unsigned int reactant_gas_species_idx,
37  const unsigned int reactant_solid_species_idx,
38  const unsigned int product_species_idx )
39  : CatalyticWallBase<Chemistry>(chem_mixture,gamma,reactant_gas_species_idx),
40  _reactant_gas_species_idx(reactant_gas_species_idx),
41  _reactant_solid_species_idx(reactant_solid_species_idx),
42  _product_species_idx(product_species_idx)
43  {
44  return;
45  }
46 
47  template<typename Chemistry>
49  {
50  return;
51  }
52 
53  template<typename Chemistry>
54  void GasSolidCatalyticWall<Chemistry>::init( const libMesh::FEMSystem& system )
55  {
56  const std::string r_var_name = std::string("w_"+this->_chemistry.species_name( this->_reactant_gas_species_idx ) );
57 
58  const std::string p_var_name = std::string("w_"+this->_chemistry.species_name( this->_product_species_idx ) );
59 
60  libmesh_assert( system.has_variable( r_var_name ) );
61  libmesh_assert( system.has_variable( p_var_name ) );
62 
63  this->_reactant_gas_var_idx = system.variable_number( r_var_name );
64 
65  this->_product_var_idx = system.variable_number( p_var_name );
66 
67  return;
68  }
69 
70  template<typename Chemistry>
72  const CachedValues& cache,
73  const bool request_jacobian )
74  {
75  libMesh::FEGenericBase<libMesh::Real>* side_fe = NULL;
76  context.get_side_fe( _reactant_gas_var_idx, side_fe );
77 
78  // The number of local degrees of freedom in each variable.
79  const unsigned int n_var_dofs = context.get_dof_indices(_reactant_gas_var_idx).size();
80 
81  libmesh_assert_equal_to( n_var_dofs, context.get_dof_indices(_product_var_idx).size() );
82 
83  // Element Jacobian * quadrature weight for side integration.
84  const std::vector<libMesh::Real> &JxW_side = side_fe->get_JxW();
85 
86  // The var shape functions at side quadrature points.
87  const std::vector<std::vector<libMesh::Real> >& var_phi_side = side_fe->get_phi();
88 
89  // Physical location of the quadrature points
90  const std::vector<libMesh::Point>& var_qpoint = side_fe->get_xyz();
91 
92  // reactant residual
93  libMesh::DenseSubVector<libMesh::Number> &F_r_var = context.get_elem_residual(_reactant_gas_var_idx);
94 
95  // product residual
96  libMesh::DenseSubVector<libMesh::Number> &F_p_var = context.get_elem_residual(_product_var_idx);
97 
98  unsigned int n_qpoints = context.get_side_qrule().n_points();
99 
100  for (unsigned int qp=0; qp != n_qpoints; qp++)
101  {
102  libMesh::Real jac = JxW_side[qp];
103 
104  if( this->_is_axisymmetric )
105  {
106  const libMesh::Number r = var_qpoint[qp](0);
107  jac *= r;
108  }
109 
110  const libMesh::Real rho = cache.get_cached_values(Cache::MIXTURE_DENSITY)[qp];
111 
112  const libMesh::Real Y_r = cache.get_cached_vector_values(Cache::MASS_FRACTIONS)[qp][this->_reactant_gas_species_idx];
113 
114  const libMesh::Real T = cache.get_cached_values(Cache::TEMPERATURE)[qp];
115 
116  const libMesh::Real r_value = this->compute_reactant_gas_mass_flux(rho, Y_r, T);
117 
118  const libMesh::Real p_value = this->compute_product_mass_flux(rho, Y_r, T);
119 
120  for (unsigned int i=0; i != n_var_dofs; i++)
121  {
122  F_r_var(i) += r_value*var_phi_side[i][qp]*jac;
123 
124  F_p_var(i) += p_value*var_phi_side[i][qp]*jac;
125 
126  if( request_jacobian )
127  {
128  libmesh_not_implemented();
129  }
130  }
131  }
132 
133  return;
134  }
135 
136 } // end namespace GRINS
GasSolidCatalyticWall(const Chemistry &chem_mixture, CatalycityBase &gamma, const unsigned int reactant_gas_species_idx, const unsigned int reactant_solid_species_idx, const unsigned int product_species_idx)
virtual void init(const libMesh::FEMSystem &system)
GRINS namespace.
const std::vector< std::vector< libMesh::Number > > & get_cached_vector_values(unsigned int quantity) const
virtual void apply_fluxes(AssemblyContext &context, const CachedValues &cache, const bool request_jacobian)
const std::vector< libMesh::Number > & get_cached_values(unsigned int quantity) const
Definition: cached_values.C:99

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