GRINS-0.7.0
reacting_low_mach_navier_stokes_abstract.C
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 
26 #include "grins_config.h"
27 
28 // This class
30 
31 // GRINS
32 #include "grins/assembly_context.h"
34 #include "grins/cantera_mixture.h"
35 #include "grins/grins_enums.h"
36 #include "grins/antioch_mixture.h"
40 
41 // libMesh
42 #include "libmesh/string_to_enum.h"
43 #include "libmesh/quadrature.h"
44 #include "libmesh/fem_system.h"
45 
46 namespace GRINS
47 {
48 
50  const GetPot& input)
51  : Physics(physics_name, input),
52  _flow_vars(input, PhysicsNaming::reacting_low_mach_navier_stokes()),
53  _press_var(input,PhysicsNaming::reacting_low_mach_navier_stokes(), true /*is_constraint_var*/),
54  _temp_vars(input, PhysicsNaming::reacting_low_mach_navier_stokes()),
55  _species_vars(input, PhysicsNaming::reacting_low_mach_navier_stokes()),
56  _n_species(_species_vars.n_species()),
57  _fixed_density( input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/fixed_density", false ) ),
58  _fixed_rho_value(0.0)
59  {
60  this->set_parameter
61  (_fixed_rho_value, input,
62  "Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/fixed_rho_value", 0.0 );
63 
64  _enable_thermo_press_calc = input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/enable_thermo_press_calc", false );
66  _p0_var.reset( new ThermoPressureFEVariable(input, PhysicsNaming::reacting_low_mach_navier_stokes(), true /*is_constraint_var*/) );
67 
68  this->read_input_options(input);
69  this->register_variables();
70  }
71 
73  {
74  // Read thermodynamic pressure info
77  "ThermodynamicPressure",
79  (*this),
80  _p0 );
81 
82  // Read gravity vector
83  unsigned int g_dim = input.vector_variable_size("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/g");
84 
85  _g(0) = input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/g", 0.0, 0 );
86  _g(1) = input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/g", 0.0, 1 );
87 
88  if( g_dim == 3)
89  _g(2) = input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/g", 0.0, 2 );
90 
91  }
92 
94  {
96  this->_press_var);
98  this->_flow_vars);
100  this->_temp_vars);
102  this->_species_vars);
103  if( this->_enable_thermo_press_calc )
105  *(this->_p0_var));
106  }
107 
108  void ReactingLowMachNavierStokesAbstract::init_variables( libMesh::FEMSystem* system )
109  {
110  // Get libMesh to assign an index for each variable
111  this->_dim = system->get_mesh().mesh_dimension();
112 
113  this->_species_vars.init(system);
114  this->_flow_vars.init(system);
115  this->_press_var.init(system);
116  this->_temp_vars.init(system);
117 
118  /* If we need to compute the thermodynamic pressure, we force this to be a first
119  order scalar variable. */
121  _p0_var->init(system);
122  }
123 
125  {
126  const unsigned int dim = system->get_mesh().mesh_dimension();
127 
128  for( unsigned int i = 0; i < this->_n_species; i++ )
129  {
130  system->time_evolving( _species_vars.species(i) );
131  }
132 
133  system->time_evolving(_flow_vars.u());
134  system->time_evolving(_flow_vars.v());
135 
136  if (dim == 3)
137  system->time_evolving(_flow_vars.w());
138 
139  system->time_evolving(_temp_vars.T());
140  system->time_evolving(_press_var.p());
141 
143  system->time_evolving(_p0_var->p0());
144  }
145 
147  {
148  // We should prerequest all the data
149  // we will need to build the linear system
150  // or evaluate a quantity of interest.
151  context.get_element_fe(_species_vars.species(0))->get_JxW();
152  context.get_element_fe(_species_vars.species(0))->get_phi();
153  context.get_element_fe(_species_vars.species(0))->get_dphi();
154  context.get_element_fe(_species_vars.species(0))->get_xyz();
155 
156  context.get_element_fe(_flow_vars.u())->get_JxW();
157  context.get_element_fe(_flow_vars.u())->get_phi();
158  context.get_element_fe(_flow_vars.u())->get_dphi();
159  context.get_element_fe(_flow_vars.u())->get_xyz();
160 
161  context.get_element_fe(_temp_vars.T())->get_JxW();
162  context.get_element_fe(_temp_vars.T())->get_phi();
163  context.get_element_fe(_temp_vars.T())->get_dphi();
164  context.get_element_fe(_temp_vars.T())->get_xyz();
165 
166  context.get_element_fe(_press_var.p())->get_phi();
167  context.get_element_fe(_press_var.p())->get_xyz();
168  }
169 
170 } // end namespace GRINS
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.
virtual void init(libMesh::FEMSystem *system)
Add variables to the system.
bool _enable_thermo_press_calc
Flag to enable thermodynamic pressure calculation.
static PhysicsName reacting_low_mach_navier_stokes()
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
Definition: physics.h:107
static std::string temperature_section()
virtual void init(libMesh::FEMSystem *system)
Add variables to the system.
static void check_and_register_variable(const std::string &var_name, const FEVariablesBase &variable)
First check if var_name is registered and then register.
GRINS namespace.
libMesh::UniquePtr< ThermoPressureFEVariable > _p0_var
VariableIndex p() const
static std::string velocity_section()
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
static std::string species_mass_fractions_section()
void read_input_options(const GetPot &input)
Read options from GetPot input file.
static std::string thermo_pressure_section()
static std::string pressure_section()
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
static void read_property(const GetPot &input, const std::string &old_option, const std::string &property, const std::string &core_physics, ParameterUser &param_user, libMesh::Real &value)
Helper function for parsing/maintaing backward compatibility.
VariableIndex species(unsigned int species) const
virtual void init_variables(libMesh::FEMSystem *system)
Initialize variables for this physics.

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