GRINS-0.8.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-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 #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 
57  FEVariablesBase( const std::vector<std::string>& var_names,
58  const std::vector<VariableIndex>& var_indices,
59  const std::set<libMesh::subdomain_id_type>& subdomain_ids )
60  : _vars(var_indices),
61  _var_names(var_names),
62  _is_constraint_var(false),
63  _neumann_bc_sign(1.0),
64  _subdomain_ids(subdomain_ids)
65  {
66  libmesh_assert_equal_to(var_names.size(), var_indices.size());
67  }
68 
69  virtual ~FEVariablesBase(){};
70 
72 
78 
79  bool is_constraint_var() const
80  { return _is_constraint_var; }
81 
83 
86  void set_neumann_bc_is_positive( bool is_positive );
87 
88  libMesh::Real neumann_bc_sign() const
89  { return _neumann_bc_sign; }
90 
92 
93  const std::vector<std::string>& active_var_names() const
94  { return _var_names; }
95 
96  const std::vector<VariableIndex>& var_indices() const
97  { return _vars; }
98 
99  const std::set<libMesh::subdomain_id_type>& subdomain_ids() const
100  { return _subdomain_ids; }
101 
102  protected:
103 
104  std::vector<VariableIndex> _vars;
105 
106  std::vector<std::string> _var_names;
107 
109 
115 
117 
119  libMesh::Real _neumann_bc_sign;
120 
121  std::set<libMesh::subdomain_id_type> _subdomain_ids;
122  };
123 
124  inline
126  {
127  if(is_positive)
128  _neumann_bc_sign = 1.0;
129  else
130  _neumann_bc_sign = -1.0;
131  }
132 
133 } // end namespace GRINS
134 
135 #endif // GRINS_FE_VARIABLES_BASE_H
std::set< libMesh::subdomain_id_type > _subdomain_ids
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.
GRINS namespace.
libMesh::Real neumann_bc_sign() const
void set_neumann_bc_is_positive(bool is_positive)
Reset whetever Neumann bc is postive or not.
const std::set< libMesh::subdomain_id_type > & subdomain_ids() const
FEVariablesBase(const std::vector< std::string > &var_names, const std::vector< VariableIndex > &var_indices, const std::set< libMesh::subdomain_id_type > &subdomain_ids)
std::vector< std::string > _var_names
bool is_constraint_var() const
const std::vector< std::string > & active_var_names() const
Return the var names that are active from this class.
void set_is_constraint_var(bool is_constraint_var)
Set whether or not this is a "constraint" variable.
std::vector< VariableIndex > _vars
const std::vector< VariableIndex > & var_indices() const

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