GRINS-0.8.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-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 
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(GRINSPrivate::VariableWarehouse::get_variable_subclass<VelocityVariable>(VariablesParsing::velocity_variable_name(input,physics_name,VariablesParsing::PHYSICS))),
53  _press_var(GRINSPrivate::VariableWarehouse::get_variable_subclass<PressureFEVariable>(VariablesParsing::press_variable_name(input,physics_name,VariablesParsing::PHYSICS))),
54  _temp_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<PrimitiveTempFEVariables>(VariablesParsing::temp_variable_name(input,physics_name,VariablesParsing::PHYSICS))),
55  _species_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<SpeciesMassFractionsVariable>(VariablesParsing::species_mass_frac_variable_name(input,physics_name,VariablesParsing::PHYSICS))),
56  _p0_var(NULL),
57  _n_species(_species_vars.n_species()),
58  _fixed_density( input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/fixed_density", false ) ),
59  _fixed_rho_value(0.0)
60  {
62 
63  this->set_parameter
64  (_fixed_rho_value, input,
65  "Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/fixed_rho_value", 0.0 );
66 
67  _enable_thermo_press_calc = input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/enable_thermo_press_calc", false );
69  {
70  _p0_var = &GRINSPrivate::VariableWarehouse::get_variable_subclass<ThermoPressureVariable>(VariablesParsing::thermo_press_variable_name(input,physics_name,VariablesParsing::PHYSICS));
72  }
73 
74  this->read_input_options(input);
75 
80  }
81 
83  {
84  // Read thermodynamic pressure info
87  "ThermodynamicPressure",
89  (*this),
90  _p0 );
91 
92  // Read gravity vector
93  unsigned int g_dim = input.vector_variable_size("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/g");
94 
95  _g(0) = input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/g", 0.0, 0 );
96 
97  if( g_dim > 1)
98  _g(1) = input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/g", 0.0, 1 );
99 
100  if( g_dim == 3)
101  _g(2) = input("Physics/"+PhysicsNaming::reacting_low_mach_navier_stokes()+"/g", 0.0, 2 );
102 
103  }
104 
106  {
107  const unsigned int dim = system->get_mesh().mesh_dimension();
108 
109  for( unsigned int i = 0; i < this->_n_species; i++ )
110  {
111  system->time_evolving( _species_vars.species(i), 1 );
112  }
113 
114  system->time_evolving(_flow_vars.u(), 1);
115 
116  if (dim > 1)
117  system->time_evolving(_flow_vars.v(), 1);
118 
119  if (dim == 3)
120  system->time_evolving(_flow_vars.w(), 1);
121 
122  system->time_evolving(_temp_vars.T(), 1);
123  system->time_evolving(_press_var.p(), 1);
124 
126  system->time_evolving(_p0_var->p0(), 1);
127  }
128 
130  {
131  // We should prerequest all the data
132  // we will need to build the linear system
133  // or evaluate a quantity of interest.
134  context.get_element_fe(_species_vars.species(0))->get_JxW();
135  context.get_element_fe(_species_vars.species(0))->get_phi();
136  context.get_element_fe(_species_vars.species(0))->get_dphi();
137  context.get_element_fe(_species_vars.species(0))->get_xyz();
138 
139  context.get_element_fe(_flow_vars.u())->get_JxW();
140  context.get_element_fe(_flow_vars.u())->get_phi();
141  context.get_element_fe(_flow_vars.u())->get_dphi();
142  context.get_element_fe(_flow_vars.u())->get_xyz();
143 
144  context.get_element_fe(_temp_vars.T())->get_JxW();
145  context.get_element_fe(_temp_vars.T())->get_phi();
146  context.get_element_fe(_temp_vars.T())->get_dphi();
147  context.get_element_fe(_temp_vars.T())->get_xyz();
148 
149  context.get_element_fe(_press_var.p())->get_phi();
150  context.get_element_fe(_press_var.p())->get_xyz();
151  }
152 
153 } // 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.
bool _enable_thermo_press_calc
Flag to enable thermodynamic pressure calculation.
VariableIndex species(unsigned int species) const
VariableIndex T() const
static PhysicsName reacting_low_mach_navier_stokes()
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
Definition: physics.h:106
void check_var_subdomain_consistency(const FEVariablesBase &var) const
Check that var is enabled on at least the subdomains this Physics is.
Definition: physics.C:174
GRINS namespace.
VariableIndex p() const
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
void read_input_options(const GetPot &input)
Read options from GetPot input file.
VariableIndex p0() const
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.
void set_is_constraint_var(bool is_constraint_var)
Set whether or not this is a "constraint" variable.
static std::string thermo_press_variable_name(const GetPot &input, const std::string &subsection_name, const SECTION_TYPE section_type)

Generated on Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1