GRINS-0.7.0
fe_variables_base.h
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 #ifndef GRINS_FE_VARIABLES_BASE_H
27 #define GRINS_FE_VARIABLES_BASE_H
28 
29 // C++
30 #include <vector>
31 #include <string>
32 #include <limits>
33 
34 // GRINS
35 #include "grins/grins_enums.h"
36 #include "grins/var_typedefs.h"
38 
39 // libMesh
40 #include "libmesh/libmesh_common.h"
41 #include "libmesh/enum_order.h"
42 #include "libmesh/enum_fe_family.h"
43 
44 // libMesh forward declarations
45 class GetPot;
46 namespace libMesh
47 {
48  class FEMSystem;
49 }
50 
51 namespace GRINS
52 {
54  {
55  public:
56 
58  : _is_constraint_var(is_constraint_var),
59  _neumann_bc_sign(1.0)
60  {}
61 
63 
65 
68  virtual void init( libMesh::FEMSystem* system ) =0;
69 
70  bool is_constraint_var() const
71  { return _is_constraint_var; }
72 
74 
77  void set_neumann_bc_is_positive( bool is_positive );
78 
79  libMesh::Real neumann_bc_sign() const
80  { return _neumann_bc_sign; }
81 
83 
84  const std::vector<std::string>& active_var_names() const
85  { return _var_names; }
86 
87  const std::vector<VariableIndex>& var_indices() const
88  { return _vars; }
89 
90  protected:
91 
93 
98  void parse_names_from_input( const GetPot& input,
99  const std::string& subsection,
100  std::vector<std::string>& var_names,
101  const std::vector<std::string>& default_names );
102 
104 
108  void duplicate_name_section_check( const GetPot& input ) const;
109 
111 
118  bool check_dep_name_input( const GetPot& input,
119  const std::string& new_subsection ) const;
120 
121  std::vector<VariableIndex> _vars;
122 
123  std::vector<std::string> _var_names;
124 
125  std::vector<GRINSEnums::FEFamily> _family;
126 
127  std::vector<GRINSEnums::Order> _order;
128 
130 
136 
138 
140  libMesh::Real _neumann_bc_sign;
141 
142  };
143 
144  inline
146  {
147  if(is_positive)
148  _neumann_bc_sign = 1.0;
149  else
150  _neumann_bc_sign = -1.0;
151  }
152 
153 } // end namespace GRINS
154 
155 #endif // GRINS_FE_VARIABLES_BASE_H
std::vector< GRINSEnums::FEFamily > _family
std::vector< GRINSEnums::Order > _order
bool _is_constraint_var
Tracks whether this is a constraint variable.
libMesh::Real _neumann_bc_sign
Track the sign of the Neumann BC term. Defaults to 1.0.
virtual void init(libMesh::FEMSystem *system)=0
Add variables to the system.
GRINS namespace.
libMesh::Real neumann_bc_sign() const
void parse_names_from_input(const GetPot &input, const std::string &subsection, std::vector< std::string > &var_names, const std::vector< std::string > &default_names)
Method to parse variable names from input.
void set_neumann_bc_is_positive(bool is_positive)
Reset whetever Neumann bc is postive or not.
FEVariablesBase(bool is_constraint_var)
std::vector< std::string > _var_names
bool is_constraint_var() const
bool check_dep_name_input(const GetPot &input, const std::string &new_subsection) const
Check for deprecated variable name input style.
const std::vector< std::string > & active_var_names() const
Return the var names that are active from this class.
std::vector< VariableIndex > _vars
void duplicate_name_section_check(const GetPot &input) const
Check for old name style and new name style. If both present, error.
const std::vector< VariableIndex > & var_indices() const

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