GRINS-0.6.0
reacting_low_mach_navier_stokes.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 // This class
28 
29 // GRINS
30 #include "grins/assembly_context.h"
35 
36 // libMesh
37 #include "libmesh/quadrature.h"
38 #include "libmesh/fem_system.h"
39 
40 namespace GRINS
41 {
42  template<typename Mixture, typename Evaluator>
44  : ReactingLowMachNavierStokesBase<Mixture,Evaluator>(physics_name,input),
45  _p_pinning(input,physics_name),
46  _rho_index(0),
47  _mu_index(0),
48  _k_index(0),
49  _cp_index(0)
50  {
51  this->read_input_options(input);
52 
53  // This is deleted in the base class
55  this->_gas_mixture.chemistry() );
56 
57  if( this->_bc_handler->is_axisymmetric() )
58  {
59  this->_is_axisymmetric = true;
60  }
61 
62  this->_ic_handler = new GenericICHandler( physics_name, input );
63 
64  return;
65  }
66 
67  template<typename Mixture, typename Evaluator>
69  {
70  return;
71  }
72 
73  template<typename Mixture, typename Evaluator>
75  {
76  // Other quantities read in base class
77 
78  // Read pressure pinning information
79  this->_pin_pressure = input("Physics/"+reacting_low_mach_navier_stokes+"/pin_pressure", false );
80 
81  return;
82  }
83 
84  template<typename Mixture, typename Evaluator>
87  {
88  std::string section = "Physics/"+reacting_low_mach_navier_stokes+"/output_vars";
89 
90  if( input.have_variable(section) )
91  {
92  unsigned int n_vars = input.vector_variable_size(section);
93 
94  for( unsigned int v = 0; v < n_vars; v++ )
95  {
96  std::string name = input(section,"DIE!",v);
97 
98  if( name == std::string("rho") )
99  {
100  this->_rho_index = postprocessing.register_quantity( name );
101  }
102  else if( name == std::string("mu") )
103  {
104  this->_mu_index = postprocessing.register_quantity( name );
105  }
106  else if( name == std::string("k") )
107  {
108  this->_k_index = postprocessing.register_quantity( name );
109  }
110  else if( name == std::string("cp") )
111  {
112  this->_cp_index = postprocessing.register_quantity( name );
113  }
114  else if( name == std::string("mole_fractions") )
115  {
116  this->_mole_fractions_index.resize(this->n_species());
117 
118  for( unsigned int s = 0; s < this->n_species(); s++ )
119  {
120  this->_mole_fractions_index[s] = postprocessing.register_quantity( "X_"+this->_gas_mixture.species_name(s) );
121  }
122  }
123  else if( name == std::string("h_s") )
124  {
125  this->_h_s_index.resize(this->n_species());
126 
127  for( unsigned int s = 0; s < this->n_species(); s++ )
128  {
129  this->_h_s_index[s] = postprocessing.register_quantity( "h_"+this->_gas_mixture.species_name(s) );
130  }
131  }
132  else if( name == std::string("omega_dot") )
133  {
134  this->_omega_dot_index.resize(this->n_species());
135 
136  for( unsigned int s = 0; s < this->n_species(); s++ )
137  {
138  this->_omega_dot_index[s] = postprocessing.register_quantity( "omega_dot_"+this->_gas_mixture.species_name(s) );
139  }
140 
141  std::cout << "omega_dot size = " << _omega_dot_index.size() << std::endl;
142  }
143  else
144  {
145  std::cerr << "Error: Invalue output_vars value for "+reacting_low_mach_navier_stokes << std::endl
146  << " Found " << name << std::endl
147  << " Acceptable values are: rho" << std::endl
148  << " mu" << std::endl
149  << " k" << std::endl
150  << " cp" << std::endl
151  << " mole_fractions" << std::endl
152  << " omega_dot" << std::endl;
153  libmesh_error();
154  }
155  }
156  }
157 
158  return;
159  }
160 
161  template<typename Mixture, typename Evaluator>
163  {
164  // First call base class
166 
167  // We also need the side shape functions, etc.
168  context.get_side_fe(this->_u_var)->get_JxW();
169  context.get_side_fe(this->_u_var)->get_phi();
170  context.get_side_fe(this->_u_var)->get_dphi();
171  context.get_side_fe(this->_u_var)->get_xyz();
172 
173  context.get_side_fe(this->_T_var)->get_JxW();
174  context.get_side_fe(this->_T_var)->get_phi();
175  context.get_side_fe(this->_T_var)->get_dphi();
176  context.get_side_fe(this->_T_var)->get_xyz();
177 
178  return;
179  }
180 
181  template<typename Mixture, typename Evaluator>
183  AssemblyContext& context,
184  CachedValues& cache )
185  {
186  if( compute_jacobian )
187  {
188  libmesh_not_implemented();
189  }
190  // Convenience
191  const VariableIndex s0_var = this->_species_vars[0];
192 
193  // The number of local degrees of freedom in each variable.
194  const unsigned int n_p_dofs = context.get_dof_indices(this->_p_var).size();
195  const unsigned int n_s_dofs = context.get_dof_indices(s0_var).size();
196  const unsigned int n_u_dofs = context.get_dof_indices(this->_u_var).size();
197  const unsigned int n_T_dofs = context.get_dof_indices(this->_T_var).size();
198 
199  // Check number of dofs is same for _u_var, v_var and w_var.
200  libmesh_assert (n_u_dofs == context.get_dof_indices(this->_v_var).size());
201  if (this->_dim == 3)
202  libmesh_assert (n_u_dofs == context.get_dof_indices(this->_w_var).size());
203 
204  // Element Jacobian * quadrature weights for interior integration.
205  const std::vector<libMesh::Real>& JxW =
206  context.get_element_fe(this->_u_var)->get_JxW();
207 
208  // The pressure shape functions at interior quadrature points.
209  const std::vector<std::vector<libMesh::Real> >& p_phi =
210  context.get_element_fe(this->_p_var)->get_phi();
211 
212  // The species shape functions at interior quadrature points.
213  const std::vector<std::vector<libMesh::Real> >& s_phi = context.get_element_fe(s0_var)->get_phi();
214 
215  // The species shape function gradients at interior quadrature points.
216  const std::vector<std::vector<libMesh::Gradient> >& s_grad_phi = context.get_element_fe(s0_var)->get_dphi();
217 
218  // The pressure shape functions at interior quadrature points.
219  const std::vector<std::vector<libMesh::Real> >& u_phi =
220  context.get_element_fe(this->_u_var)->get_phi();
221 
222  // The velocity shape function gradients at interior quadrature points.
223  const std::vector<std::vector<libMesh::RealGradient> >& u_gradphi =
224  context.get_element_fe(this->_u_var)->get_dphi();
225 
226  // The temperature shape functions at interior quadrature points.
227  const std::vector<std::vector<libMesh::Real> >& T_phi =
228  context.get_element_fe(this->_T_var)->get_phi();
229 
230  // The temperature shape functions gradients at interior quadrature points.
231  const std::vector<std::vector<libMesh::RealGradient> >& T_gradphi =
232  context.get_element_fe(this->_T_var)->get_dphi();
233 
234  const std::vector<libMesh::Point>& u_qpoint =
235  context.get_element_fe(this->_u_var)->get_xyz();
236 
237  libMesh::DenseSubVector<libMesh::Number>& Fp = context.get_elem_residual(this->_p_var); // R_{p}
238 
239  libMesh::DenseSubVector<libMesh::Number> &Fu = context.get_elem_residual(this->_u_var); // R_{u}
240  libMesh::DenseSubVector<libMesh::Number> &Fv = context.get_elem_residual(this->_v_var); // R_{v}
241  libMesh::DenseSubVector<libMesh::Number> &Fw = context.get_elem_residual(this->_w_var); // R_{w}
242 
243  libMesh::DenseSubVector<libMesh::Number> &FT = context.get_elem_residual(this->_T_var); // R_{T}
244 
245  unsigned int n_qpoints = context.get_element_qrule().n_points();
246  for (unsigned int qp=0; qp != n_qpoints; qp++)
247  {
248  libMesh::Number rho = cache.get_cached_values(Cache::MIXTURE_DENSITY)[qp];
249 
250  libMesh::Number u, v, T;
251  u = cache.get_cached_values(Cache::X_VELOCITY)[qp];
252  v = cache.get_cached_values(Cache::Y_VELOCITY)[qp];
253 
254  T = cache.get_cached_values(Cache::TEMPERATURE)[qp];
255 
256  const libMesh::Gradient& grad_T =
258 
259  libMesh::NumberVectorValue U(u,v);
260  if (this->_dim == 3)
261  U(2) = cache.get_cached_values(Cache::Z_VELOCITY)[qp]; // w
262 
263  libMesh::Gradient grad_u = cache.get_cached_gradient_values(Cache::X_VELOCITY_GRAD)[qp];
264  libMesh::Gradient grad_v = cache.get_cached_gradient_values(Cache::Y_VELOCITY_GRAD)[qp];
265 
266  libMesh::Gradient grad_w;
267  if (this->_dim == 3)
269 
270  libMesh::Number divU = grad_u(0) + grad_v(1);
271  if (this->_dim == 3)
272  divU += grad_w(2);
273 
274  libMesh::NumberVectorValue grad_uT( grad_u(0), grad_v(0) );
275  libMesh::NumberVectorValue grad_vT( grad_u(1), grad_v(1) );
276  libMesh::NumberVectorValue grad_wT;
277  if( this->_dim == 3 )
278  {
279  grad_uT(2) = grad_w(0);
280  grad_vT(2) = grad_w(1);
281  grad_wT = libMesh::NumberVectorValue( grad_u(2), grad_v(2), grad_w(2) );
282  }
283 
284  libMesh::Number mu = cache.get_cached_values(Cache::MIXTURE_VISCOSITY)[qp];
285  libMesh::Number p = cache.get_cached_values(Cache::PRESSURE)[qp];
286 
287  const std::vector<libMesh::Real>& D =
289 
290  libMesh::Number cp =
292 
293  libMesh::Number k =
295 
296  const std::vector<libMesh::Real>& omega_dot =
298 
299  const std::vector<libMesh::Real>& h =
301 
302  const libMesh::Number r = u_qpoint[qp](0);
303 
304  libMesh::Real jac = JxW[qp];
305 
306  if( this->_is_axisymmetric )
307  {
308  divU += U(0)/r;
309  jac *= r;
310  }
311 
312  libMesh::Real M = cache.get_cached_values(Cache::MOLAR_MASS)[qp];
313 
314  std::vector<libMesh::Gradient> grad_ws = cache.get_cached_vector_gradient_values(Cache::MASS_FRACTIONS_GRAD)[qp];
315  libmesh_assert_equal_to( grad_ws.size(), this->_n_species );
316 
317  // Continuity Residual
318  libMesh::Gradient mass_term(0.0,0.0,0.0);
319  for(unsigned int s=0; s < this->_n_species; s++ )
320  {
321  mass_term += grad_ws[s]/this->_gas_mixture.M(s);
322  }
323  mass_term *= M;
324 
325  for (unsigned int i=0; i != n_p_dofs; i++)
326  {
327  Fp(i) += (-U*(mass_term + grad_T/T) + divU)*jac*p_phi[i][qp];
328  }
329 
330  // Species residuals
331  for(unsigned int s=0; s < this->_n_species; s++ )
332  {
333  libMesh::DenseSubVector<libMesh::Number> &Fs =
334  context.get_elem_residual(this->_species_vars[s]); // R_{s}
335 
336  const libMesh::Real term1 = -rho*(U*grad_ws[s]) + omega_dot[s];
337  const libMesh::Gradient term2 = -rho*D[s]*grad_ws[s];
338 
339  for (unsigned int i=0; i != n_s_dofs; i++)
340  {
342  Fs(i) += ( term1*s_phi[i][qp] + term2*s_grad_phi[i][qp] )*jac;
343  }
344  }
345 
346  // Momentum residuals
347  for (unsigned int i=0; i != n_u_dofs; i++)
348  {
349  Fu(i) += ( -rho*U*grad_u*u_phi[i][qp]
350  + p*u_gradphi[i][qp](0)
351  - mu*(u_gradphi[i][qp]*grad_u + u_gradphi[i][qp]*grad_uT
352  - 2.0/3.0*divU*u_gradphi[i][qp](0) )
353  + rho*this->_g(0)*u_phi[i][qp]
354  )*jac;
355 
358  if( this->_is_axisymmetric )
359  {
360  Fu(i) += u_phi[i][qp]*( p/r - 2*mu*U(0)/(r*r) - 2.0/3.0*mu*divU/r )*jac;
361  }
362 
363  Fv(i) += ( -rho*U*grad_v*u_phi[i][qp]
364  + p*u_gradphi[i][qp](1)
365  - mu*(u_gradphi[i][qp]*grad_v + u_gradphi[i][qp]*grad_vT
366  - 2.0/3.0*divU*u_gradphi[i][qp](1) )
367  + rho*this->_g(1)*u_phi[i][qp]
368  )*jac;
369 
370  if (this->_dim == 3)
371  {
372  Fw(i) += ( -rho*U*grad_w*u_phi[i][qp]
373  + p*u_gradphi[i][qp](2)
374  - mu*(u_gradphi[i][qp]*grad_w + u_gradphi[i][qp]*grad_wT
375  - 2.0/3.0*divU*u_gradphi[i][qp](2) )
376  + rho*this->_g(2)*u_phi[i][qp]
377  )*jac;
378  }
379  }
380 
381  // Energy residual
382  libMesh::Real chem_term = 0.0;
383  for(unsigned int s=0; s < this->_n_species; s++ )
384  {
385  chem_term += h[s]*omega_dot[s];
386  }
387 
388  for (unsigned int i=0; i != n_T_dofs; i++)
389  {
390  FT(i) += ( ( -rho*cp*U*grad_T - chem_term )*T_phi[i][qp]
391  - k*grad_T*T_gradphi[i][qp] )*jac;
392  }
393 
394  } // quadrature loop
395 
396  return;
397  }
398 
399  template<typename Mixture, typename Evaluator>
401  AssemblyContext& context,
402  CachedValues& cache )
403  {
406  std::vector<BoundaryID> ids = context.side_boundary_ids();
407 
408  for( std::vector<BoundaryID>::const_iterator it = ids.begin();
409  it != ids.end(); it++ )
410  {
411  libmesh_assert (*it != libMesh::BoundaryInfo::invalid_id);
412 
413  this->_bc_handler->apply_neumann_bcs( context, cache, compute_jacobian, *it );
414  }
415 
416  return;
417  }
418 
419  template<typename Mixture, typename Evaluator>
421  AssemblyContext& context,
422  CachedValues& /* cache */ )
423  {
424  // Pin p = p_value at p_point
425  if( this->_pin_pressure )
426  {
427  _p_pinning.pin_value( context, compute_jacobian, this->_p_var );
428  }
429 
430  return;
431  }
432 
433  template<typename Mixture, typename Evaluator>
435  AssemblyContext& /*context*/,
436  CachedValues& /*cache*/ )
437  {
438  libmesh_not_implemented();
439 
440  return;
441  }
442 
443  template<typename Mixture, typename Evaluator>
445  CachedValues& cache )
446  {
447  Evaluator gas_evaluator( this->_gas_mixture );
448 
449  const unsigned int n_qpoints = context.get_element_qrule().n_points();
450 
451  std::vector<libMesh::Real> u, v, w, T, p, p0;
452  u.resize(n_qpoints);
453  v.resize(n_qpoints);
454  if( this->_dim > 2 )
455  w.resize(n_qpoints);
456 
457  T.resize(n_qpoints);
458  p.resize(n_qpoints);
459  p0.resize(n_qpoints);
460 
461  std::vector<libMesh::Gradient> grad_u, grad_v, grad_w, grad_T;
462  grad_u.resize(n_qpoints);
463  grad_v.resize(n_qpoints);
464  if( this->_dim > 2 )
465  grad_w.resize(n_qpoints);
466 
467  grad_T.resize(n_qpoints);
468 
469  std::vector<std::vector<libMesh::Real> > mass_fractions;
470  std::vector<std::vector<libMesh::Gradient> > grad_mass_fractions;
471  mass_fractions.resize(n_qpoints);
472  grad_mass_fractions.resize(n_qpoints);
473 
474  std::vector<libMesh::Real> M;
475  M.resize(n_qpoints);
476 
477  std::vector<libMesh::Real> R;
478  R.resize(n_qpoints);
479 
480  std::vector<libMesh::Real> rho;
481  rho.resize(n_qpoints);
482 
483  for (unsigned int qp = 0; qp != n_qpoints; ++qp)
484  {
485  u[qp] = context.interior_value(this->_u_var, qp);
486  v[qp] = context.interior_value(this->_v_var, qp);
487 
488  grad_u[qp] = context.interior_gradient(this->_u_var, qp);
489  grad_v[qp] = context.interior_gradient(this->_v_var, qp);
490  if( this->_dim > 2 )
491  {
492  w[qp] = context.interior_value(this->_w_var, qp);
493  grad_w[qp] = context.interior_gradient(this->_w_var, qp);
494  }
495  T[qp] = context.interior_value(this->_T_var, qp);
496  grad_T[qp] = context.interior_gradient(this->_T_var, qp);
497 
498  p[qp] = context.interior_value(this->_p_var, qp);
499  p0[qp] = this->get_p0_steady(context, qp);
500 
501  mass_fractions[qp].resize(this->_n_species);
502  grad_mass_fractions[qp].resize(this->_n_species);
503 
504  for( unsigned int s = 0; s < this->_n_species; s++ )
505  {
508  mass_fractions[qp][s] = std::max( context.interior_value(this->_species_vars[s],qp), 0.0 );
509  grad_mass_fractions[qp][s] = context.interior_gradient(this->_species_vars[s],qp);
510  }
511 
512  M[qp] = gas_evaluator.M_mix( mass_fractions[qp] );
513 
514  R[qp] = gas_evaluator.R_mix( mass_fractions[qp] );
515 
516  rho[qp] = this->rho( T[qp], p0[qp], R[qp] );
517  }
518 
519  cache.set_values(Cache::X_VELOCITY, u);
520  cache.set_values(Cache::Y_VELOCITY, v);
521 
524 
525  if(this->_dim > 2)
526  {
527  cache.set_values(Cache::Z_VELOCITY, w);
529  }
530 
531  cache.set_values(Cache::TEMPERATURE, T);
533 
534  cache.set_values(Cache::PRESSURE, p);
536 
537  cache.set_vector_values(Cache::MASS_FRACTIONS, mass_fractions);
538  cache.set_vector_gradient_values(Cache::MASS_FRACTIONS_GRAD, grad_mass_fractions);
539 
540  cache.set_values(Cache::MOLAR_MASS, M);
541 
543 
545 
546  /* These quantities must be computed after T, mass_fractions, p0
547  are set into the cache. */
548  std::vector<libMesh::Real> mu;
549  mu.resize(n_qpoints);
550 
551  std::vector<libMesh::Real> cp;
552  cp.resize(n_qpoints);
553 
554  std::vector<libMesh::Real> k;
555  k.resize(n_qpoints);
556 
557  std::vector<std::vector<libMesh::Real> > h_s;
558  h_s.resize(n_qpoints);
559 
560  std::vector<std::vector<libMesh::Real> > D_s;
561  D_s.resize(n_qpoints);
562 
563  std::vector<std::vector<libMesh::Real> > omega_dot_s;
564  omega_dot_s.resize(n_qpoints);
565 
566  for (unsigned int qp = 0; qp != n_qpoints; ++qp)
567  {
568  gas_evaluator.mu_and_k(cache,qp,mu[qp],k[qp]);
569  cp[qp] = gas_evaluator.cp(cache,qp);
570 
571  h_s[qp].resize(this->_n_species);
572  gas_evaluator.h_s( cache, qp, h_s[qp] );
573 
574  D_s[qp].resize(this->_n_species);
575  gas_evaluator.D( cache, qp, D_s[qp] );
576 
577  omega_dot_s[qp].resize(this->_n_species);
578  gas_evaluator.omega_dot( cache, qp, omega_dot_s[qp] );
579  }
580 
586  cache.set_vector_values(Cache::OMEGA_DOT, omega_dot_s);
587 
588  return;
589  }
590 
591  template<typename Mixture, typename Evaluator>
593  CachedValues& cache )
594  {
595  Evaluator gas_evaluator( this->_gas_mixture );
596 
597  const unsigned int n_qpoints = context.get_side_qrule().n_points();
598 
599  // Need for Catalytic Wall
602  std::vector<libMesh::Real> T, rho;
603  T.resize(n_qpoints);
604  rho.resize(n_qpoints);
605 
606  std::vector<std::vector<libMesh::Real> > mass_fractions;
607  mass_fractions.resize(n_qpoints);
608 
609  for (unsigned int qp = 0; qp != n_qpoints; ++qp)
610  {
611  T[qp] = context.side_value(this->_T_var, qp);
612 
613  mass_fractions[qp].resize(this->_n_species);
614  for( unsigned int s = 0; s < this->_n_species; s++ )
615  {
618  mass_fractions[qp][s] = std::max( context.side_value(this->_species_vars[s],qp), 0.0 );
619  }
620  const libMesh::Real p0 = this->get_p0_steady_side(context, qp);
621 
622  rho[qp] = this->rho( T[qp], p0, gas_evaluator.R_mix(mass_fractions[qp]) );
623  }
624 
625  cache.set_values(Cache::TEMPERATURE, T);
626  cache.set_vector_values(Cache::MASS_FRACTIONS, mass_fractions);
628 
629  return;
630  }
631 
632  template<typename Mixture, typename Evaluator>
634  const AssemblyContext& context,
635  const libMesh::Point& point,
636  libMesh::Real& value )
637  {
638  Evaluator gas_evaluator( this->_gas_mixture );
639 
640  if( quantity_index == this->_rho_index )
641  {
642  std::vector<libMesh::Real> Y( this->_n_species );
643  libMesh::Real T = this->T(point,context);
644  libMesh::Real p0 = this->get_p0_steady(context,point);
645  this->mass_fractions( point, context, Y );
646 
647  value = this->rho( T, p0, gas_evaluator.R_mix(Y) );
648  }
649  else if( quantity_index == this->_mu_index )
650  {
651  std::vector<libMesh::Real> Y( this->_n_species );
652  libMesh::Real T = this->T(point,context);
653  this->mass_fractions( point, context, Y );
654 
655  value = gas_evaluator.mu( T, Y );
656  }
657  else if( quantity_index == this->_k_index )
658  {
659  std::vector<libMesh::Real> Y( this->_n_species );
660  libMesh::Real T = this->T(point,context);
661  this->mass_fractions( point, context, Y );
662 
663  value = gas_evaluator.k( T, Y );
664  }
665  else if( quantity_index == this->_cp_index )
666  {
667  std::vector<libMesh::Real> Y( this->_n_species );
668  libMesh::Real T = this->T(point,context);
669  this->mass_fractions( point, context, Y );
670 
671  value = gas_evaluator.cp( T, Y );
672  }
673  // Now check for species dependent stuff
674  else
675  {
676  if( !this->_h_s_index.empty() )
677  {
678  libmesh_assert_equal_to( _h_s_index.size(), this->n_species() );
679 
680  for( unsigned int s = 0; s < this->n_species(); s++ )
681  {
682  if( quantity_index == this->_h_s_index[s] )
683  {
684  libMesh::Real T = this->T(point,context);
685 
686  value = gas_evaluator.h_s( T, s );
687  return;
688  }
689  }
690  }
691 
692  if( !this->_mole_fractions_index.empty() )
693  {
694  libmesh_assert_equal_to( _mole_fractions_index.size(), this->n_species() );
695 
696  for( unsigned int s = 0; s < this->n_species(); s++ )
697  {
698  if( quantity_index == this->_mole_fractions_index[s] )
699  {
700  std::vector<libMesh::Real> Y( this->_n_species );
701  this->mass_fractions( point, context, Y );
702 
703  libMesh::Real M = gas_evaluator.M_mix(Y);
704 
705  value = gas_evaluator.X( s, M, Y[s] );
706  return;
707  }
708  }
709  }
710 
711  if( !this->_omega_dot_index.empty() )
712  {
713  libmesh_assert_equal_to( _omega_dot_index.size(), this->n_species() );
714 
715  for( unsigned int s = 0; s < this->n_species(); s++ )
716  {
717  if( quantity_index == this->_omega_dot_index[s] )
718  {
719  std::vector<libMesh::Real> Y( this->n_species() );
720  this->mass_fractions( point, context, Y );
721 
722  libMesh::Real T = this->T(point,context);
723 
724  libMesh::Real p0 = this->get_p0_steady(context,point);
725 
726  libMesh::Real rho = this->rho( T, p0, gas_evaluator.R_mix(Y) );
727 
728  std::vector<libMesh::Real> omega_dot( this->n_species() );
729  gas_evaluator.omega_dot( T, rho, Y, omega_dot );
730 
731  value = omega_dot[s];
732  return;
733  }
734  }
735  }
736 
737  } // if/else quantity_index
738 
739  return;
740  }
741 
742 } // namespace GRINS
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
Definition: var_typedefs.h:40
unsigned int register_quantity(std::string name)
Register quantity to be postprocessed.
GRINS::ICHandlingBase * _ic_handler
Definition: physics.h:258
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
virtual void register_postprocessing_vars(const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
Register postprocessing variables for ReactingLowMachNavierStokes.
void set_values(unsigned int quantity, std::vector< libMesh::Number > &values)
Definition: cached_values.C:72
GRINS::BCHandlingBase * _bc_handler
Definition: physics.h:256
void set_vector_gradient_values(unsigned int quantity, std::vector< std::vector< libMesh::Gradient > > &values)
Definition: cached_values.C:86
Base class for reading and handling initial conditions for physics classes.
virtual void side_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for boundaries of elements on the domain boundary.
virtual void compute_side_time_derivative_cache(const AssemblyContext &context, CachedValues &cache)
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for element interiors.
GRINS namespace.
const std::vector< std::vector< libMesh::Number > > & get_cached_vector_values(unsigned int quantity) const
virtual void compute_element_time_derivative_cache(const AssemblyContext &context, CachedValues &cache)
const std::vector< std::vector< libMesh::Gradient > > & get_cached_vector_gradient_values(unsigned int quantity) const
std::string PhysicsName
const std::vector< libMesh::Gradient > & get_cached_gradient_values(unsigned int quantity) const
bool is_axisymmetric() const
const PhysicsName reacting_low_mach_navier_stokes
void set_vector_values(unsigned int quantity, std::vector< std::vector< libMesh::Number > > &values)
Definition: cached_values.C:93
void set_gradient_values(unsigned int quantity, std::vector< libMesh::Gradient > &values)
Definition: cached_values.C:78
virtual void mass_residual(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part...
virtual void side_constraint(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Constraint part(s) of physics for boundaries of elements on the domain boundary.
virtual void compute_postprocessed_quantity(unsigned int quantity_index, const AssemblyContext &context, const libMesh::Point &point, libMesh::Real &value)
bool _is_axisymmetric
Definition: physics.h:268
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
const std::vector< libMesh::Number > & get_cached_values(unsigned int quantity) const
Definition: cached_values.C:99
virtual void read_input_options(const GetPot &input)
Read options from GetPot input file.

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