GRINS-0.7.0
List of all members | Public Member Functions | Protected Attributes | Private Member Functions
GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator > Class Template Reference

#include <reacting_low_mach_navier_stokes.h>

Inheritance diagram for GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >:
Inheritance graph
[legend]
Collaboration diagram for GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >:
Collaboration graph
[legend]

Public Member Functions

 ReactingLowMachNavierStokes (const PhysicsName &physics_name, const GetPot &input)
 
virtual ~ReactingLowMachNavierStokes ()
 
virtual void auxiliary_init (MultiphysicsSystem &system)
 Any auxillary initialization a Physics class may need. More...
 
virtual void register_postprocessing_vars (const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
 Register postprocessing variables for ReactingLowMachNavierStokes. More...
 
virtual void init_context (AssemblyContext &context)
 Initialize context for added physics variables. More...
 
virtual void element_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for element interiors. More...
 
virtual void element_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for element interiors. More...
 
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. More...
 
virtual void compute_element_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_postprocessed_quantity (unsigned int quantity_index, const AssemblyContext &context, const libMesh::Point &point, libMesh::Real &value)
 
- Public Member Functions inherited from GRINS::ReactingLowMachNavierStokesBase< Mixture >
 ReactingLowMachNavierStokesBase (const PhysicsName &physics_name, const GetPot &input)
 
virtual ~ReactingLowMachNavierStokesBase ()
 
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. More...
 
const Mixture & gas_mixture () const
 
- Public Member Functions inherited from GRINS::ReactingLowMachNavierStokesAbstract
 ReactingLowMachNavierStokesAbstract (const PhysicsName &physics_name, const GetPot &input)
 
virtual ~ReactingLowMachNavierStokesAbstract ()
 
virtual void init_variables (libMesh::FEMSystem *system)
 Initialize variables for this physics. More...
 
virtual void set_time_evolving_vars (libMesh::FEMSystem *system)
 Sets velocity variables to be time-evolving. More...
 
unsigned int n_species () const
 
libMesh::Real T (const libMesh::Point &p, const AssemblyContext &c) const
 
void mass_fractions (const libMesh::Point &p, const AssemblyContext &c, std::vector< libMesh::Real > &mass_fracs) const
 
libMesh::Real rho (libMesh::Real T, libMesh::Real p0, libMesh::Real R_mix) const
 
libMesh::Real get_p0_steady (const AssemblyContext &c, unsigned int qp) const
 
libMesh::Real get_p0_steady_side (const AssemblyContext &c, unsigned int qp) const
 
libMesh::Real get_p0_steady (const AssemblyContext &c, const libMesh::Point &p) const
 
libMesh::Real get_p0_transient (const AssemblyContext &c, unsigned int qp) const
 
- Public Member Functions inherited from GRINS::Physics
 Physics (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~Physics ()
 
virtual bool enabled_on_elem (const libMesh::Elem *elem)
 Find if current physics is active on supplied element. More...
 
void set_is_steady (bool is_steady)
 Sets whether this physics is to be solved with a steady solver or not. More...
 
bool is_steady () const
 Returns whether or not this physics is being solved with a steady solver. More...
 
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. More...
 
virtual void nonlocal_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for scalar variables. More...
 
virtual void side_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for scalar variables. More...
 
virtual void damping_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Damping matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void nonlocal_mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Mass matrix part(s) for scalar variables. More...
 
void init_ics (libMesh::FEMSystem *system, libMesh::CompositeFunction< libMesh::Number > &all_ics)
 
virtual void compute_side_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_element_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_damping_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
ICHandlingBaseget_ic_handler ()
 
- Public Member Functions inherited from GRINS::ParameterUser
 ParameterUser (const std::string &user_name)
 
virtual ~ParameterUser ()
 
virtual void set_parameter (libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
 Each subclass can simultaneously read a parameter value from. More...
 
virtual void set_parameter (libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void set_parameter (libMesh::ParsedFEMFunction< libMesh::Number > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void move_parameter (const libMesh::Number &old_parameter, libMesh::Number &new_parameter)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &old_func, libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFEMFunction< libMesh::Number > &old_func, libMesh::ParsedFEMFunction< libMesh::Number > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 

Protected Attributes

bool _pin_pressure
 Enable pressure pinning. More...
 
PressurePinning _p_pinning
 
unsigned int _rho_index
 Index from registering this quantity. More...
 
std::vector< unsigned int > _species_viscosity
 Index from registering this quantity. Each species will have it's own index. More...
 
unsigned int _mu_index
 Index from registering this quantity. More...
 
unsigned int _k_index
 Index from registering this quantity. More...
 
unsigned int _cp_index
 Index from registering this quantity. More...
 
std::vector< unsigned int > _mole_fractions_index
 Index from registering this quantity. Each species will have it's own index. More...
 
std::vector< unsigned int > _h_s_index
 Index from registering this quantity. Each species will have it's own index. More...
 
std::vector< unsigned int > _omega_dot_index
 Index from registering this quantity. Each species will have it's own index. More...
 
- Protected Attributes inherited from GRINS::ReactingLowMachNavierStokesBase< Mixture >
Mixture _gas_mixture
 
- Protected Attributes inherited from GRINS::ReactingLowMachNavierStokesAbstract
libMesh::Number _p0
 
unsigned int _dim
 Physical dimension of problem. More...
 
VelocityFEVariables _flow_vars
 
PressureFEVariable _press_var
 
PrimitiveTempFEVariables _temp_vars
 
libMesh::UniquePtr< ThermoPressureFEVariable_p0_var
 
SpeciesMassFractionsFEVariables _species_vars
 
unsigned int _n_species
 Number of species. More...
 
libMesh::Point _g
 Gravity vector. More...
 
bool _enable_thermo_press_calc
 Flag to enable thermodynamic pressure calculation. More...
 
bool _fixed_density
 
libMesh::Real _fixed_rho_value
 
- Protected Attributes inherited from GRINS::Physics
const PhysicsName _physics_name
 Name of the physics object. Used for reading physics specific inputs. More...
 
GRINS::ICHandlingBase_ic_handler
 
std::set< libMesh::subdomain_id_type > _enabled_subdomains
 Subdomains on which the current Physics class is enabled. More...
 

Private Member Functions

 ReactingLowMachNavierStokes ()
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::Physics
static void set_is_axisymmetric (bool is_axisymmetric)
 Set whether we should treat the problem as axisymmetric. More...
 
static bool is_axisymmetric ()
 
- Static Public Attributes inherited from GRINS::ParameterUser
static std::string zero_vector_function = std::string("{0}")
 A parseable function string with LIBMESH_DIM components, all 0. More...
 
- Protected Member Functions inherited from GRINS::Physics
libMesh::UniquePtr< libMesh::FEGenericBase< libMesh::Real > > build_new_fe (const libMesh::Elem *elem, const libMesh::FEGenericBase< libMesh::Real > *fe, const libMesh::Point p)
 
void parse_enabled_subdomains (const GetPot &input, const std::string &physics_name)
 
- Static Protected Attributes inherited from GRINS::Physics
static bool _is_steady = false
 Caches whether or not the solver that's being used is steady or not. More...
 
static bool _is_axisymmetric = false
 Caches whether we are solving an axisymmetric problem or not. More...
 

Detailed Description

template<typename Mixture, typename Evaluator>
class GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >

Definition at line 35 of file reacting_low_mach_navier_stokes.h.

Constructor & Destructor Documentation

template<typename Mixture , typename Evaluator >
GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::ReactingLowMachNavierStokes ( const PhysicsName physics_name,
const GetPot &  input 
)

Definition at line 42 of file reacting_low_mach_navier_stokes.C.

References GRINS::Physics::_ic_handler, GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_pin_pressure, and GRINS::PhysicsNaming::reacting_low_mach_navier_stokes().

43  : ReactingLowMachNavierStokesBase<Mixture>(physics_name,input),
44  _p_pinning(input,physics_name),
45  _rho_index(0),
46  _mu_index(0),
47  _k_index(0),
48  _cp_index(0)
49  {
50  this->_pin_pressure = input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/pin_pressure", false );
51 
52  this->_ic_handler = new GenericICHandler( physics_name, input );
53  }
GRINS::ICHandlingBase * _ic_handler
Definition: physics.h:269
static PhysicsName reacting_low_mach_navier_stokes()
unsigned int _k_index
Index from registering this quantity.
unsigned int _mu_index
Index from registering this quantity.
unsigned int _rho_index
Index from registering this quantity.
unsigned int _cp_index
Index from registering this quantity.
template<typename Mixture , typename Evaluator >
virtual GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::~ReactingLowMachNavierStokes ( )
inlinevirtual

Definition at line 41 of file reacting_low_mach_navier_stokes.h.

41 {};
template<typename Mixture , typename Evaluator >
GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::ReactingLowMachNavierStokes ( )
private

Member Function Documentation

template<typename Mixture , typename Evaluator >
void GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::auxiliary_init ( MultiphysicsSystem system)
virtual

Any auxillary initialization a Physics class may need.

This is called after all variables are added, so this method can safely query the MultiphysicsSystem about variable information.

Reimplemented from GRINS::Physics.

Definition at line 56 of file reacting_low_mach_navier_stokes.C.

57  {
58  if( _pin_pressure )
59  _p_pinning.check_pin_location(system.get_mesh());
60  }
void check_pin_location(const libMesh::MeshBase &mesh)
Check the mesh to ensure pin location is found.
template<typename Mixture , typename Evaluator >
void GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::compute_element_time_derivative_cache ( const AssemblyContext context,
CachedValues cache 
)
virtual
Todo:
Need to figure out something smarter for controling species that go slightly negative.

Reimplemented from GRINS::Physics.

Definition at line 405 of file reacting_low_mach_navier_stokes.C.

References GRINS::Cache::DIFFUSION_COEFFS, GRINS::Cache::MASS_FRACTIONS, GRINS::Cache::MASS_FRACTIONS_GRAD, GRINS::Cache::MIXTURE_DENSITY, GRINS::Cache::MIXTURE_GAS_CONSTANT, GRINS::Cache::MIXTURE_SPECIFIC_HEAT_P, GRINS::Cache::MIXTURE_THERMAL_CONDUCTIVITY, GRINS::Cache::MIXTURE_VISCOSITY, GRINS::Cache::MOLAR_MASS, GRINS::Cache::OMEGA_DOT, GRINS::Cache::PRESSURE, GRINS::CachedValues::set_gradient_values(), GRINS::CachedValues::set_values(), GRINS::CachedValues::set_vector_gradient_values(), GRINS::CachedValues::set_vector_values(), GRINS::Cache::SPECIES_ENTHALPY, GRINS::Cache::TEMPERATURE, GRINS::Cache::TEMPERATURE_GRAD, GRINS::Cache::THERMO_PRESSURE, GRINS::Cache::X_VELOCITY, GRINS::Cache::X_VELOCITY_GRAD, GRINS::Cache::Y_VELOCITY, GRINS::Cache::Y_VELOCITY_GRAD, GRINS::Cache::Z_VELOCITY, and GRINS::Cache::Z_VELOCITY_GRAD.

407  {
408  Evaluator gas_evaluator( this->_gas_mixture );
409 
410  const unsigned int n_qpoints = context.get_element_qrule().n_points();
411 
412  std::vector<libMesh::Real> u, v, w, T, p, p0;
413  u.resize(n_qpoints);
414  v.resize(n_qpoints);
415  if( this->_dim > 2 )
416  w.resize(n_qpoints);
417 
418  T.resize(n_qpoints);
419  p.resize(n_qpoints);
420  p0.resize(n_qpoints);
421 
422  std::vector<libMesh::Gradient> grad_u, grad_v, grad_w, grad_T;
423  grad_u.resize(n_qpoints);
424  grad_v.resize(n_qpoints);
425  if( this->_dim > 2 )
426  grad_w.resize(n_qpoints);
427 
428  grad_T.resize(n_qpoints);
429 
430  std::vector<std::vector<libMesh::Real> > mass_fractions;
431  std::vector<std::vector<libMesh::Gradient> > grad_mass_fractions;
432  mass_fractions.resize(n_qpoints);
433  grad_mass_fractions.resize(n_qpoints);
434 
435  std::vector<libMesh::Real> M;
436  M.resize(n_qpoints);
437 
438  std::vector<libMesh::Real> R;
439  R.resize(n_qpoints);
440 
441  std::vector<libMesh::Real> rho;
442  rho.resize(n_qpoints);
443 
444  std::vector<libMesh::Real> cp;
445  cp.resize(n_qpoints);
446 
447  std::vector<libMesh::Real> mu;
448  mu.resize(n_qpoints);
449 
450  std::vector<libMesh::Real> k;
451  k.resize(n_qpoints);
452 
453  std::vector<std::vector<libMesh::Real> > h_s;
454  h_s.resize(n_qpoints);
455 
456  std::vector<std::vector<libMesh::Real> > D_s;
457  D_s.resize(n_qpoints);
458 
459  std::vector<std::vector<libMesh::Real> > omega_dot_s;
460  omega_dot_s.resize(n_qpoints);
461 
462  for (unsigned int qp = 0; qp != n_qpoints; ++qp)
463  {
464  u[qp] = context.interior_value(this->_flow_vars.u(), qp);
465  v[qp] = context.interior_value(this->_flow_vars.v(), qp);
466 
467  grad_u[qp] = context.interior_gradient(this->_flow_vars.u(), qp);
468  grad_v[qp] = context.interior_gradient(this->_flow_vars.v(), qp);
469  if( this->_dim > 2 )
470  {
471  w[qp] = context.interior_value(this->_flow_vars.w(), qp);
472  grad_w[qp] = context.interior_gradient(this->_flow_vars.w(), qp);
473  }
474 
475  T[qp] = context.interior_value(this->_temp_vars.T(), qp);
476  grad_T[qp] = context.interior_gradient(this->_temp_vars.T(), qp);
477 
478  p[qp] = context.interior_value(this->_press_var.p(), qp);
479  p0[qp] = this->get_p0_steady(context, qp);
480 
481  mass_fractions[qp].resize(this->_n_species);
482  grad_mass_fractions[qp].resize(this->_n_species);
483  h_s[qp].resize(this->_n_species);
484 
485  for( unsigned int s = 0; s < this->_n_species; s++ )
486  {
489  mass_fractions[qp][s] = std::max( context.interior_value(this->_species_vars.species(s),qp), 0.0 );
490  grad_mass_fractions[qp][s] = context.interior_gradient(this->_species_vars.species(s),qp);
491  h_s[qp][s] = gas_evaluator.h_s( T[qp], s );
492  }
493 
494  M[qp] = gas_evaluator.M_mix( mass_fractions[qp] );
495 
496  R[qp] = gas_evaluator.R_mix( mass_fractions[qp] );
497 
498  rho[qp] = this->rho( T[qp], p0[qp], R[qp] );
499 
500  cp[qp] = gas_evaluator.cp(T[qp], p0[qp], mass_fractions[qp]);
501 
502  D_s[qp].resize(this->_n_species);
503 
504  gas_evaluator.mu_and_k_and_D( T[qp], rho[qp], cp[qp], mass_fractions[qp],
505  mu[qp], k[qp], D_s[qp] );
506 
507  omega_dot_s[qp].resize(this->_n_species);
508  gas_evaluator.omega_dot( T[qp], rho[qp], mass_fractions[qp], omega_dot_s[qp] );
509  }
510 
511  cache.set_values(Cache::X_VELOCITY, u);
512  cache.set_values(Cache::Y_VELOCITY, v);
513  cache.set_gradient_values(Cache::X_VELOCITY_GRAD, grad_u);
514  cache.set_gradient_values(Cache::Y_VELOCITY_GRAD, grad_v);
515 
516  if(this->_dim > 2)
517  {
518  cache.set_values(Cache::Z_VELOCITY, w);
519  cache.set_gradient_values(Cache::Z_VELOCITY_GRAD, grad_w);
520  }
521 
522  cache.set_values(Cache::TEMPERATURE, T);
523  cache.set_gradient_values(Cache::TEMPERATURE_GRAD, grad_T);
524  cache.set_values(Cache::PRESSURE, p);
525  cache.set_values(Cache::THERMO_PRESSURE, p0);
526  cache.set_vector_values(Cache::MASS_FRACTIONS, mass_fractions);
527  cache.set_vector_gradient_values(Cache::MASS_FRACTIONS_GRAD, grad_mass_fractions);
528  cache.set_values(Cache::MOLAR_MASS, M);
529  cache.set_values(Cache::MIXTURE_GAS_CONSTANT, R);
530  cache.set_values(Cache::MIXTURE_DENSITY, rho);
531  cache.set_values(Cache::MIXTURE_SPECIFIC_HEAT_P, cp);
532  cache.set_values(Cache::MIXTURE_VISCOSITY, mu);
533  cache.set_values(Cache::MIXTURE_THERMAL_CONDUCTIVITY, k);
534  cache.set_vector_values(Cache::DIFFUSION_COEFFS, D_s);
535  cache.set_vector_values(Cache::SPECIES_ENTHALPY, h_s);
536  cache.set_vector_values(Cache::OMEGA_DOT, omega_dot_s);
537  }
libMesh::Real T(const libMesh::Point &p, const AssemblyContext &c) const
void mass_fractions(const libMesh::Point &p, const AssemblyContext &c, std::vector< libMesh::Real > &mass_fracs) const
libMesh::Real rho(libMesh::Real T, libMesh::Real p0, libMesh::Real R_mix) const
VariableIndex p() const
VariableIndex species(unsigned int species) const
libMesh::Real get_p0_steady(const AssemblyContext &c, unsigned int qp) const
template<typename Mixture , typename Evaluator >
void GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::compute_postprocessed_quantity ( unsigned int  quantity_index,
const AssemblyContext context,
const libMesh::Point &  point,
libMesh::Real &  value 
)
virtual

Reimplemented from GRINS::Physics.

Definition at line 540 of file reacting_low_mach_navier_stokes.C.

544  {
545  Evaluator gas_evaluator( this->_gas_mixture );
546 
547  if( quantity_index == this->_rho_index )
548  {
549  std::vector<libMesh::Real> Y( this->_n_species );
550  libMesh::Real T = this->T(point,context);
551  libMesh::Real p0 = this->get_p0_steady(context,point);
552  this->mass_fractions( point, context, Y );
553 
554  value = this->rho( T, p0, gas_evaluator.R_mix(Y) );
555  }
556  else if( quantity_index == this->_mu_index )
557  {
558  std::vector<libMesh::Real> Y( this->_n_species );
559  libMesh::Real T = this->T(point,context);
560  this->mass_fractions( point, context, Y );
561  libMesh::Real p0 = this->get_p0_steady(context,point);
562 
563  value = gas_evaluator.mu( T, p0, Y );
564  }
565  else if( quantity_index == this->_k_index )
566  {
567  std::vector<libMesh::Real> Y( this->_n_species );
568  libMesh::Real T = this->T(point,context);
569  this->mass_fractions( point, context, Y );
570  libMesh::Real p0 = this->get_p0_steady(context,point);
571 
572  value = gas_evaluator.k( T, p0, Y );
573  }
574  else if( quantity_index == this->_cp_index )
575  {
576  std::vector<libMesh::Real> Y( this->_n_species );
577  libMesh::Real T = this->T(point,context);
578  this->mass_fractions( point, context, Y );
579  libMesh::Real p0 = this->get_p0_steady(context,point);
580 
581  value = gas_evaluator.cp( T, p0, Y );
582  }
583  // Now check for species dependent stuff
584  else
585  {
586  if( !this->_h_s_index.empty() )
587  {
588  libmesh_assert_equal_to( _h_s_index.size(), this->n_species() );
589 
590  for( unsigned int s = 0; s < this->n_species(); s++ )
591  {
592  if( quantity_index == this->_h_s_index[s] )
593  {
594  libMesh::Real T = this->T(point,context);
595 
596  value = gas_evaluator.h_s( T, s );
597  return;
598  }
599  }
600  }
601 
602  if( !this->_mole_fractions_index.empty() )
603  {
604  libmesh_assert_equal_to( _mole_fractions_index.size(), this->n_species() );
605 
606  for( unsigned int s = 0; s < this->n_species(); s++ )
607  {
608  if( quantity_index == this->_mole_fractions_index[s] )
609  {
610  std::vector<libMesh::Real> Y( this->_n_species );
611  this->mass_fractions( point, context, Y );
612 
613  libMesh::Real M = gas_evaluator.M_mix(Y);
614 
615  value = gas_evaluator.X( s, M, Y[s] );
616  return;
617  }
618  }
619  }
620 
621  if( !this->_omega_dot_index.empty() )
622  {
623  libmesh_assert_equal_to( _omega_dot_index.size(), this->n_species() );
624 
625  for( unsigned int s = 0; s < this->n_species(); s++ )
626  {
627  if( quantity_index == this->_omega_dot_index[s] )
628  {
629  std::vector<libMesh::Real> Y( this->n_species() );
630  this->mass_fractions( point, context, Y );
631 
632  libMesh::Real T = this->T(point,context);
633 
634  libMesh::Real p0 = this->get_p0_steady(context,point);
635 
636  libMesh::Real rho = this->rho( T, p0, gas_evaluator.R_mix(Y) );
637 
638  std::vector<libMesh::Real> omega_dot( this->n_species() );
639  gas_evaluator.omega_dot( T, rho, Y, omega_dot );
640 
641  value = omega_dot[s];
642  return;
643  }
644  }
645  }
646 
647  } // if/else quantity_index
648 
649  return;
650  }
std::vector< unsigned int > _mole_fractions_index
Index from registering this quantity. Each species will have it's own index.
libMesh::Real T(const libMesh::Point &p, const AssemblyContext &c) const
void mass_fractions(const libMesh::Point &p, const AssemblyContext &c, std::vector< libMesh::Real > &mass_fracs) const
unsigned int _k_index
Index from registering this quantity.
libMesh::Real rho(libMesh::Real T, libMesh::Real p0, libMesh::Real R_mix) const
unsigned int _mu_index
Index from registering this quantity.
std::vector< unsigned int > _omega_dot_index
Index from registering this quantity. Each species will have it's own index.
unsigned int _rho_index
Index from registering this quantity.
libMesh::Real get_p0_steady(const AssemblyContext &c, unsigned int qp) const
std::vector< unsigned int > _h_s_index
Index from registering this quantity. Each species will have it's own index.
unsigned int _cp_index
Index from registering this quantity.
template<typename Mixture , typename Evaluator >
void GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::element_constraint ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Constraint part(s) of physics for element interiors.

Reimplemented from GRINS::Physics.

Definition at line 381 of file reacting_low_mach_navier_stokes.C.

384  {
385  // Pin p = p_value at p_point
386  if( this->_pin_pressure )
387  {
388  _p_pinning.pin_value( context, compute_jacobian, this->_press_var.p() );
389  }
390 
391  return;
392  }
VariableIndex p() const
void pin_value(libMesh::DiffContext &context, const bool request_jacobian, const GRINS::VariableIndex var, const double penalty=1.0)
The idea here is to pin a variable to a particular value if there is a null space - e...
template<typename Mixture , typename Evaluator >
void GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::element_time_derivative ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Time dependent part(s) of physics for element interiors.

Todo:
Need to add SCEBD term.
Todo:
Would it be better to put this in its own DoF loop and do the if check once?

Reimplemented from GRINS::Physics.

Definition at line 158 of file reacting_low_mach_navier_stokes.C.

References GRINS::Cache::DIFFUSION_COEFFS, GRINS::CachedValues::get_cached_gradient_values(), GRINS::CachedValues::get_cached_values(), GRINS::CachedValues::get_cached_vector_gradient_values(), GRINS::CachedValues::get_cached_vector_values(), GRINS::Physics::is_axisymmetric(), GRINS::Cache::MASS_FRACTIONS_GRAD, GRINS::Cache::MIXTURE_DENSITY, GRINS::Cache::MIXTURE_SPECIFIC_HEAT_P, GRINS::Cache::MIXTURE_THERMAL_CONDUCTIVITY, GRINS::Cache::MIXTURE_VISCOSITY, GRINS::Cache::MOLAR_MASS, GRINS::Cache::OMEGA_DOT, GRINS::Cache::PRESSURE, GRINS::Cache::SPECIES_ENTHALPY, GRINS::Cache::TEMPERATURE, GRINS::Cache::TEMPERATURE_GRAD, GRINS::Cache::X_VELOCITY, GRINS::Cache::X_VELOCITY_GRAD, GRINS::Cache::Y_VELOCITY, GRINS::Cache::Y_VELOCITY_GRAD, GRINS::Cache::Z_VELOCITY, and GRINS::Cache::Z_VELOCITY_GRAD.

161  {
162  if( compute_jacobian )
163  {
164  libmesh_not_implemented();
165  }
166  // Convenience
167  const VariableIndex s0_var = this->_species_vars.species(0);
168 
169  // The number of local degrees of freedom in each variable.
170  const unsigned int n_p_dofs = context.get_dof_indices(this->_press_var.p()).size();
171  const unsigned int n_s_dofs = context.get_dof_indices(s0_var).size();
172  const unsigned int n_u_dofs = context.get_dof_indices(this->_flow_vars.u()).size();
173  const unsigned int n_T_dofs = context.get_dof_indices(this->_temp_vars.T()).size();
174 
175  // Check number of dofs is same for _flow_vars.u(), v_var and w_var.
176  libmesh_assert (n_u_dofs == context.get_dof_indices(this->_flow_vars.v()).size());
177  if (this->_dim == 3)
178  libmesh_assert (n_u_dofs == context.get_dof_indices(this->_flow_vars.w()).size());
179 
180  // Element Jacobian * quadrature weights for interior integration.
181  const std::vector<libMesh::Real>& JxW =
182  context.get_element_fe(this->_flow_vars.u())->get_JxW();
183 
184  // The pressure shape functions at interior quadrature points.
185  const std::vector<std::vector<libMesh::Real> >& p_phi =
186  context.get_element_fe(this->_press_var.p())->get_phi();
187 
188  // The species shape functions at interior quadrature points.
189  const std::vector<std::vector<libMesh::Real> >& s_phi = context.get_element_fe(s0_var)->get_phi();
190 
191  // The species shape function gradients at interior quadrature points.
192  const std::vector<std::vector<libMesh::Gradient> >& s_grad_phi = context.get_element_fe(s0_var)->get_dphi();
193 
194  // The pressure shape functions at interior quadrature points.
195  const std::vector<std::vector<libMesh::Real> >& u_phi =
196  context.get_element_fe(this->_flow_vars.u())->get_phi();
197 
198  // The velocity shape function gradients at interior quadrature points.
199  const std::vector<std::vector<libMesh::RealGradient> >& u_gradphi =
200  context.get_element_fe(this->_flow_vars.u())->get_dphi();
201 
202  // The temperature shape functions at interior quadrature points.
203  const std::vector<std::vector<libMesh::Real> >& T_phi =
204  context.get_element_fe(this->_temp_vars.T())->get_phi();
205 
206  // The temperature shape functions gradients at interior quadrature points.
207  const std::vector<std::vector<libMesh::RealGradient> >& T_gradphi =
208  context.get_element_fe(this->_temp_vars.T())->get_dphi();
209 
210  const std::vector<libMesh::Point>& u_qpoint =
211  context.get_element_fe(this->_flow_vars.u())->get_xyz();
212 
213  libMesh::DenseSubVector<libMesh::Number>& Fp = context.get_elem_residual(this->_press_var.p()); // R_{p}
214 
215  libMesh::DenseSubVector<libMesh::Number> &Fu = context.get_elem_residual(this->_flow_vars.u()); // R_{u}
216  libMesh::DenseSubVector<libMesh::Number> &Fv = context.get_elem_residual(this->_flow_vars.v()); // R_{v}
217  libMesh::DenseSubVector<libMesh::Real>* Fw = NULL;
218 
219  if( this->_dim == 3 )
220  {
221  Fw = &context.get_elem_residual(this->_flow_vars.w()); // R_{w}
222  }
223 
224  libMesh::DenseSubVector<libMesh::Number> &FT = context.get_elem_residual(this->_temp_vars.T()); // R_{T}
225 
226  unsigned int n_qpoints = context.get_element_qrule().n_points();
227  for (unsigned int qp=0; qp != n_qpoints; qp++)
228  {
229  libMesh::Number rho = cache.get_cached_values(Cache::MIXTURE_DENSITY)[qp];
230 
231  libMesh::Number u, v, T;
232  u = cache.get_cached_values(Cache::X_VELOCITY)[qp];
233  v = cache.get_cached_values(Cache::Y_VELOCITY)[qp];
234 
235  T = cache.get_cached_values(Cache::TEMPERATURE)[qp];
236 
237  const libMesh::Gradient& grad_T =
238  cache.get_cached_gradient_values(Cache::TEMPERATURE_GRAD)[qp];
239 
240  libMesh::NumberVectorValue U(u,v);
241  if (this->_dim == 3)
242  U(2) = cache.get_cached_values(Cache::Z_VELOCITY)[qp]; // w
243 
244  libMesh::Gradient grad_u = cache.get_cached_gradient_values(Cache::X_VELOCITY_GRAD)[qp];
245  libMesh::Gradient grad_v = cache.get_cached_gradient_values(Cache::Y_VELOCITY_GRAD)[qp];
246 
247  libMesh::Gradient grad_w;
248  if (this->_dim == 3)
249  grad_w = cache.get_cached_gradient_values(Cache::Z_VELOCITY_GRAD)[qp];
250 
251  libMesh::Number divU = grad_u(0) + grad_v(1);
252  if (this->_dim == 3)
253  divU += grad_w(2);
254 
255  libMesh::NumberVectorValue grad_uT( grad_u(0), grad_v(0) );
256  libMesh::NumberVectorValue grad_vT( grad_u(1), grad_v(1) );
257  libMesh::NumberVectorValue grad_wT;
258  if( this->_dim == 3 )
259  {
260  grad_uT(2) = grad_w(0);
261  grad_vT(2) = grad_w(1);
262  grad_wT = libMesh::NumberVectorValue( grad_u(2), grad_v(2), grad_w(2) );
263  }
264 
265  libMesh::Number mu = cache.get_cached_values(Cache::MIXTURE_VISCOSITY)[qp];
266  libMesh::Number p = cache.get_cached_values(Cache::PRESSURE)[qp];
267 
268  const std::vector<libMesh::Real>& D =
269  cache.get_cached_vector_values(Cache::DIFFUSION_COEFFS)[qp];
270 
271  libMesh::Number cp =
272  cache.get_cached_values(Cache::MIXTURE_SPECIFIC_HEAT_P)[qp];
273 
274  libMesh::Number k =
275  cache.get_cached_values(Cache::MIXTURE_THERMAL_CONDUCTIVITY)[qp];
276 
277  const std::vector<libMesh::Real>& omega_dot =
278  cache.get_cached_vector_values(Cache::OMEGA_DOT)[qp];
279 
280  const std::vector<libMesh::Real>& h =
281  cache.get_cached_vector_values(Cache::SPECIES_ENTHALPY)[qp];
282 
283  const libMesh::Number r = u_qpoint[qp](0);
284 
285  libMesh::Real jac = JxW[qp];
286 
288  {
289  divU += U(0)/r;
290  jac *= r;
291  }
292 
293  libMesh::Real M = cache.get_cached_values(Cache::MOLAR_MASS)[qp];
294 
295  std::vector<libMesh::Gradient> grad_ws = cache.get_cached_vector_gradient_values(Cache::MASS_FRACTIONS_GRAD)[qp];
296  libmesh_assert_equal_to( grad_ws.size(), this->_n_species );
297 
298  // Continuity Residual
299  libMesh::Gradient mass_term(0.0,0.0,0.0);
300  for(unsigned int s=0; s < this->_n_species; s++ )
301  {
302  mass_term += grad_ws[s]/this->_gas_mixture.M(s);
303  }
304  mass_term *= M;
305 
306  for (unsigned int i=0; i != n_p_dofs; i++)
307  {
308  Fp(i) += (-U*(mass_term + grad_T/T) + divU)*jac*p_phi[i][qp];
309  }
310 
311  // Species residuals
312  for(unsigned int s=0; s < this->_n_species; s++ )
313  {
314  libMesh::DenseSubVector<libMesh::Number> &Fs =
315  context.get_elem_residual(this->_species_vars.species(s)); // R_{s}
316 
317  const libMesh::Real term1 = -rho*(U*grad_ws[s]) + omega_dot[s];
318  const libMesh::Gradient term2 = -rho*D[s]*grad_ws[s];
319 
320  for (unsigned int i=0; i != n_s_dofs; i++)
321  {
323  Fs(i) += ( term1*s_phi[i][qp] + term2*s_grad_phi[i][qp] )*jac;
324  }
325  }
326 
327  // Momentum residuals
328  for (unsigned int i=0; i != n_u_dofs; i++)
329  {
330  Fu(i) += ( -rho*U*grad_u*u_phi[i][qp]
331  + p*u_gradphi[i][qp](0)
332  - mu*(u_gradphi[i][qp]*grad_u + u_gradphi[i][qp]*grad_uT
333  - 2.0/3.0*divU*u_gradphi[i][qp](0) )
334  + rho*this->_g(0)*u_phi[i][qp]
335  )*jac;
336 
340  {
341  Fu(i) += u_phi[i][qp]*( p/r - 2*mu*U(0)/(r*r) - 2.0/3.0*mu*divU/r )*jac;
342  }
343 
344  Fv(i) += ( -rho*U*grad_v*u_phi[i][qp]
345  + p*u_gradphi[i][qp](1)
346  - mu*(u_gradphi[i][qp]*grad_v + u_gradphi[i][qp]*grad_vT
347  - 2.0/3.0*divU*u_gradphi[i][qp](1) )
348  + rho*this->_g(1)*u_phi[i][qp]
349  )*jac;
350 
351  if (this->_dim == 3)
352  {
353  (*Fw)(i) += ( -rho*U*grad_w*u_phi[i][qp]
354  + p*u_gradphi[i][qp](2)
355  - mu*(u_gradphi[i][qp]*grad_w + u_gradphi[i][qp]*grad_wT
356  - 2.0/3.0*divU*u_gradphi[i][qp](2) )
357  + rho*this->_g(2)*u_phi[i][qp]
358  )*jac;
359  }
360  }
361 
362  // Energy residual
363  libMesh::Real chem_term = 0.0;
364  for(unsigned int s=0; s < this->_n_species; s++ )
365  {
366  chem_term += h[s]*omega_dot[s];
367  }
368 
369  for (unsigned int i=0; i != n_T_dofs; i++)
370  {
371  FT(i) += ( ( -rho*cp*U*grad_T - chem_term )*T_phi[i][qp]
372  - k*grad_T*T_gradphi[i][qp] )*jac;
373  }
374 
375  } // quadrature loop
376 
377  return;
378  }
static bool is_axisymmetric()
Definition: physics.h:133
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
Definition: var_typedefs.h:42
libMesh::Real T(const libMesh::Point &p, const AssemblyContext &c) const
libMesh::Real rho(libMesh::Real T, libMesh::Real p0, libMesh::Real R_mix) const
VariableIndex p() const
VariableIndex species(unsigned int species) const
template<typename Mixture , typename Evaluator >
void GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::init_context ( AssemblyContext context)
virtual

Initialize context for added physics variables.

Reimplemented from GRINS::ReactingLowMachNavierStokesAbstract.

Definition at line 140 of file reacting_low_mach_navier_stokes.C.

References GRINS::ReactingLowMachNavierStokesAbstract::init_context().

141  {
142  // First call base class
144 
145  // We also need the side shape functions, etc.
146  context.get_side_fe(this->_flow_vars.u())->get_JxW();
147  context.get_side_fe(this->_flow_vars.u())->get_phi();
148  context.get_side_fe(this->_flow_vars.u())->get_dphi();
149  context.get_side_fe(this->_flow_vars.u())->get_xyz();
150 
151  context.get_side_fe(this->_temp_vars.T())->get_JxW();
152  context.get_side_fe(this->_temp_vars.T())->get_phi();
153  context.get_side_fe(this->_temp_vars.T())->get_dphi();
154  context.get_side_fe(this->_temp_vars.T())->get_xyz();
155  }
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
template<typename Mixture , typename Evaluator >
void GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::mass_residual ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part.

Reimplemented from GRINS::Physics.

Definition at line 395 of file reacting_low_mach_navier_stokes.C.

398  {
399  libmesh_not_implemented();
400 
401  return;
402  }
template<typename Mixture , typename Evaluator >
void GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::register_postprocessing_vars ( const GetPot &  input,
PostProcessedQuantities< libMesh::Real > &  postprocessing 
)
virtual

Register postprocessing variables for ReactingLowMachNavierStokes.

Reimplemented from GRINS::Physics.

Definition at line 63 of file reacting_low_mach_navier_stokes.C.

References GRINS::PhysicsNaming::reacting_low_mach_navier_stokes(), and GRINS::PostProcessedQuantities< NumericType >::register_quantity().

65  {
66  std::string section = "Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/output_vars";
67 
68  if( input.have_variable(section) )
69  {
70  unsigned int n_vars = input.vector_variable_size(section);
71 
72  for( unsigned int v = 0; v < n_vars; v++ )
73  {
74  std::string name = input(section,"DIE!",v);
75 
76  if( name == std::string("rho") )
77  {
78  this->_rho_index = postprocessing.register_quantity( name );
79  }
80  else if( name == std::string("mu") )
81  {
82  this->_mu_index = postprocessing.register_quantity( name );
83  }
84  else if( name == std::string("k") )
85  {
86  this->_k_index = postprocessing.register_quantity( name );
87  }
88  else if( name == std::string("cp") )
89  {
90  this->_cp_index = postprocessing.register_quantity( name );
91  }
92  else if( name == std::string("mole_fractions") )
93  {
94  this->_mole_fractions_index.resize(this->n_species());
95 
96  for( unsigned int s = 0; s < this->n_species(); s++ )
97  {
98  this->_mole_fractions_index[s] = postprocessing.register_quantity( "X_"+this->_gas_mixture.species_name(s) );
99  }
100  }
101  else if( name == std::string("h_s") )
102  {
103  this->_h_s_index.resize(this->n_species());
104 
105  for( unsigned int s = 0; s < this->n_species(); s++ )
106  {
107  this->_h_s_index[s] = postprocessing.register_quantity( "h_"+this->_gas_mixture.species_name(s) );
108  }
109  }
110  else if( name == std::string("omega_dot") )
111  {
112  this->_omega_dot_index.resize(this->n_species());
113 
114  for( unsigned int s = 0; s < this->n_species(); s++ )
115  {
116  this->_omega_dot_index[s] = postprocessing.register_quantity( "omega_dot_"+this->_gas_mixture.species_name(s) );
117  }
118 
119  std::cout << "omega_dot size = " << _omega_dot_index.size() << std::endl;
120  }
121  else
122  {
123  std::cerr << "Error: Invalue output_vars value for "+PhysicsNaming::reacting_low_mach_navier_stokes() << std::endl
124  << " Found " << name << std::endl
125  << " Acceptable values are: rho" << std::endl
126  << " mu" << std::endl
127  << " k" << std::endl
128  << " cp" << std::endl
129  << " mole_fractions" << std::endl
130  << " omega_dot" << std::endl;
131  libmesh_error();
132  }
133  }
134  }
135 
136  return;
137  }
static PhysicsName reacting_low_mach_navier_stokes()
std::vector< unsigned int > _mole_fractions_index
Index from registering this quantity. Each species will have it's own index.
unsigned int _k_index
Index from registering this quantity.
unsigned int _mu_index
Index from registering this quantity.
std::vector< unsigned int > _omega_dot_index
Index from registering this quantity. Each species will have it's own index.
unsigned int _rho_index
Index from registering this quantity.
std::vector< unsigned int > _h_s_index
Index from registering this quantity. Each species will have it's own index.
unsigned int _cp_index
Index from registering this quantity.

Member Data Documentation

template<typename Mixture , typename Evaluator >
unsigned int GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_cp_index
protected

Index from registering this quantity.

Definition at line 96 of file reacting_low_mach_navier_stokes.h.

template<typename Mixture , typename Evaluator >
std::vector<unsigned int> GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_h_s_index
protected

Index from registering this quantity. Each species will have it's own index.

Definition at line 102 of file reacting_low_mach_navier_stokes.h.

template<typename Mixture , typename Evaluator >
unsigned int GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_k_index
protected

Index from registering this quantity.

Definition at line 93 of file reacting_low_mach_navier_stokes.h.

template<typename Mixture , typename Evaluator >
std::vector<unsigned int> GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_mole_fractions_index
protected

Index from registering this quantity. Each species will have it's own index.

Definition at line 99 of file reacting_low_mach_navier_stokes.h.

template<typename Mixture , typename Evaluator >
unsigned int GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_mu_index
protected

Index from registering this quantity.

Definition at line 90 of file reacting_low_mach_navier_stokes.h.

template<typename Mixture , typename Evaluator >
std::vector<unsigned int> GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_omega_dot_index
protected

Index from registering this quantity. Each species will have it's own index.

Definition at line 105 of file reacting_low_mach_navier_stokes.h.

template<typename Mixture , typename Evaluator >
PressurePinning GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_p_pinning
protected

Definition at line 81 of file reacting_low_mach_navier_stokes.h.

template<typename Mixture , typename Evaluator >
bool GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_pin_pressure
protected
template<typename Mixture , typename Evaluator >
unsigned int GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_rho_index
protected

Index from registering this quantity.

Definition at line 84 of file reacting_low_mach_navier_stokes.h.

template<typename Mixture , typename Evaluator >
std::vector<unsigned int> GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >::_species_viscosity
protected

Index from registering this quantity. Each species will have it's own index.

Definition at line 87 of file reacting_low_mach_navier_stokes.h.


The documentation for this class was generated from the following files:

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